merge: desktop

This commit is contained in:
AngeD 2023-04-05 15:14:34 +02:00
commit 36576bb3cb
6 changed files with 22 additions and 57 deletions

@ -1 +1 @@
Subproject commit 94291c924f0efdbc16ac625cf77ae7d3a7fa5821 Subproject commit 0bc0c38e1b11dfb6b5f1794d53869f89ccf9e78f

@ -1 +1 @@
Subproject commit d546bcd1f1393e144396fc049ae4bf7d4fffccab Subproject commit 871f5665d92d59a369cf916e9aa4d321d466f1e3

@ -1 +1 @@
Subproject commit cb9788b12a1fade6be631ad905928f9a5f7eb03f Subproject commit b474978b2e9435c10ca66f8281352ebc825264f4

@ -1 +1 @@
Subproject commit cc9913210498e2d527486310f1e8a53b93f55ca8 Subproject commit 8d23fbd6964b8446bbc73ff04507362d1fd49eb5

View File

@ -1,48 +1,29 @@
#!/bin/bash #!/bin/bash -e
set -e
shopt -s extglob nullglob shopt -s extglob nullglob
set_brightness() { set_brightness() {
MAX="$(cat "$1"/max_brightness)" local max; max="$(cat "$1"/max_brightness)"
FILE="$1"/brightness local file="$1"/brightness
VAL="$(($2 * MAX / 100 + 1))" local val="$(($2 * max / 100 + 1))"
[ "$VAL" -lt 0 ] && VAL=0 [ "$val" -lt 0 ] && val=0
[ "$VAL" -gt "$MAX" ] && VAL="$MAX" [ "$val" -gt "$max" ] && val="$max"
echo "$VAL" > "$FILE" echo "$val" > "$file"
} }
CUR_FILE="${XDG_CACHE_HOME:-$HOME/.cache}/current_brightness" CUR_FILE="${XDG_CACHE_HOME:-$HOME/.cache}/current_brightness"
CUR="$(cat "$CUR_FILE" 2> /dev/null || echo 50)"
set +e
CUR="$(cat "$CUR_FILE" || echo 50)"
set -e
case "${1:0:1}" in case "${1:0:1}" in
'') '') echo "$CUR"; exit ;;
exit 1 '+'|'-') NEW="$((CUR - CUR % $1 + $1))" ;;
;; *) NEW="$1" ;;
'+'|'-')
NEW="$((CUR - CUR % $1 + $1))"
;;
*)
NEW="$1"
;;
esac esac
[ "$NEW" -lt 0 ] && NEW=0
[ "$NEW" -gt 100 ] && NEW=100
for dev in /sys/class/backlight/*; do for dev in /sys/class/backlight/*; do
set_brightness "$dev" "$NEW" set_brightness "$dev" "$NEW"
done done
echo "$NEW" > "$CUR_FILE" echo "$NEW" > "$CUR_FILE"
# update sbar
kill -35 "$(cat "$HOME/.cache/pidofbar")" kill -35 "$(cat "$HOME/.cache/pidofbar")"
if [ -t 1 ]; then
echo "$NEW"
fi

View File

@ -1,37 +1,21 @@
#!/bin/bash #!/bin/bash -e
set -e
SINK='@DEFAULT_AUDIO_SINK@' SINK='@DEFAULT_AUDIO_SINK@'
if [ "$1" == 'm' ]; then if [ "$1" == 'm' ]; then
wpctl set-mute "$SINK" toggle wpctl set-mute "$SINK" toggle
else else
VOL="$((10#$(wpctl get-volume "$SINK" | tr -dc '0-9')))" CUR="$((10#$(wpctl get-volume "$SINK" | tr -dc '0-9')))"
[ -n "$1" ] && VOL="$((VOL - VOL % $1))"
case "${1:0:1}" in case "${1:0:1}" in
'') '') echo "$CUR"; exit ;;
echo "$VOL" '+'|'-') CUR="$((CUR - CUR % $1 + $1))" ;;
exit *) CUR="$1" ;;
;;
'+'|'-')
VOL="$((VOL + $1))"
;;
*)
VOL="$1"
;;
esac esac
[ "$VOL" -lt 0 ] && VOL=0 wpctl set-volume -l 1 "$SINK" "$CUR%"
[ "$VOL" -gt 100 ] && VOL=100 wpctl set-mute "$SINK" 0
wpctl set-volume "$SINK" "$VOL%"
wpctl set-mute "$SINK" 0
fi fi
# update sbar # update sbar
kill -34 "$(cat "$HOME/.cache/pidofbar")" kill -34 "$(cat "$HOME/.cache/pidofbar")"
if [ -t 1 ]; then
echo "$VOL"
fi