-
Notifications
You must be signed in to change notification settings - Fork 26
rfct: power menu and more #114
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
base: main
Are you sure you want to change the base?
Conversation
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 Oh, and also I moved the (Systemd) thing after "Power Menu" in the header below the title like this: 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. |
1baf235
to
f333a7f
Compare
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.
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.
Instead of having copies of the UI and config code for each backend, put the UI code in a single Widget. Each backend implements a conversion from it's config to a common config that can represent any power menu.
Okay, I guess I could do a simple thing and move the regex that clippy so gladly pointed out. Or, I could create another PR to finally bring in I have the code to fix this already: I guess both? |
@rharish101 This is ready for review now. |
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:
The screenshots are available in #108.