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
|
module_config
|
||||||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||||
|
|
||||||
|
[ -e "/tmp/module_bat_hidden" ] && exit
|
||||||
|
|
||||||
# clicking
|
# clicking
|
||||||
CLICK() {
|
CLICK() {
|
||||||
# values
|
# values
|
||||||
|
@ -18,18 +20,18 @@ CLICK() {
|
||||||
|
|
||||||
# enable icon spacing
|
# enable icon spacing
|
||||||
[ -n "$ICON" ] && ICONSPACING=" " # one character spacing
|
[ -n "$ICON" ] && ICONSPACING=" " # one character spacing
|
||||||
|
|
||||||
# send the notification
|
# send the notification
|
||||||
SEND_NOTIF() {
|
SEND_NOTIF() {
|
||||||
FULL_BATTERY="${ICON}${ICONSPACING}$BATTERY_FULL"
|
FULL_BATTERY="${ICON}${ICONSPACING}$BATTERY_FULL"
|
||||||
notify-send "$FULL_BATTERY"
|
notify-send "$FULL_BATTERY"
|
||||||
|
|
||||||
echo "Notification sent successfully!"
|
echo "Notification sent successfully!"
|
||||||
echo "INFO: $FULL_BATTERY"
|
echo "INFO: $FULL_BATTERY"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ command -v date > /dev/null || exit
|
||||||
# load config
|
# load config
|
||||||
module_config
|
module_config
|
||||||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||||
|
[ -e "/tmp/module_date_hidden" ] && exit
|
||||||
|
|
||||||
|
|
||||||
# click
|
# click
|
||||||
|
@ -26,25 +27,25 @@ CLICK() {
|
||||||
|
|
||||||
[ -z "$TERMINAL" ] && TERMINAL=st
|
[ -z "$TERMINAL" ] && TERMINAL=st
|
||||||
[ -n "$ICON" ] && ICONSPACING=" " # one character spacing
|
[ -n "$ICON" ] && ICONSPACING=" " # one character spacing
|
||||||
|
|
||||||
# check value of button
|
# check value of button
|
||||||
case "$BUTTON" in
|
case "$BUTTON" in
|
||||||
"3") pgrep -x gsimplecal > /dev/null && pkill gsimplecal || gsimplecal ; return ;;
|
"3") pgrep -x gsimplecal > /dev/null && pkill gsimplecal || gsimplecal ; return ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# send the notification
|
# send the notification
|
||||||
SEND_NOTIF() {
|
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"
|
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
|
# some output
|
||||||
echo "Notification sent successfully!"
|
echo "Notification sent successfully!"
|
||||||
echo "INFO: $FULL_DATE"
|
echo "INFO: $FULL_DATE"
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
# dfmpeg module for status/stellar
|
# dfmpeg module for status/stellar
|
||||||
|
|
||||||
command -v speedwm-dfmpeg > /dev/null || exit
|
command -v speedwm-dfmpeg > /dev/null || exit
|
||||||
|
[ -e "/tmp/module_dfmpeg_hidden" ] && exit
|
||||||
|
|
||||||
# load config
|
# load config
|
||||||
module_config
|
module_config
|
||||||
|
@ -16,34 +17,34 @@ CLICK() {
|
||||||
[ -e "/tmp/outputfilename" ] && DFMPEG_REC_PATH="$(cat /tmp/outputfilename)"
|
[ -e "/tmp/outputfilename" ] && DFMPEG_REC_PATH="$(cat /tmp/outputfilename)"
|
||||||
[ -e "/tmp/speedwm-button" ] && BUTTON="$(cat /tmp/speedwm-button)"
|
[ -e "/tmp/speedwm-button" ] && BUTTON="$(cat /tmp/speedwm-button)"
|
||||||
[ -z "$TERMINAL" ] && TERMINAL=st
|
[ -z "$TERMINAL" ] && TERMINAL=st
|
||||||
|
|
||||||
pgrep -x ffmpeg > /dev/null || return
|
pgrep -x ffmpeg > /dev/null || return
|
||||||
|
|
||||||
case "$BUTTON" in
|
case "$BUTTON" in
|
||||||
"3") speedwm-dfmpeg ; exit ;;
|
"3") speedwm-dfmpeg ; exit ;;
|
||||||
"2") $DFMPEG_STOP_CMD ; exit ;;
|
"2") $DFMPEG_STOP_CMD ; exit ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# check a few things
|
# check a few things
|
||||||
[ -e "/tmp/isaudio" ] && DFMPEG_AUDIO="Recording audio" || DFMPEG_AUDIO="Not recording audio"
|
[ -e "/tmp/isaudio" ] && DFMPEG_AUDIO="Recording audio" || DFMPEG_AUDIO="Not recording audio"
|
||||||
[ -e "/tmp/isencoding" ] && DFMPEG_ENCODING="Encoding"
|
[ -e "/tmp/isencoding" ] && DFMPEG_ENCODING="Encoding"
|
||||||
[ -e "/tmp/encoding-codec" ] && DFMPEG_ENCODING="Encoding with $(cat /tmp/encoding-codec)"
|
[ -e "/tmp/encoding-codec" ] && DFMPEG_ENCODING="Encoding with $(cat /tmp/encoding-codec)"
|
||||||
[ -n "$ICON" ] && ICONSPACING=" " # one character spacing
|
[ -n "$ICON" ] && ICONSPACING=" " # one character spacing
|
||||||
|
|
||||||
# send the notification
|
# send the notification
|
||||||
SEND_NOTIF() {
|
SEND_NOTIF() {
|
||||||
FULL_RECSTATUS="$(printf "${ICON}${ICONSPACING}Recording video $DFMPEG_REC_PATH\n${DFMPEG_AUDIO}, ${DFMPEG_ENCODING}\nMiddle click to stop recording.")"
|
FULL_RECSTATUS="$(printf "${ICON}${ICONSPACING}Recording video $DFMPEG_REC_PATH\n${DFMPEG_AUDIO}, ${DFMPEG_ENCODING}\nMiddle click to stop recording.")"
|
||||||
notify-send "$FULL_RECSTATUS"
|
notify-send "$FULL_RECSTATUS"
|
||||||
|
|
||||||
# some output
|
# some output
|
||||||
echo "Notification sent successfully!"
|
echo "Notification sent successfully!"
|
||||||
echo "INFO: $FULL_RECSTATUS"
|
echo "INFO: $FULL_RECSTATUS"
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ module_config
|
||||||
[ -z "$ICON" ] && ICON="$ITEM12_ICON"
|
[ -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)"
|
[ -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
|
[ -d "$ITEM12_EMAIL_DIR" ] || exit
|
||||||
|
[ -e "/tmp/module_email_hidden" ] && exit
|
||||||
|
|
||||||
# clicking
|
# clicking
|
||||||
CLICK() {
|
CLICK() {
|
||||||
|
@ -18,18 +19,18 @@ CLICK() {
|
||||||
|
|
||||||
# enable icon spacing
|
# enable icon spacing
|
||||||
[ -n "$ICON" ] && ICONSPACING=" " # one character spacing
|
[ -n "$ICON" ] && ICONSPACING=" " # one character spacing
|
||||||
|
|
||||||
# send the notification
|
# send the notification
|
||||||
SEND_NOTIF() {
|
SEND_NOTIF() {
|
||||||
FULL_EMAIL="${ICON}${ICONSPACING}$EMAIL_UNREADS"
|
FULL_EMAIL="${ICON}${ICONSPACING}$EMAIL_UNREADS"
|
||||||
notify-send "$FULL_EMAIL $ITEM12_UNREAD_TEXT"
|
notify-send "$FULL_EMAIL $ITEM12_UNREAD_TEXT"
|
||||||
|
|
||||||
echo "Notification sent successfully!"
|
echo "Notification sent successfully!"
|
||||||
echo "INFO: $FULL_EMAIL $ITEM12_UNREAD_TEXT"
|
echo "INFO: $FULL_EMAIL $ITEM12_UNREAD_TEXT"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
module_config
|
module_config
|
||||||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||||
[ "$ENABLE_ITEM9" = "true" ] || exit
|
[ "$ENABLE_ITEM9" = "true" ] || exit
|
||||||
|
[ -e "/tmp/module_music_hidden" ] && exit
|
||||||
|
|
||||||
# get information, the following functions depend on this
|
# get information, the following functions depend on this
|
||||||
GETPROP() {
|
GETPROP() {
|
||||||
|
@ -14,7 +15,7 @@ GETPROP() {
|
||||||
[ "$ITEM9_BACKEND" = "mocp" ] && command -v mocp > /dev/null || ITEM9_BACKEND=cmus
|
[ "$ITEM9_BACKEND" = "mocp" ] && command -v mocp > /dev/null || ITEM9_BACKEND=cmus
|
||||||
[ -z "$ITEM9_BACKEND" ] && exit
|
[ -z "$ITEM9_BACKEND" ] && exit
|
||||||
pgrep -x "$ITEM9_BACKEND" > /dev/null || exit
|
pgrep -x "$ITEM9_BACKEND" > /dev/null || exit
|
||||||
|
|
||||||
# for cmus
|
# for cmus
|
||||||
CMUS() {
|
CMUS() {
|
||||||
MUSIC_FILENAME="$(basename "$(cmus-remote -C status | grep file)")"
|
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_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_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 //")"
|
MUSIC_SHUFFLE="$(cmus-remote -C status | grep 'shuffle' | sed "s/on/Yes/; s/off/No/; s/set shuffle //")"
|
||||||
|
|
||||||
# for notification
|
# 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")"
|
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
|
# for mocp
|
||||||
MOCP() {
|
MOCP() {
|
||||||
MUSIC_FILENAME="$(basename "$(mocp -Q %file)")"
|
MUSIC_FILENAME="$(basename "$(mocp -Q %file)")"
|
||||||
|
@ -44,11 +45,11 @@ GETPROP() {
|
||||||
MUSIC_TIMEELAPSED="$(mocp -Q %ct)"
|
MUSIC_TIMEELAPSED="$(mocp -Q %ct)"
|
||||||
MUSIC_TIMETOTAL="$(mocp -Q %tt)"
|
MUSIC_TIMETOTAL="$(mocp -Q %tt)"
|
||||||
# todo: genre
|
# todo: genre
|
||||||
|
|
||||||
# for notification
|
# 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")"
|
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
|
[ "$ITEM9_BACKEND" = "cmus" ] && CMUS || MOCP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,26 +59,26 @@ CLICK() {
|
||||||
# values
|
# values
|
||||||
ICON="$ITEM9_ICON"
|
ICON="$ITEM9_ICON"
|
||||||
BUTTON="$(cat /tmp/speedwm-button)"
|
BUTTON="$(cat /tmp/speedwm-button)"
|
||||||
|
|
||||||
[ -z "$TERMINAL" ] && TERMINAL=st
|
[ -z "$TERMINAL" ] && TERMINAL=st
|
||||||
[ -n "$ICON" ] && ICONSPACING=" " # one character spacing
|
[ -n "$ICON" ] && ICONSPACING=" " # one character spacing
|
||||||
|
|
||||||
# button
|
# button
|
||||||
case "$BUTTON" in
|
case "$BUTTON" in
|
||||||
"3") $TERMINAL -e $ITEM9_BACKEND ; exit ;;
|
"3") $TERMINAL -e $ITEM9_BACKEND ; exit ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# send the notification
|
# send the notification
|
||||||
SEND_NOTIF() {
|
SEND_NOTIF() {
|
||||||
notify-send "$FULL_MUSIC"
|
notify-send "$FULL_MUSIC"
|
||||||
|
|
||||||
# some information
|
# some information
|
||||||
echo "Notification sent successfully!"
|
echo "Notification sent successfully!"
|
||||||
echo "INFO: $FULL_MUSIC"
|
echo "INFO: $FULL_MUSIC"
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ module_config
|
||||||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||||
[ -z "$URL" ] && URL="1.1.1.1"
|
[ -z "$URL" ] && URL="1.1.1.1"
|
||||||
[ "$ENABLE_ITEM6" = "true" ] || exit
|
[ "$ENABLE_ITEM6" = "true" ] || exit
|
||||||
|
[ -e "/tmp/module_net_hidden" ] && exit
|
||||||
|
|
||||||
# get stats
|
# get stats
|
||||||
GETNSTAT() {
|
GETNSTAT() {
|
||||||
|
|
|
@ -4,9 +4,10 @@
|
||||||
# load config
|
# load config
|
||||||
module_config
|
module_config
|
||||||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||||
|
[ -e "/tmp/module_news_hidden" ] && exit
|
||||||
[ "$ENABLE_ITEM10" = "true" ] || exit
|
[ "$ENABLE_ITEM10" = "true" ] || exit
|
||||||
command -v newsboat > /dev/null || exit
|
command -v newsboat > /dev/null || exit
|
||||||
|
|
||||||
NEWS_COUNT="$(newsboat -x print-unread | awk '{ print $1 }' || return)"
|
NEWS_COUNT="$(newsboat -x print-unread | awk '{ print $1 }' || return)"
|
||||||
|
|
||||||
# clicking
|
# clicking
|
||||||
|
@ -23,20 +24,20 @@ CLICK() {
|
||||||
case "$BUTTON" in
|
case "$BUTTON" in
|
||||||
"3") $TERMINAL newsboat ; return ;;
|
"3") $TERMINAL newsboat ; return ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# send the notification
|
# send the notification
|
||||||
SEND_NOTIF() {
|
SEND_NOTIF() {
|
||||||
notify-send "${ICON}${ICONSPACING}$NEWS_COUNT $ITEM10_TEXT"
|
notify-send "${ICON}${ICONSPACING}$NEWS_COUNT $ITEM10_TEXT"
|
||||||
|
|
||||||
# some information
|
# some information
|
||||||
echo "Notification sent successfully!"
|
echo "Notification sent successfully!"
|
||||||
echo "INFO: ${ICON}${ICONSPACING}$NEWS_COUNT $ITEM10_TEXT"
|
echo "INFO: ${ICON}${ICONSPACING}$NEWS_COUNT $ITEM10_TEXT"
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
module_config
|
module_config
|
||||||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||||
[ "$ENABLE_ITEM1" = "true" ] || exit
|
[ "$ENABLE_ITEM1" = "true" ] || exit
|
||||||
|
[ -e "/tmp/module_ram_hidden" ] && exit
|
||||||
command -v free > /dev/null || exit
|
command -v free > /dev/null || exit
|
||||||
|
|
||||||
# get status
|
# get status
|
||||||
|
@ -22,27 +23,27 @@ CLICK() {
|
||||||
[ -e "/tmp/speedwm-button" ] && BUTTON="$(cat /tmp/speedwm-button)"
|
[ -e "/tmp/speedwm-button" ] && BUTTON="$(cat /tmp/speedwm-button)"
|
||||||
[ -z "$TERMINAL" ] && TERMINAL=st
|
[ -z "$TERMINAL" ] && TERMINAL=st
|
||||||
[ -n "$ICON" ] && ICONSPACING=" " # one character spacing
|
[ -n "$ICON" ] && ICONSPACING=" " # one character spacing
|
||||||
|
|
||||||
# check value of button
|
# check value of button
|
||||||
case "$BUTTON" in
|
case "$BUTTON" in
|
||||||
"2") command -v notify-send > /dev/null && notify-send "$(ps axch -o cmd:12,%mem --sort=%mem | tail -n 10)" ; exit ;;
|
"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 ;;
|
"3") $TERMINAL -e htop ; exit ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# send the notification
|
# send the notification
|
||||||
SEND_NOTIF() {
|
SEND_NOTIF() {
|
||||||
FULL_RAM="$(printf "${ICON}${ICONSPACING}Used: $RAM_USED\nFree: $RAM_LEFT\nTotal: $RAM_TOTAL\n")"
|
FULL_RAM="$(printf "${ICON}${ICONSPACING}Used: $RAM_USED\nFree: $RAM_LEFT\nTotal: $RAM_TOTAL\n")"
|
||||||
notify-send "$FULL_RAM"
|
notify-send "$FULL_RAM"
|
||||||
|
|
||||||
# some information
|
# some information
|
||||||
echo "Notification sent successfully!"
|
echo "Notification sent successfully!"
|
||||||
echo "INFO: $FULL_RAM"
|
echo "INFO: $FULL_RAM"
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
module_config
|
module_config
|
||||||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||||
[ "$ENABLE_ITEM8" != "true" ] && exit
|
[ "$ENABLE_ITEM8" != "true" ] && exit
|
||||||
|
[ -e "/tmp/module_temp_hidden" ] && exit
|
||||||
command -v sensors > /dev/null || exit
|
command -v sensors > /dev/null || exit
|
||||||
|
|
||||||
# click
|
# click
|
||||||
|
@ -12,25 +13,25 @@ CLICK() {
|
||||||
# values
|
# values
|
||||||
ICON="$ITEM8_ICON"
|
ICON="$ITEM8_ICON"
|
||||||
[ -e "/tmp/speedwm-button" ] && BUTTON="$(cat /tmp/speedwm-button)" || BUTTON="0"
|
[ -e "/tmp/speedwm-button" ] && BUTTON="$(cat /tmp/speedwm-button)" || BUTTON="0"
|
||||||
|
|
||||||
[ "$ITEM8_FORMAT_CELSIUS" = "true" ] || FARG="-F"
|
[ "$ITEM8_FORMAT_CELSIUS" = "true" ] || FARG="-F"
|
||||||
[ -z "$TERMINAL" ] && TERMINAL=st
|
[ -z "$TERMINAL" ] && TERMINAL=st
|
||||||
[ -n "$ICON" ] && ICONSPACING=" " # one character spacing
|
[ -n "$ICON" ] && ICONSPACING=" " # one character spacing
|
||||||
|
|
||||||
TEMP_FULL="$(sensors $FARG)"
|
TEMP_FULL="$(sensors $FARG)"
|
||||||
|
|
||||||
# send the notification
|
# send the notification
|
||||||
SEND_NOTIF() {
|
SEND_NOTIF() {
|
||||||
FULL_TEMP="${ICON}${ICONSPACING}$TEMP_FULL"
|
FULL_TEMP="${ICON}${ICONSPACING}$TEMP_FULL"
|
||||||
notify-send "$FULL_TEMP"
|
notify-send "$FULL_TEMP"
|
||||||
|
|
||||||
# some information
|
# some information
|
||||||
echo "Notification sent successfully!"
|
echo "Notification sent successfully!"
|
||||||
echo "INFO: $FULL_TEMP"
|
echo "INFO: $FULL_TEMP"
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
|
@ -6,6 +6,7 @@ module_config
|
||||||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||||
[ "$ENABLE_ITEM2" = "true" ] || exit
|
[ "$ENABLE_ITEM2" = "true" ] || exit
|
||||||
command -v date > /dev/null || exit
|
command -v date > /dev/null || exit
|
||||||
|
[ -e "/tmp/module_time_hidden" ] && exit
|
||||||
|
|
||||||
# click
|
# click
|
||||||
CLICK() {
|
CLICK() {
|
||||||
|
@ -19,21 +20,21 @@ CLICK() {
|
||||||
[ -e "/tmp/speedwm-button" ] && BUTTON="$(cat /tmp/speedwm-button)" || BUTTON="0"
|
[ -e "/tmp/speedwm-button" ] && BUTTON="$(cat /tmp/speedwm-button)" || BUTTON="0"
|
||||||
[ -z "$TERMINAL" ] && TERMINAL=st
|
[ -z "$TERMINAL" ] && TERMINAL=st
|
||||||
[ -n "$ICONSPACING" ] && ICONSPACING=" " # one character spacing
|
[ -n "$ICONSPACING" ] && ICONSPACING=" " # one character spacing
|
||||||
|
|
||||||
# send the notification
|
# send the notification
|
||||||
SEND_NOTIF() {
|
SEND_NOTIF() {
|
||||||
FULL_TIME="${ICON}${ICONSPACING}The time is $TIME_FULL $TIME_ZONE."
|
FULL_TIME="${ICON}${ICONSPACING}The time is $TIME_FULL $TIME_ZONE."
|
||||||
notify-send "$FULL_TIME"
|
notify-send "$FULL_TIME"
|
||||||
|
|
||||||
# some information
|
# some information
|
||||||
echo "Notification sent successfully!"
|
echo "Notification sent successfully!"
|
||||||
echo "INFO: $FULL_TIME"
|
echo "INFO: $FULL_TIME"
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||||
|
|
||||||
return
|
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
|
module_config
|
||||||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||||
[ "$ENABLE_ITEM4" != "true" ] && exit
|
[ "$ENABLE_ITEM4" != "true" ] && exit
|
||||||
|
[ -e "/tmp/module_vol_hidden" ] && exit
|
||||||
|
|
||||||
command -v pactl > /dev/null && BACKEND=pactl || BACKEND=amixer
|
command -v pactl > /dev/null && BACKEND=pactl || BACKEND=amixer
|
||||||
command -v awk > /dev/null || exit
|
command -v awk > /dev/null || exit
|
||||||
|
@ -22,26 +23,26 @@ CLICK() {
|
||||||
[ -e "/tmp/speedwm-button" ] && BUTTON="$(cat /tmp/speedwm-button)" || BUTTON="0"
|
[ -e "/tmp/speedwm-button" ] && BUTTON="$(cat /tmp/speedwm-button)" || BUTTON="0"
|
||||||
[ -z "$TERMINAL" ] && TERMINAL=st
|
[ -z "$TERMINAL" ] && TERMINAL=st
|
||||||
[ -n "$ICON" ] && ICONSPACING=" " # one character spacing
|
[ -n "$ICON" ] && ICONSPACING=" " # one character spacing
|
||||||
|
|
||||||
# check value of button
|
# check value of button
|
||||||
case "$BUTTON" in
|
case "$BUTTON" in
|
||||||
"3") $TERMINAL speedwm-audioctrl -runmixer ; exit ;;
|
"3") $TERMINAL speedwm-audioctrl -runmixer ; exit ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# send the notification
|
# send the notification
|
||||||
SEND_NOTIF() {
|
SEND_NOTIF() {
|
||||||
FULL_VOL="${ICON}${ICONSPACING}$VOL_VOLUME"
|
FULL_VOL="${ICON}${ICONSPACING}$VOL_VOLUME"
|
||||||
notify-send "$FULL_VOL"
|
notify-send "$FULL_VOL"
|
||||||
|
|
||||||
# some information
|
# some information
|
||||||
echo "Notification sent successfully!"
|
echo "Notification sent successfully!"
|
||||||
echo "INFO: $FULL_VOL"
|
echo "INFO: $FULL_VOL"
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||||
|
|
||||||
return
|
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/")"
|
[ "$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" -gt "99" ] && ICON="$ITEM4_ICON_100 "
|
||||||
[ "$VOL" -lt "100" ] && ICON="$ITEM4_ICON_75"
|
[ "$VOL" -lt "100" ] && ICON="$ITEM4_ICON_75"
|
||||||
[ "$VOL" -lt "51" ] && ICON="$ITEM4_ICON_50"
|
[ "$VOL" -lt "51" ] && ICON="$ITEM4_ICON_50"
|
||||||
[ "$VOL" -lt "26" ] && ICON="$ITEM4_ICON_25"
|
[ "$VOL" -lt "26" ] && ICON="$ITEM4_ICON_25"
|
||||||
[ "$VOL" -lt "1" ] && ICON="$ITEM4_ICON_0"
|
[ "$VOL" -lt "1" ] && ICON="$ITEM4_ICON_0"
|
||||||
|
|
||||||
# mute status
|
# mute status
|
||||||
[ "$BACKEND" = "pactl" ] && pactl get-sink-mute @DEFAULT_SINK@ | grep -q yes && ICON="$ITEM4_ICON_MUTED" && MUTEDATA=" $ITEM4_MUTE_TEXT" || MUTEDATA=""
|
[ "$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=""
|
[ "$ITEM4_SHOW_MUTE" != "true" ] && MUTEDATA=""
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
module_config
|
module_config
|
||||||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||||
[ "$ENABLE_ITEM5" = "true" ] || exit
|
[ "$ENABLE_ITEM5" = "true" ] || exit
|
||||||
|
[ -e "/tmp/module_weather_hidden" ] && exit
|
||||||
command -v curl > /dev/null || exit
|
command -v curl > /dev/null || exit
|
||||||
|
|
||||||
# weather data
|
# weather data
|
||||||
|
@ -56,29 +57,29 @@ CLICK() {
|
||||||
WEATHER_TERM="speedwm-core -curl-weather"
|
WEATHER_TERM="speedwm-core -curl-weather"
|
||||||
ICON="$ICON"
|
ICON="$ICON"
|
||||||
BUTTON="$(cat /tmp/speedwm-button)"
|
BUTTON="$(cat /tmp/speedwm-button)"
|
||||||
|
|
||||||
[ -z "$TERMINAL" ] && TERMINAL=st
|
[ -z "$TERMINAL" ] && TERMINAL=st
|
||||||
[ -n "$ICON" ] && ICONSPACING=" " # one character spacing
|
[ -n "$ICON" ] && ICONSPACING=" " # one character spacing
|
||||||
|
|
||||||
# check value of button
|
# check value of button
|
||||||
case "$BUTTON" in
|
case "$BUTTON" in
|
||||||
"3") $TERMINAL "clear ; curl -s wttr.in | head -n 38 | tail -n 37 ; read a ; return " ;;
|
"3") $TERMINAL "clear ; curl -s wttr.in | head -n 38 | tail -n 37 ; read a ; return " ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# send the notification
|
# send the notification
|
||||||
SEND_NOTIF() {
|
SEND_NOTIF() {
|
||||||
FULL_WEATHER="${ICON}${ICONSPACING}$WEATHER_FULL"
|
FULL_WEATHER="${ICON}${ICONSPACING}$WEATHER_FULL"
|
||||||
notify-send "$FULL_WEATHER"
|
notify-send "$FULL_WEATHER"
|
||||||
|
|
||||||
# some information
|
# some information
|
||||||
echo "Notification sent successfully!"
|
echo "Notification sent successfully!"
|
||||||
echo "INFO: $FULL_WEATHER"
|
echo "INFO: $FULL_WEATHER"
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue