From 6b9ef9fda0e13cdfd18dc8e484ad5dc9c3532f33 Mon Sep 17 00:00:00 2001 From: Federico Amedeo Izzo Date: Fri, 12 Apr 2019 23:00:02 +0000 Subject: [PATCH] nokia-n900: The power button suspends the device in i3. (!313) With this patch the power button (the one you use to turn it on) suspends the device. This should allow to save more energy with respect to just turning the screen off (slider button). I tested myself on Nokia N900. [ci:skip-build]: already built successfully in CI --- device/device-nokia-n900/10-noroot-suspend | 2 ++ device/device-nokia-n900/APKBUILD | 12 ++++++++---- device/device-nokia-n900/i3wm/i3wm.conf | 3 +++ 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 device/device-nokia-n900/10-noroot-suspend diff --git a/device/device-nokia-n900/10-noroot-suspend b/device/device-nokia-n900/10-noroot-suspend new file mode 100644 index 000000000..e315323bd --- /dev/null +++ b/device/device-nokia-n900/10-noroot-suspend @@ -0,0 +1,2 @@ +%wheel ALL = NOPASSWD: /usr/sbin/pm-suspend + diff --git a/device/device-nokia-n900/APKBUILD b/device/device-nokia-n900/APKBUILD index 475198647..95ef95b37 100644 --- a/device/device-nokia-n900/APKBUILD +++ b/device/device-nokia-n900/APKBUILD @@ -1,6 +1,6 @@ pkgname=device-nokia-n900 pkgver=4 -pkgrel=3 +pkgrel=4 pkgdesc="Nokia N900" url="https://postmarketos.org" arch="armv7" @@ -35,6 +35,7 @@ source=" i3wm/i3status.conf i3wm/protip_shell.sh xorg.conf + 10-noroot-suspend " options="!check !archcheck" @@ -100,7 +101,7 @@ x11() { i3wm() { install_if="$pkgname postmarketos-ui-i3wm" - depends="unclutter-xfixes conky feh postmarketos-artwork-wallpapers" + depends="unclutter-xfixes conky feh postmarketos-artwork-wallpapers pm-utils" install -D -m644 "$srcdir"/i3wm.conf \ "$subpkgdir"/etc/skel/.config/i3/config install -D -m644 "$srcdir"/i3status.conf \ @@ -111,6 +112,8 @@ i3wm() { "$subpkgdir"/etc/skel/.protip_shell.sh install -D -m644 "$srcdir"/conky.conf \ "$subpkgdir"/etc/skel/.config/conky/conky.conf + install -D -m440 "$srcdir"/10-noroot-suspend \ + "$subpkgdir"/etc/sudoers.d/10-noroot-suspend } nonfree_firmware() { @@ -135,7 +138,8 @@ e023df91295fe7e410e163747d17e5b92fe3c022ff076e286778b8334368f885603b8fda65671e4a 7f48d1a044f8c02f7b1d11487ec1f83978d9b0ea12529156e7418f82be556d9baee32b70c4d911174e388bb4941dc19519e93e7551d00ffcd825c848665ff096 weston.ini 4e7abd1ac6223494b2ce96f7fb2dfe6116ee8a526440df07307994ed577f1860222548f7512273b5a21febac8119794774658f60e5d6976747ddc60323d26a62 bq27200_status.sh 16c31bf28b9dcc256821b153de199bd27decc76e4bde63130c1d1556a63cf2cafb64c4d4df42e00690564fce801c5216e8e97e4262a546440fd4bc2e14eaae1c conky.conf -434811c37901a992506f836b14752c9611213cd99bce1dace65be57254311fc95cfb2351a941fcfb6535db80ec86d7777909ca21c194eb924854c518e309808e i3wm.conf +491ef37932453b8e0b5081dd2b5cfaee64fafebccdccd4af02c9181e3719a1322b37b954b1f8d9b53cecfb28cd4c228c7203e457758f1a38826e62c8e645f928 i3wm.conf 3bed8554400d6bbebf7e61b14f347a0f3e24b29be296c56fc829ed655cf67fa547c09bb715589b716d6c3f04492e9f3a12473dce6c7151bc15562b9d102bac2f i3status.conf 0b80af9fd1f36e6bc06bdfdf48352897234ac7457210649016665da8570a5a64b8a0841b4fbeb64fd7054a5246a64718cf4412f8a53024ce39b28a80984972d8 protip_shell.sh -a91f98daa60efa2beb2ff6b405097f92edca5f1bbb9e7675499139be52ca2570712f8f06f9032ef29f636f99c8f8da8b992f746eab6424aac04260c16158bcc2 xorg.conf" +a91f98daa60efa2beb2ff6b405097f92edca5f1bbb9e7675499139be52ca2570712f8f06f9032ef29f636f99c8f8da8b992f746eab6424aac04260c16158bcc2 xorg.conf +38ecdf876b5aa9df2e5ea61c7ebb6f9ca871bdf433029808d028d563dfd740232b3dc21dba098a7622453212af1272e2e782be861b4a96a49fd475a618442d45 10-noroot-suspend" diff --git a/device/device-nokia-n900/i3wm/i3wm.conf b/device/device-nokia-n900/i3wm/i3wm.conf index 47d596f8e..d9bf84333 100644 --- a/device/device-nokia-n900/i3wm/i3wm.conf +++ b/device/device-nokia-n900/i3wm/i3wm.conf @@ -63,6 +63,9 @@ bindsym Shift+space mode "command" # This is the slidey button on the side bindsym XF86ScreenSaver exec --no-startup-id lock.sh +# Pressing the power button suspends the device +bindsym XF86PowerOff exec --no-startup-id sudo pm-suspend + # Start i3bar to display a workspace bar (plus the system information i3status # finds out, if available) bar {