Skip to content

Conversation

chewi
Copy link

@chewi chewi commented Apr 21, 2018

This is specified by separating the two commands with a -- argument. Giving a deactivate command without an activate command is allowed.

My groff knowledge is practically non-existent and I didn't know how to format the synopsis like I have in the usage text so I'll leave that to you.

I made this change because I want to use xrandr to turn off one monitor while leaving the other on. DPMS in X11 is global so you can't use it to do that. Infuriatingly, this didn't work because it seems that screensaver events are not emitted when the monitor is off so it never comes back on.

This is specified by separating the two commands with a --
argument. Giving a deactivate command without an activate command is
allowed.
@chewi
Copy link
Author

chewi commented Apr 22, 2018

Admittedly I didn't fully think this through. Even if the above did work, the second screen would be on but black, which isn't what I want. This feature could still be very useful though and I couldn't find any other program that currently does this!

@unixdj
Copy link
Owner

unixdj commented Apr 27, 2018

Apologies for the late reply.

As far as I know, you can use xrandr to turn the second monitor off. What are you trying to do with XRandR, and how is it connected to XScreenSaver?

What would be the use of the "deactivate" command? As far as I understand, if xssstart is used to run a screen saver with a password prompt, the ScreenSaverOff event will be delivered before the password is entered. If you run a screen saver such as xlock, you can use sh -c 'xlock ; deactivate' to run a command after the password is entered. In fact, I run xssstart as xssstart lock-screen slock, where lock-screen is a script:

#!/bin/sh

off () {
	notify-send DUNST_COMMAND_PAUSE
	killall -1 gpg-agent
}

on () {
	notify-send DUNST_COMMAND_RESUME
}
trap on SIGHUP SIGINT SIGTERM

off
"$@"
on

Otherwise, the commit looks good at first glance. I just want to understand its use better before I merge it.

Thank you for the pull request!

@chewi
Copy link
Author

chewi commented Apr 27, 2018

Sorry for the confusion. I imagined there might be other reasons why you would want to trigger a command after an idle time and also another when activity resumes. In my case, I'm not interested in locking the session, I just want to turn one of the monitors off while the other may be playing a movie or something. Since xssstart doesn't actually prevent Xorg from blanking both screens, this won't work.

I've since discovered the IDLETIME counter available from the SYNC extension. This is much more appropriate for my needs as it reports on user activity without interference from X11's screensaver feature. I believe this is used by xscreensaver now and there's an interesing backstory in this bug report. I'm hoping that this still works after disabling the output with XRandR. I think it will.

Since I don't think you're interested in X11's screensaver feature either, it may make sense for you to use this extension too. Let me know you're thoughts as I may end up implementing this.

As for this pull request, I'll let you decide whether it's useful enough to merge. I won't be using xssstart now unless I rework it to use the SYNC extension but I thought it was worth submitting this anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants