Open Bavuett opened 2 years ago
Making this a separate file would be better so the user can automatically use the script instead of having to edit it.
Will do that!
Done! This should fit your needs.
Great! Let's hope this can be merged.
Hi! I noticed that the Pull Request isn't merged. Is everything ok, or is there something I need to do?
I can't merge pull requests. Only the owner can or anyone with the pull request permission.
Ah, sorry. I got confused and thought you had the permissions. Have a good day!
Had to install elogind first and edit sudoers file for this to work
UPDATE: You can add this to one of the forks such as mine(https://github.com/Spaxly/rofi-power-menu) as a separate branch until I get a script working to choose systemctl or other commands.
@Spaxly What edit did you make to your sudoers to get this working?
@Spaxly What edit did you make to your sudoers to get this working?
I had to allow the commands to be used without sudo, I don't have the specifics because I don't use Void or rofi power menu anymore
Thanks for the PR! I'm not too familiar with systemctl and loginctl, so do you know if systemctl
could be replaced with loginctl
in the original script? I mean, is there any reason to use systemctl
instead of loginctl
, do you know?
You could certainly replace poweroff and reboot, and I'm fairly certain you can replace hibernate and suspend as well.
Hey! Sorry for not answering, but here in Italy we have a quite long Easter vacation and I stayed off of GitHub as well.
I am not using Void Linux much anymore, but as far as I know Loginctl is Runit's (Systemd alternative that Void uses) CLI for managing the power status of the machine.
Since I am now using Fedora and can use Systemctl without any problems I didn't look up for ways to improve it further, but I am available if you need help since I rely on your script daily and would love to be useful.
Alright, it seems that the "standard" loginctl
with systemd doesn't have commands for suspend/hibernate/reboot/shutdown: https://www.freedesktop.org/software/systemd/man/loginctl.html
I wonder if these commands are more general, that is, work on a larger set of Linux OSes:
pm-suspend
(requires pm-utils package)pm-hibernate
(requires pm-utils package)reboot
or shutdown -r
(do these work only with systemd or does each OS define aliases in a way that works in that OS?)poweroff
or shutdown -P
(do these work only with systemd or does each OS define aliases in a way that works in that OS?)Alternatively, the script could try a few different ways to do the action until the command succeeds. For instance:
systemctl poweroff || poweroff || shutdown -P
systemctl suspend || loginctl suspend || pm-suspend
Or something like that. But I'd prefer having a single command that's supposed to work on all Linux OSes if possible.
EDIT: Apparently, there's no "POSIX-way" of shutting down etc. And I couldn't find any reference on if there exists "The Correct Command".
As a Void Linux user, I had problems using this script. By browsing this repo's issues, I have discovered that you can't use systemctl on Void Linux (I am a new Linux user so I didn't know that). For this reason, I added comments to help people like me who don't know about these details to encourage them to use loginctl as an alternative, which works without any problem.