Giter Site home page Giter Site logo

Comments (6)

rharish101 avatar rharish101 commented on June 12, 2024

Since I can't run regreet without greetd, it's hard to run regreet with GTK_DEBUG=inspector and poke around to see what can be customized. Adding a demo mode would really help.

Good idea, a demo mode would also help in development. I guess I can try to somehow mock greetd in the codebase with the demo mode.

I realized that this program needs layer shell.

Could you tell me why? Is it because the inspector doesn't work with it, or is it because it would also provide more features?

Are there extra documentation on how to theme regreet in CSS?

Not really, I didn't make any, since it's just like any other GTK app. If you want to see the GTK structure, just see src/gui/templates.rs. Specifically, these lines:

/// Main UI of the greeter
#[relm4::widget_template(pub)]
impl WidgetTemplate for Ui {
view! {
gtk::Overlay {
/// Background image
#[name = "background"]
gtk::Picture,
/// Main login box
add_overlay = &gtk::Frame {
set_halign: gtk::Align::Center,
set_valign: gtk::Align::Center,
inline_css: "background-color: @theme_bg_color",
gtk::Grid {
set_column_spacing: 15,
set_margin_bottom: 15,
set_margin_end: 15,
set_margin_start: 15,
set_margin_top: 15,
set_row_spacing: 15,
set_width_request: 500,
/// Widget to display messages to the user
#[name = "message_label"]
attach[0, 0, 3, 1] = &gtk::Label {
set_margin_bottom: 15,
// Format all messages in boldface.
#[wrap(Some)]
set_attributes = &gtk::pango::AttrList {
insert: {
let mut font_desc = gtk::pango::FontDescription::new();
font_desc.set_weight(gtk::pango::Weight::Bold);
gtk::pango::AttrFontDesc::new(&font_desc)
},
},
},
#[template]
attach[0, 1, 1, 1] = &EntryLabel {
set_label: "User:",
set_height_request: 45,
},
/// Label for the sessions widget
#[name = "session_label"]
#[template]
attach[0, 2, 1, 1] = &EntryLabel {
set_label: "Session:",
set_height_request: 45,
},
/// Widget containing the usernames
#[name = "usernames_box"]
attach[1, 1, 1, 1] = &gtk::ComboBoxText { set_hexpand: true },
/// Widget where the user enters the username
#[name = "username_entry"]
attach[1, 1, 1, 1] = &gtk::Entry { set_hexpand: true },
/// Widget containing the sessions
#[name = "sessions_box"]
attach[1, 2, 1, 1] = &gtk::ComboBoxText,
/// Widget where the user enters the session
#[name = "session_entry"]
attach[1, 2, 1, 1] = &gtk::Entry,
/// Label for the password widget
#[name = "input_label"]
#[template]
attach[0, 2, 1, 1] = &EntryLabel {
set_height_request: 45,
},
/// Widget where the user enters a secret
#[name = "secret_entry"]
attach[1, 2, 1, 1] = &gtk::PasswordEntry { set_show_peek_icon: true },
/// Widget where the user enters something visible
#[name = "visible_entry"]
attach[1, 2, 1, 1] = &gtk::Entry,
/// Button to toggle manual user entry
#[name = "user_toggle"]
attach[2, 1, 1, 1] = &gtk::ToggleButton {
set_icon_name: "document-edit-symbolic",
set_tooltip_text: Some("Manually enter username"),
},
/// Button to toggle manual session entry
#[name = "sess_toggle"]
attach[2, 2, 1, 1] = &gtk::ToggleButton {
set_icon_name: "document-edit-symbolic",
set_tooltip_text: Some("Manually enter session command"),
},
/// Collection of action buttons (eg. Login)
attach[1, 3, 2, 1] = &gtk::Box {
set_halign: gtk::Align::End,
set_spacing: 15,
/// Button to cancel password entry
#[name = "cancel_button"]
gtk::Button {
set_focusable: true,
set_label: "Cancel",
},
/// Button to enter the password and login
#[name = "login_button"]
gtk::Button {
set_focusable: true,
set_label: "Login",
set_receives_default: true,
add_css_class: "suggested-action",
},
},
},
},
/// Clock widget
add_overlay = &gtk::Frame {
set_halign: gtk::Align::Center,
set_valign: gtk::Align::Start,
// Make it fit cleanly onto the top edge of the screen.
inline_css: "
border-top-right-radius: 0px;
border-top-left-radius: 0px;
border-top-width: 0px;
background-color: @theme_bg_color;
",
/// Label displaying the current date & time
#[name = "datetime_label"]
gtk::Label { set_width_request: 150 },
},
/// Collection of widgets appearing at the bottom
add_overlay = &gtk::Box {
set_orientation: gtk::Orientation::Vertical,
set_halign: gtk::Align::Center,
set_valign: gtk::Align::End,
set_margin_bottom: 15,
set_spacing: 15,
gtk::Frame {
/// Notification bar for error messages
#[name = "error_info"]
gtk::InfoBar {
// During init, the info bar closing animation is shown. To hide that, make
// it invisible. Later, the code will permanently make it visible, so that
// `InfoBar::set_revealed` will work properly with animations.
set_visible: false,
set_message_type: gtk::MessageType::Error,
/// The actual error message
#[name = "error_label"]
gtk::Label {
set_halign: gtk::Align::Center,
set_margin_top: 10,
set_margin_bottom: 10,
set_margin_start: 10,
set_margin_end: 10,
},
}
},
/// Collection of buttons that close the greeter (eg. Reboot)
gtk::Box {
set_halign: gtk::Align::Center,
set_homogeneous: true,
set_spacing: 15,
/// Button to reboot
#[name = "reboot_button"]
#[template]
EndButton { set_label: "Reboot" },
/// Button to power-off
#[name = "poweroff_button"]
#[template]
EndButton { set_label: "Power Off" },
},
},
}
}
}

