Command line argument for suspending PC?

Hello

I would like to set a keyboard shortcut which suspends my PC when pressed (instead of manually clicking power icon and then selecting ‘Suspend’). I would need to know the command for this, since it’s required to be set in the keyboard shortcuts menu. So far I have tried systemctl suspend, and although it does work, it seems to have a different effect on my PC , since my PC case does not flash the LED when it’s suspended this way. When I suspend using the graphical way (power icon->suspend), the LED flashes correct when suspended. This makes me think my systemctl suspend command may not be the correct way of suspending, so my question is, what is the right command for this?

BTW I am using Manjaro Xfce if that makes any difference.

Thanks

1 Like

systemctl suspend

2 Likes
systemctl suspend

should work for anything running systemd.

bah! beat me! :racehorse:

1 Like

… sorry :wink:
but answer ~25 minutes after initial post is not exactly race horse like :wink:
… just a coincidence
I do not worry about being first.

Oh of course … just a jest. No problems :slight_smile:

I don’t know what is the deal with your LED’s (flashing or not flashing …)
I would prefer them to not be flashing …
but I do use this quite often when listening to something while already in bed and I don’t want to get up to shut the system down …
for example
sleep 30m && systemctl suspend
when the podcast is 30 minutes long …

ah yes that would work.
Simple enough … if you want to get fancy you might even write a service to check when the player stops.

Thanks for the answers ! Ok, I guess I should stick with systemctl suspend then. Is that the same command that is executed when the ‘Suspend’ button is pressed?

Does anyone happen to know what hardcoded command is used for that button?

And what should be the command to just turn the screen off ?

I’d have just said “yes”
but there is a 6 character minimum for a reply, so …
yes :wink:

I don’t know - I never had a need to do that -
but it should be fairly easy to find out by asking Google or the search engine of your preference.

1 Like

Thanks very much , that command xfce4-session-logout --suspend is what i was after !

xfce4-session-logout --suspend
… the effect of that is just the very same as
systemctl suspend

The system suspends - it does not just turn off the screen.

But “suspend” (and wake up from it) is very fast
it does not really make a difference in the end …

But instead of just the screen being off - the whole system is down while it is suspended :wink:

Found that;
xset -display :0 dpms force off

Thanks for clarifying :+1:
For some my corsair case LED recognizes it as a sleep, and it flashes the LED, whilst original one didn’t make it flash. The flash is kinda useful for me because I can glance at my PC from far away to see if it’s in sleep or actually shut down (in which case it doesn’t flash at all when off)

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.