jluttine / rofi-power-menu

Configurable power menu mode for Rofi and dmenu
MIT License
422 stars 53 forks source link

Added comments for users that can't use systemctl. #11

Open Bavuett opened 2 years ago

Bavuett commented 2 years ago

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.

ohxxm commented 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.

Bavuett commented 2 years ago

Will do that!

Bavuett commented 2 years ago

Done! This should fit your needs.

ohxxm commented 2 years ago

Great! Let's hope this can be merged.

Bavuett commented 2 years ago

Hi! I noticed that the Pull Request isn't merged. Is everything ok, or is there something I need to do?

ohxxm commented 2 years ago

I can't merge pull requests. Only the owner can or anyone with the pull request permission.

Bavuett commented 2 years ago

Ah, sorry. I got confused and thought you had the permissions. Have a good day!

ohxxm commented 2 years ago

Had to install elogind first and edit sudoers file for this to work

ohxxm commented 2 years ago

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.

gagero commented 2 years ago

@Spaxly What edit did you make to your sudoers to get this working?

ohxxm commented 2 years ago

@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

jluttine commented 1 year ago

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?

gagero commented 1 year ago

You could certainly replace poweroff and reboot, and I'm fairly certain you can replace hibernate and suspend as well.

Bavuett commented 1 year ago

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.

jluttine commented 1 year ago

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:

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