From bf020acd0fd4ca511ac479f537d41661a2ae708f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Wed, 14 Oct 2020 10:33:55 +0200 Subject: x11-misc/myi3lock: fixed keyboard layout and screen fade on inactivity --- x11-misc/myi3lock/files/myi3lock | 3 ++ x11-misc/myi3lock/files/mylock-notifier-fade.sh | 65 +++++++++++++++++++++++++ x11-misc/myi3lock/myi3lock-1.3.2-r1.ebuild | 20 -------- x11-misc/myi3lock/myi3lock-1.4.0-r1.ebuild | 21 ++++++++ 4 files changed, 89 insertions(+), 20 deletions(-) create mode 100755 x11-misc/myi3lock/files/mylock-notifier-fade.sh delete mode 100644 x11-misc/myi3lock/myi3lock-1.3.2-r1.ebuild create mode 100644 x11-misc/myi3lock/myi3lock-1.4.0-r1.ebuild (limited to 'x11-misc/myi3lock') diff --git a/x11-misc/myi3lock/files/myi3lock b/x11-misc/myi3lock/files/myi3lock index 0572cbc..846a249 100755 --- a/x11-misc/myi3lock/files/myi3lock +++ b/x11-misc/myi3lock/files/myi3lock @@ -8,6 +8,9 @@ if [ "$1" != "--login" ]; then ( sleep 3; xset dpms force off ) & fi +# Switch keyboard to expected layout +ibus engine xkb:us::eng + # Run lock i3lock -n -c 000000 -i "$(shuf -n1 -e "$BACKS"/*)" diff --git a/x11-misc/myi3lock/files/mylock-notifier-fade.sh b/x11-misc/myi3lock/files/mylock-notifier-fade.sh new file mode 100755 index 0000000..d983aee --- /dev/null +++ b/x11-misc/myi3lock/files/mylock-notifier-fade.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +# Example notifier script -- lowers screen brightness, then waits to be killed +# and restores previous brightness on exit. + +## CONFIGURATION ############################################################## + +# Brightness will be lowered to this value. +min_brightness=0 + +# If your video driver works with xbacklight, set -time and -steps for fading +# to $min_brightness here. Setting steps to 1 disables fading. +fade_time=200 +fade_steps=20 + +# If you have a driver without RandR backlight property (e.g. radeon), set this +# to use the sysfs interface and create a .conf file in /etc/tmpfiles.d/ +# containing the following line to make the sysfs file writable for group +# "users": +# +# m /sys/class/backlight/acpi_video0/brightness 0664 root users - - +# +#sysfs_path=/sys/class/backlight/acpi_video0/brightness + +# Time to sleep (in seconds) between increments when using sysfs. If unset or +# empty, fading is disabled. +fade_step_time=0.05 + +############################################################################### + +get_brightness() { + if [[ -z $sysfs_path ]]; then + xbacklight -get + else + cat $sysfs_path + fi +} + +set_brightness() { + if [[ -z $sysfs_path ]]; then + xbacklight -steps 1 -set $1 + else + echo $1 > $sysfs_path + fi +} + +fade_brightness() { + if [[ -z $sysfs_path ]]; then + xbacklight -time $fade_time -steps $fade_steps -set $1 + elif [[ -z $fade_step_time ]]; then + set_brightness $1 + else + local level + for level in $(eval echo {$(get_brightness)..$1}); do + set_brightness $level + sleep $fade_step_time + done + fi +} + +trap 'exit 0' TERM INT +trap "set_brightness $(get_brightness); kill %%" EXIT +fade_brightness $min_brightness +sleep 2147483647 & +wait diff --git a/x11-misc/myi3lock/myi3lock-1.3.2-r1.ebuild b/x11-misc/myi3lock/myi3lock-1.3.2-r1.ebuild deleted file mode 100644 index 9b8caa0..0000000 --- a/x11-misc/myi3lock/myi3lock-1.3.2-r1.ebuild +++ /dev/null @@ -1,20 +0,0 @@ -EAPI=7 - -DESCRIPTION="Script calling i3lock used to automate some tasks on lock" -HOMEPAGE="https://git.cynerd.cz" -S="${WORKDIR}" - -LICENSE="GPL-3.0+" -SLOT="0" -KEYWORDS="~amd64 ~x86" - -RDEPEND=" - x11-misc/i3lock - x11-themes/background-lnxpcs - x11-misc/xss-lock - x11-wm/i3" -BDEPEND="" - -src_install() { - dobin "${FILESDIR}/myi3lock" -} diff --git a/x11-misc/myi3lock/myi3lock-1.4.0-r1.ebuild b/x11-misc/myi3lock/myi3lock-1.4.0-r1.ebuild new file mode 100644 index 0000000..64950a7 --- /dev/null +++ b/x11-misc/myi3lock/myi3lock-1.4.0-r1.ebuild @@ -0,0 +1,21 @@ +EAPI=7 + +DESCRIPTION="Script calling i3lock used to automate some tasks on lock" +HOMEPAGE="https://git.cynerd.cz" +S="${WORKDIR}" + +LICENSE="GPL-3.0+" +SLOT="0" +KEYWORDS="~amd64 ~x86" + +RDEPEND=" + x11-misc/i3lock + x11-themes/background-lnxpcs + x11-misc/xss-lock + x11-wm/i3" +BDEPEND="" + +src_install() { + dobin "${FILESDIR}/myi3lock" + dobin "${FILESDIR}/mylock-notifier-fade.sh" +} -- cgit v1.2.3