Massive change to the structure of the tree.

This commit is contained in:
Bartek Stalewski 2025-03-10 23:59:38 +01:00
parent 2fc5f7a514
commit c71934ed3b
No known key found for this signature in database
137 changed files with 51 additions and 266 deletions

View file

@ -0,0 +1,17 @@
#!/bin/bash
for battery in /sys/class/power_supply/BAT?*; do
# If non-first battery, print a space separator.
[ -n "${capacity+x}" ] && printf " "
# Sets up the status and capacity
case "$(cat "$battery/status")" in
"Full") status="\uf102" ;;
"Discharging") status="\uf063" ;;
"Charging") status="\uf062" ;;
"Not charging") status="\uf444"; exit 0 ;;
"Unknown") status="\uf128" ;;
esac
capacity=$(cat "$battery/capacity")
# Will make a warn variable if discharging and low
[ "$capacity" -le 20 ] && printf "<span background='#770000' foreground='#ffffff'>${status} ${capacity}%%</span>" || printf "${status} ${capacity}%%"
done && exit 0

View file

@ -0,0 +1,37 @@
#!/bin/bash
key_micmute() {
state=$(pactl get-source-mute @DEFAULT_SOURCE@ | awk -F': ' '{print $2}')
case ${state} in
yes)
echo 1 | doas tee /sys/devices/platform/thinkpad_acpi/leds/platform::micmute/brightness
pactl set-source-mute @DEFAULT_SOURCE@ 0 ;;
no)
echo 0 | doas tee /sys/devices/platform/thinkpad_acpi/leds/platform::micmute/brightness
pactl set-source-mute @DEFAULT_SOURCE@ 1 ;;
esac
}
vol_decrease() {
pactl set-sink-volume @DEFAULT_SINK@ -5%
volume=$(pactl get-sink-volume @DEFAULT_SINK@ | head -n 1 | awk -F' / *' '{print $2}')
notify-send -t 2000 -u low "volume: $volume"
}
vol_increase() {
pactl set-sink-volume @DEFAULT_SINK@ +5%
volume=$(pactl get-sink-volume @DEFAULT_SINK@ | head -n 1 | awk -F' / *' '{print $2}')
notify-send -t 2000 -u low "volume: $volume"
}
if [ $1 ]; then
case $1 in
dec) vol_decrease ;;
inc) vol_increase ;;
micmute) key_micmute ;;
esac
else
vol=$(pactl get-sink-volume @DEFAULT_SINK@ | awk -F' / ' '{print $2}' | tr -d '%')
[ $(pactl get-sink-mute @DEFAULT_SINK@ | awk -F': ' '{print $2}') = yes ] || [ "$vol" -eq 0 ] && mute="audio muted" || mute=""
[ $(pactl get-source-mute @DEFAULT_SOURCE@ | awk -F': ' '{print $2}') = no ] && printf "${mute} mic unmuted" || printf "${mute}"
fi

View file

@ -0,0 +1,7 @@
#!/bin/bash
interface=$(ip a | grep 'wg[0-9]:' | awk -F': ' '{print $2}')
case $interface in
wg0) printf 'wireguard running' ;;
wg1) printf 'wireguard running (all traffic)' ;;
esac

View file

@ -0,0 +1,65 @@
#!/bin/sh
div="---"
set_output() {
sel_sink=$(printf "$sinks\\n$div\\nback\\n$div\\nexit" | wofi -G --dmenu -i -p "select output device")
case "$sel_sink" in
back) show_current ;;
exit) exit ;;
*) pactl set-default-sink $(pactl list sinks | grep -B 1 "$sel_sink" | awk -F': ' '/Name:/ {print $2}') ;;
esac
#kill -46 $(pidof dwmblocks)
show_current
}
set_input() {
sel_source=$(printf "$sources\\n$div\\nbluetooth profile\\n$div\\nback\\n$div\\nexit" | wofi -G --dmenu -i -p "select input device")
case "$sel_source" in
back) show_current ;;
exit) exit ;;
bluetooth*) set_bt_profile ;;
*) pactl set-default-source "$(pactl list sources | grep -B 1 "$sel_source" | awk -F': ' '/Name:/ {print $2}')" ;;
esac
#kill -46 $(pidof dwmblocks)
show_current
}
set_bt_profile() {
bt_sink=$(pactl list cards | awk -F'"' '/device.name.*bluez/ {print $2}')
[ -z "${bt_sink}" ] &&
{ notify-send -t 2000 -u critical "ﳌ no headphones connected"; exit; }
profile_chosen=$(printf "profile mSBC\\nprofile LDAC\\n$div\\nback\\nexit" | wofi -G --dmenu -i -p "select bluettoth profile")
case "$profile_chosen" in
back) show_current ;;
exit) exit ;;
profile*mSBC) pactl set-card-profile $bt_sink headset-head-unit-msbc
pactl set-default-source $(pactl list sources short | awk '/bluez_input/ {print $2}') ;;
profile*LDAC) pactl set-card-profile $bt_sink a2dp-sink-ldac ;;
*) show_current ;;
esac
pactl set-default
}
show_current() {
def_snk=$(pactl list | grep -A 1 "Name: $(pactl get-default-sink)\$" | awk -F': ' '/Description: / {print $2}')
def_src=$(pactl list | grep -A 1 "Name: $(pactl get-default-source)\$" | awk -F': ' '/Description: / {print $2}')
chosen=$(printf "output: $def_snk\\ninput: $def_src" | wofi -G --dmenu -i -p "current audio devices")
if [ "$1" = "no_switch" ]; then
case "$chosen" in
*) notify-send -t 2000 -u critical "婢 no device to switch" ;;
esac
else
case "$chosen" in
output*) set_output ;;
input*) set_input ;;
esac
fi
}
sinks=$(pactl list sinks | awk -F': ' '/Description:/ {print $2}')
sources=$(pactl list sources | grep -v 'Monitor of ' | awk -F': ' '/Description:/ {print $2}')
[ "$(echo "$sinks" | wc -l)" -lt 2 ] &&
{ show_current no_switch; exit; }
show_current

View file

@ -0,0 +1,11 @@
#!/bin/sh
chosen=$(cut -d ';' -f1 $XDG_CONFIG_HOME/qtile/chars/* | wofi -G --dmenu -i -p "select character to copy" | sed "s/ .*//")
[ -z "$chosen" ] && exit
if [ -n "$1" ]; then
xdotool type "$chosen"
else
printf "$chosen" | wl-copy -n
notify-send -t 2000 "'$chosen' copied to clipboard" &
fi