You are not logged in.
Pages: 1
Hello,
I have an issue with my laptop, but I don't know how to debug it. I use Arch with Openbox, and have the following lines in my autostart configuration file :
(sleep 2 && xset -dpms) &
(sleep 2 && xset s off) &
xautolock -detectsleep -time 3 -locker "systemctl suspend;slock" &I use a keybind to disable xautolock and thus (I think) disable suspend/sleep mode on my laptop. Here it is (from my .config/openbox/rc.xml file) :
<keybind key="C-A-d">
<action name="Execute">
<command>xautolock -disable</command>
</action>
<action name="Execute">
<command>dunstify -t 2000 "Suspend disabled"</command>
</action>
</keybind>I have another keybind to re-enable sleep mode, of course.
When I hit the keybind, sometimes it works (my laptop never suspends), sometimes it doesn't (it suspends, whereas I do have seen the "Suspend disabled" notification).
The problem is I don't know how to debug this. journalctl shows nothing. So what have I missed ?
Thanx in advance for any help !
Offline
I wanted to share what I have found : this is due to a bug in xautolock (as it has already been said in this forum message).
More precisely, mpv runs "xdg-screensaver reset" every 10 seconds to prevent a screensaver from being started during video playback. Then xdg-screensaver runs "xautolock -restart" (as we can see in the xautolock_screensaver() function inside of the xdg-screensaver.in file here). But xautolock -restart is buggy, and then any call to an xautolock function returns an error ("Could not locate a running xautolock").
I have solved it like this : I have created a script called "mpv" in my /usr/local/bin/ folder, which has the priority in my $PATH variable. This script contains the following code :
#!/bin/bash
/usr/bin/xautolock -disable && /usr/bin/mpv --no-stop-screensaver "$@" && /usr/bin/xautolock -enableBefore marking this thread as solved, I'd like to hear your advices : is it a good solution ? I think it is, since it is probably independent from the desktop environment that is being used (I use none by the way). But maybe have I missed something ? I'm so far from being an expert in bash, and have only experimenting with Linux for a few months...
Thanx for your advices !
Last edited by LithoUser (2017-05-13 09:42:26)
Offline
Well this doesn't seem to work perfectly : yesterday, I was looking at a video using mpv, and suddenly my laptop has suspended (after 3 mins, so there's no doubt that this is due to xautolock, since that's how I've set the xautolock timer).
I don't understand : the "&&" in the below script does mean that the commands will be executed one after the other, right ?
#!/bin/dash
/usr/bin/xautolock -disable && /usr/bin/mpv --no-stop-screensaver "$@" && /usr/bin/xautolock -enable(By the way, yes, I know use dash instead of bash, since it's lighter and faster, even if it doesn't make any difference for such a little script).
So I guess this means :
- disable xautolock ;
- THEN, when it's disabled, display the video ;
- THEN, when the video has ended, enable xautolock.
Am I right ? Would anyone know why this code doesn't work ? (I'm always wondering if there should be an "&" at the end of my script, or an "exit"... or nothing at all ; but this can't be the cause of the problem, right ?)
Last edited by LithoUser (2017-05-17 05:55:07)
Offline
Wow! Good investigation, and thank you for all the information!
I just have a simple question: How are you starting mpv? Can you confirm that you are using your script? For example, if you are starting mpv by double-clicking a video file in a file manager, it might not know to use "/usr/local/bin/mpv"...
Offline
I launch it using "mpv myfile.avi" directly in my terminal.
In any case, since my $PATH is the default one, "/usr/local/bin" has the priority over "/usr/bin/", so my "/usr/local/bin/mpv" should always be loaded first (even from a script or from a file manager), and should act as a wrapper for mpv, right ?
$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perlLast edited by LithoUser (2017-05-18 05:37:46)
Offline
Pages: 1