Last active
June 11, 2024 01:48
-
-
Save ekickx/e8af98dd346087b6a4a8ca5a1f2a8fa3 to your computer and use it in GitHub Desktop.
labwc sample conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<openbox_config> | |
<keyboard> | |
<keybind key="XF86AudioMute"> | |
<action name="Execute"> | |
<command>bash ~/Projects/bin/volume mute</command> | |
</action> | |
</keybind> | |
<keybind key="XF86AudioRaiseVolume"> | |
<action name="Execute"> | |
<command>bash ~/Projects/bin/volume up</command> | |
</action> | |
</keybind> | |
<keybind key="XF86AudioLowerVolume"> | |
<action name="Execute"> | |
<command>bash ~/Projects/bin/volume down</command> | |
</action> | |
</keybind> | |
<keybind key="A-Tab"> | |
<action name="NextWindow"/> | |
</keybind> | |
<keybind key="W-t"> | |
<action name="Execute"> | |
<command>gnome-terminal</command> | |
</action> | |
</keybind> | |
<keybind key="W-f"> | |
<action name="Execute"> | |
<command>nautilus</command> | |
</action> | |
</keybind> | |
</keyboard> | |
<lab> | |
<xdg_shell_server_side_deco>yes</xdg_shell_server_side_deco> | |
</lab> | |
</openbox_config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# You can call this script like this: | |
# $./volume.sh up | |
# $./volume.sh down | |
# $./volume.sh mute | |
notif="notify-send -t 5000" | |
get_volume(){ | |
amixer get Master | grep '%' | head -n 1 | cut -d '[' -f 2 | cut -d '%' -f 1 | |
} | |
is_mute(){ | |
amixer get Master | grep '%' | grep -oE '[^ ]+$' | grep off > /dev/null | |
} | |
send_notification(){ | |
volume=$(get_volume) | |
# Make the bar with the special character ─ (it's not dash -) | |
# https://en.wikipedia.org/wiki/Box-drawing_character | |
bar=$(seq -s "─" $((volume/5)) | sed 's/[0-9]//g') | |
# Send the notification | |
if pgrep mako &>/dev/null; then | |
makoctl dismiss | |
if is_mute; then | |
$notif " 婢 $volume $bar" | |
else | |
$notif " 墳 $volume $bar" | |
fi | |
fi | |
} | |
case $1 in | |
up) | |
# Set the volume on (if it was muted) | |
# Up the volume (+ 5%) | |
amixer sset Master 5%+ > /dev/null | |
send_notification | |
;; | |
down) | |
amixer sset Master 5%- > /dev/null | |
send_notification | |
;; | |
mute) | |
# Toggle mute | |
amixer set Master 1+ toggle > /dev/null | |
send_notification | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment