Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Configurable power menu using libadwaita widgets #108

Open
1 of 2 tasks
max-ishere opened this issue Jan 2, 2025 · 10 comments
Open
1 of 2 tasks

feat: Configurable power menu using libadwaita widgets #108

max-ishere opened this issue Jan 2, 2025 · 10 comments

Comments

@max-ishere
Copy link
Contributor

max-ishere commented Jan 2, 2025

This can start chiping away at implementing #46. I am creating this issue for discussions on the feature set.

  1. Move the power menu into a Gnome panel looking button. Something like the below, but it would be an icon button that would pop up options just for rebooting, etc.

  2. Additionally, something I really wanted to add to regreet is more options than just the two reboot and shutdown, I sometimes need to suspend the system while logged out and I sometimes need to boot into firmware (systemd-specific, maybe there is a generic linuxy way).

    Having a dynamic amount of menu options is not easy in the current layout and a list would make more sense.

  3. Add a confirmation pop-up before actions are taken. This should be optional and only required for destructive actions such as rebooting, suspend should not trigger it. The pop-up may have a timer attached to it to automatically confirm the action after say a minute.

TODO

  • Does libadwaita support custom theming?
  • Figure out how to make an adwaita alert
@rharish101
Copy link
Owner

Would using libadwaita imply that you can't theme them with GTK themes? If so, then I'd prefer using regular GTK widgets as the default, with libadwaita as a separate compile-time/config option.

The other points sound good, although I fail to see why the number of options would be dynamic. There should be just suspend, hibernate, hybrid sleep, reboot and shutdown, right?

@max-ishere
Copy link
Contributor Author

Would using libadwaita imply that you can't theme them with GTK themes?

I need to test that. Adw has CSS and stuff like that so I think its possible. One thing I really like is the significantly better looking widgets.

I fail to see why the number of options would be dynamic. There should be just suspend, hibernate, hybrid sleep, reboot and shutdown, right?

I am not sure what you are implying here...

  1. Screens have different sizes, there may be different languages and all this means you can fit a reasonable amount of buttons vertically compared to a limited amount of horizontal space available.

  2. My plan is to detect the init system and use commands specific to that like systemctl reboot --firmware-setup, fallback to the current way with reboot and poweroff, but also allow custom list of commands in the config.

Note

This is a draft of the config format, the merged format may be different

Hardcoded templates (useful for handling specifics of each command better)

[widget.power_menu]
template = "auto_detect" # default if not specified
# or
template = "systemd"

Or fully custom

[[widget.power_menu.commands]]
title = "Reboot"
command = ["reboot"]
confirm = true

[[widget.power_menu.commands]]
title = "Shutdown"
command = ["poweroff"]
confirm = true

@max-ishere
Copy link
Contributor Author

Also a note on the different types of sleep. Hibernate requires swap which may not be available on some systems. I hope there is a way to detect support for it without running the command so it can be hidden from the list automatically.

@max-ishere
Copy link
Contributor Author

Here is an adw::SplitButton. Looks like it is following whatever css style Cosmic setup for GTK.

image

@rharish101
Copy link
Owner

Okay, got your points about why the options are dynamic. Makes sense why it might be better as a vertical list.

Also, nice to see that libadwaita can be themed. I also agree that they generally look better.

@max-ishere
Copy link
Contributor Author

I am a little stuck on implementing alerts as a confirmation system. They just show up as a separate window on startup and it will cause problems on cage. Besides, it should not even be appearing on launch in the first place. So I guess I will just substitute the alert with something else...

Also getting more busy in the following days so I may not finish this any time soon.

@rharish101
Copy link
Owner

I am a little stuck on implementing alerts as a confirmation system. They just show up as a separate window on startup and it will cause problems on cage.

What about using popups instead? Would that work?

Also getting more busy in the following days so I may not finish this any time soon.

No problem, it's FOSS, we are not entitled to your time. I've taken breaks spanning months 😝.

@max-ishere
Copy link
Contributor Author

Hmm, there's different types of dialogs? I might look into that later.

@rharish101
Copy link
Owner

What I meant was use something like this instead of a dialog: https://docs.gtk.org/gtk4/class.Popover.html.

@max-ishere
Copy link
Contributor Author

Yeah, most likely this is the way. Btw, I am recalling the way alerts worked on GNOME and it seems they were separate windows and the compositor made them stick in a particular spot. Which is a bad idea in this case because of fullscreen and cage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants