updated waybar for laptop
This commit is contained in:
12
.config/waybar/scripts/mic_status.sh
Executable file
12
.config/waybar/scripts/mic_status.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# Prints JSON for Waybar showing mic muted/unmuted
|
||||
set -euo pipefail
|
||||
is_muted=$(wpctl get-mute @DEFAULT_AUDIO_SOURCE@ | awk '{print $2}')
|
||||
vol=$(wpctl get-volume @DEFAULT_AUDIO_SOURCE@ | awk '{printf("%.0f", $2*100)}' || echo 0)
|
||||
|
||||
if [[ "$is_muted" == "true" ]]; then
|
||||
echo '{"text":"","tooltip":"Mic: muted","class":"muted"}'
|
||||
else
|
||||
echo "{\"text\":\" ${vol}%\",\"tooltip\":\"Mic: ${vol}%\",\"class\":\"live\"}"
|
||||
fi
|
||||
|
4
.config/waybar/scripts/mic_toggle.sh
Executable file
4
.config/waybar/scripts/mic_toggle.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
|
||||
|
14
.config/waybar/scripts/touchpad_status.sh
Executable file
14
.config/waybar/scripts/touchpad_status.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
dev="$(hyprctl -j devices | jq -r '.touchpads[0].name')"
|
||||
if [[ -z "$dev" || "$dev" == "null" ]]; then
|
||||
echo '{"text":"","tooltip":"No touchpad detected","class":"absent"}'
|
||||
exit 0
|
||||
fi
|
||||
state=$(hyprctl getoption "device:$dev:enabled" -j | jq -r '.int')
|
||||
if [[ "$state" -eq 1 ]]; then
|
||||
echo '{"text":"","tooltip":"Touchpad: enabled","class":"on"}'
|
||||
else
|
||||
echo '{"text":"","tooltip":"Touchpad: disabled","class":"off"}'
|
||||
fi
|
||||
|
14
.config/waybar/scripts/touchpad_toggle.sh
Executable file
14
.config/waybar/scripts/touchpad_toggle.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
# Toggles touchpad using Hyprland device keyword.
|
||||
set -euo pipefail
|
||||
dev="$(hyprctl -j devices | jq -r '.touchpads[0].name')"
|
||||
[[ -z "$dev" || "$dev" == "null" ]] && exit 0
|
||||
state=$(hyprctl getoption "device:$dev:enabled" -j | jq -r '.int')
|
||||
if [[ "$state" -eq 1 ]]; then
|
||||
hyprctl keyword "device:$dev:enabled" 0
|
||||
notify-send -a waybar "Touchpad" "Disabled"
|
||||
else
|
||||
hyprctl keyword "device:$dev:enabled" 1
|
||||
notify-send -a waybar "Touchpad" "Enabled"
|
||||
fi
|
||||
|
Reference in New Issue
Block a user