diff options
author | Vikas Kushwaha <dev@vikas.rocks> | 2024-11-21 13:30:52 +0530 |
---|---|---|
committer | Vikas Kushwaha <dev@vikas.rocks> | 2024-11-21 13:30:52 +0530 |
commit | 5c916d69d457101326803eb076a746060e3618cf (patch) | |
tree | d6fce3256eede1c1bf78fb6a1be75b9cc4b84cee /.local/bin/desktop |
Moved from github
Diffstat (limited to '.local/bin/desktop')
-rwxr-xr-x | .local/bin/desktop/beautify | 102 | ||||
-rwxr-xr-x | .local/bin/desktop/brightness | 32 | ||||
-rwxr-xr-x | .local/bin/desktop/detect-keys | 3 | ||||
-rwxr-xr-x | .local/bin/desktop/dmenu-syncthing-devices | 25 | ||||
-rwxr-xr-x | .local/bin/desktop/dmenu-unicode | 11 | ||||
-rwxr-xr-x | .local/bin/desktop/dmenu-zeal | 27 | ||||
-rwxr-xr-x | .local/bin/desktop/edit-graphical-buffer | 17 | ||||
-rwxr-xr-x | .local/bin/desktop/i3exit | 54 | ||||
-rwxr-xr-x | .local/bin/desktop/i3exit-script | 18 | ||||
-rwxr-xr-x | .local/bin/desktop/librewolf-open | 39 | ||||
-rwxr-xr-x | .local/bin/desktop/mlock | 22 | ||||
-rwxr-xr-x | .local/bin/desktop/remap | 146 | ||||
-rwxr-xr-x | .local/bin/desktop/remapd | 6 | ||||
-rwxr-xr-x | .local/bin/desktop/setdp | 36 | ||||
-rwxr-xr-x | .local/bin/desktop/show-i3-keybindings | 11 | ||||
-rwxr-xr-x | .local/bin/desktop/toggle-xeyes | 7 | ||||
-rwxr-xr-x | .local/bin/desktop/torbrowser | 30 | ||||
-rwxr-xr-x | .local/bin/desktop/volctl | 50 |
18 files changed, 636 insertions, 0 deletions
diff --git a/.local/bin/desktop/beautify b/.local/bin/desktop/beautify new file mode 100755 index 0000000..e535129 --- /dev/null +++ b/.local/bin/desktop/beautify @@ -0,0 +1,102 @@ +#!/bin/sh + +## properties of script + +## set home screen and lock screen wallpaper +HOMEWALL="${XDG_DATA_HOME:-$HOME/.local/share}/wallpapers/artix-wampire.png" +LOCKWALL="${XDG_DATA_HOME:-$HOME/.local/share}/wallpapers/artix-wampire.png" + +## choose random wallpaper from a directory +# WALLPAPERS="$HOME/.local/share/wallpapers" +## requires 'setbg' script found in lukesmithxyz github repo +setbg_link="https://github.com/LukeSmithxyz/voidrice/blob/master/.local/bin/setbg" +## path to download script files like setbg +BIN="$HOME/.local/bin" + +# Location to put lock screen wallpaper for lock program +LOCKWALL_LOC="/tmp/lockWall" + +## list of programs to be installed/uninstalled +PROGRAMS="eza dust conky picom xwallpaper cxxmatrix" +## some additional programs that I think are essential are installed below +## these will be not removed during uninstall + + +help() { echo "beautify - beautify you desktop environment + +USAGE: + beautify [OPTION]... + +OPTIONS: + -h show this help message + + -i install programs for beautification + -u uninstall beautification programs + -x clear beautifications + + The above group of options are conflicting. + Passing any one of them will disable the others. + +This is very much a personal script and is meant to be configured directly. +I have only made it work with arch linux and the pacman package manager."; } + +err() { printf 'beautify: %s\n' "$@" >&2; exit 1; } +while getopts 'iuxh' o; do case "$o" in + i) opflag=0 ;; + u) opflag=1 ;; + x) opflag=2 ;; + h) help >&2; exit ;; + *) err "invalid option -- '$OPTARG'" ;; +esac done +shift $((OPTIND - 1)) + +case "$opflag" in + 0) + PROGRAMS="$PROGRAMS neovim tmux dunst highlight starship" + sudo pacman -Syu --noconfirm + for pkg in $PROGRAMS; do + if ! pacman -Q "$pkg" >/dev/null; then + yay -S --noconfirm "$pkg" + fi + done + + mkdir -pv ~/.local/bin + wget -c "$setbg_link" -o "${BIN}/setbg" && chmod +x "${BIN}/setbg" + ;; + + 1) + for pkg in $PROGRAMS; do + if pacman -Q "$pkgs" >/dev/null; then + sudo pacman -Rns --noconfirm "$pkg" + fi + done + rm -f "$setbg" + ;; + + 2) + i3-msg 'gaps inner all set 0' + xwallpaper --clear + rm -f "$LOCKWALL_LOC" + killall -q -o 1s conky picom beautify + ;; +esac + +[ -n "$opflag" ] && exit + +if [ "${LOCKWALL%.png}" = "$LOCKWALL" ]; then + temp="/tmp/$(basename "${LOCKWALL%.*}.png")" + convert "$LOCKWALL" "$temp" + cp -f "$temp" "$LOCKWALL_LOC" + rm -f "$temp" +else + cp -f "$LOCKWALL" "$LOCKWALL_LOC" +fi + +i3-msg 'gaps inner all set 10' +xwallpaper --zoom "$HOMEWALL" +pidof -q conky || conky +pidof -q picom || picom -b + +if [ -e "$WALLPAPERS" ]; then + while sleep 1m; do setbg "$WALLPAPERS"; done +fi diff --git a/.local/bin/desktop/brightness b/.local/bin/desktop/brightness new file mode 100755 index 0000000..11733f4 --- /dev/null +++ b/.local/bin/desktop/brightness @@ -0,0 +1,32 @@ +#!/bin/sh + +help() { echo "brightness - change screen brightness +USAGE: brightness <up|down>"; } + +[ "$#" -lt 1 ] && help >&2 && exit 1 + +brightness="$(brightnessctl --machine-readable | cut -d, -f4 | tr -d %)" +step="$(( brightness / 10 + 1))" + +case "$1" in + up) brightnessctl --quiet set +${step}% ;; + down) brightnessctl --quiet set ${step}%- ;; + *) help >&2; exit 1 ;; +esac + +brightness="$(brightnessctl --machine-readable | cut -d, -f4)" + +if [ -n "$TMUX" ]; then + tmux display "Brightness: $brightness" + exit +fi + +notify() { [ -n "$DISPLAY" ] && notify-send -r 45234 "$1" "$2"; } +case "${brightness%\%}" in + [0-9]) notify "💡 Brightness: $brightness" ;; + [1-7][0-9]) notify "🔅 Brightness: $brightness" ;; + [89][0-9]) notify "🔆 Brightness: $brightness" ;; + 100) notify "🔆 MAX Brightness: $brightness" ;; + *) notify "brightness" "can't determine brightness" +esac +exit 0 diff --git a/.local/bin/desktop/detect-keys b/.local/bin/desktop/detect-keys new file mode 100755 index 0000000..da00dad --- /dev/null +++ b/.local/bin/desktop/detect-keys @@ -0,0 +1,3 @@ +#!/bin/sh + +xev | awk -F'[ )]+' '/^KeyPress/ { a[NR+2] } NR in a { printf "%-3s %s\n", $5, $8 }' diff --git a/.local/bin/desktop/dmenu-syncthing-devices b/.local/bin/desktop/dmenu-syncthing-devices new file mode 100755 index 0000000..bb93f6d --- /dev/null +++ b/.local/bin/desktop/dmenu-syncthing-devices @@ -0,0 +1,25 @@ +#!/bin/sh + +pidof -q syncthing || { + echo "ERROR: Syncthing is not running" >&2 + exit 2 +} + +get_devices() { + for device_id in $(syncthing cli config devices list); do + printf '%-10s %s\n' \ + "$(syncthing cli config devices "$device_id" name get)" \ + "$device_id" + done | nl -w1 -s'. ' +} + +device="$(get_devices | dmenu -l 10 -p "Syncthing devices")" +device_id="${device##* }" +[ -z "$device_id" ] && exit 1 + +if [ -n "$1" ]; then + xdotool type "$device_id" +else + printf '%s\n' "$device_id" | xclip -selection clipboard + notify-send "📋 Copied to clipboard" "$device_id" +fi diff --git a/.local/bin/desktop/dmenu-unicode b/.local/bin/desktop/dmenu-unicode new file mode 100755 index 0000000..16e1cfc --- /dev/null +++ b/.local/bin/desktop/dmenu-unicode @@ -0,0 +1,11 @@ +#!/bin/sh + +chosen=$(cat ~/.local/share/chars/* | dmenu -i -l 25 -fn :size=20) + +[ -z "$chosen" ] && exit + +if [ -n "$1" ]; then + printf "%s" "${chosen#* }" | cut -d\; -f1 | tr -d '\n' | xclip -selection clipboard +else + printf "%s" "${chosen%% *}" | xclip -selection clipboard +fi diff --git a/.local/bin/desktop/dmenu-zeal b/.local/bin/desktop/dmenu-zeal new file mode 100755 index 0000000..608be89 --- /dev/null +++ b/.local/bin/desktop/dmenu-zeal @@ -0,0 +1,27 @@ +#!/bin/sh + +cd ~/.local/share/Zeal/Zeal || exit + +selection="$(echo "Shell +C/C++ +Java +Python +$(find . -maxdepth 1 -type d ! -name 'docsets' | + tail +2 | cut -c3- | sed 's/^/ds:/') +" | dmenu -i -p "Select docset group")" + +case "$selection" in + Shell) key="bash,zsh,linux" ;; + C/C++) key="c,cpp,linux" ;; + Java) key="java,javaspec" ;; + Python) key="python,numpy,matplotlib" ;; + ds:*) + ln -sfT "${selection#ds:}" docsets + killall -q zeal; zeal + exit + ;; + *) exit 2 ;; +esac + +query="$(dmenu -p "Enter query")" +zeal "$key:$query" diff --git a/.local/bin/desktop/edit-graphical-buffer b/.local/bin/desktop/edit-graphical-buffer new file mode 100755 index 0000000..10eac8f --- /dev/null +++ b/.local/bin/desktop/edit-graphical-buffer @@ -0,0 +1,17 @@ +#!/bin/sh + +sleep 0.5 +xdotool key --clearmodifiers ctrl+a ctrl+c +content="$(xclip -o -sel clipboard)" + +tempfile=/tmp/scratch-buffer/$$.txt +mkdir -pv /tmp/scratch-buffer +echo "$content" | tee "$tempfile" > "$tempfile.bak" +${TERMINAL:-xdg-terminal-exec} -c dropdown_buffer -e nvim "$tempfile" + +diff "$tempfile" "$tempfile.bak" >/dev/null || { + xclip -sel clipboard < "$tempfile" + xdotool key --clearmodifiers ctrl+a ctrl+v +} + +rm -f "$tempfile" "$tempfile.bak" diff --git a/.local/bin/desktop/i3exit b/.local/bin/desktop/i3exit new file mode 100755 index 0000000..0be387c --- /dev/null +++ b/.local/bin/desktop/i3exit @@ -0,0 +1,54 @@ +#!/bin/sh + +# with openrc use loginctl +[ "$(cat /proc/1/comm)" = "systemd" ] && logind=systemctl || logind=loginctl + +command="$1" +system_control() { + if [ "$(loginctl show-session --property=NCurrentSessions --value)" -gt 2 ]; then + notify-send --replace-id=4252 \ + "i3exit" "Multiple users are logged in\nCant't $command" + exit + fi + eval "$@" +} + +lockWall="$HOME/.local/share/lockWall" +lock_desktop() { + [ -f "$lockWall" ] && + i3lock --tiling --image="$lockWall" || + i3lock --color=001177 + pkill ssh-agent +} + +case "$command" in + lock) + lock_desktop + xset dpms force off + ;; + logout) + switch-session + i3-msg exit + ;; + switch_user) + dm-tool switch-to-greeter + ;; + suspend) + lock_desktop; $logind suspend + ;; + hibernate) + system_control lock_desktop && $logind hibernate + ;; + reboot) + system_control $logind reboot + ;; + shutdown) + system_control $logind poweroff + ;; + *) + echo "== ! i3exit: missing or invalid argument ! ==" + echo "Try again with: lock | logout | switch_user | suspend | hibernate | reboot | shutdown" + exit 2 +esac + +exit 0 diff --git a/.local/bin/desktop/i3exit-script b/.local/bin/desktop/i3exit-script new file mode 100755 index 0000000..b27f0f5 --- /dev/null +++ b/.local/bin/desktop/i3exit-script @@ -0,0 +1,18 @@ +#!/bin/bash +# TODO: copy and configure the i3 script to take parametres +# possibly make it as syst-power + +# snippet for blur effect on lock screen + + +# DEPEDNDENCIES: i3lock imagemagic scrot + +PICTURE=/tmp/i3lock.png +SCREENSHOT="scrot $PICTURE" + +BLUR="5x4" + +$SCREENSHOT +convert $PICTURE -blur $BLUR $PICTURE +i3lock -i $PICTURE +rm $PICTURE diff --git a/.local/bin/desktop/librewolf-open b/.local/bin/desktop/librewolf-open new file mode 100755 index 0000000..4bb2d70 --- /dev/null +++ b/.local/bin/desktop/librewolf-open @@ -0,0 +1,39 @@ +#!/bin/sh + +window="LibreWolf" +running() { windows=$(wmctrl -l) + test "${windows#*"$window"}" != "$windows"; } +press() { sleep 0.1; xdotool keyup Super + xdotool key --clearmodifiers "$@"; } + +if ! running; then + notify-send "Starting $window..." + start="$(date +%s.%3N)" + setsid -f librewolf -P "${FFPROFILE:-default-release}" + for _ in $(seq 1000); do sleep 0.1; running && break; done + end="$(date +%s.%3N)" + time="$(echo "$end - $start" | bc)" + notify-send "$window" "Started in ${time}s" + started=1 +fi + +wmctrl -a "$window" || + { notify-send "ffbrowser" "ERROR: librewolf window not found"; exit 1; } +[ "$started" = 1 ] || press ctrl+t + +query="$*" +if [ "$query" != "${query#http*://}" ]; then + press ctrl+l +elif [ -e "$query" ]; then + query="$(readlink -f "$query")"; press ctrl+l +else + # workaround for ctrl+k not working at initial startup + [ "$started" = 1 ] && sleep 0.5 + press ctrl+k +fi + +if [ -n "$query" ]; then + xdotool type "$query" + press Return +fi + diff --git a/.local/bin/desktop/mlock b/.local/bin/desktop/mlock new file mode 100755 index 0000000..67da8a3 --- /dev/null +++ b/.local/bin/desktop/mlock @@ -0,0 +1,22 @@ +#!/bin/sh + +command -v xtrlock || exit + +[ "$(xrandr --current | grep -c "\S* connected \S\+.* (")" -gt 1 ] && { + xtrlock -b -f + xset dpms force off + exit +} + +TERMINAL="alacritty -t matrixlock" +if command -v cxxmatrix; then + $TERMINAL -e cxxmatrix & +elif command -v cmatrix; then + $TERMINAL -e sh -c 'sleep 0.5 && cmatrix' & +else + xtrlock -b -f; exit +fi + +xtrlock -f +sleep 0.2 +wmctrl -r matrixlock -b add,fullscreen diff --git a/.local/bin/desktop/remap b/.local/bin/desktop/remap new file mode 100755 index 0000000..3635464 --- /dev/null +++ b/.local/bin/desktop/remap @@ -0,0 +1,146 @@ +#!/bin/sh + +# This script cannot run without the X server (GUI) +# So exit if DISPLAY is not set +[ -z "$DISPLAY" ] && { + notify-send remap "ERROR: DISPLAY not set" + exit +} + +timeout="${KEY_RELEASE_TIMEOUT:-500}" + +help() { echo "remap - remap modifier keys for easy access + +USAGE: + remap [OPTION]... + +OPTIONS: + -x reset keys + -t toggle (remap/reset) + -s show remap status + -i show info of all key remaps + -h show this help message"; } + +key_info() { echo " + +-----------------+-----------------------------------+ + | Before | After | + +-----------------+-----------------+-----------------+ + | Key | On Hold | On Tap | + +-----------------+-----------------+-----------------+ + | Tab | Super | Tab | + | Caps Lock | Ctrl | Esc | + | Space | Shift | Space | + | Left Ctrl | Ctrl | Caps Lock | + | Escape | Tab | Tab | + +-----------------+-----------------+-----------------+ + +Note: + By default, 'On Tap' will timeout at 500 miliseconds. In other words, + if you release a key after timeout, the key will not be generated. + You can increase it's value by setting the \$KEY_RELEASE_TIMEOUT environment + variable. This is useful in case you don't have a fast typing speed. + +If you want to change more keys or want a different configuration, you +can edit the remap_keys() function inside this script. + "; } + +while getopts 'rxtsih' o; do case "$o" in + x) action=x ;; + t) action=t ;; + s) action=s ;; + i) key_info >&2; exit ;; + h) help >&2; exit ;; + *) printf "remap: invalid argument -- '%s'\n" "$OPTARG" ;; +esac; done + +status_file="/tmp/.remap.lock" +keymap_file="/tmp/.xmodmap.defaults" +[ -f "$keymap_file" ] || xmodmap -pke > "$keymap_file" + +msg() { + [ "$VERBOSE_REMAP" != 1 ] && return + printf "remap: %s\n" "$@" + # notify-send "remap" "$*" +} + +remap_keys() { + msg "remapping keys..." + # Fast key repeats + xset r rate 300 50 + + # New key behaviour on Hold + # lines after ! are comments + xmodmap - <<-EOF + ! Hold Caps_Lock -> Control_R + remove lock = Caps_Lock + remove Control = Control_R + ! keysym Control_R = Caps_Lock + keysym Caps_Lock = Control_R + ! add lock = Caps_Lock + add Control = Control_R + keycode any = Caps_Lock + + ! Hold space -> Shift_R + remove shift = Shift_R + keycode 65 = Shift_R + add shift = Shift_R + keycode any = space + + ! Hold Tab -> Super_L + ! ! Escape -> Tab + remove mod4 = Super_L + keycode 23 = Super_L + keycode any = Tab ISO_Left_Tab Tab ISO_Left_Tab + ! keycode 133 = Tab ISO_Left_Tab Tab ISO_Left_Tab + add mod4 = Super_L + ! keycode 230 = Escape + ! keycode 9 = Tab ISO_Left_Tab Tab ISO_Left_Tab + EOF + + # New key behaviour on Tap + killall xcape 2>/dev/null + xcape -t "$timeout" -e "Super_L=Tab" + xcape -t "$timeout" -e "Control_R=Escape" + xcape -t "$timeout" -e "Shift_L=Caps_Lock" + xcape -t "$timeout" -e "Shift_R=space" + date > "$status_file" + xset led 3 + msg "keys remapped" +} + + +reset_keys() { + msg "resetting keys..." + xset r rate + killall xcape 2>/dev/null + setxkbmap -layout us + xmodmap "$keymap_file" + + [ -f "$status_file" ] && rm "$status_file" + xset -led 3 + msg "keys reset" +} + +toggle_remap() { + if [ -f "$status_file" ]; then + reset_keys + else + remap_keys + fi +} + +remap_status() { + if [ -f "$status_file" ]; then + printf "Keys are remapped since " + cat "$status_file" + else + echo "Keys are NOT remapped" + fi +} + +case "$action" in + s) remap_status ;; + x) reset_keys ;; + t) toggle_remap ;; + *) remap_keys ;; +esac diff --git a/.local/bin/desktop/remapd b/.local/bin/desktop/remapd new file mode 100755 index 0000000..851d7d2 --- /dev/null +++ b/.local/bin/desktop/remapd @@ -0,0 +1,6 @@ +#!/bin/sh + +while :; do + remap + grep -qP -m1 '[^un]bind.+\/[^:]+\(usb\)' <(udevadm monitor -u -t seat -s input -s usb) +done diff --git a/.local/bin/desktop/setdp b/.local/bin/desktop/setdp new file mode 100755 index 0000000..48c6a7a --- /dev/null +++ b/.local/bin/desktop/setdp @@ -0,0 +1,36 @@ +#!/bin/sh + +displays="$(xrandr | grep "^\S* connected" | cut -d\ -f1)" +display_count="$(echo "$displays" | wc -l)" + +[ "$display_count" -gt 2 ] && + { echo "Too many displays to configure" >&2; exit 1; } + +set -- + + +if [ "$display_count" = 2 ]; then + + for display in $displays; do + case "$display" in + eDP*) export PRIMARY="$display"; set -- "$@" --output "$display" --mode 1920x1080 --primary --pos 0x270 ;; + HDMI*) set -- "$@" --output "$display" --mode 1920x1080 --pos 1920x0 --scale "1.25x1.25" ;; + esac + done + +else + + for display in $displays; do + case "$display" in + eDP*) set -- "$@" --output "$display" --primary --mode 1920x1080 --scale "1.1x1.1" ;; + HDMI*) set -- "$@" --output "$display" --mode 1366x768 --scale "1.25x1.25" ;; + LVDS*) set -- "$@" --output "$display" --primary ;; + DP*) set -- "$@" --output "$display" --primary --scale "1.1x1.1" ;; + esac + done + +fi + + +eval "xrandr --auto $*" + diff --git a/.local/bin/desktop/show-i3-keybindings b/.local/bin/desktop/show-i3-keybindings new file mode 100755 index 0000000..45d0626 --- /dev/null +++ b/.local/bin/desktop/show-i3-keybindings @@ -0,0 +1,11 @@ +#!/bin/sh + +if [ -n "$TERM" ]; then + grep '^bindsym' ~/.config/i3/config | sort | + sed 's/^bindsym \(\S*\)\s\+\(.*\)$/\1|\2/; s/\$super+/  /; s/Shift+/וּ /; s/$alt+/Alt /; s/Ctrl+/Ctrl /' | + column --table --separator='|' | less -r +else + grep '^bindsym' ~/.config/i3/config | sort | + sed 's/^bindsym \(\S*\)\s\+\(.*\)$/\1|\2/; s/\$super+/  /; s/Shift+/Shift /; s/$alt+/Alt /; s/Ctrl+/Ctrl /' | + column --table --separator='|' | yad --text-info +fi diff --git a/.local/bin/desktop/toggle-xeyes b/.local/bin/desktop/toggle-xeyes new file mode 100755 index 0000000..af5c590 --- /dev/null +++ b/.local/bin/desktop/toggle-xeyes @@ -0,0 +1,7 @@ +#!/bin/sh + +if pidof -q xeyes; then + killall xeyes +else + setsid -f xeyes +fi diff --git a/.local/bin/desktop/torbrowser b/.local/bin/desktop/torbrowser new file mode 100755 index 0000000..27e365b --- /dev/null +++ b/.local/bin/desktop/torbrowser @@ -0,0 +1,30 @@ +#!/bin/sh + +help() { echo "torbrowser - open or search in tor browser +USAGE: torbrowser <open|search> [query]"; } + +cmd="$1" +case "$cmd" in + open) extra_cmds='' ;; + search) extra_cmds='press ctrl+k' ;; + *) help >&2; exit 1 ;; +esac + +query="$2" +window="Tor Browser" +windows=$(wmctrl -l) +if [ "${windows##*"$window"}" = "$windows" ]; then + # query="$(dmenu -p "search in tor browser")" || exit + torbrowser-launcher && sleep 3 +fi + +press() { + xdotool keyup ctrl shift alt super meta BackSpace Tab Escape Return + xdotool key "$1" +} + +wmctrl -a "$window" +press ctrl+t +$extra_cmds +xdotool type "$query" +press Return diff --git a/.local/bin/desktop/volctl b/.local/bin/desktop/volctl new file mode 100755 index 0000000..7d0edb9 --- /dev/null +++ b/.local/bin/desktop/volctl @@ -0,0 +1,50 @@ +#!/bin/sh + +help() { echo "volctl - change system volume +USAGE: volctl <toggle|up|down>"; } + +[ "$#" -lt 1 ] && help >&2 && exit 1 + +case "$1" in + toggle) wpctl set-mute @DEFAULT_SINK@ toggle ;; + up) wpctl set-volume @DEFAULT_SINK@ 5%+ ;; + down) wpctl set-volume @DEFAULT_SINK@ 5%- ;; + *) help >&2; exit 1 ;; +esac + +vol="$(wpctl get-volume @DEFAULT_SINK@ | tr -d .)" +vol="${vol#Volume: }" + +notify() { + if [ -n "$DISPLAY" ]; then + notify-send -t 3000 -r 93475 "$1" + else + printf 'volume : ' + wpctl get-volume @DEFAULT_SINK@ + fi +} + +if [ "$vol" != "${vol% \[MUTED\]}" ]; then + vol="${vol% \[MUTED\]}" + muted=1 +else + muted=0 +fi + +vol="$(printf '%.0f' "$vol")" + +msg="" +if [ "$vol" -gt "100" ]; then icon="📢"; msg=" Boosted" +elif [ "$vol" = "100" ]; then icon="🔊"; msg=" Maxed" +elif [ "$vol" -gt "70" ]; then icon="🔊" +elif [ "$vol" -gt "30" ]; then icon="🔉" +elif [ "$vol" -gt "0" ]; then icon="🔈" +else icon="🔇" +fi + +if [ "$muted" -eq 1 ]; then + notify "🔇 Volume Muted ($vol%)" +else + notify "$icon Volume$msg: $vol%" +fi + |