diff --git a/module/common/tmux/tmux.conf b/module/common/tmux/tmux.conf index 1fa00ed..7c27b8c 100644 --- a/module/common/tmux/tmux.conf +++ b/module/common/tmux/tmux.conf @@ -71,7 +71,7 @@ set -g status-style "bg=#3c3836 fg=#a89984" set -g status-left "#[bold,bg=#a89984,fg=#282828] #H-#S #(count=$(tmux list-clients -t #S | wc -l); [ ${count} -gt 1 ] && echo (${count}) )#[bg=#3c3836,fg=#a89984]" set -g status-left-length 50 set -g status-right-length 50 -set -g status-right " #(tmux_script battery) %Y-%m-%d #[fg=#a89984]#[bold,bg=#a89984,fg=#282828] %H:%M " +set -g status-right " #(tmux_script volume) #(tmux_script battery)  %Y-%m-%d #[fg=#a89984]#[bold,bg=#a89984,fg=#282828] %H:%M " set-window-option -g window-status-separator "" diff --git a/module/common/tmux/tmux_script.sh b/module/common/tmux/tmux_script.sh index aee8d23..58bf502 100755 --- a/module/common/tmux/tmux_script.sh +++ b/module/common/tmux/tmux_script.sh @@ -15,7 +15,6 @@ function _tmux_battery() { [[ "${status}" = "Charging" ]] && is_charging=true local icon - if ((level>=60)) then icon="󱊣" @@ -29,15 +28,38 @@ function _tmux_battery() { icon="󰂎" fi - echo -n " ${level} ${icon}" + echo -n "${icon}" ${is_charging} && echo -n "󱐋" - echo -n " " + [[ "${level}" -lt 40 ]] && echo -n " ${level}" +} + +function _tmux_volume() { + local IFS=$'\n' + local level=$(wpctl get-volume @DEFAULT_SINK@ | cut -d\ -f2 | sed -e "s/^0//" -e "s/\.//") + [[ "${level}" = "00" ]] && level="0" + + local icon + if ((level>=80)) + then + icon="󰕾" + elif ((level>=40)) + then + icon="󰖀" + elif ((level>=10)) + then + icon="" + else + icon="󰝟" + fi + + wpctl get-volume @DEFAULT_SINK@ | grep '[MUTED]' && icon="󰸈" + + echo -n "${icon}" + [[ "${level}" -gt 100 ]] && echo -n " ${level}%" } case ${action} in - "battery") - _tmux_battery - ;; - "*") - ;; + "battery") _tmux_battery ;; + "volume") _tmux_volume ;; + "*") ;; esac