Tmux : Add volume to status-bar.
This commit is contained in:
parent
9fb105f50d
commit
f4494a11f4
|
@ -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 ""
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue