From 98b193dc0b40e1517e6482249475c21a279693e8 Mon Sep 17 00:00:00 2001 From: Jack-Benny Persson Date: Wed, 25 Jun 2025 19:09:03 +0200 Subject: [PATCH] Initial commit --- README.md | 12 ++++++++++++ battery-info | 2 ++ battery-thresholds | 6 ++++++ fvwm-config | 39 +++++++++++++++++++++++++++++++++++++++ set-batt-40-70 | 4 ++++ set-batt-90-100 | 4 ++++ set-batt-95-100 | 4 ++++ xbrightness | 14 ++++++++++++++ xvol | 16 ++++++++++++++++ 9 files changed, 101 insertions(+) create mode 100644 README.md create mode 100755 battery-info create mode 100755 battery-thresholds create mode 100644 fvwm-config create mode 100755 set-batt-40-70 create mode 100755 set-batt-90-100 create mode 100755 set-batt-95-100 create mode 100755 xbrightness create mode 100755 xvol diff --git a/README.md b/README.md new file mode 100644 index 0000000..c5a77bf --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# Thinkpad T14 (AMD) with Debian specific FVWM2/3 configs +A collection of small but useful scripts, menu items, and shortcuts for FVWM +running on my Thinkpad T14 with Debian 13. + +A huge thank you goes out to [Carl Svensson](https://datagubbe.se/) who got me interested +in FVWM again after many years. +My `xvol` and `xbrightness` scripts are also based on [his versions](https://datagubbe.se/xvol/). +If you haven't done so already, check out his [FVWM daily driver config](https://datagubbe.se/1yearconf/). + +Please note that the config file in this directory only show the parts where my scripts are +used. The rest of my FVWM config is pretty standard, based on the default +FVWM3 config. diff --git a/battery-info b/battery-info new file mode 100755 index 0000000..aa5309f --- /dev/null +++ b/battery-info @@ -0,0 +1,2 @@ +#!/bin/bash +upower -i /org/freedesktop/UPower/devices/battery_BAT0 diff --git a/battery-thresholds b/battery-thresholds new file mode 100755 index 0000000..cfdd7b5 --- /dev/null +++ b/battery-thresholds @@ -0,0 +1,6 @@ +#!/bin/bash +echo "Current Thresholds" +echo "" + +echo "Start: $(cat /sys/class/power_supply/BAT0/charge_start_threshold)%" +echo "Stop: $(cat /sys/class/power_supply/BAT0/charge_stop_threshold)%" diff --git a/fvwm-config b/fvwm-config new file mode 100644 index 0000000..ad396de --- /dev/null +++ b/fvwm-config @@ -0,0 +1,39 @@ +################# +### Shortcuts ### +################# + +# Adjust volume +Key XF86AudioLowerVolume A N Exec exec /usr/local/bin/xvol down +Key XF86AudioRaiseVolume A N Exec exec /usr/local/bin/xvol up +Key XF86AudioMute A N Exec exec /usr/local/bin/xvol mute + +# Adjust brightness +Key XF86MonBrightnessUp A N Exec exec /usr/local/bin/xbrightness up +Key XF86MonBrightnessDown A N Exec exec /usr/local/bin/xbrightness down + + +################## +### Menu items ### +################## + +# Set DPMS timeouts +AddToMenu DPMS "DPMS timeout" Title ++ "10 minutes" Exec exec xset s 600 600 dpms 600 600 600 ++ "20 minutes" Exec exec xset s 1200 1200 dpms 1200 1200 1200 ++ "30 minutes" Exec exec xset s 1800 1800 dpms 1800 1800 1800 ++ "1,5 hours" Exec exec xset s 5400 5400 dpms 5400 5400 5400 ++ "3 hours" Exec exec xset s 10800 10800 dpms 10800 10800 10800 + +# Battery settings +AddToMenu Battery "Battery Config" Title ++ "Show Info" Exec exec upower -i /org/freedesktop/UPower/devices/battery_BAT0 | xmessage -file - ++ "Show Thresholds" Exec exec /usr/local/bin/battery-thresholds | xmessage -file - ++ "Set Threshold 40, 70" Exec xterm -e 'sudo /usr/local/bin/set-batt-40-70' ++ "Set Threshold 90, 100" Exec xterm -e 'sudo /usr/local/bin/set-batt-90-100' ++ "Set Threshold 95, 100" Exec xterm -e 'sudo /usr/local/bin/set-batt-95-100' + +# Set TearFree +AddToMenu TearFree "Tear Free" Title ++ "Set TearFree" Exec exec xrandr --output eDP --set TearFree on ++ "Unset TearFree" Exec exec xrandr --output eDP --set TearFree off + diff --git a/set-batt-40-70 b/set-batt-40-70 new file mode 100755 index 0000000..55a4cd2 --- /dev/null +++ b/set-batt-40-70 @@ -0,0 +1,4 @@ +#!/bin/bash +echo 40 > /sys/class/power_supply/BAT0/charge_start_threshold +echo 70 > /sys/class/power_supply/BAT0/charge_stop_threshold +read -p "Thresholds set to 40 & 70" diff --git a/set-batt-90-100 b/set-batt-90-100 new file mode 100755 index 0000000..b75c30d --- /dev/null +++ b/set-batt-90-100 @@ -0,0 +1,4 @@ +#!/bin/bash +echo 90 > /sys/class/power_supply/BAT0/charge_start_threshold +echo 100 > /sys/class/power_supply/BAT0/charge_stop_threshold +read -p "Thresholds set to 90 & 100" diff --git a/set-batt-95-100 b/set-batt-95-100 new file mode 100755 index 0000000..280fc97 --- /dev/null +++ b/set-batt-95-100 @@ -0,0 +1,4 @@ +#!/bin/bash +echo 95 > /sys/class/power_supply/BAT0/charge_start_threshold +echo 100 > /sys/class/power_supply/BAT0/charge_stop_threshold +read -p "Thresholds set to 95 & 100" diff --git a/xbrightness b/xbrightness new file mode 100755 index 0000000..dd3c35f --- /dev/null +++ b/xbrightness @@ -0,0 +1,14 @@ +#!/bin/bash + +if [ $1 = "up" ]; then + brightnessctl set +5% &> /dev/null + brightnessctl | grep 'Current brightness' \ + | awk '{ print $4 }' | tr -d '()' \ + | xmessage -timeout 1 -geometry 120x80-0-0 -file - &> /dev/null +elif [ $1 = "down" ]; then + brightnessctl set 5%- &> /dev/null + brightnessctl | grep 'Current brightness' \ + | awk '{ print $4 }' | tr -d '()' \ + | xmessage -timeout 1 -geometry 120x80-0-0 -file - &> /dev/null +fi + diff --git a/xvol b/xvol new file mode 100755 index 0000000..9601f1c --- /dev/null +++ b/xvol @@ -0,0 +1,16 @@ +#!/bin/bash + +if [ $1 = "up" ]; then + pactl set-sink-mute 0 false ; pactl set-sink-volume 0 +5% + pactl list sinks | grep "Volume" | head -n 1 | awk '{ print $5 }' \ + | xmessage -timeout 1 -geometry 120x80-0-0 -file - &> /dev/null +elif [ $1 = "down" ]; then + pactl set-sink-mute 0 false ; pactl set-sink-volume 0 -5% + pactl list sinks | grep "Volume" | head -n 1 | awk '{ print $5 }' \ + | xmessage -timeout 1 -geometry 120x80-0-0 -file - &> /dev/null +elif [ $1 = "mute" ]; then + pactl set-sink-mute 0 toggle + pactl list sinks | grep -i mute | head -n 1 | awk '{ print $2 }' \ + | xmessage -timeout 1 -geometry 120x80-0-0 -file - &> /dev/null +fi +