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)
|
X11CFLAGS = $(shell pkg-config --cflags x11)
|
||||||
X11LIBS = $(shell pkg-config --libs x11)
|
X11LIBS = $(shell pkg-config --libs x11)
|
||||||
|
|
||||||
|
ifdef LAPTOP
|
||||||
|
CFLAGS += -DLAPTOP
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef THINKPAD
|
||||||
|
CFLAGS += -DTHINKPAD
|
||||||
|
endif
|
||||||
|
|
||||||
all: dwmblocks sigdwmblocks/sigdwmblocks xgetrootname/xgetrootname
|
all: dwmblocks sigdwmblocks/sigdwmblocks xgetrootname/xgetrootname
|
||||||
laptop: LFLAG = -DLAPTOP
|
|
||||||
laptop: install
|
|
||||||
|
|
||||||
dwmblocks: dwmblocks.c config.h block.h
|
dwmblocks: dwmblocks.c config.h block.h
|
||||||
${CC} -o $@ -Wno-missing-field-initializers -Wno-unused-parameter ${LFLAG} ${CFLAGS} ${X11CFLAGS} $< ${X11LIBS}
|
${CC} -o $@ -Wno-missing-field-initializers -Wno-unused-parameter ${LFLAG} ${CFLAGS} ${X11CFLAGS} $< ${X11LIBS}
|
||||||
|
|
|
@ -18,8 +18,13 @@ if [ "$status" = "Full" ]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chargeNow=$(cat "$battery/charge_now" 2>&1)
|
if [[ -n "${THINKPAD}" ]]; then
|
||||||
chargeFull=$(cat "$battery/charge_full" 2>&1)
|
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)
|
capacity=$(echo "$chargeNow/$chargeFull*100" | bc -l)
|
||||||
|
|
||||||
printf "%s %.0f%%" "$statusIcon" "$capacity"
|
printf "%s %.0f%%" "$statusIcon" "$capacity"
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
case "$1" in
|
case "$1" in
|
||||||
1) "$TERMINAL" -e "htop" ;;
|
1) "$TERMINAL" -e "htop" ;;
|
||||||
2) "$TERMINAL" -e "bashmount" ;;
|
2) "$TERMINAL" -e "bashmount" ;;
|
||||||
3) psensor ;;
|
3) ! [ -v THINKPAD ] && psensor ;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -2,15 +2,6 @@
|
||||||
|
|
||||||
ICON="📧"
|
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)"
|
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"
|
printf "$ICON %s" "$unreadMails"
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ -v THINKPAD ]; then
|
||||||
|
thunderbird
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
#1) "$TERMINAL" -e "neomutt" ;;
|
|
||||||
1) "$TERMINAL" -e "neomutt" > ~/.cache/neomutt.log 2>&1
|
1) "$TERMINAL" -e "neomutt" > ~/.cache/neomutt.log 2>&1
|
||||||
#3) mw -Y ;;
|
|
||||||
# 3) "$TERMINAL" -e "neomutt" ;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
sigdwmblocks 3
|
sigdwmblocks 3
|
||||||
|
|
|
@ -9,14 +9,10 @@ manageCalcurse() {
|
||||||
}
|
}
|
||||||
|
|
||||||
manageNotifications() {
|
manageNotifications() {
|
||||||
#"$TERMINAL" -e "dunstctl" "history-pop"
|
|
||||||
dunstctl history-pop
|
dunstctl history-pop
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
1) manageCalcurse ;;
|
1) manageCalcurse ;;
|
||||||
3) manageNotifications ;;
|
3) manageNotifications ;;
|
||||||
|
|
||||||
# Agregar appointments o algo de ese estilo
|
|
||||||
# Time tracker tmb puede ser
|
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -7,6 +7,9 @@ ICONmute="🔇"
|
||||||
ICONspeakermute="🔕"
|
ICONspeakermute="🔕"
|
||||||
ICONspeaker="🔔"
|
ICONspeaker="🔔"
|
||||||
ICONheadphone="🎧"
|
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-extra1
|
||||||
SINKHDMI=alsa_output.pci-0000_01_00.1.hdmi-stereo
|
SINKHDMI=alsa_output.pci-0000_01_00.1.hdmi-stereo
|
||||||
|
@ -29,8 +32,14 @@ checkDefaultSink() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
VOLUME=$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{printf $5}' | sed s/%//)
|
if [ -v THINKPAD ]; then
|
||||||
MUTE=$(pactl get-sink-mute @DEFAULT_SINK@ | awk '{printf $2}')
|
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
|
checkDefaultSink
|
||||||
|
|
||||||
|
@ -47,6 +56,17 @@ getIcon() {
|
||||||
fi
|
fi
|
||||||
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
|
if [ -v LAPTOP ]; then
|
||||||
printf "$ICON %s" "$VOLUME%"
|
printf "$ICON %s" "$VOLUME%"
|
||||||
return
|
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
|
SINKANALOG=alsa_output.pci-0000_00_1b.0.analog-stereo
|
||||||
|
|
||||||
checkDefaultSink() {
|
checkDefaultSink() {
|
||||||
|
[ -v LAPTOP ] && return
|
||||||
|
|
||||||
PACTLOUTPUT="$(pactl get-default-sink)"
|
PACTLOUTPUT="$(pactl get-default-sink)"
|
||||||
|
|
||||||
if echo $PACTLOUTPUT | grep -q "$SINKANALOG"; then
|
if echo $PACTLOUTPUT | grep -q "$SINKANALOG"; then
|
||||||
|
@ -56,10 +58,18 @@ refreshVolumeBlock() {
|
||||||
|
|
||||||
checkDefaultSink
|
checkDefaultSink
|
||||||
|
|
||||||
case "$1" in
|
if [ -v THINKPAD ]; then
|
||||||
1) manageAlsamixer ;;
|
case "$1" in
|
||||||
2) changeDefaultSink;;
|
1) manageAlsamixer ;;
|
||||||
3) pactl set-sink-mute @DEFAULT_SINK@ toggle;;
|
2) ;; #changeDefaultSink ;;
|
||||||
esac
|
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
|
refreshVolumeBlock
|
||||||
|
|
|
@ -1,14 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
#TEMP=$(curl -s "wttr.in/Argentina?format=%c%t\n" | sed 's/+//')
|
TEMP=$(curl -s "wttr.in/Vienna?format=%c+%t\n")
|
||||||
#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_ICON=$(echo -n $TEMP | cut -d+ -f1)
|
TEMP_ICON=$(echo -n $TEMP | cut -d+ -f1)
|
||||||
#TEMP=$(echo -n $TEMP | cut -b 8-)
|
|
||||||
TEMP_TEMP=$(echo -n $TEMP | cut -d+ -f2)
|
TEMP_TEMP=$(echo -n $TEMP | cut -d+ -f2)
|
||||||
|
|
||||||
ICON_LEN=$(printf $TEMP_ICON | wc -c)
|
ICON_LEN=$(printf $TEMP_ICON | wc -c)
|
||||||
|
@ -16,12 +9,7 @@ ICON_VAR=$(($ICON_LEN-3))
|
||||||
if [ $ICON_LEN -gt 4 ]; then
|
if [ $ICON_LEN -gt 4 ]; then
|
||||||
TEMP_ICON=$(echo -n $TEMP | cut -b 1-$ICON_VAR)
|
TEMP_ICON=$(echo -n $TEMP | cut -b 1-$ICON_VAR)
|
||||||
printf "%s %s" "$TEMP_ICON" "$TEMP_TEMP"
|
printf "%s %s" "$TEMP_ICON" "$TEMP_TEMP"
|
||||||
#printf "%s %s •" "$TEMP_ICON" "$TEMP_TEMP"
|
|
||||||
else
|
else
|
||||||
printf "%s%s" "$TEMP_ICON" "$TEMP_TEMP"
|
printf "%s%s" "$TEMP_ICON" "$TEMP_TEMP"
|
||||||
fi
|
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