summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlad Wenter2015-08-03 08:49:52 +0200
committerAlad Wenter2015-08-03 08:49:52 +0200
commitb7b1e94114a9d3f63586d9a3a20a67a831c5b261 (patch)
tree105dfd77a8cd3575d5b8dc6b40a4cf449a37b7a3
parent0f68f59defbf0a683f775e1311007082e71e65e0 (diff)
downloadaur-b7b1e94114a9d3f63586d9a3a20a67a831c5b261.tar.gz
Ignore X screensaver (fixes #5)
-rw-r--r--PKGBUILD11
-rw-r--r--ignore-blank.patch83
2 files changed, 92 insertions, 2 deletions
diff --git a/PKGBUILD b/PKGBUILD
index dc0ddfcda3ad..4eecc6e7f24a 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -10,10 +10,12 @@ license=('MIT')
depends=('xcb-util' 'systemd')
makedepends=('cmake' 'python-docutils' 'git')
optdepends=('bash-completion: for bash completion')
-source=("$pkgname::git+https://bitbucket.org/raymonad/${pkgname%-git}.git")
+source=("$pkgname::git+https://bitbucket.org/raymonad/${pkgname%-git}.git"
+ 'ignore-blank.patch')
+md5sums=('SKIP'
+ 'b12e5dd8463d6300ebe3a2b525a12926')
provides=('xss-lock')
conflicts=('xss-lock')
-md5sums=('SKIP')
pkgver() {
cd "$pkgname"
@@ -21,6 +23,11 @@ pkgver() {
printf "%s" "${ver//-/.}"
}
+prepare() {
+ cd "$pkgname"/src
+ patch -p0 < "$srcdir"/ignore-blank.patch
+}
+
build() {
cd "$pkgname"
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
diff --git a/ignore-blank.patch b/ignore-blank.patch
new file mode 100644
index 000000000000..aeb65c611b32
--- /dev/null
+++ b/ignore-blank.patch
@@ -0,0 +1,83 @@
+--- xss-lock.c.orig 2015-01-15 10:34:31.469611430 +0100
++++ xss-lock.c 2015-01-15 15:51:45.360306124 +0100
+@@ -61,6 +61,7 @@
+ static gboolean opt_quiet = FALSE;
+ static gboolean opt_verbose = FALSE;
+ static gboolean opt_ignore_sleep = FALSE;
++static gboolean opt_ignore_blank = FALSE;
+ static gboolean opt_print_version = FALSE;
+
+ static GOptionEntry opt_entries[] = {
+@@ -68,6 +69,7 @@
+ {"notifier", 'n', G_OPTION_FLAG_FILENAME, G_OPTION_ARG_CALLBACK, parse_notifier_cmd, "Send notification using CMD", "CMD"},
+ {"transfer-sleep-lock", 'l', 0, G_OPTION_ARG_NONE, &locker.transfer_sleep_lock_fd, "Pass sleep delay lock file descriptor to locker", NULL},
+ {"ignore-sleep", 0, 0, G_OPTION_ARG_NONE, &opt_ignore_sleep, "Do not lock on suspend/hibernate", NULL},
++ {"ignore-blank", 0, 0, G_OPTION_ARG_NONE, &opt_ignore_blank, "Do not lock on screensaver events", NULL},
+ {"quiet", 'q', 0, G_OPTION_ARG_NONE, &opt_quiet, "Output only fatal errors", NULL},
+ {"verbose", 'v', 0, G_OPTION_ARG_NONE, &opt_verbose, "Output more messages", NULL},
+ {"version", 0, 0, G_OPTION_ARG_NONE, &opt_print_version, "Print version number and exit", NULL},
+@@ -170,34 +172,36 @@
+ xcb_screensaver_notify_event_t *xss_event =
+ (xcb_screensaver_notify_event_t *)event;
+
+- switch (xss_event->state) {
+- case XCB_SCREENSAVER_STATE_ON:
+- if (xss_event->kind == XCB_SCREENSAVER_KIND_INTERNAL)
+- /* According to the original protocol, this forces the external
+- * saver (i.e., me) to be started after deactivating the
+- * internal saver, which may be started if the server is
+- * grabbed when the saver activates, but Xorg does not seem to
+- * work that way; I'm leaving this in anyway.
+- */
+- xcb_force_screen_saver(connection, XCB_SCREEN_SAVER_ACTIVE);
+- else if (!notifier.cmd || xss_event->forced) {
+- start_child(&locker);
+- logind_session_set_idle_hint(TRUE);
+- } else if (!locker.pid)
+- start_child(&notifier);
+- else
+- logind_session_set_idle_hint(TRUE);
+- break;
+- case XCB_SCREENSAVER_STATE_OFF:
+- kill_child(&notifier);
+- logind_session_set_idle_hint(FALSE);
+- break;
+- case XCB_SCREENSAVER_STATE_CYCLE:
+- if (!locker.pid) {
+- logind_session_set_idle_hint(TRUE);
+- start_child(&locker);
+- }
+- break;
++ if (!opt_ignore_blank) {
++ switch (xss_event->state) {
++ case XCB_SCREENSAVER_STATE_ON:
++ if (xss_event->kind == XCB_SCREENSAVER_KIND_INTERNAL)
++ /* According to the original protocol, this forces the external
++ * saver (i.e., me) to be started after deactivating the
++ * internal saver, which may be started if the server is
++ * grabbed when the saver activates, but Xorg does not seem to
++ * work that way; I'm leaving this in anyway.
++ */
++ xcb_force_screen_saver(connection, XCB_SCREEN_SAVER_ACTIVE);
++ else if (!notifier.cmd || xss_event->forced) {
++ start_child(&locker);
++ logind_session_set_idle_hint(TRUE);
++ } else if (!locker.pid)
++ start_child(&notifier);
++ else
++ logind_session_set_idle_hint(TRUE);
++ break;
++ case XCB_SCREENSAVER_STATE_OFF:
++ kill_child(&notifier);
++ logind_session_set_idle_hint(FALSE);
++ break;
++ case XCB_SCREENSAVER_STATE_CYCLE:
++ if (!locker.pid) {
++ logind_session_set_idle_hint(TRUE);
++ start_child(&locker);
++ }
++ break;
++ }
+ }
+ }
+ return TRUE;