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
|
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. |
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.
65719aa to
1c80ede
Compare
|
I rebased this onto |
|
Welp. The last commit was working fine, so it's probably an issue with the libadwaita version. @rharish101 what do you think about using Nix in the CI? I was gonna add a Nix flake for some time, and I guess now is the time to do it? I can add it in a separate PR, or right here, it doesn't really matter to me. |

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
shutdowncommand. 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.