You are not logged in.
Pages: 1
i have a simple dmenu to-do list script on my system.
i would like to be able to run the script when my system wakes from sleep, reminding me of my tasks.
i have tried creating an executable script in /usr/lib/systemd/system-sleep/
#!/bin/sh
case $1/$2 in
pre/*)
;;
post/*)
/home/usr/privacy313/scripts/todo
;;
esacbut it doesn't appear to do anything.
any help would be greatly appreciated/
Offline
https://gist.github.com/AladW/de1c5676d93d05a5a0e1
You can also hardcode at least the DISPLAY and user variable, but the script is run as root w/o knowledge of the $DISPLAY.
Online
does this go in /usr/lib/systemd/system-sleep/ and if so where should i define the todo script to be loaded?
Offline
What?
The point is that you need to explicitly export the DISPLAY variable to dmenu and also run it as the user that runs the X11 session (your regular UID)
Whether you do that in the sleep hook or /home/usr/privacy313/scripts/todo or somewhere else entirely doesn't matter - but I assume you want to do it in the sleep hook unless you maybe also want to use a systed timer or cronjob to trigger the todo script.
nb. that the linked script to import the variables looks for the xinit process on the active terminal. If you do not use xinit, you'll have to adapt it.
Online
thanks.
so i see this should go inside the sleep hook in my case.
i first tried directly defining display and UID in the sleep hook by adding
DISPLAY=:0
UID=1000no luck there.
so i tried to add the script you linked in the sleep hook prior to the case statement. i am using xinit, so there shouldn't be a complication there.
also no luck however.
i guess i'm still missing something..
Offline
This is one of the rare occasions where sudo is going to fix it - in particular "sudo -u ..."
Edit: also you probably did no "export" the variables?
Last edited by seth (2020-11-10 18:27:49)
Online
Pages: 1