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

rfct: power menu and more #114

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

max-ishere
Copy link
Contributor

This PR is not complete yet, but I wanted to get some feedback if the overall direction is right.

I taught ReGreet how to interact with systemd and the linux shutdown command. Coming up is support for arbitrary commands (blocker for merging this). I don't have any more time this weekend to work on this so I'll just leave this draft until I finish the last feature.

There's also i18n support added. Currently, only the power menu is translated, with 2 languages (the ones I know): English & Ukrainian. Going through the entire repo and replacing all the strings is rather time-consuming so I won't be doing that just yet.

To test out the different languages, run this:

LANG=uk cargo run -- --demo

The screenshots are available in #108.

Power menu is now in a pop-over (menu button) in the panel (top-right).

Power menu can understand how to work with systemd. This enables better
feature parity between what systemd can do and what the power menu knows
how to do. The power menu is also aware of what button is "dangerous"
(powers off the systemrharish101/ReGreet) and asks for confirmation

Closes rharish101#108.
`man 8 shutdown` is a generic Linux command for system poweroff and
reboot.

Some minor refactors and a fix of the lowercase_first_char function -
now doesn't panic with non-ascii first character.
@max-ishere
Copy link
Contributor Author

I've added the custom power menu type. It can translate it's buttons and select icons automatically, you just have to specify the action type:

[[widget.power_menu.custom.commands]] # commands is a list
action = "poweroff"
#name = "something" // Custom string instead of `action=`
command = ["poweroff"]

But looking at the code afresh, I can see a lot of duplication that can be resolved with a generic power menu trait.

Oh, and also I moved the (Systemd) thing after "Power Menu" in the header below the title like this:

image

The text is probably a bit too small though.


Not ready for merging since I also want to add proper docs and refactor the different power menus to make them reuse the duplicated code.

The custom power menu allows you to run arbitrary commands while
integrating with the i18n layer, automatic icon selection and
automatically infers the neccessity of the confirm dialog.
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

Successfully merging this pull request may close these issues.

1 participant