Add module which allows you to toggle modules on/off
This commit is contained in:
parent
fe1c9cf3f0
commit
0995683a26
|
@ -5,6 +5,8 @@
|
|||
module_config
|
||||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||
|
||||
[ -e "/tmp/module_bat_hidden" ] && exit
|
||||
|
||||
# clicking
|
||||
CLICK() {
|
||||
# values
|
||||
|
@ -18,18 +20,18 @@ CLICK() {
|
|||
|
||||
# enable icon spacing
|
||||
[ -n "$ICON" ] && ICONSPACING=" " # one character spacing
|
||||
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_BATTERY="${ICON}${ICONSPACING}$BATTERY_FULL"
|
||||
notify-send "$FULL_BATTERY"
|
||||
|
||||
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_BATTERY"
|
||||
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||
exit 1
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ command -v date > /dev/null || exit
|
|||
# load config
|
||||
module_config
|
||||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||
[ -e "/tmp/module_date_hidden" ] && exit
|
||||
|
||||
|
||||
# click
|
||||
|
@ -26,25 +27,25 @@ CLICK() {
|
|||
|
||||
[ -z "$TERMINAL" ] && TERMINAL=st
|
||||
[ -n "$ICON" ] && ICONSPACING=" " # one character spacing
|
||||
|
||||
|
||||
# check value of button
|
||||
case "$BUTTON" in
|
||||
"3") pgrep -x gsimplecal > /dev/null && pkill gsimplecal || gsimplecal ; return ;;
|
||||
esac
|
||||
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_DATE="$(printf "${ICON}${ICONSPACING}$DATE_DAY_W_LONG, $DATE_MONTH_W_LONG, $DATE_DAY $DATE_YEAR\nWeek: $DATE_WEEK\nDay of the week: $DATE_WEEKDAY")" && notify-send "$FULL_DATE"
|
||||
|
||||
|
||||
# some output
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_DATE"
|
||||
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
# dfmpeg module for status/stellar
|
||||
|
||||
command -v speedwm-dfmpeg > /dev/null || exit
|
||||
[ -e "/tmp/module_dfmpeg_hidden" ] && exit
|
||||
|
||||
# load config
|
||||
module_config
|
||||
|
@ -16,34 +17,34 @@ CLICK() {
|
|||
[ -e "/tmp/outputfilename" ] && DFMPEG_REC_PATH="$(cat /tmp/outputfilename)"
|
||||
[ -e "/tmp/speedwm-button" ] && BUTTON="$(cat /tmp/speedwm-button)"
|
||||
[ -z "$TERMINAL" ] && TERMINAL=st
|
||||
|
||||
|
||||
pgrep -x ffmpeg > /dev/null || return
|
||||
|
||||
|
||||
case "$BUTTON" in
|
||||
"3") speedwm-dfmpeg ; exit ;;
|
||||
"2") $DFMPEG_STOP_CMD ; exit ;;
|
||||
esac
|
||||
|
||||
|
||||
# check a few things
|
||||
[ -e "/tmp/isaudio" ] && DFMPEG_AUDIO="Recording audio" || DFMPEG_AUDIO="Not recording audio"
|
||||
[ -e "/tmp/isencoding" ] && DFMPEG_ENCODING="Encoding"
|
||||
[ -e "/tmp/encoding-codec" ] && DFMPEG_ENCODING="Encoding with $(cat /tmp/encoding-codec)"
|
||||
[ -n "$ICON" ] && ICONSPACING=" " # one character spacing
|
||||
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_RECSTATUS="$(printf "${ICON}${ICONSPACING}Recording video $DFMPEG_REC_PATH\n${DFMPEG_AUDIO}, ${DFMPEG_ENCODING}\nMiddle click to stop recording.")"
|
||||
notify-send "$FULL_RECSTATUS"
|
||||
|
||||
|
||||
# some output
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_RECSTATUS"
|
||||
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ module_config
|
|||
[ -z "$ICON" ] && ICON="$ITEM12_ICON"
|
||||
[ -z "$EMAIL_UNREADS" ] && EMAIL_UNREADS="$(find $ITEM12_EMAIL_DIR/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f >/tmp/module_email_data 2>/dev/null && wc -l </tmp/module_email_data || echo 0)"
|
||||
[ -d "$ITEM12_EMAIL_DIR" ] || exit
|
||||
[ -e "/tmp/module_email_hidden" ] && exit
|
||||
|
||||
# clicking
|
||||
CLICK() {
|
||||
|
@ -18,18 +19,18 @@ CLICK() {
|
|||
|
||||
# enable icon spacing
|
||||
[ -n "$ICON" ] && ICONSPACING=" " # one character spacing
|
||||
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_EMAIL="${ICON}${ICONSPACING}$EMAIL_UNREADS"
|
||||
notify-send "$FULL_EMAIL $ITEM12_UNREAD_TEXT"
|
||||
|
||||
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_EMAIL $ITEM12_UNREAD_TEXT"
|
||||
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||
exit 1
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
module_config
|
||||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||
[ "$ENABLE_ITEM9" = "true" ] || exit
|
||||
[ -e "/tmp/module_music_hidden" ] && exit
|
||||
|
||||
# get information, the following functions depend on this
|
||||
GETPROP() {
|
||||
|
@ -14,7 +15,7 @@ GETPROP() {
|
|||
[ "$ITEM9_BACKEND" = "mocp" ] && command -v mocp > /dev/null || ITEM9_BACKEND=cmus
|
||||
[ -z "$ITEM9_BACKEND" ] && exit
|
||||
pgrep -x "$ITEM9_BACKEND" > /dev/null || exit
|
||||
|
||||
|
||||
# for cmus
|
||||
CMUS() {
|
||||
MUSIC_FILENAME="$(basename "$(cmus-remote -C status | grep file)")"
|
||||
|
@ -28,11 +29,11 @@ GETPROP() {
|
|||
MUSIC_TIMETOTAL="$(cmus-remote -Q | grep duration | sed "s/duration //g" | awk '{printf "%02d:%02d:%02d",$0/3600,$0%3600/60,$0%60}' | sed "s/00://")"
|
||||
MUSIC_REPEAT="$(cmus-remote -C status | grep 'repeat ' | sed "s/true/Yes/; s/false/No/; s/set repeat //")"
|
||||
MUSIC_SHUFFLE="$(cmus-remote -C status | grep 'shuffle' | sed "s/on/Yes/; s/off/No/; s/set shuffle //")"
|
||||
|
||||
|
||||
# for notification
|
||||
FULL_MUSIC="$(printf "${ICON}${ICONSPACING}Artist: $MUSIC_ARTIST\nTitle: $MUSIC_TITLE\nAlbum: $MUSIC_ALBUM\nGenre: $MUSIC_GENRE\nTime elapsed: $MUSIC_TIMEELAPSED\nTotal time: $MUSIC_TIMETOTAL\nFile: $MUSIC_FILENAME\nDirectory: $MUSIC_FILEDIR\nPath: $MUSIC_FILEDIR/$MUSIC_FILENAME\nRepeat: $MUSIC_REPEAT\nShuffle: $MUSIC_SHUFFLE" | sed "s/stellar_amp/\&/g")"
|
||||
}
|
||||
|
||||
|
||||
# for mocp
|
||||
MOCP() {
|
||||
MUSIC_FILENAME="$(basename "$(mocp -Q %file)")"
|
||||
|
@ -44,11 +45,11 @@ GETPROP() {
|
|||
MUSIC_TIMEELAPSED="$(mocp -Q %ct)"
|
||||
MUSIC_TIMETOTAL="$(mocp -Q %tt)"
|
||||
# todo: genre
|
||||
|
||||
|
||||
# for notification
|
||||
FULL_MUSIC="$(printf "${ICON}${ICONSPACING}Artist: $MUSIC_ARTIST\nTitle: $MUSIC_TITLE\nAlbum: $MUSIC_ALBUM\nTime elapsed: $MUSIC_TIMEELAPSED\nTotal time: $MUSIC_TIMETOTAL\nFile: $MUSIC_FILENAME\nDirectory: $MUSIC_FILEDIR\nPath: $MUSIC_FILEDIR/$MUSIC_FILENAME" | sed "s/stellar_amp/\&/g")"
|
||||
}
|
||||
|
||||
|
||||
[ "$ITEM9_BACKEND" = "cmus" ] && CMUS || MOCP
|
||||
}
|
||||
|
||||
|
@ -58,26 +59,26 @@ CLICK() {
|
|||
# values
|
||||
ICON="$ITEM9_ICON"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
|
||||
|
||||
[ -z "$TERMINAL" ] && TERMINAL=st
|
||||
[ -n "$ICON" ] && ICONSPACING=" " # one character spacing
|
||||
|
||||
|
||||
# button
|
||||
case "$BUTTON" in
|
||||
"3") $TERMINAL -e $ITEM9_BACKEND ; exit ;;
|
||||
esac
|
||||
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
notify-send "$FULL_MUSIC"
|
||||
|
||||
|
||||
# some information
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_MUSIC"
|
||||
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||
return
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ module_config
|
|||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||
[ -z "$URL" ] && URL="1.1.1.1"
|
||||
[ "$ENABLE_ITEM6" = "true" ] || exit
|
||||
[ -e "/tmp/module_net_hidden" ] && exit
|
||||
|
||||
# get stats
|
||||
GETNSTAT() {
|
||||
|
|
|
@ -4,9 +4,10 @@
|
|||
# load config
|
||||
module_config
|
||||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||
[ -e "/tmp/module_news_hidden" ] && exit
|
||||
[ "$ENABLE_ITEM10" = "true" ] || exit
|
||||
command -v newsboat > /dev/null || exit
|
||||
|
||||
|
||||
NEWS_COUNT="$(newsboat -x print-unread | awk '{ print $1 }' || return)"
|
||||
|
||||
# clicking
|
||||
|
@ -23,20 +24,20 @@ CLICK() {
|
|||
case "$BUTTON" in
|
||||
"3") $TERMINAL newsboat ; return ;;
|
||||
esac
|
||||
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
notify-send "${ICON}${ICONSPACING}$NEWS_COUNT $ITEM10_TEXT"
|
||||
|
||||
|
||||
# some information
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: ${ICON}${ICONSPACING}$NEWS_COUNT $ITEM10_TEXT"
|
||||
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
module_config
|
||||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||
[ "$ENABLE_ITEM1" = "true" ] || exit
|
||||
[ -e "/tmp/module_ram_hidden" ] && exit
|
||||
command -v free > /dev/null || exit
|
||||
|
||||
# get status
|
||||
|
@ -22,27 +23,27 @@ CLICK() {
|
|||
[ -e "/tmp/speedwm-button" ] && BUTTON="$(cat /tmp/speedwm-button)"
|
||||
[ -z "$TERMINAL" ] && TERMINAL=st
|
||||
[ -n "$ICON" ] && ICONSPACING=" " # one character spacing
|
||||
|
||||
|
||||
# check value of button
|
||||
case "$BUTTON" in
|
||||
"2") command -v notify-send > /dev/null && notify-send "$(ps axch -o cmd:12,%mem --sort=%mem | tail -n 10)" ; exit ;;
|
||||
"3") $TERMINAL -e htop ; exit ;;
|
||||
esac
|
||||
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_RAM="$(printf "${ICON}${ICONSPACING}Used: $RAM_USED\nFree: $RAM_LEFT\nTotal: $RAM_TOTAL\n")"
|
||||
notify-send "$FULL_RAM"
|
||||
|
||||
|
||||
# some information
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_RAM"
|
||||
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
module_config
|
||||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||
[ "$ENABLE_ITEM8" != "true" ] && exit
|
||||
[ -e "/tmp/module_temp_hidden" ] && exit
|
||||
command -v sensors > /dev/null || exit
|
||||
|
||||
# click
|
||||
|
@ -12,25 +13,25 @@ CLICK() {
|
|||
# values
|
||||
ICON="$ITEM8_ICON"
|
||||
[ -e "/tmp/speedwm-button" ] && BUTTON="$(cat /tmp/speedwm-button)" || BUTTON="0"
|
||||
|
||||
|
||||
[ "$ITEM8_FORMAT_CELSIUS" = "true" ] || FARG="-F"
|
||||
[ -z "$TERMINAL" ] && TERMINAL=st
|
||||
[ -n "$ICON" ] && ICONSPACING=" " # one character spacing
|
||||
|
||||
TEMP_FULL="$(sensors $FARG)"
|
||||
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_TEMP="${ICON}${ICONSPACING}$TEMP_FULL"
|
||||
notify-send "$FULL_TEMP"
|
||||
|
||||
|
||||
# some information
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_TEMP"
|
||||
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
return
|
||||
|
|
|
@ -6,6 +6,7 @@ module_config
|
|||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||
[ "$ENABLE_ITEM2" = "true" ] || exit
|
||||
command -v date > /dev/null || exit
|
||||
[ -e "/tmp/module_time_hidden" ] && exit
|
||||
|
||||
# click
|
||||
CLICK() {
|
||||
|
@ -19,21 +20,21 @@ CLICK() {
|
|||
[ -e "/tmp/speedwm-button" ] && BUTTON="$(cat /tmp/speedwm-button)" || BUTTON="0"
|
||||
[ -z "$TERMINAL" ] && TERMINAL=st
|
||||
[ -n "$ICONSPACING" ] && ICONSPACING=" " # one character spacing
|
||||
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_TIME="${ICON}${ICONSPACING}The time is $TIME_FULL $TIME_ZONE."
|
||||
notify-send "$FULL_TIME"
|
||||
|
||||
|
||||
# some information
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_TIME"
|
||||
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
49
modules/module_toggle
Executable file
49
modules/module_toggle
Executable file
|
@ -0,0 +1,49 @@
|
|||
#!/bin/sh
|
||||
# module_toggle
|
||||
|
||||
orig=34
|
||||
|
||||
module_time=1
|
||||
module_date=2
|
||||
module_bat=3
|
||||
module_vol=4
|
||||
module_ram=5
|
||||
module_net=6
|
||||
module_temp=7
|
||||
module_weather=8
|
||||
module_music=9
|
||||
module_dfmpeg=10
|
||||
module_news=11
|
||||
module_email=12
|
||||
|
||||
module_bat_id="$(expr $orig + $module_bat)"
|
||||
module_date_id="$(expr $orig + $module_date)"
|
||||
module_time_id="$(expr $orig + $module_time)"
|
||||
module_vol_id="$(expr $orig + $module_vol)"
|
||||
module_ram_id="$(expr $orig + $module_ram)"
|
||||
module_net_id="$(expr $orig + $module_net)"
|
||||
module_temp_id="$(expr $orig + $module_temp)"
|
||||
module_weather_id="$(expr $orig + $module_weather)"
|
||||
module_music_id="$(expr $orig + $module_music)"
|
||||
module_dfmpeg_id="$(expr $orig + $module_dfmpeg)"
|
||||
module_news_id="$(expr $orig + $module_news)"
|
||||
module_email_id="$(expr $orig + $module_email)"
|
||||
|
||||
init() {
|
||||
case "${1}" in
|
||||
"module_bat") [ -e "/tmp/module_bat_hidden" ] && rm -f /tmp/module_bat_hidden || touch /tmp/module_bat_hidden; kill -$module_bat_id $(pidof status) ;;
|
||||
"module_date") [ -e "/tmp/module_date_hidden" ] && rm -f /tmp/module_date_hidden || touch /tmp/module_date_hidden; kill -$module_date_id $(pidof status) ;;
|
||||
"module_time") [ -e "/tmp/module_time_hidden" ] && rm -f /tmp/module_time_hidden || touch /tmp/module_time_hidden; kill -$module_time_id $(pidof status) ;;
|
||||
"module_vol") [ -e "/tmp/module_vol_hidden" ] && rm -f /tmp/module_vol_hidden || touch /tmp/module_vol_hidden; kill -$module_vol_id $(pidof status) ;;
|
||||
"module_ram") [ -e "/tmp/module_ram_hidden" ] && rm -f /tmp/module_ram_hidden || touch /tmp/module_ram_hidden; kill -$module_ram_id $(pidof status) ;;
|
||||
"module_net") [ -e "/tmp/module_net_hidden" ] && rm -f /tmp/module_net_hidden || touch /tmp/module_net_hidden; kill -$module_net_id $(pidof status) ;;
|
||||
"module_temp") [ -e "/tmp/module_temp_hidden" ] && rm -f /tmp/module_temp_hidden || touch /tmp/module_temp_hidden; kill -$module_temp_id $(pidof status) ;;
|
||||
"module_weather") [ -e "/tmp/module_weather_hidden" ] && rm -f /tmp/module_weather_hidden || touch /tmp/module_weather_hidden; kill -$module_weather_id $(pidof status) ;;
|
||||
"module_music") [ -e "/tmp/module_music_hidden" ] && rm -f /tmp/module_music_hidden || touch /tmp/module_music_hidden; kill -$module_music_id $(pidof status) ;;
|
||||
"module_dfmpeg") [ -e "/tmp/module_dfmpeg_hidden" ] && rm -f /tmp/module_dfmpeg_hidden || touch /tmp/module_dfmpeg_hidden; kill -$module_dfmpeg_id $(pidof status) ;;
|
||||
"module_news") [ -e "/tmp/module_news_hidden" ] && rm -f /tmp/module_news_hidden || touch /tmp/module_news_hidden; kill -$module_news_id $(pidof status) ;;
|
||||
"module_email") [ -e "/tmp/module_email_hidden" ] && rm -f /tmp/module_email_hidden || touch /tmp/module_email_hidden; kill -$module_email_id $(pidof status) ;;
|
||||
esac
|
||||
}
|
||||
|
||||
init "${@}"
|
|
@ -5,6 +5,7 @@
|
|||
module_config
|
||||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||
[ "$ENABLE_ITEM4" != "true" ] && exit
|
||||
[ -e "/tmp/module_vol_hidden" ] && exit
|
||||
|
||||
command -v pactl > /dev/null && BACKEND=pactl || BACKEND=amixer
|
||||
command -v awk > /dev/null || exit
|
||||
|
@ -22,26 +23,26 @@ CLICK() {
|
|||
[ -e "/tmp/speedwm-button" ] && BUTTON="$(cat /tmp/speedwm-button)" || BUTTON="0"
|
||||
[ -z "$TERMINAL" ] && TERMINAL=st
|
||||
[ -n "$ICON" ] && ICONSPACING=" " # one character spacing
|
||||
|
||||
|
||||
# check value of button
|
||||
case "$BUTTON" in
|
||||
"3") $TERMINAL speedwm-audioctrl -runmixer ; exit ;;
|
||||
esac
|
||||
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_VOL="${ICON}${ICONSPACING}$VOL_VOLUME"
|
||||
notify-send "$FULL_VOL"
|
||||
|
||||
|
||||
# some information
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_VOL"
|
||||
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -50,11 +51,11 @@ GETDATA() {
|
|||
[ "$BACKEND" = "pactl" ] && VOL="$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{ print $5; exit }' | sed "s/\%//g")" || VOL="$(amixer -c 0 get Master | tail -n1 | sed -r "s/.*\[(.*)%\].*/\1/")"
|
||||
|
||||
[ "$VOL" -gt "99" ] && ICON="$ITEM4_ICON_100 "
|
||||
[ "$VOL" -lt "100" ] && ICON="$ITEM4_ICON_75"
|
||||
[ "$VOL" -lt "51" ] && ICON="$ITEM4_ICON_50"
|
||||
[ "$VOL" -lt "26" ] && ICON="$ITEM4_ICON_25"
|
||||
[ "$VOL" -lt "100" ] && ICON="$ITEM4_ICON_75"
|
||||
[ "$VOL" -lt "51" ] && ICON="$ITEM4_ICON_50"
|
||||
[ "$VOL" -lt "26" ] && ICON="$ITEM4_ICON_25"
|
||||
[ "$VOL" -lt "1" ] && ICON="$ITEM4_ICON_0"
|
||||
|
||||
|
||||
# mute status
|
||||
[ "$BACKEND" = "pactl" ] && pactl get-sink-mute @DEFAULT_SINK@ | grep -q yes && ICON="$ITEM4_ICON_MUTED" && MUTEDATA=" $ITEM4_MUTE_TEXT" || MUTEDATA=""
|
||||
[ "$ITEM4_SHOW_MUTE" != "true" ] && MUTEDATA=""
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
module_config
|
||||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||
[ "$ENABLE_ITEM5" = "true" ] || exit
|
||||
[ -e "/tmp/module_weather_hidden" ] && exit
|
||||
command -v curl > /dev/null || exit
|
||||
|
||||
# weather data
|
||||
|
@ -56,29 +57,29 @@ CLICK() {
|
|||
WEATHER_TERM="speedwm-core -curl-weather"
|
||||
ICON="$ICON"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
|
||||
|
||||
[ -z "$TERMINAL" ] && TERMINAL=st
|
||||
[ -n "$ICON" ] && ICONSPACING=" " # one character spacing
|
||||
|
||||
|
||||
# check value of button
|
||||
case "$BUTTON" in
|
||||
"3") $TERMINAL "clear ; curl -s wttr.in | head -n 38 | tail -n 37 ; read a ; return " ;;
|
||||
esac
|
||||
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_WEATHER="${ICON}${ICONSPACING}$WEATHER_FULL"
|
||||
notify-send "$FULL_WEATHER"
|
||||
|
||||
|
||||
# some information
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_WEATHER"
|
||||
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue