diff options
| author | Peter Son Struschka <me@peter-struschka.com> | 2021-06-12 23:35:05 +0800 |
|---|---|---|
| committer | Peter Son Struschka <me@peter-struschka.com> | 2021-06-12 23:35:05 +0800 |
| commit | 4d63577b487a8bf877401312f22142094e2d4584 (patch) | |
| tree | a35596a5ccda6537b05da0a04a775a85bdc25b06 /basics/.local/bin | |
| parent | a99b14adcece0b4f42849b5ba229a49d1b17c50d (diff) | |
| download | dotfiles-4d63577b487a8bf877401312f22142094e2d4584.tar.gz dotfiles-4d63577b487a8bf877401312f22142094e2d4584.tar.bz2 dotfiles-4d63577b487a8bf877401312f22142094e2d4584.tar.lz dotfiles-4d63577b487a8bf877401312f22142094e2d4584.tar.xz dotfiles-4d63577b487a8bf877401312f22142094e2d4584.tar.zst dotfiles-4d63577b487a8bf877401312f22142094e2d4584.zip | |
all: zsh prompt update, general script updates
Diffstat (limited to 'basics/.local/bin')
| -rwxr-xr-x | basics/.local/bin/dim-screen.sh | 65 | ||||
| -rwxr-xr-x | basics/.local/bin/setup-widescreen | 2 |
2 files changed, 66 insertions, 1 deletions
diff --git a/basics/.local/bin/dim-screen.sh b/basics/.local/bin/dim-screen.sh new file mode 100755 index 0000000..d983aee --- /dev/null +++ b/basics/.local/bin/dim-screen.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/basics/.local/bin/setup-widescreen b/basics/.local/bin/setup-widescreen index 0082ff9..b81013a 100755 --- a/basics/.local/bin/setup-widescreen +++ b/basics/.local/bin/setup-widescreen @@ -6,5 +6,5 @@ xrandr --newmode "3440x1440_30.00" 196.25 3440 3600 3952 4464 1440 1443 1453 xrandr --addmode HDMI1 3440x1440_30.00 -xrandr --output HDMI1 --mode 3440x1440_30.00 --primary --left-of eDP1 +xrandr --output HDMI1 --mode 3440x1440_30.00 --primary --right-of eDP1 |
