2

Is there a way to change the command executed by xfce4-power-manager when it wants to suspend? I assume it runs xfce4-session-logout --suspend, but I would like it to run

xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -s false && xfce4-session-logout --suspend

instead. Is there a way to do this?

1
  • You must tell more about your system ! What dm do you use ? ...
    – ctac_
    Jun 17, 2019 at 17:22

2 Answers 2

1

See if this works Simon. Add this script to your ~/bin folder and name it xfce4-session-logout. Please follow up if you would like assistance in setting up a ~/bin folder, i.e. making sure it is in your $PATH or making the script executable.

#!/bin/bash

if [ "$1" == "--suspend" ]; then
    xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -s false && /usr/bin/xfce4-session-logout --suspend
else
    /usr/bin/xfce4-session-logout "$@"
fi
4
  • That looks like a good idea! I'm currently tinkering with systemd/system-sleep/ scripts. I'll try both and let you know whether it works! Jun 20, 2019 at 17:50
  • @Simon The systemd sleep commands did actually occur to me after posting my answer. I've used that before for a bug workaround. bugs.debian.org/cgi-bin/bugreport.cgi?bug=866162 (workaround at bottom). I am pretty sure you'll need to include those export commands for the xfconf-query command to work for the systemd sleep option.
    – jbrock
    Jun 20, 2019 at 22:01
  • I got it to work using systemd, but your solution worked as well. I posted my method as a seperate answer as well. Jun 21, 2019 at 19:45
  • Nice! I'm glad to hear both worked. I agree as well that the systemd option is cleaner.
    – jbrock
    Jun 22, 2019 at 4:36
0

I managed to get it working by placing a script in the following location: /lib/systemd/system-sleep/. The script contained the following:

#!/bin/sh  
DBUS_SESSION_BUS_ADDRESS=unix:path=/usr/user/UID/bus su USER -c "xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -s false"  

UID should be replaced by the relevant user id ($ id -u), and USER by the name of the user the script is for ($ whoami).

I tested jbrock's answer, and that also seemed to work, although I find the systemd option slightly cleaner since it doesn't redirect any command references.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .