Update blocks
This commit is contained in:
parent
6bc1f9b506
commit
bf57ecdd6b
10
GNUmakefile
10
GNUmakefile
|
@ -6,9 +6,15 @@ CFLAGS = -O3 -Wall -Wextra
|
|||
X11CFLAGS = $(shell pkg-config --cflags x11)
|
||||
X11LIBS = $(shell pkg-config --libs x11)
|
||||
|
||||
ifdef LAPTOP
|
||||
CFLAGS += -DLAPTOP
|
||||
endif
|
||||
|
||||
ifdef THINKPAD
|
||||
CFLAGS += -DTHINKPAD
|
||||
endif
|
||||
|
||||
all: dwmblocks sigdwmblocks/sigdwmblocks xgetrootname/xgetrootname
|
||||
laptop: LFLAG = -DLAPTOP
|
||||
laptop: install
|
||||
|
||||
dwmblocks: dwmblocks.c config.h block.h
|
||||
${CC} -o $@ -Wno-missing-field-initializers -Wno-unused-parameter ${LFLAG} ${CFLAGS} ${X11CFLAGS} $< ${X11LIBS}
|
||||
|
|
|
@ -18,8 +18,13 @@ if [ "$status" = "Full" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
if [[ -n "${THINKPAD}" ]]; then
|
||||
chargeNow=$(cat "$battery/energy_now" 2>&1)
|
||||
chargeFull=$(cat "$battery/energy_full" 2>&1)
|
||||
else
|
||||
chargeNow=$(cat "$battery/charge_now" 2>&1)
|
||||
chargeFull=$(cat "$battery/charge_full" 2>&1)
|
||||
fi
|
||||
capacity=$(echo "$chargeNow/$chargeFull*100" | bc -l)
|
||||
|
||||
printf "%s %.0f%%" "$statusIcon" "$capacity"
|
||||
|
|
|
@ -3,5 +3,5 @@
|
|||
case "$1" in
|
||||
1) "$TERMINAL" -e "htop" ;;
|
||||
2) "$TERMINAL" -e "bashmount" ;;
|
||||
3) psensor ;;
|
||||
3) ! [ -v THINKPAD ] && psensor ;;
|
||||
esac
|
||||
|
|
|
@ -2,15 +2,6 @@
|
|||
|
||||
ICON="📧"
|
||||
|
||||
getMails() {
|
||||
#mw -Y > /dev/null &
|
||||
#setsid -f mw -Y > /dev/null
|
||||
#setsid -f $TERMINAL -e "mw" "-Y"
|
||||
#mailsync > /dev/null
|
||||
/.$HOME/mailCheck > /dev/null
|
||||
}
|
||||
|
||||
#getMails
|
||||
unreadMails="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f 2>/dev/null | wc -l 2>/dev/null)"
|
||||
|
||||
printf "$ICON %s" "$unreadMails"
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ -v THINKPAD ]; then
|
||||
thunderbird
|
||||
return
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
#1) "$TERMINAL" -e "neomutt" ;;
|
||||
1) "$TERMINAL" -e "neomutt" > ~/.cache/neomutt.log 2>&1
|
||||
#3) mw -Y ;;
|
||||
# 3) "$TERMINAL" -e "neomutt" ;;
|
||||
esac
|
||||
|
||||
sigdwmblocks 3
|
||||
|
|
|
@ -9,14 +9,10 @@ manageCalcurse() {
|
|||
}
|
||||
|
||||
manageNotifications() {
|
||||
#"$TERMINAL" -e "dunstctl" "history-pop"
|
||||
dunstctl history-pop
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
1) manageCalcurse ;;
|
||||
3) manageNotifications ;;
|
||||
|
||||
# Agregar appointments o algo de ese estilo
|
||||
# Time tracker tmb puede ser
|
||||
esac
|
||||
|
|
|
@ -7,6 +7,9 @@ ICONmute="🔇"
|
|||
ICONspeakermute="🔕"
|
||||
ICONspeaker="🔔"
|
||||
ICONheadphone="🎧"
|
||||
ICONmicrophone="🎤"
|
||||
ICONmicrophonemute="😶"
|
||||
ICONmicrophonemute="🤫"
|
||||
|
||||
#SINKHDMI=alsa_output.pci-0000_01_00.1.hdmi-stereo-extra1
|
||||
SINKHDMI=alsa_output.pci-0000_01_00.1.hdmi-stereo
|
||||
|
@ -29,8 +32,14 @@ checkDefaultSink() {
|
|||
fi
|
||||
}
|
||||
|
||||
if [ -v THINKPAD ]; then
|
||||
VOLUME=$(wpctl get-volume @DEFAULT_SINK@ | awk '{printf "%d", $2 * 100}')
|
||||
MUTE=$(wpctl get-volume @DEFAULT_SINK@ | grep -q "MUTED" && echo "yes")
|
||||
MUTE_SOURCE=$(wpctl get-volume @DEFAULT_SOURCE@ | grep -q "MUTED" && echo "yes")
|
||||
else
|
||||
VOLUME=$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{printf $5}' | sed s/%//)
|
||||
MUTE=$(pactl get-sink-mute @DEFAULT_SINK@ | awk '{printf $2}')
|
||||
fi
|
||||
|
||||
checkDefaultSink
|
||||
|
||||
|
@ -47,6 +56,17 @@ getIcon() {
|
|||
fi
|
||||
fi
|
||||
|
||||
if [ -v THINKPAD ]; then
|
||||
MIC_ICON=$ICONmicrophone
|
||||
if [ "$MUTE_SOURCE" = "yes" ]; then
|
||||
MIC_ICON=$ICONmicrophonemute
|
||||
fi
|
||||
printf "$ICON %s $MIC_ICON" "$VOLUME%"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "?"
|
||||
|
||||
if [ -v LAPTOP ]; then
|
||||
printf "$ICON %s" "$VOLUME%"
|
||||
return
|
||||
|
|
|
@ -5,6 +5,8 @@ SINKHDMI=alsa_output.pci-0000_01_00.1.hdmi-stereo
|
|||
SINKANALOG=alsa_output.pci-0000_00_1b.0.analog-stereo
|
||||
|
||||
checkDefaultSink() {
|
||||
[ -v LAPTOP ] && return
|
||||
|
||||
PACTLOUTPUT="$(pactl get-default-sink)"
|
||||
|
||||
if echo $PACTLOUTPUT | grep -q "$SINKANALOG"; then
|
||||
|
@ -56,10 +58,18 @@ refreshVolumeBlock() {
|
|||
|
||||
checkDefaultSink
|
||||
|
||||
if [ -v THINKPAD ]; then
|
||||
case "$1" in
|
||||
1) manageAlsamixer ;;
|
||||
2) ;; #changeDefaultSink ;;
|
||||
3) wpctl set-mute @DEFAULT_SINK@ toggle ;;
|
||||
esac
|
||||
else
|
||||
case "$1" in
|
||||
1) manageAlsamixer ;;
|
||||
2) changeDefaultSink ;;
|
||||
3) pactl set-sink-mute @DEFAULT_SINK@ toggle ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
refreshVolumeBlock
|
||||
|
|
|
@ -1,14 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
#TEMP=$(curl -s "wttr.in/Argentina?format=%c%t\n" | sed 's/+//')
|
||||
#TEMP=$(curl -s "wttr.in/Argentina?format=%c%t\n")
|
||||
TEMP=$(curl -s "wttr.in/BuenosAires?format=%c+%t\n")
|
||||
# Corto algunos caracteres pues se imprime un caracter inválido entre medio.
|
||||
# Es algún tema de los unicode. En terminal se imprime bien...
|
||||
#TEMP_ICON=$(echo -n $TEMP | cut -b 1-3)
|
||||
#TEMP_ICON=$(echo -n $TEMP | cut -b 1-4)
|
||||
TEMP=$(curl -s "wttr.in/Vienna?format=%c+%t\n")
|
||||
TEMP_ICON=$(echo -n $TEMP | cut -d+ -f1)
|
||||
#TEMP=$(echo -n $TEMP | cut -b 8-)
|
||||
TEMP_TEMP=$(echo -n $TEMP | cut -d+ -f2)
|
||||
|
||||
ICON_LEN=$(printf $TEMP_ICON | wc -c)
|
||||
|
@ -16,12 +9,7 @@ ICON_VAR=$(($ICON_LEN-3))
|
|||
if [ $ICON_LEN -gt 4 ]; then
|
||||
TEMP_ICON=$(echo -n $TEMP | cut -b 1-$ICON_VAR)
|
||||
printf "%s %s" "$TEMP_ICON" "$TEMP_TEMP"
|
||||
#printf "%s %s •" "$TEMP_ICON" "$TEMP_TEMP"
|
||||
else
|
||||
printf "%s%s" "$TEMP_ICON" "$TEMP_TEMP"
|
||||
fi
|
||||
|
||||
#perl -CO -E "say "\N{$TEMP_ICON}""
|
||||
|
||||
# Otra forma de bypassear el feof y que se imprima bien es haciendo un grep:
|
||||
#printf $TEMP_ICON | grep -P "[\x{fe0f}]"
|
||||
|
|
Loading…
Reference in New Issue