update
This commit is contained in:
parent
ad6face1c6
commit
deb1011b2a
0
lang/en/.config/tint2/scripts/volumettf → common/volumettf
Normal file → Executable file
0
lang/en/.config/tint2/scripts/volumettf → common/volumettf
Normal file → Executable file
@ -1,87 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
me="$(basename "$0")"
|
||||
maxlen="$2" # Longitud máxima de la cuerda antes de dividir en líneas
|
||||
lines="$1" # Es mejor si maxlen% lines es 0
|
||||
tmp_dir="/tmp"
|
||||
|
||||
function only_me_or_exit {
|
||||
# Asegúrese de que solo se esté ejecutando 1 instancia
|
||||
touch "$1"
|
||||
read lastPID < "$1" # Si lastPID no es nulo y existe un proceso con ese pid, salir [ ! -z "$lastPID" -a -d /proc/$lastPID ] && { echo "Ya se está ejecutando una instancia de $me con pid $lastPID." ; exit 1 ; } # else - Guardar pid en el archivo de bloqueo y continuar echo $$ > "$1"
|
||||
}
|
||||
|
||||
function exit_only_me {
|
||||
rm "$pidfile"
|
||||
exit
|
||||
}
|
||||
|
||||
function otherinfo_func {
|
||||
# Obtener el tiempo actual y total de la canción
|
||||
iCurrentTime="$(audtool --current-song-output-length)"
|
||||
iTotalTime="$(audtool --current-song-length)"
|
||||
echo "${iCurrentTime}/${iTotalTime}"
|
||||
}
|
||||
|
||||
function join_maxlen_func {
|
||||
# 2 strings - $1 y $2 - no pasar $maxlen de caracteres
|
||||
# pero la primera cuerda debe acortarse, no la 2da.
|
||||
dots=""
|
||||
[ ${#1} -gt $((maxlen - ${#2})) ] && dots="..."
|
||||
echo "${1:0:((maxlen - ${#dots} - ${#2}))}$dots $2"
|
||||
}
|
||||
|
||||
function lines_func {
|
||||
string="$1"
|
||||
for (( ; lines > 1 ; lines-- ))
|
||||
do
|
||||
length=${#string}
|
||||
for (( fwd=$((length/lines)) , bwd=$((length/lines)) ; bwd >= 0 ; fwd++ , bwd-- ))
|
||||
do
|
||||
if [[ "${string:$fwd:1}" = " " ]]
|
||||
then
|
||||
echo "${string:0:$fwd}"
|
||||
string="${string:$((fwd + 1))}"
|
||||
break
|
||||
fi
|
||||
if [[ "${string:$bwd:1}" = " " ]]
|
||||
then
|
||||
echo "${string:0:$bwd}"
|
||||
string="${string:$((bwd + 1))}"
|
||||
break
|
||||
fi
|
||||
#~ "${string:$bwd:1}"
|
||||
#~ wordlength
|
||||
done
|
||||
done
|
||||
echo "$string"
|
||||
}
|
||||
|
||||
# Solo se tiene que ejecutar 1 sola instancia
|
||||
pidfile="$tmp_dir/${me}_pid"
|
||||
only_me_or_exit "$pidfile"
|
||||
|
||||
if pidof audacious >/dev/null
|
||||
then
|
||||
|
||||
status="$(audtool --playback-status)"
|
||||
infostring="$(audtool --current-song)"
|
||||
|
||||
case "$status" in
|
||||
"playing")
|
||||
#echo ""
|
||||
lines_func " $(join_maxlen_func "$infostring" "$(otherinfo_func)")"
|
||||
exit_only_me
|
||||
;;
|
||||
"paused")
|
||||
#echo ""
|
||||
lines_func " $(join_maxlen_func "$infostring" "$(otherinfo_func)")"
|
||||
exit_only_me
|
||||
;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
echo # no icon for uptime?
|
||||
exit_only_me
|
@ -1,44 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
function get_current_desktop {
|
||||
DSK=($(wmctrl -d | grep \* | tr -s ' ' | cut -d' ' -f1,10))
|
||||
CUR_DSK=${DSK[0]}
|
||||
CUR_DSK_NAME=${DSK[1]}
|
||||
}
|
||||
|
||||
function get_desktop_count {
|
||||
MAX_DSK=$(wmctrl -d | wc -l)
|
||||
}
|
||||
|
||||
function switch_desktop {
|
||||
get_current_desktop
|
||||
get_desktop_count
|
||||
MAX_IDX=$((MAX_DSK-1))
|
||||
NEW_DSK=$((CUR_DSK+1))
|
||||
if [ "$NEW_DSK" -lt 0 ]; then
|
||||
NEW_DSK=${MAX_IDX}
|
||||
elif [ "$NEW_DSK" -gt "$MAX_IDX" ]; then
|
||||
NEW_DSK=0
|
||||
fi
|
||||
wmctrl -s $NEW_DSK
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
info)
|
||||
get_current_desktop
|
||||
echo "<small>$CUR_DSK_NAME</small>"
|
||||
;;
|
||||
number)
|
||||
get_current_desktop
|
||||
echo $CUR_DSK
|
||||
;;
|
||||
next)
|
||||
switch_desktop 1
|
||||
;;
|
||||
prev)
|
||||
switch_desktop -1
|
||||
;;
|
||||
*)
|
||||
echo "WRONG INPUT"
|
||||
;;
|
||||
esac
|
@ -1,33 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Tint2 volume executor with icond from volumeicon
|
||||
|
||||
muted=$(pacmd list-sinks | awk '/muted/ { print $2 }')
|
||||
vol=$(LANG=C pactl list sinks | awk '/Volume:/ {printf "%s ",$5}' | cut -f1 -d ' ' | cut -f1 -d '%')
|
||||
|
||||
if [[ $muted = "no" ]]; then
|
||||
if [[ $vol -ge 80 ]]; then
|
||||
echo /usr/share/volumeicon/icons/Blue Bar/8.png
|
||||
echo "$vol%"
|
||||
elif [[ $vol -ge 70 ]]; then
|
||||
echo /usr/share/volumeicon/icons/Blue Bar/7.png
|
||||
echo "$vol%"
|
||||
elif [[ $vol -ge 60 ]]; then
|
||||
echo /usr/share/volumeicon/icons/Blue Bar/6.png
|
||||
echo "$vol%"
|
||||
elif [[ $vol -ge 50 ]]; then
|
||||
echo /usr/share/volumeicon/icons/Blue Bar/5.png
|
||||
echo "$vol%"
|
||||
elif [[ $vol -ge 30 ]]; then
|
||||
echo /usr/share/volumeicon/icons/Blue Bar/4.png
|
||||
echo "$vol%"
|
||||
elif [[ $vol -ge 10 ]]; then
|
||||
echo /usr/share/volumeicon/icons/Blue Bar/3.png
|
||||
echo "$vol%"
|
||||
elif [[ $vol -ge 0 ]]; then
|
||||
echo /usr/share/volumeicon/icons/Blue Bar/2.png
|
||||
echo "$vol%"
|
||||
fi
|
||||
else
|
||||
echo /usr/share/volumeicon/icons/Blue Bar/1.png
|
||||
echo ""
|
||||
fi
|
Loading…
Reference in New Issue
Block a user