from regreet.

takase1121 avatar takase1121 commented on June 12, 2024

Could you tell me why? Is it because the inspector doesn't work with it, or is it because it would also provide more features?

Sorry, I didn't meant it like this - regreet would stay on top of the inspector so one can't use it.
I assume the demo mode would allow regreet to run as a normal window, so it can be moved around.

from regreet.

rharish101 avatar rharish101 commented on June 12, 2024

Sorry, I didn't meant it like this - regreet would stay on top of the inspector so one can't use it. I assume the demo mode would allow regreet to run as a normal window, so it can be moved around.

Ah, so you mean that the demo mode should "disable" layer shell? Well, ReGreet doesn't use layer shell; it's just a normal window that's fullscreen.

I develop ReGreet on an X11 desktop (although Wayland might also work, but I haven't tested it) by running it through the command line. It spawns a fullscreen window, which I can reduce to a normal window using my window manager. Then I can access the inspector.

The demo mode I'm thinking of should allow one to use all ReGreet features - like showing the list of (dummy) usernames/sessions, enter (dummy) passwords, etc. - without actually contacting greetd.

from regreet.

takase1121 avatar takase1121 commented on June 12, 2024

Ah, so you mean that the demo mode should "disable" layer shell? Well, ReGreet doesn't use layer shell; it's just a normal window that's fullscreen.

Oh, didn't know!

I develop ReGreet on an X11 desktop (although Wayland might also work, but I haven't tested it) by running it through the command line. It spawns a fullscreen window, which I can reduce to a normal window using my window manager. Then I can access the inspector.

How do you connect to greetd when running as another user? I've been trying to figure this out.

from regreet.

rharish101 avatar rharish101 commented on June 12, 2024

How do you connect to greetd when running as another user? I've been trying to figure this out.

I just run ReGreet as the greeter user using sudo, as follows:

sudo -Eu greeter regreet

The -E switch is to allow passing environment variables. Here, it's needed to get the greetd IPC socket.

from regreet.

exoess avatar exoess commented on June 12, 2024
sudo -Eu greeter regreet

tried this, just got

panicked at 'called `Result::unwrap()` on an `Err` value: BoolError { message: "Failed to initialize GTK", filename: "/build/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gtk4-0.5.5/src/rt.rs", function: "gtk4::rt", line: 153 }', /build/.cargo/registry/src/index.crates.io-6f17d22bba15001f/relm4-0.5.0/src/lib.rs:110:17

from regreet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.