Browse Source

i3lock-color: add patch to sleep after locking

master
PapaTutuWawa 2 years ago
parent
commit
989eb5882c
  1. 18
      .gitignore
  2. 55
      i3lock-color/0001-Also-pass-screen-brightness-keys-as-media-keys.patch
  3. 43
      i3lock-color/0002-sleep-after-lock.patch
  4. 43
      i3lock-color/PKGBUILD

18
.gitignore

@ -1,16 +1,6 @@
# Ignore makepkg's directories
**/pkg/
**/src/
*/**/*
# Ignore build artifacts
**/*.tar.xz
**/*.tar.gz
# Often used source files
**/*.sig
**/*.asc
# Special packages
# dmenu-ptw
dmenu-ptw/**/*
!dmenu-ptw/PKGBUILD
# Only allow PKGBUILDS and patch files
!*/PKGBUILD
!*/*.patch

55
i3lock-color/0001-Also-pass-screen-brightness-keys-as-media-keys.patch

@ -0,0 +1,55 @@
From e71a208aab9f1530be80f6405bd0596dfca35a3a Mon Sep 17 00:00:00 2001
From: Alad Wenter <alad@archlinux.org>
Date: Wed, 7 Aug 2019 00:47:21 +0200
Subject: [PATCH] Also pass screen brightness keys as media keys
Rebase of upstream commits:
2a6545e5bbc2d5d1f20ac71a45cabef27113d7cd # Also pass screen brightness keys as media keys
2766a1380818d70b7b8ed41b6aaca1124e11c790 # Add docs about passing of media keys
71cf4bda1b6f37847fae95de2f035995454743cd # Add long option for media key passing to docs
---
i3lock.1 | 6 ++++++
i3lock.c | 2 ++
2 files changed, 8 insertions(+)
diff --git a/i3lock.1 b/i3lock.1
index 761a6bd..f388a09 100644
--- a/i3lock.1
+++ b/i3lock.1
@@ -28,6 +28,7 @@ i3lock-color \- improved screen locker
.RB [\|\-u\|]
.RB [\|\-e\|]
.RB [\|\-f\|]
+.RB [\|\-m\|]
.SH DESCRIPTION
.B i3lock-color
@@ -121,6 +122,11 @@ Note that this number is zero indexed. The ordering is dependent on libxinerama.
Captures the screen and blurs it using the given sigma (radius).
Images may still be overlaid over the blurred screenshot.
+.TP
+.B \-m, \-\-pass-media-keys
+Allow the following keys to be used while the screen is locked by passing them through:
+XF86AudioPlay, XF86AudioPause, XF86AudioStop, XF86AudioPrev, XF86AudioNext, XF86AudioMu
+
.TP
.B \-\-indicator
Forces the indicator to always be visible, instead of only showing on activity.
diff --git a/i3lock.c b/i3lock.c
index d3fcee8..7926599 100644
--- a/i3lock.c
+++ b/i3lock.c
@@ -652,6 +652,8 @@ static void handle_key_press(xcb_key_press_event_t *event) {
case XKB_KEY_XF86AudioMute:
case XKB_KEY_XF86AudioLowerVolume:
case XKB_KEY_XF86AudioRaiseVolume:
+ case XKB_KEY_XF86MonBrightnessUp:
+ case XKB_KEY_XF86MonBrightnessDown:
xcb_send_event(conn, true, screen->root, XCB_EVENT_MASK_BUTTON_PRESS, (char *)event);
return;
}
--
2.22.0

43
i3lock-color/0002-sleep-after-lock.patch

@ -0,0 +1,43 @@
diff --git a/i3lock.c b/i3lock.c
index 1547f0c..920055e 100644
--- a/i3lock.c
+++ b/i3lock.c
@@ -1345,6 +1345,7 @@ int main(int argc, char *argv[]) {
int curs_choice = CURS_NONE;
int o;
int longoptind = 0;
+ int sleep_after_lock = 0;
struct option longopts[] = {
{"version", no_argument, NULL, 'v'},
{"nofork", no_argument, NULL, 'n'},
@@ -1391,6 +1392,8 @@ int main(int argc, char *argv[]) {
{"radius", required_argument, NULL, 402},
{"ring-width", required_argument, NULL, 403},
+ {"sleep", no_argument, NULL, 'a'},
+
// alignment
{"time-align", required_argument, NULL, 500},
@@ -1497,6 +1500,9 @@ int main(int argc, char *argv[]) {
fprintf(stderr, "Inactivity timeout only makes sense with DPMS, which was removed. Please see the manpage i3lock(1).\n");
break;
}
+ case 'a':
+ sleep_after_lock = 1;
+ break;
case 'c': {
arg = optarg;
@@ -2286,6 +2292,11 @@ int main(int argc, char *argv[]) {
start_time_redraw_tick(main_loop);
}
}
+
+ /* Put the machine to sleep before entering the main loop */
+ if (sleep_after_lock)
+ system("systemctl suspend");
+
ev_loop(main_loop, 0);
if (stolen_focus == XCB_NONE) {

43
i3lock-color/PKGBUILD

@ -0,0 +1,43 @@
# Maintainer: Alad Wenter <alad@archlinux.org>
# Contributor: ibrokemypie <ibrokemypie@bastardi.net>
pkgname=i3lock-color
pkgver=2.12.c
pkgrel=1
_commit=60d68356db80549cb6e40a093b2f884b500aac44 # 2.12.c
pkgdesc="improved screenlocker with color configuration support"
arch=('x86_64')
url=https://github.com/PandorasFox/i3lock-color
license=('MIT')
depends=('xcb-util-image' 'pam' 'libev' 'cairo' 'libxkbcommon-x11'
'libjpeg-turbo' 'xcb-util-xrm' 'pkgconf')
makedepends=('git')
provides=('i3lock')
conflicts=('i3lock')
source=("$pkgname-$pkgver::git+https://github.com/PandorasFox/$pkgname#commit=$_commit"
'0001-Also-pass-screen-brightness-keys-as-media-keys.patch'
'0002-sleep-after-lock.patch')
sha256sums=('SKIP'
'f09ebac78d0f021449734fe38afbc9e389a350255ba88cd5a89d86988fe639db'
'9678e581357d35891ff13addc6204febb58e9574161a6aeaa2b638df49f79d73')
prepare() {
cd "$pkgname-$pkgver"
patch -p1 < "$srcdir"/0001-Also-pass-screen-brightness-keys-as-media-keys.patch
patch -p1 < "$srcdir"/0002-sleep-after-lock.patch
# Fix ticket FS#31544, sed line taken from gentoo
sed -i -e 's:login:system-auth:' pam/i3lock
autoreconf -fiv
}
build() {
cd "$pkgname-$pkgver"
./configure --prefix=/usr --sysconfdir=/etc
}
package() {
cd "$pkgname-$pkgver"
make DESTDIR="$pkgdir" install
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
Loading…
Cancel
Save