Rework status bar, main code is now in the modules
This commit is contained in:
parent
20e5beade6
commit
422d7767ca
73
modules/module_bat
Executable file
73
modules/module_bat
Executable file
|
@ -0,0 +1,73 @@
|
|||
#!/bin/sh
|
||||
# battery module for status/stellar
|
||||
|
||||
# load config
|
||||
. $HOME/.config/speedwm-de/status/config
|
||||
BINDIR="$(dirname $(command -v status))/"
|
||||
|
||||
# argument 1
|
||||
ARG1="$1"
|
||||
|
||||
# clicking
|
||||
CLICK() {
|
||||
# values
|
||||
ICON="$ITEM11_ICON"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
BATTERY_FULL="$(acpi)"
|
||||
|
||||
command -v acpi > /dev/null || exit
|
||||
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
esac
|
||||
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
|
||||
# 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
|
||||
}
|
||||
|
||||
# information itself
|
||||
PRINT() {
|
||||
if [ "$ENABLE_ITEM11" = "true" ]; then
|
||||
# print capacity
|
||||
if [ -e "/sys/class/power_supply/BAT0/capacity" ]; then
|
||||
echo "$SEPARATOR $ITEM11_ICON $(cat /sys/class/power_supply/BAT0/capacity)%"
|
||||
fi
|
||||
|
||||
# print capacity for second battery if it exists
|
||||
if [ -e "/sys/class/power_supply/BAT1/capacity" ]; then
|
||||
echo "$SEPARATOR $ITEM11_ICON $(cat /sys/class/power_supply/BAT1/capacity)%"
|
||||
fi
|
||||
|
||||
# show charging status
|
||||
if [ -e "${BINDIR}acpi" ]; then
|
||||
if [ "$ITEM11_SHOW_CHARGING_STATUS" = "true" ]; then
|
||||
CHARGESTATUS=$(echo ", $(acpi | awk '{ print $3 }' | sed "s|,||g" | sed "s|Discharging|$ITEM11_DISCHARGING_TEXT|g; s|Charging|$ITEM11_CHARGING_TEXT|g; s|Fully charged|$ITEM11_FULL_TEXT|g")") && echo $CHARGESTATUS
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# argument 1
|
||||
case "$ARG1" in
|
||||
"") CLICK ;;
|
||||
"--print") PRINT > /tmp/module_bat ;;
|
||||
"--click") CLICK ;;
|
||||
esac
|
|
@ -1,49 +1,70 @@
|
|||
#!/bin/sh
|
||||
# date module for status/stellar
|
||||
|
||||
# values
|
||||
DATE_DAY="$(date +%d)" # day number
|
||||
DATE_DAY_OF_YEAR="$(date +%j)" # year day number
|
||||
DATE_DAY_W_SHORT="$(date +%a)" # short day (ie. mon)
|
||||
DATE_DAY_W_LONG="$(date +%A)" # long day (ie. monday)
|
||||
DATE_MONTH="$(date +%m)" # month number
|
||||
DATE_MONTH_W_SHORT="$(date +%b)" # short month (ie. oct)
|
||||
DATE_MONTH_W_LONG="$(date +%B)" # long month (ie. october)
|
||||
DATE_YEAR="$(date +%Y)" # year number
|
||||
DATE_WEEK="$(date +%W)" # week number
|
||||
DATE_WEEKDAY="$(date +%w)" # day of the week in number
|
||||
ICON="$1" # icon is first argument
|
||||
BUTTON="$(cat /tmp/speedwm-button)" # button
|
||||
# load config
|
||||
. $HOME/.config/speedwm-de/status/config
|
||||
BINDIR="$(dirname $(command -v status))/"
|
||||
|
||||
# load status config
|
||||
if [ -e "$HOME/.config/speedwm-de/status/config" ]; then
|
||||
. $HOME/.config/speedwm-de/status/config
|
||||
if [ "$1" = "" ]; then
|
||||
ICON="$ITEM3_ICON"
|
||||
ARG1="$1"
|
||||
|
||||
# click
|
||||
CLICK() {
|
||||
# values
|
||||
DATE_DAY="$(date +%d)" # day number
|
||||
DATE_DAY_OF_YEAR="$(date +%j)" # year day number
|
||||
DATE_DAY_W_SHORT="$(date +%a)" # short day (ie. mon)
|
||||
DATE_DAY_W_LONG="$(date +%A)" # long day (ie. monday)
|
||||
DATE_MONTH="$(date +%m)" # month number
|
||||
DATE_MONTH_W_SHORT="$(date +%b)" # short month (ie. oct)
|
||||
DATE_MONTH_W_LONG="$(date +%B)" # long month (ie. october)
|
||||
DATE_YEAR="$(date +%Y)" # year number
|
||||
DATE_WEEK="$(date +%W)" # week number
|
||||
DATE_WEEKDAY="$(date +%w)" # day of the week in number
|
||||
ICON="$ITEM3_ICON" # icon is first argument
|
||||
BUTTON="$(cat /tmp/speedwm-button)" # button
|
||||
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
esac
|
||||
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
fi
|
||||
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
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"
|
||||
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_DATE"
|
||||
|
||||
# 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"
|
||||
exit 0
|
||||
}
|
||||
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_DATE"
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
exit 0
|
||||
exit 1
|
||||
}
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
# information itself
|
||||
PRINT() {
|
||||
if [ "$ENABLE_ITEM3" = "true" ]; then
|
||||
if [ -e "${DATEBINDIR}date" ]; then
|
||||
DAY="$(date +%d)"
|
||||
MONTH="$(date +%m)"
|
||||
YEAR="$(date +%Y)"
|
||||
|
||||
exit 1
|
||||
echo "$SEPARATOR $ITEM3_ICON $ITEM3_FORMAT" | sed "s|@d|$DAY|; s|@m|$MONTH|; s|@y|$YEAR|"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# argument 1
|
||||
case "$ARG1" in
|
||||
"") CLICK ;;
|
||||
"--print") PRINT > /tmp/module_date ;;
|
||||
"--click") CLICK ;;
|
||||
esac
|
||||
|
|
|
@ -1,66 +1,84 @@
|
|||
#!/bin/sh
|
||||
# dfmpeg module for status/stellar
|
||||
|
||||
# values
|
||||
DFMPEG_CMD="speedwm-dfmpeg -s"
|
||||
DFMPEG_REC_PATH="$(cat /tmp/outputfilename)"
|
||||
ICON="$1"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
# load config
|
||||
. $HOME/.config/speedwm-de/status/config
|
||||
BINDIR="$(dirname $(command -v status))/"
|
||||
|
||||
# load status config
|
||||
if [ -e "$HOME/.config/speedwm-de/status/config" ]; then
|
||||
. $HOME/.config/speedwm-de/status/config
|
||||
if [ "$1" = "" ]; then
|
||||
ICON="$ITEM7_ICON"
|
||||
fi
|
||||
fi
|
||||
ARG1="$1"
|
||||
|
||||
pgrep -x ffmpeg || exit 1
|
||||
# click
|
||||
CLICK() {
|
||||
# values
|
||||
DFMPEG_CMD="speedwm-dfmpeg -s"
|
||||
DFMPEG_REC_PATH="$(cat /tmp/outputfilename)"
|
||||
ICON="$ITEM7_ICON"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
esac
|
||||
pgrep -x ffmpeg || exit 1
|
||||
|
||||
case "$BUTTON" in
|
||||
"3") speedwm-dfmpeg ; exit ;;
|
||||
"2") $DFMPEG_CMD ; exit ;;
|
||||
esac
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
esac
|
||||
|
||||
# check if recording audio
|
||||
if [ -e "/tmp/isaudio" ]; then
|
||||
DFMPEG_AUDIO="Recording audio"
|
||||
else
|
||||
DFMPEG_AUDIO="Not recording audio"
|
||||
fi
|
||||
case "$BUTTON" in
|
||||
"3") speedwm-dfmpeg ; exit ;;
|
||||
"2") $DFMPEG_CMD ; exit ;;
|
||||
esac
|
||||
|
||||
# check if encoding
|
||||
if [ -e "/tmp/isencoding" ]; then
|
||||
if [ -e "/tmp/encoding-codec" ]; then
|
||||
DFMPEG_ENCODING="Encoding with $(cat /tmp/encoding-codec)"
|
||||
# check if recording audio
|
||||
if [ -e "/tmp/isaudio" ]; then
|
||||
DFMPEG_AUDIO="Recording audio"
|
||||
else
|
||||
DFMPEG_ENCODING="Encoding"
|
||||
DFMPEG_AUDIO="Not recording audio"
|
||||
fi
|
||||
else
|
||||
DFMPEG_ENCODING="Not encoding"
|
||||
fi
|
||||
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
# check if encoding
|
||||
if [ -e "/tmp/isencoding" ]; then
|
||||
if [ -e "/tmp/encoding-codec" ]; then
|
||||
DFMPEG_ENCODING="Encoding with $(cat /tmp/encoding-codec)"
|
||||
else
|
||||
DFMPEG_ENCODING="Encoding"
|
||||
fi
|
||||
else
|
||||
DFMPEG_ENCODING="Not encoding"
|
||||
fi
|
||||
|
||||
# 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"
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_RECSTATUS"
|
||||
# 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"
|
||||
|
||||
exit 0
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_RECSTATUS"
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
exit 1
|
||||
}
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
# information itself
|
||||
PRINT() {
|
||||
# Check if we're recording with dfmpeg or not
|
||||
if [ "$ENABLE_ITEM7" = "true" ]; then
|
||||
if [ -e "/tmp/dfmpeg-recording" ]; then
|
||||
echo "$SEPARATOR $ITEM7_ICON $ITEM7_RECORDING_TEXT"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
exit 1
|
||||
# argument 1
|
||||
case "$ARG1" in
|
||||
"") CLICK ;;
|
||||
"--print") PRINT > /tmp/module_dfmpeg ;;
|
||||
"--click") CLICK ;;
|
||||
esac
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
#!/bin/sh
|
||||
# music module for status/stellar
|
||||
|
||||
# values
|
||||
ICON="$1"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
# load config
|
||||
. $HOME/.config/speedwm-de/status/config
|
||||
BINDIR="$(dirname $(command -v status))/"
|
||||
|
||||
# load status config
|
||||
if [ -e "$HOME/.config/speedwm-de/status/config" ]; then
|
||||
. $HOME/.config/speedwm-de/status/config
|
||||
ARG1="$1"
|
||||
|
||||
if [ "$1" = "" ]; then
|
||||
ICON="$ITEM9_ICON"
|
||||
fi
|
||||
CLICK() {
|
||||
# values
|
||||
ICON="$ITEM9_ICON"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
|
||||
if [ "$ITEM9_BACKEND" = "auto" ]; then
|
||||
command -v mocp > /dev/null && ITEM9_BACKEND=mocp
|
||||
|
@ -23,74 +22,211 @@ if [ -e "$HOME/.config/speedwm-de/status/config" ]; then
|
|||
command -v mocp > /dev/null || ITEM9_BACKEND=cmus
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# for cmus
|
||||
CMUS() {
|
||||
MUSIC_FILENAME="$(basename "$(cmus-remote -C status | grep file)")"
|
||||
MUSIC_FILENAME_CUT="$(basename "$(cmus-remote -C status | grep file)"| sed 's|\(.*\)[.].*|\1|')"
|
||||
MUSIC_FILEDIR="$(dirname "$(cmus-remote -C status | grep file | sed 's/file //g')")"
|
||||
MUSIC_ARTIST="$(cmus-remote -C status | grep "tag artist" | sed "s/tag artist //g")"
|
||||
MUSIC_SONG="$(cmus-remote -C status | grep "tag title" | sed "s/tag title //g")"
|
||||
MUSIC_ALBUM="$(cmus-remote -C status | grep "tag album" | head -n 1 | sed "s/tag album //g")"
|
||||
MUSIC_GENRE="$(cmus-remote -C status | grep "tag genre" | sed "s/tag genre //g")"
|
||||
MUSIC_TIMEELAPSED="$(cmus-remote -Q | grep position | sed "s/position //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_SHUFFLE="$(cmus-remote -C status | grep 'shuffle' | sed "s/on/Yes/; s/off/No/; s/set shuffle //")"
|
||||
}
|
||||
|
||||
# for mocp
|
||||
MOCP() {
|
||||
MUSIC_FILENAME="$(basename "$(mocp -Q %file)")"
|
||||
MUSIC_FILENAME_CUT="$(basename "$(mocp -Q %file)" | sed 's|\(.*\)[.].*|\1|')"
|
||||
MUSIC_FILEDIR="$(dirname "$(mocp -Q %file)")"
|
||||
MUSIC_ARTIST="$(mocp -Q %artist)"
|
||||
MUSIC_SONG="$(mocp -Q %song)"
|
||||
MUSIC_ALBUM="$(mocp -Q %album)"
|
||||
MUSIC_TIMEELAPSED="$(mocp -Q %ct)"
|
||||
MUSIC_TIMETOTAL="$(mocp -Q %tt)"
|
||||
# todo: genre
|
||||
}
|
||||
# for cmus
|
||||
CMUS() {
|
||||
MUSIC_FILENAME="$(basename "$(cmus-remote -C status | grep file)")"
|
||||
MUSIC_FILENAME_CUT="$(basename "$(cmus-remote -C status | grep file)"| sed 's|\(.*\)[.].*|\1|')"
|
||||
MUSIC_FILEDIR="$(dirname "$(cmus-remote -C status | grep file | sed 's/file //g')")"
|
||||
MUSIC_ARTIST="$(cmus-remote -C status | grep "tag artist" | sed "s/tag artist //g")"
|
||||
MUSIC_SONG="$(cmus-remote -C status | grep "tag title" | sed "s/tag title //g")"
|
||||
MUSIC_ALBUM="$(cmus-remote -C status | grep "tag album" | head -n 1 | sed "s/tag album //g")"
|
||||
MUSIC_GENRE="$(cmus-remote -C status | grep "tag genre" | sed "s/tag genre //g")"
|
||||
MUSIC_TIMEELAPSED="$(cmus-remote -Q | grep position | sed "s/position //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_SHUFFLE="$(cmus-remote -C status | grep 'shuffle' | sed "s/on/Yes/; s/off/No/; s/set shuffle //")"
|
||||
}
|
||||
|
||||
# set variables with content
|
||||
case "$ITEM9_BACKEND" in
|
||||
"cmus") CMUS ;;
|
||||
"mocp") MOCP ;;
|
||||
esac
|
||||
# for mocp
|
||||
MOCP() {
|
||||
MUSIC_FILENAME="$(basename "$(mocp -Q %file)")"
|
||||
MUSIC_FILENAME_CUT="$(basename "$(mocp -Q %file)" | sed 's|\(.*\)[.].*|\1|')"
|
||||
MUSIC_FILEDIR="$(dirname "$(mocp -Q %file)")"
|
||||
MUSIC_ARTIST="$(mocp -Q %artist)"
|
||||
MUSIC_SONG="$(mocp -Q %song)"
|
||||
MUSIC_ALBUM="$(mocp -Q %album)"
|
||||
MUSIC_TIMEELAPSED="$(mocp -Q %ct)"
|
||||
MUSIC_TIMETOTAL="$(mocp -Q %tt)"
|
||||
# todo: genre
|
||||
}
|
||||
|
||||
# terminal
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
esac
|
||||
# set variables with content
|
||||
case "$ITEM9_BACKEND" in
|
||||
"cmus") CMUS ;;
|
||||
"mocp") MOCP ;;
|
||||
esac
|
||||
|
||||
# button
|
||||
case "$BUTTON" in
|
||||
"3") $TERMINAL -e $ITEM9_BACKEND ; exit ;;
|
||||
esac
|
||||
# terminal
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
esac
|
||||
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
# button
|
||||
case "$BUTTON" in
|
||||
"3") $TERMINAL -e $ITEM9_BACKEND ; exit ;;
|
||||
esac
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
if [ "$ITEM9_BACKEND" = "cmus" ]; then
|
||||
FULL_MUSIC="$(printf "${ICON}${ICONSPACING}Artist: $MUSIC_ARTIST\nTitle: $MUSIC_SONG\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")"
|
||||
else
|
||||
FULL_MUSIC="$(printf "${ICON}${ICONSPACING}Artist: $MUSIC_ARTIST\nTitle: $MUSIC_SONG\nAlbum: $MUSIC_ALBUM\nTime elapsed: $MUSIC_TIMEELAPSED\nTotal time: $MUSIC_TIMETOTAL\nFile: $MUSIC_FILENAME\nDirectory: $MUSIC_FILEDIR\nPath: $MUSIC_FILEDIR/$MUSIC_FILENAME")"
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
|
||||
notify-send "$FULL_MUSIC"
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
if [ "$ITEM9_BACKEND" = "cmus" ]; then
|
||||
FULL_MUSIC="$(printf "${ICON}${ICONSPACING}Artist: $MUSIC_ARTIST\nTitle: $MUSIC_SONG\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")"
|
||||
else
|
||||
FULL_MUSIC="$(printf "${ICON}${ICONSPACING}Artist: $MUSIC_ARTIST\nTitle: $MUSIC_SONG\nAlbum: $MUSIC_ALBUM\nTime elapsed: $MUSIC_TIMEELAPSED\nTotal time: $MUSIC_TIMETOTAL\nFile: $MUSIC_FILENAME\nDirectory: $MUSIC_FILEDIR\nPath: $MUSIC_FILEDIR/$MUSIC_FILENAME")"
|
||||
fi
|
||||
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_MUSIC"
|
||||
notify-send "$FULL_MUSIC"
|
||||
|
||||
exit 0
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_MUSIC"
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
exit 1
|
||||
}
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
# information itself
|
||||
PRINT() {
|
||||
# Auto set backend if set to auto
|
||||
if [ "$ITEM9_BACKEND" = "auto" ]; then
|
||||
if [ -e "${BINDIR}cmus" ]; then
|
||||
ITEM9_BACKEND="cmus"
|
||||
elif [ -e "${BINDIR}mocp" ]; then
|
||||
ITEM9_BACKEND="mocp"
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 1
|
||||
if [ "$ENABLE_ITEM9" = "true" ]; then
|
||||
if [ "$ITEM9_BACKEND" = "mocp" ]; then
|
||||
if [ -e "${BINDIR}mocp" ]; then
|
||||
if [ "$(echo $(mocp -Q %file))" != "" ]; then
|
||||
|
||||
# filename
|
||||
if [ "$ITEM9_DISPLAY_FILE" = "true" ]; then
|
||||
if [ "$(mocp -Q %file | head -n 1)" != "" ]; then
|
||||
echo "$SEPARATOR $ITEM9_ICON $ITEM9_PRE_FILE$(basename "$(mocp -Q %file)" | sed 's|\(.*\)[.].*|\1|')$ITEM9_POST_FILE"
|
||||
fi
|
||||
else
|
||||
|
||||
# artist
|
||||
if [ "$ITEM9_DISPLAY_ARTIST" = "true" ]; then
|
||||
if [ "$(mocp -Q %artist | head -n 1)" != "" ]; then
|
||||
MUSIC_ARTIST="$(mocp -Q %artist)"
|
||||
fi
|
||||
fi
|
||||
|
||||
# title
|
||||
if [ "$ITEM9_DISPLAY_TITLE" = "true" ]; then
|
||||
if [ "$(mocp -Q %song | head -n 1)" != "" ]; then
|
||||
MUSIC_SONG="$(mocp -Q %song)"
|
||||
fi
|
||||
fi
|
||||
|
||||
# album
|
||||
if [ "$ITEM9_DISPLAY_ALBUM" = "true" ]; then
|
||||
if [ "$(mocp -Q %album | head -n 1)" != "" ]; then
|
||||
MUSIC_ALBUM="$(mocp -Q %album)"
|
||||
fi
|
||||
fi
|
||||
|
||||
# time elapsed
|
||||
if [ "$ITEM9_DISPLAY_TIMEELAPSED" = "true" ]; then
|
||||
if [ "$(mocp -Q %tl | head -n 1)" != "" ]; then
|
||||
MUSIC_TIMEELAPSED="$(mocp -Q %ct)"
|
||||
fi
|
||||
fi
|
||||
|
||||
# total time
|
||||
if [ "$ITEM9_DISPLAY_TIMETOTAL" = "true" ]; then
|
||||
if [ "$(mocp -Q %tt | head -n 1)" != "" ]; then
|
||||
MUSIC_TIMETOTAL="$(mocp -Q %tt)"
|
||||
fi
|
||||
fi
|
||||
|
||||
data="$(printf "$ITEM9_FORMAT" | sed "s|@ab|$MUSIC_ALBUM|; s|@t|$MUSIC_SONG|; s|@g||; s|@a|$MUSIC_ARTIST|; s|@tt|$MUSIC_TIMETOTAL|; s|@te|$MUSIC_TIMEELAPSED|; s| ||g")"
|
||||
|
||||
# actually print it
|
||||
echo "$SEPARATOR $ITEM9_ICON $data"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ENABLE_ITEM9" = "true" ]; then
|
||||
if [ -e "${BINDIR}cmus-remote" ]; then
|
||||
if [ "$(cmus-remote -C status | head -n 1 | awk '{ print $2 }')" = "playing" ]; then
|
||||
if [ "$ITEM9_DISPLAY_FILE" = "true" ]; then
|
||||
echo "$SEPARATOR $ITEM9_ICON $ITEM9_PRE_FILE$(basename "$(cmus-remote -C status | grep file)"| sed 's|\(.*\)[.].*|\1|')$ITEM9_POST_FILE"
|
||||
else
|
||||
|
||||
# artist
|
||||
if [ "$ITEM9_DISPLAY_ARTIST" = "true" ]; then
|
||||
if [ "$(cmus-remote -C status | grep "tag artist")" != "" ]; then
|
||||
MUSIC_ARTIST="$(cmus-remote -C status | grep "tag artist" | sed "s/tag artist //g")"
|
||||
fi
|
||||
fi
|
||||
|
||||
# title
|
||||
if [ "$ITEM9_DISPLAY_TITLE" = "true" ]; then
|
||||
if [ "$(cmus-remote -C status | grep "tag title")" != "" ]; then
|
||||
MUSIC_SONG="$(cmus-remote -C status | grep "tag title" | sed "s/tag title //g")"
|
||||
fi
|
||||
fi
|
||||
|
||||
# album
|
||||
if [ "$ITEM9_DISPLAY_ALBUM" = "true" ]; then
|
||||
if [ "$(cmus-remote -C status | grep "tag album")" != "" ]; then
|
||||
MUSIC_ALBUM="$(cmus-remote -C status | grep "tag album" | head -n 1 | sed "s/tag album //g")"
|
||||
fi
|
||||
fi
|
||||
|
||||
# genre
|
||||
if [ "$ITEM9_DISPLAY_GENRE" = "true" ]; then
|
||||
if [ "$(cmus-remote -C status | grep "tag genre")" != "" ]; then
|
||||
MUSIC_GENRE="$(cmus-remote -C status | grep "tag genre" | sed "s/tag genre //g")"
|
||||
fi
|
||||
fi
|
||||
|
||||
# time elapsed
|
||||
if [ "$ITEM9_DISPLAY_TIMEELAPSED" = "true" ]; then
|
||||
if [ "$(cmus-remote -Q | grep position | sed "s/position //g")" != "" ]; then
|
||||
MUSIC_TIMEELAPSED="$(cmus-remote -Q | grep position | sed "s/position //g" | awk '{printf "%02d:%02d:%02d",$0/3600,$0%3600/60,$0%60}' | sed "s/00://")"
|
||||
fi
|
||||
fi
|
||||
|
||||
# total time
|
||||
if [ "$ITEM9_DISPLAY_TIMETOTAL" = "true" ]; then
|
||||
if [ "$(cmus-remote -Q | grep duration | sed "s/duration //g")" != "" ]; then
|
||||
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://")"
|
||||
fi
|
||||
fi
|
||||
|
||||
data="$(printf "$ITEM9_FORMAT" | sed "s|@ab|$MUSIC_ALBUM|; s|@t|$MUSIC_SONG|; s|@g|$MUSIC_GENRE|; s|@a|$MUSIC_ARTIST|; s|@tt|$MUSIC_TIMETOTAL|; s|@te|$MUSIC_TIMEELAPSED|; s| ||g")"
|
||||
|
||||
# actually print it
|
||||
if [ "$data" != "" ]; then
|
||||
echo "$SEPARATOR $ITEM9_ICON $data"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# argument 1
|
||||
case "$ARG1" in
|
||||
"") CLICK ;;
|
||||
"--print") PRINT > /tmp/module_music ;;
|
||||
"--click") CLICK ;;
|
||||
esac
|
||||
|
|
|
@ -1,45 +1,63 @@
|
|||
#!/bin/sh
|
||||
# network module for status/stellar
|
||||
|
||||
# values
|
||||
NETWORK_TRANSMITTED="$(awk '{$1=$1/1024000; print $1"B";}' /sys/class/net/[ew]*/statistics/tx_bytes | sed "s/.*\(....\)/\1/; s|B|B/s |; s/[.]/0./")"
|
||||
NETWORK_RECEIVED="$(awk '{$1=$1/1024000; print $1"B";}' /sys/class/net/[ew]*/statistics/rx_bytes | sed "s/.*\(....\)/\1/; s|B|B/s |; s/[.]/0./")"
|
||||
ICON="$1"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
# load config
|
||||
. $HOME/.config/speedwm-de/status/config
|
||||
BINDIR="$(dirname $(command -v status))/"
|
||||
|
||||
# load status config
|
||||
if [ -e "$HOME/.config/speedwm-de/status/config" ]; then
|
||||
. $HOME/.config/speedwm-de/status/config
|
||||
if [ "$1" = "" ]; then
|
||||
ICON="$ITEM6_ICON"
|
||||
ARG1="$1"
|
||||
|
||||
|
||||
# click
|
||||
CLICK() {
|
||||
# values
|
||||
NETWORK_TRANSMITTED="$(awk '{$ARG1=$ARG1/1024000; print $ARG1"B";}' /sys/class/net/[ew]*/statistics/tx_bytes | sed "s/.*\(....\)/\1/; s|B|B/s |; s/[.]/0./")"
|
||||
NETWORK_RECEIVED="$(awk '{$ARG1=$ARG1/1024000; print $ARG1"B";}' /sys/class/net/[ew]*/statistics/rx_bytes | sed "s/.*\(....\)/\1/; s|B|B/s |; s/[.]/0./")"
|
||||
ICON="$ITEM6_ICON"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
esac
|
||||
|
||||
case "$BUTTON" in
|
||||
"3") $TERMINAL -e bmon ; exit ;;
|
||||
esac
|
||||
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
fi
|
||||
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
esac
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_NETWORK="${ICON}${ICONSPACING}${NETWORK_TRANSMITTED}transmitted, ${NETWORK_RECEIVED}received."
|
||||
notify-send "$FULL_NETWORK"
|
||||
|
||||
case "$BUTTON" in
|
||||
"3") $TERMINAL -e bmon ; exit ;;
|
||||
esac
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_NETWORK"
|
||||
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
exit 0
|
||||
}
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_NETWORK="${ICON}${ICONSPACING}${NETWORK_TRANSMITTED}transmitted, ${NETWORK_RECEIVED}received."
|
||||
notify-send "$FULL_NETWORK"
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_NETWORK"
|
||||
|
||||
exit 0
|
||||
exit 1
|
||||
}
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
# information itself
|
||||
PRINT() {
|
||||
if [ "$ENABLE_ITEM6" = "true" ]; then
|
||||
if [ -e "${BINDIR}awk" ]; then
|
||||
echo "$SEPARATOR $ITEM6_ICON $(awk '{$1=$1/1024000; print $1"B";}' /sys/class/net/[ew]*/statistics/tx_bytes | sed "s/.*\(....\)/\1/; s|B|B/s |; s/[.]/0./")"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
exit 1
|
||||
# argument 1
|
||||
case "$ARG1" in
|
||||
"") CLICK ;;
|
||||
"--print") PRINT > /tmp/module_net ;;
|
||||
"--click") CLICK ;;
|
||||
esac
|
||||
|
|
71
modules/module_news
Executable file
71
modules/module_news
Executable file
|
@ -0,0 +1,71 @@
|
|||
#!/bin/sh
|
||||
# news module for status/stellar
|
||||
|
||||
# load config
|
||||
. $HOME/.config/speedwm-de/status/config
|
||||
BINDIR="$(dirname $(command -v status))/"
|
||||
|
||||
# argument 1
|
||||
ARG1="$1"
|
||||
|
||||
# clicking
|
||||
CLICK() {
|
||||
# values
|
||||
ICON="$ITEM10_ICON"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
NEWS_COUNT="$(newsboat -x print-unread | awk '{ print $1 }')"
|
||||
|
||||
if [ "$NEWS_COUNT" = "Error:" ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
command -v newsboat > /dev/null || exit
|
||||
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
esac
|
||||
|
||||
case "$BUTTON" in
|
||||
"3") $TERMINAL newsboat ; exit ;;
|
||||
esac
|
||||
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
notify-send "${ICON}${ICONSPACING}$NEWS_COUNT $ITEM10_TEXT"
|
||||
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: ${ICON}${ICONSPACING}$NEWS_COUNT $ITEM10_TEXT"
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
exit 1
|
||||
}
|
||||
|
||||
# information itself
|
||||
PRINT() {
|
||||
if [ "$ENABLE_ITEM10" = "true" ]; then
|
||||
if [ -e "${BINDIR}newsboat" ]; then
|
||||
newscount="$(newsboat -x print-unread | awk '{ print $1 }')"
|
||||
|
||||
if [ "$newscount" != "Error:" ]; then
|
||||
echo "$SEPARATOR $ITEM10_ICON $newscount $ITEM10_TEXT"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# argument 1
|
||||
case "$ARG1" in
|
||||
"") CLICK ;;
|
||||
"--print") PRINT > /tmp/module_news ;;
|
||||
"--click") CLICK ;;
|
||||
esac
|
|
@ -1,46 +1,73 @@
|
|||
#!/bin/sh
|
||||
# ram module for status/stellar
|
||||
|
||||
# values
|
||||
RAM_USED="$(echo "$(free -h --giga | awk '/^Mem/ {print $3}')B")"
|
||||
RAM_TOTAL="$(echo "$(free -h --giga | awk '/^Mem/ {print $2}')B")"
|
||||
RAM_LEFT="$(echo "$(free -h --giga | awk '/^Mem/ {print $7}')B")"
|
||||
ICON="$1"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
# load config
|
||||
. $HOME/.config/speedwm-de/status/config
|
||||
BINDIR="$(dirname $(command -v status))/"
|
||||
|
||||
# load status config
|
||||
if [ -e "$HOME/.config/speedwm-de/status/config" ]; then
|
||||
. $HOME/.config/speedwm-de/status/config
|
||||
if [ "$1" = "" ]; then
|
||||
ICON="$ITEM1_ICON"
|
||||
ARG1="$1"
|
||||
|
||||
CLICK() {
|
||||
# values
|
||||
RAM_USED="$(echo "$(free -h --giga | awk '/^Mem/ {print $3}')B")"
|
||||
RAM_TOTAL="$(echo "$(free -h --giga | awk '/^Mem/ {print $2}')B")"
|
||||
RAM_LEFT="$(echo "$(free -h --giga | awk '/^Mem/ {print $7}')B")"
|
||||
ICON="$ITEM1_ICON"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
esac
|
||||
|
||||
case "$BUTTON" in
|
||||
"3") $TERMINAL -e htop ;;
|
||||
esac
|
||||
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
fi
|
||||
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
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"
|
||||
|
||||
case "$BUTTON" in
|
||||
"3") $TERMINAL -e htop ;;
|
||||
esac
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_RAM"
|
||||
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
exit 0
|
||||
}
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_RAM="$(printf "${ICON}${ICONSPACING}Used: $RAM_USED\nFree: $RAM_LEFT\nTotal: $RAM_TOTAL\n")"
|
||||
notify-send "$FULL_RAM"
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_RAM"
|
||||
|
||||
exit 0
|
||||
exit 1
|
||||
}
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
# information itself
|
||||
PRINT() {
|
||||
if [ "$ENABLE_ITEM1" = "true" ]; then
|
||||
# Used RAM
|
||||
if [ -e "${BINDIR}free" ]; then
|
||||
USEDRAM="$(echo "$(free -h --giga | awk '/^Mem/ {print $3}')B")"
|
||||
fi
|
||||
|
||||
exit 1
|
||||
# Total RAM
|
||||
if [ -e "${BINDIR}free" ]; then
|
||||
TOTALRAM="$(echo "$(free -h --giga | awk '/^Mem/ {print $2}')B")"
|
||||
fi
|
||||
|
||||
if [ -e "${BINDIR}free" ]; then
|
||||
echo "$SEPARATOR $ITEM1_ICON $ITEM1_FORMAT" | sed "s|@u|$USEDRAM|; s|@t|$TOTALRAM|"
|
||||
fi
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
# argument 1
|
||||
case "$ARG1" in
|
||||
"") CLICK ;;
|
||||
"--print") PRINT > /tmp/module_ram ;;
|
||||
"--click") CLICK ;;
|
||||
esac
|
||||
|
|
|
@ -1,52 +1,74 @@
|
|||
#!/bin/sh
|
||||
# cpu temp module for status/stellar
|
||||
|
||||
# values
|
||||
ICON="$1"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
# load config
|
||||
. $HOME/.config/speedwm-de/status/config
|
||||
BINDIR="$(dirname $(command -v status))/"
|
||||
|
||||
# load status config
|
||||
if [ -e "$HOME/.config/speedwm-de/status/config" ]; then
|
||||
. $HOME/.config/speedwm-de/status/config
|
||||
if [ "$1" = "" ]; then
|
||||
ICON="$ITEM8_ICON"
|
||||
fi
|
||||
ARG1="$1"
|
||||
|
||||
# click
|
||||
CLICK() {
|
||||
# values
|
||||
ICON="$ITEM8_ICON"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
|
||||
if [ "$ITEM8_FORMAT_CELSIUS" != "true" ]; then
|
||||
FARG="-F"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -e "/tmp/iscelsius" ]; then
|
||||
if [ "$FARG" = "" ]; then
|
||||
FARG="-F"
|
||||
if [ ! -e "/tmp/iscelsius" ]; then
|
||||
if [ "$FARG" = "" ]; then
|
||||
FARG="-F"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
TEMP_FULL="$(sensors $FARG)"
|
||||
command -v sensors > /dev/null || exit 1
|
||||
TEMP_FULL="$(sensors $FARG)"
|
||||
command -v sensors > /dev/null || exit 1
|
||||
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
esac
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
esac
|
||||
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_TEMP="${ICON}${ICONSPACING}$TEMP_FULL"
|
||||
notify-send "$FULL_TEMP"
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_TEMP="${ICON}${ICONSPACING}$TEMP_FULL"
|
||||
notify-send "$FULL_TEMP"
|
||||
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_TEMP"
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_TEMP"
|
||||
|
||||
exit 0
|
||||
exit 0
|
||||
}
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
exit 1
|
||||
}
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
# information itself
|
||||
PRINT() {
|
||||
if [ "$ENABLE_ITEM8" = "true" ]; then
|
||||
if [ -e "${BINDIR}sensors" ]; then
|
||||
if [ "$ITEM8_FORMAT_CELSIUS" = "true" ]; then
|
||||
echo "$SEPARATOR $ITEM8_ICON $(sensors | grep temp1 | awk '{ print $2 }')"
|
||||
touch /tmp/iscelsius
|
||||
else
|
||||
echo "$SEPARATOR $ITEM8_ICON $(sensors -f | grep temp1 | awk '{ print $2 }')"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
exit 1
|
||||
# argument 1
|
||||
case "$ARG1" in
|
||||
"") CLICK ;;
|
||||
"--print") PRINT > /tmp/module_temp ;;
|
||||
"--click") CLICK ;;
|
||||
esac
|
||||
|
|
|
@ -1,44 +1,64 @@
|
|||
#!/bin/sh
|
||||
# time module for status/stellar
|
||||
|
||||
# values
|
||||
TIME_SECOND="$(date +%S)"
|
||||
TIME_MINUTE="$(date +%M)"
|
||||
TIME_HOUR="$(date +%H)"
|
||||
TIME_FULL="$(date +%T)"
|
||||
TIME_ZONE="$(date +%Z)"
|
||||
ICON="$1"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
# load config
|
||||
. $HOME/.config/speedwm-de/status/config
|
||||
BINDIR="$(dirname $(command -v status))/"
|
||||
|
||||
# load status config
|
||||
if [ -e "$HOME/.config/speedwm-de/status/config" ]; then
|
||||
. $HOME/.config/speedwm-de/status/config
|
||||
if [ "$1" = "" ]; then
|
||||
ICON="$ITEM2_ICON"
|
||||
ARG1="$1"
|
||||
|
||||
# click
|
||||
CLICK() {
|
||||
# values
|
||||
TIME_SECOND="$(date +%S)"
|
||||
TIME_MINUTE="$(date +%M)"
|
||||
TIME_HOUR="$(date +%H)"
|
||||
TIME_FULL="$(date +%T)"
|
||||
TIME_ZONE="$(date +%Z)"
|
||||
ICON="$ITEM2_ICON"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
esac
|
||||
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
fi
|
||||
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
esac
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_TIME="${ICON}${ICONSPACING}The time is $TIME_FULL $TIME_ZONE."
|
||||
notify-send "$FULL_TIME"
|
||||
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_TIME"
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_TIME="${ICON}${ICONSPACING}The time is $TIME_FULL $TIME_ZONE."
|
||||
notify-send "$FULL_TIME"
|
||||
exit 0
|
||||
}
|
||||
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_TIME"
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
exit 0
|
||||
exit 1
|
||||
}
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
# information itself
|
||||
PRINT() {
|
||||
if [ "$ENABLE_ITEM2" = "true" ]; then
|
||||
if [ -e "${DATEBINDIR}date" ]; then
|
||||
HOURS="$(date +%H)"
|
||||
MINUTES="$(date +%M)"
|
||||
SECONDS="$(date +%S)"
|
||||
echo "$SEPARATOR $ITEM2_ICON $ITEM2_FORMAT" | sed "s|@h|$HOURS|; s|@m|$MINUTES|; s|@s|$SECONDS|"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
exit 1
|
||||
# argument 1
|
||||
case "$ARG1" in
|
||||
"") CLICK ;;
|
||||
"--print") PRINT > /tmp/module_time ;;
|
||||
"--click") CLICK ;;
|
||||
esac
|
||||
|
|
|
@ -1,45 +1,71 @@
|
|||
#!/bin/sh
|
||||
# ram module for status/stellar
|
||||
# volume module for status/stellar
|
||||
#
|
||||
# load config
|
||||
. $HOME/.config/speedwm-de/status/config
|
||||
BINDIR="$(dirname $(command -v status))/"
|
||||
ARG1="$1"
|
||||
|
||||
# values
|
||||
VOL_VOLUME="$(speedwm-audioctrl -getvol)"
|
||||
VOL_ISPULSE="$(speedwm-audioctrl -getbackend)"
|
||||
ICON="$1"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
|
||||
# load status config
|
||||
if [ -e "$HOME/.config/speedwm-de/status/config" ]; then
|
||||
. $HOME/.config/speedwm-de/status/config
|
||||
if [ "$1" = "" ]; then
|
||||
ICON="$ITEM4_ICON"
|
||||
# click
|
||||
CLICK() {
|
||||
# values
|
||||
VOL_VOLUME="$(speedwm-audioctrl -getvol)"
|
||||
VOL_ISPULSE="$(speedwm-audioctrl -getbackend)"
|
||||
ICON="$ITEM4_ICON"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
esac
|
||||
|
||||
case "$BUTTON" in
|
||||
"3") $TERMINAL speedwm-audioctrl -runmixer ; exit ;;
|
||||
esac
|
||||
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
fi
|
||||
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
esac
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_VOL="${ICON}${ICONSPACING}$VOL_VOLUME"
|
||||
notify-send "$FULL_VOL"
|
||||
|
||||
case "$BUTTON" in
|
||||
"3") $TERMINAL speedwm-audioctrl -runmixer ; exit ;;
|
||||
esac
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_VOL"
|
||||
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
exit 0
|
||||
}
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_VOL="${ICON}${ICONSPACING}$VOL_VOLUME"
|
||||
notify-send "$FULL_VOL"
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_VOL"
|
||||
|
||||
exit 0
|
||||
exit 1
|
||||
}
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
# information itself
|
||||
PRINT() {
|
||||
if [ "$ENABLE_ITEM4" = "true" ]; then
|
||||
if [ -e "${BINDIR}pactl" ]; then
|
||||
echo "$SEPARATOR $ITEM4_ICON $(echo $(pactl get-sink-volume 0 | awk '{print $5;exit}'))"
|
||||
else
|
||||
echo "$SEPARATOR $ITEM4_ICON $(echo $(amixer -c 0 get Master | tail -n1 | sed -r "s/.*\[(.*)%\].*/\1/")%)"
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 1
|
||||
# get mute
|
||||
if [ "$ITEM4_SHOW_MUTE" = "true" ]; then
|
||||
if [ -e "${BINDIR}pactl" ]; then
|
||||
pactl get-sink-mute 0 | grep -q yes && echo " $ITEM4_MUTE_TEXT"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# argument 1
|
||||
case "$ARG1" in
|
||||
"") CLICK ;;
|
||||
"--print") PRINT > /tmp/module_vol ;;
|
||||
"--click") CLICK ;;
|
||||
esac
|
||||
|
|
|
@ -1,53 +1,86 @@
|
|||
#!/bin/sh
|
||||
# weather module for status/stellar
|
||||
|
||||
# values
|
||||
WEATHER_TERM="speedwm-core -curl-weather"
|
||||
ICON="$1"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
# load config
|
||||
. $HOME/.config/speedwm-de/status/config
|
||||
BINDIR="$(dirname $(command -v status))/"
|
||||
|
||||
# load status config
|
||||
if [ -e "$HOME/.config/speedwm-de/status/config" ]; then
|
||||
. $HOME/.config/speedwm-de/status/config
|
||||
if [ "$1" = "" ]; then
|
||||
ICON="$ITEM5_ICON"
|
||||
# argument 1
|
||||
ARG1="$1"
|
||||
|
||||
# clicking
|
||||
CLICK() {
|
||||
# values
|
||||
WEATHER_TERM="speedwm-core -curl-weather"
|
||||
ICON="$ITEM5_ICON"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
esac
|
||||
|
||||
case "$BUTTON" in
|
||||
"3") $TERMINAL speedwm-core -curl-weather ; exit ;;
|
||||
esac
|
||||
|
||||
# check if a forecast exists
|
||||
# status script should create this
|
||||
if [ -e "/tmp/wstatus" ]; then
|
||||
FORECAST="$(cat /tmp/wstatus)"
|
||||
else
|
||||
echo "FATAL: No weather status available!"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
esac
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
|
||||
case "$BUTTON" in
|
||||
"3") $TERMINAL speedwm-core -curl-weather ; exit ;;
|
||||
esac
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_WEATHER="${ICON}${ICONSPACING}$FORECAST"
|
||||
notify-send "$FULL_WEATHER"
|
||||
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_WEATHER"
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
# check if a forecast exists
|
||||
# status script should create this
|
||||
if [ -e "/tmp/wstatus" ]; then
|
||||
FORECAST="$(cat /tmp/wstatus)"
|
||||
else
|
||||
echo "FATAL: No weather status available!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_WEATHER="${ICON}${ICONSPACING}$FORECAST"
|
||||
notify-send "$FULL_WEATHER"
|
||||
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_WEATHER"
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
# information itself
|
||||
PRINT() {
|
||||
if [ "$ENABLE_ITEM5" = "true" ]; then
|
||||
if [ -e "${BINDIR}curl" ]; then
|
||||
if [ -e "/tmp/itest" ]; then
|
||||
if [ -e "/tmp/wstatus" ]; then
|
||||
grep -q "<html>" /tmp/wstatus || echo "$SEPARATOR $ITEM5_ICON $(cat /tmp/wstatus)"
|
||||
else
|
||||
echo "$(curl -s wttr.in/?format="%C"), $(curl -s wttr.in/?format=3 | sed 's/.* //; s/.*\(.....\)/\1/')" > /tmp/wstatus
|
||||
echo "$SEPARATOR $ITEM5_ICON $(cat /tmp/wstatus)"
|
||||
fi
|
||||
else
|
||||
curl -so /tmp/itest wttr.in && hasinternet=true
|
||||
|
||||
exit 1
|
||||
if [ "$hasinternet" != "true" ]; then
|
||||
rm -f /tmp/itest
|
||||
rm -f /tmp/wstatus
|
||||
itemcmd5=""
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# argument 1
|
||||
case "$ARG1" in
|
||||
"") CLICK ;;
|
||||
"--print") PRINT > /tmp/module_weather ;;
|
||||
"--click") CLICK ;;
|
||||
esac
|
||||
|
|
|
@ -178,12 +178,9 @@ MORE_OPTIONS() {
|
|||
case "$(printf 'Start\nStop\nStart without audio\nPlay last\n------\nMore options\nAbout\nExit' | $RUNLAUNCHER -l 40 -p 'Record your screen:')" in
|
||||
"Exit") STATUS=idle && exit 0 ;;
|
||||
"Start") touch /tmp/isaudio ; echo "$OUTPUT_FILENAME" > /tmp/outputfilename && STATUS=recording && touch /tmp/dfmpeg-recording
|
||||
pgrep -x status && pkill -x status && status &
|
||||
$startrec && exit 0 ;;
|
||||
"Stop") pkill -x ffmpeg ; rm /tmp/dfmpeg-recording ; STATUS=idle
|
||||
pgrep -x status && pkill -x status && status & ;;
|
||||
"Stop") pkill -x ffmpeg ; rm /tmp/dfmpeg-recording ; STATUS=idle ;;
|
||||
"Start without audio") echo "$OUTPUT_FILENAME" > /tmp/outputfilename && STATUS=recording && touch /tmp/dfmpeg-recording
|
||||
pgrep -x status && pkill -x status && status &
|
||||
$startrec_no_audio && exit 0 ;;
|
||||
"Play last") DFMPEG_STATUS=idle && $MEDIA_PLAYER $(cat /tmp/outputfilename) && exit 0 ;;
|
||||
"More options") MORE_OPTIONS && exit 0 ;;
|
||||
|
|
505
status
505
status
|
@ -149,12 +149,12 @@ setloading() {
|
|||
}
|
||||
|
||||
# print data
|
||||
PRINT() {
|
||||
print() {
|
||||
setstatus "$(printf "$ITEMS_TEXT")"
|
||||
}
|
||||
|
||||
# set status2d compatible colors
|
||||
SETCOLORS_CMD() {
|
||||
setcolors2d() {
|
||||
if [ "$COLORFG" = "true" ]; then
|
||||
FSETCOLORCMD1="^C1^"
|
||||
FSETCOLORCMD2="^C2^"
|
||||
|
@ -192,61 +192,153 @@ SETCOLORS_CMD() {
|
|||
fi
|
||||
}
|
||||
|
||||
# Set bindir
|
||||
case "$BINDIR" in
|
||||
"") BINDIR=$(cat /usr/share/speedwm-bindir) ;;
|
||||
esac
|
||||
|
||||
# remove old data
|
||||
rm -f /tmp/itest
|
||||
rm -f /tmp/wstatus
|
||||
rm -f /tmp/iscelsius
|
||||
|
||||
pkill "$(pgrep -x status | sed "s/$$//g")" # Prevent duplicates
|
||||
|
||||
mkdir -p $HOME/.config/speedwm-de/status
|
||||
|
||||
printf "Loaded speedwm status $VER\n---\n"
|
||||
printf "Loaded $0 $VER\n---\n"
|
||||
|
||||
# Set it to /usr/bin if it was not possible to get it through /usr/share/speedwm-bindir
|
||||
case "$BINDIR" in
|
||||
"") BINDIR="$(dirname $(command -v status))/" ;;
|
||||
esac
|
||||
|
||||
# Systray stuff
|
||||
PRINT_TEXT() {
|
||||
# RAM usage
|
||||
ITEM1() {
|
||||
module_ram --print &
|
||||
|
||||
if [ -e "/tmp/module_ram" ]; then
|
||||
cat /tmp/module_ram
|
||||
fi
|
||||
}
|
||||
|
||||
# Time
|
||||
ITEM2() {
|
||||
module_time --print &
|
||||
|
||||
if [ -e "/tmp/module_time" ]; then
|
||||
cat /tmp/module_time
|
||||
fi
|
||||
}
|
||||
|
||||
# Date
|
||||
ITEM3() {
|
||||
module_date --print &
|
||||
|
||||
if [ -e "/tmp/module_date" ]; then
|
||||
cat /tmp/module_date
|
||||
fi
|
||||
}
|
||||
|
||||
# Volume
|
||||
ITEM4() {
|
||||
module_vol --print &
|
||||
|
||||
if [ -e "/tmp/module_vol" ]; then
|
||||
cat /tmp/module_vol
|
||||
fi
|
||||
}
|
||||
|
||||
# Weather
|
||||
ITEM5() {
|
||||
module_weather --print &
|
||||
|
||||
if [ -e "/tmp/module_weather" ]; then
|
||||
cat /tmp/module_weather
|
||||
fi
|
||||
}
|
||||
|
||||
# Network traffic
|
||||
ITEM6() {
|
||||
module_net --print &
|
||||
|
||||
if [ -e "/tmp/module_net" ]; then
|
||||
cat /tmp/module_net
|
||||
fi
|
||||
}
|
||||
|
||||
# Dfmpeg status
|
||||
ITEM7() {
|
||||
module_dfmpeg --print &
|
||||
|
||||
if [ -e "/tmp/module_dfmpeg" ]; then
|
||||
cat /tmp/module_dfmpeg
|
||||
fi
|
||||
}
|
||||
|
||||
# CPU temp
|
||||
ITEM8() {
|
||||
module_temp --print &
|
||||
|
||||
if [ -e "/tmp/module_temp" ]; then
|
||||
cat /tmp/module_temp
|
||||
fi
|
||||
}
|
||||
|
||||
# mocp/cmus status
|
||||
ITEM9() {
|
||||
module_music --print &
|
||||
|
||||
if [ -e "/tmp/module_music" ]; then
|
||||
cat /tmp/module_music
|
||||
fi
|
||||
}
|
||||
|
||||
# Newsboat unreads
|
||||
ITEM10() {
|
||||
module_news --print &
|
||||
|
||||
if [ -e "/tmp/module_news" ]; then
|
||||
cat /tmp/module_news
|
||||
fi
|
||||
}
|
||||
|
||||
# Battery percentage/charging status
|
||||
ITEM11() {
|
||||
module_bat --print &
|
||||
|
||||
if [ -e "/tmp/module_bat" ]; then
|
||||
cat /tmp/module_bat
|
||||
fi
|
||||
}
|
||||
|
||||
# Set text variables that we can print later
|
||||
ptext() {
|
||||
# Output of commands
|
||||
# We're doing this so we can manipulate them easily for various reasons.
|
||||
ITEMCMD1="$(echo "$(ITEM1)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
ITEMCMD2="$(echo "$(ITEM2)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
ITEMCMD3="$(echo "$(ITEM3)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
ITEMCMD4="$(echo "$(ITEM4)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
ITEMCMD5="$(echo "$(ITEM5)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
ITEMCMD6="$(echo "$(ITEM6)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
ITEMCMD7="$(echo "$(ITEM7)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
ITEMCMD8="$(echo "$(ITEM8)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
ITEMCMD9="$(echo "$(ITEM9)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
ITEMCMD10="$(echo "$(ITEM10)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
ITEMCMD11="$(echo "$(ITEM11)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
itemcmd1="$(echo "$(ITEM1)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
itemcmd2="$(echo "$(ITEM2)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
itemcmd3="$(echo "$(ITEM3)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
itemcmd4="$(echo "$(ITEM4)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
itemcmd5="$(echo "$(ITEM5)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
itemcmd6="$(echo "$(ITEM6)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
itemcmd7="$(echo "$(ITEM7)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
itemcmd8="$(echo "$(ITEM8)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
itemcmd9="$(echo "$(ITEM9)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
itemcmd10="$(echo "$(ITEM10)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
itemcmd11="$(echo "$(ITEM11)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
|
||||
# Add colors to them
|
||||
ITEMCMD1="$FSETCOLORCMD7$BSETCOLORCMD7$ITEMCMD1"
|
||||
ITEMCMD2="$FSETCOLORCMD11$BSETCOLORCMD11$ITEMCMD2"
|
||||
ITEMCMD3="$FSETCOLORCMD10$BSETCOLORCMD10$ITEMCMD3"
|
||||
ITEMCMD4="$FSETCOLORCMD8$BSETCOLORCMD8$ITEMCMD4"
|
||||
ITEMCMD5="$FSETCOLORCMD3$BSETCOLORCMD3$ITEMCMD5"
|
||||
ITEMCMD6="$FSETCOLORCMD6$BSETCOLORCMD6$ITEMCMD6"
|
||||
ITEMCMD7="$FSETCOLORCMD5$BSETCOLORCMD5$ITEMCMD7"
|
||||
ITEMCMD8="$FSETCOLORCMD4$BSETCOLORCMD4$ITEMCMD8"
|
||||
ITEMCMD9="$FSETCOLORCMD2$BSETCOLORCMD2$ITEMCMD9"
|
||||
ITEMCMD10="$FSETCOLORCMD9$BSETCOLORCMD9$ITEMCMD10"
|
||||
ITEMCMD11="$FSETCOLORCMD8$BSETCOLORCMD8$ITEMCMD11"
|
||||
itemcmd1="$FSETCOLORCMD7$BSETCOLORCMD7$itemcmd1"
|
||||
itemcmd2="$FSETCOLORCMD11$BSETCOLORCMD11$itemcmd2"
|
||||
itemcmd3="$FSETCOLORCMD10$BSETCOLORCMD10$itemcmd3"
|
||||
itemcmd4="$FSETCOLORCMD8$BSETCOLORCMD8$itemcmd4"
|
||||
itemcmd5="$FSETCOLORCMD3$BSETCOLORCMD3$itemcmd5"
|
||||
itemcmd6="$FSETCOLORCMD6$BSETCOLORCMD6$itemcmd6"
|
||||
itemcmd7="$FSETCOLORCMD5$BSETCOLORCMD5$itemcmd7"
|
||||
itemcmd8="$FSETCOLORCMD4$BSETCOLORCMD4$itemcmd8"
|
||||
itemcmd9="$FSETCOLORCMD2$BSETCOLORCMD2$itemcmd9"
|
||||
itemcmd10="$FSETCOLORCMD9$BSETCOLORCMD9$itemcmd10"
|
||||
itemcmd11="$FSETCOLORCMD8$BSETCOLORCMD8$itemcmd11"
|
||||
|
||||
# Clickability
|
||||
if [ "$CLICKABLE" = "true" ]; then
|
||||
ITEMS_TEXT="$(echo "$ITEM_ORDER" | sed "s|@10|\x10$ITEMCMD10|; s|@11|\x11$ITEMCMD11|; s|@1|\x01$ITEMCMD1|; s|@2|\x02$ITEMCMD2|; s|@3|\x03$ITEMCMD3|; s|@4|\x04$ITEMCMD4|; s|@5|\x05$ITEMCMD5|; s|@6|\x06$ITEMCMD6|; s|@7|\x07$ITEMCMD7|; s|@8|\x08$ITEMCMD8|; s|@9|\x09$ITEMCMD9|; s|%|%%|g")"
|
||||
ITEMS_TEXT="$(echo "$ITEM_ORDER" | sed "s|@10|\x10$itemcmd10|; s|@11|\x11$itemcmd11|; s|@1|\x01$itemcmd1|; s|@2|\x02$itemcmd2|; s|@3|\x03$itemcmd3|; s|@4|\x04$itemcmd4|; s|@5|\x05$itemcmd5|; s|@6|\x06$itemcmd6|; s|@7|\x07$itemcmd7|; s|@8|\x08$itemcmd8|; s|@9|\x09$itemcmd9|; s|%|%%|g")"
|
||||
else
|
||||
ITEMS_TEXT="$(echo "$ITEM_ORDER" | sed "s|@10|$ITEMCMD10|; s|@11|$ITEMCMD11|; s|@1|$ITEMCMD1|; s|@2|$ITEMCMD2|; s|@3|$ITEMCMD3|; s|@4|$ITEMCMD4|; s|@5|$ITEMCMD5|; s|@6|$ITEMCMD6|; s|@7|$ITEMCMD7|; s|@8|$ITEMCMD8|; s|@9|$ITEMCMD9|; s|%|%%|g")"
|
||||
ITEMS_TEXT="$(echo "$ITEM_ORDER" | sed "s|@10|$itemcmd10|; s|@11|$itemcmd11|; s|@1|$itemcmd1|; s|@2|$itemcmd2|; s|@3|$itemcmd3|; s|@4|$itemcmd4|; s|@5|$itemcmd5|; s|@6|$itemcmd6|; s|@7|$itemcmd7|; s|@8|$itemcmd8|; s|@9|$itemcmd9|; s|%|%%|g")"
|
||||
fi
|
||||
|
||||
# Auto-get character limit based on screen resolution
|
||||
|
@ -271,48 +363,48 @@ PRINT_TEXT() {
|
|||
|
||||
if [ "$CHARS" != "false" ]; then
|
||||
# Truncate item 11
|
||||
if [ "$(printf $ITEMCMD1$ITEMCMD2$ITEMCMD3$ITEMCMD4$ITEMCMD5$ITEMCMD6$ITEMCMD7$ITEMCMD8$ITEMCMD9$ITEMCMD10$ITEMCMD11 | wc -c)" -gt "$CHARS" ]; then
|
||||
ITEMCMD11=""
|
||||
if [ "$(printf $itemcmd1$itemcmd2$itemcmd3$itemcmd4$itemcmd5$itemcmd6$itemcmd7$itemcmd8$itemcmd9$itemcmd10$itemcmd11 | wc -c)" -gt "$CHARS" ]; then
|
||||
itemcmd11=""
|
||||
|
||||
# Truncate item 10
|
||||
if [ "$(printf $ITEMCMD1$ITEMCMD2$ITEMCMD3$ITEMCMD4$ITEMCMD5$ITEMCMD6$ITEMCMD7$ITEMCMD8$ITEMCMD9$ITEMCMD10$ITEMCMD11 | wc -c)" -gt "$CHARS" ]; then
|
||||
ITEMCMD10=""
|
||||
if [ "$(printf $itemcmd1$itemcmd2$itemcmd3$itemcmd4$itemcmd5$itemcmd6$itemcmd7$itemcmd8$itemcmd9$itemcmd10$itemcmd11 | wc -c)" -gt "$CHARS" ]; then
|
||||
itemcmd10=""
|
||||
|
||||
# Truncate item 9
|
||||
if [ "$(printf $ITEMCMD1$ITEMCMD2$ITEMCMD3$ITEMCMD4$ITEMCMD5$ITEMCMD6$ITEMCMD7$ITEMCMD8$ITEMCMD9$ITEMCMD10$ITEMCMD11 | wc -c)" -gt "$CHARS" ]; then
|
||||
ITEMCMD9=""
|
||||
if [ "$(printf $itemcmd1$itemcmd2$itemcmd3$itemcmd4$itemcmd5$itemcmd6$itemcmd7$itemcmd8$itemcmd9$itemcmd10$itemcmd11 | wc -c)" -gt "$CHARS" ]; then
|
||||
itemcmd9=""
|
||||
|
||||
# Truncate item 8
|
||||
if [ "$(printf $ITEMCMD1$ITEMCMD2$ITEMCMD3$ITEMCMD4$ITEMCMD5$ITEMCMD6$ITEMCMD7$ITEMCMD8$ITEMCMD9$ITEMCMD10$ITEMCMD11 | wc -c)" -gt "$CHARS" ]; then
|
||||
ITEMCMD8=""
|
||||
if [ "$(printf $itemcmd1$itemcmd2$itemcmd3$itemcmd4$itemcmd5$itemcmd6$itemcmd7$itemcmd8$itemcmd9$itemcmd10$itemcmd11 | wc -c)" -gt "$CHARS" ]; then
|
||||
itemcmd8=""
|
||||
|
||||
# Truncate item 7
|
||||
if [ "$(printf $ITEMCMD1$ITEMCMD2$ITEMCMD3$ITEMCMD4$ITEMCMD5$ITEMCMD6$ITEMCMD7$ITEMCMD8$ITEMCMD9$ITEMCMD10$ITEMCMD11 | wc -c)" -gt "$CHARS" ]; then
|
||||
ITEMCMD7=""
|
||||
if [ "$(printf $itemcmd1$itemcmd2$itemcmd3$itemcmd4$itemcmd5$itemcmd6$itemcmd7$itemcmd8$itemcmd9$itemcmd10$itemcmd11 | wc -c)" -gt "$CHARS" ]; then
|
||||
itemcmd7=""
|
||||
|
||||
# Truncate item 6
|
||||
if [ "$(printf $ITEMCMD1$ITEMCMD2$ITEMCMD3$ITEMCMD4$ITEMCMD5$ITEMCMD6$ITEMCMD7$ITEMCMD8$ITEMCMD9$ITEMCMD10$ITEMCMD11 | wc -c)" -gt "$CHARS" ]; then
|
||||
ITEMCMD6=""
|
||||
if [ "$(printf $itemcmd1$itemcmd2$itemcmd3$itemcmd4$itemcmd5$itemcmd6$itemcmd7$itemcmd8$itemcmd9$itemcmd10$itemcmd11 | wc -c)" -gt "$CHARS" ]; then
|
||||
itemcmd6=""
|
||||
|
||||
# Truncate item 5
|
||||
if [ "$(printf $ITEMCMD1$ITEMCMD2$ITEMCMD3$ITEMCMD4$ITEMCMD5$ITEMCMD6$ITEMCMD7$ITEMCMD8$ITEMCMD9$ITEMCMD10$ITEMCMD11 | wc -c)" -gt "$CHARS" ]; then
|
||||
ITEMCMD5=""
|
||||
if [ "$(printf $itemcmd1$itemcmd2$itemcmd3$itemcmd4$itemcmd5$itemcmd6$itemcmd7$itemcmd8$itemcmd9$itemcmd10$itemcmd11 | wc -c)" -gt "$CHARS" ]; then
|
||||
itemcmd5=""
|
||||
|
||||
# Truncate item 4
|
||||
if [ "$(printf $ITEMCMD1$ITEMCMD2$ITEMCMD3$ITEMCMD4$ITEMCMD5$ITEMCMD6$ITEMCMD7$ITEMCMD8$ITEMCMD9$ITEMCMD10$ITEMCMD11 | wc -c)" -gt "$CHARS" ]; then
|
||||
ITEMCMD4=""
|
||||
if [ "$(printf $itemcmd1$itemcmd2$itemcmd3$itemcmd4$itemcmd5$itemcmd6$itemcmd7$itemcmd8$itemcmd9$itemcmd10$itemcmd11 | wc -c)" -gt "$CHARS" ]; then
|
||||
itemcmd4=""
|
||||
|
||||
# Truncate item 3
|
||||
if [ "$(printf $ITEMCMD1$ITEMCMD2$ITEMCMD3$ITEMCMD4$ITEMCMD5$ITEMCMD6$ITEMCMD7$ITEMCMD8$ITEMCMD9$ITEMCMD10$ITEMCMD11 | wc -c)" -gt "$CHARS" ]; then
|
||||
ITEMCMD3=""
|
||||
if [ "$(printf $itemcmd1$itemcmd2$itemcmd3$itemcmd4$itemcmd5$itemcmd6$itemcmd7$itemcmd8$itemcmd9$itemcmd10$itemcmd11 | wc -c)" -gt "$CHARS" ]; then
|
||||
itemcmd3=""
|
||||
|
||||
# Truncate item 2
|
||||
if [ "$(printf $ITEMCMD1$ITEMCMD2$ITEMCMD3$ITEMCMD4$ITEMCMD5$ITEMCMD6$ITEMCMD7$ITEMCMD8$ITEMCMD9$ITEMCMD10$ITEMCMD11 | wc -c)" -gt "$CHARS" ]; then
|
||||
ITEMCMD2=""
|
||||
if [ "$(printf $itemcmd1$itemcmd2$itemcmd3$itemcmd4$itemcmd5$itemcmd6$itemcmd7$itemcmd8$itemcmd9$itemcmd10$itemcmd11 | wc -c)" -gt "$CHARS" ]; then
|
||||
itemcmd2=""
|
||||
|
||||
# Truncate item 1
|
||||
if [ "$(printf $ITEMCMD1$ITEMCMD2$ITEMCMD3$ITEMCMD4$ITEMCMD5$ITEMCMD6$ITEMCMD7$ITEMCMD8$ITEMCMD9$ITEMCMD10$ITEMCMD11 | wc -c)" -gt "$CHARS" ]; then
|
||||
ITEMCMD1=""
|
||||
if [ "$(printf $itemcmd1$itemcmd2$itemcmd3$itemcmd4$itemcmd5$itemcmd6$itemcmd7$itemcmd8$itemcmd9$itemcmd10$itemcmd11 | wc -c)" -gt "$CHARS" ]; then
|
||||
itemcmd1=""
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -326,303 +418,22 @@ PRINT_TEXT() {
|
|||
fi
|
||||
fi
|
||||
|
||||
PRINT
|
||||
print
|
||||
pgrep -x speedwm > /dev/null || exit 1
|
||||
}
|
||||
|
||||
# RAM usage
|
||||
ITEM1() {
|
||||
if [ "$ENABLE_ITEM1" = "true" ]; then
|
||||
# Used RAM
|
||||
if [ -e "${BINDIR}free" ]; then
|
||||
USEDRAM="$(echo "$(free -h --giga | awk '/^Mem/ {print $3}')B")"
|
||||
fi
|
||||
|
||||
# Total RAM
|
||||
if [ -e "${BINDIR}free" ]; then
|
||||
TOTALRAM="$(echo "$(free -h --giga | awk '/^Mem/ {print $2}')B")"
|
||||
fi
|
||||
|
||||
echo "$SEPARATOR $ITEM1_ICON $ITEM1_FORMAT" | sed "s|@u|$USEDRAM|; s|@t|$TOTALRAM|"
|
||||
fi
|
||||
}
|
||||
|
||||
# Time
|
||||
ITEM2() {
|
||||
if [ "$ENABLE_ITEM2" = "true" ]; then
|
||||
if [ -e "${DATEBINDIR}date" ]; then
|
||||
HOURS="$(date +%H)"
|
||||
MINUTES="$(date +%M)"
|
||||
SECONDS="$(date +%S)"
|
||||
echo "$SEPARATOR $ITEM2_ICON $ITEM2_FORMAT" | sed "s|@h|$HOURS|; s|@m|$MINUTES|; s|@s|$SECONDS|"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Date
|
||||
ITEM3() {
|
||||
if [ "$ENABLE_ITEM3" = "true" ]; then
|
||||
if [ -e "${DATEBINDIR}date" ]; then
|
||||
DAY="$(date +%d)"
|
||||
MONTH="$(date +%m)"
|
||||
YEAR="$(date +%Y)"
|
||||
|
||||
echo "$SEPARATOR $ITEM3_ICON $ITEM3_FORMAT" | sed "s|@d|$DAY|; s|@m|$MONTH|; s|@y|$YEAR|"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Volume
|
||||
ITEM4() {
|
||||
if [ "$ENABLE_ITEM4" = "true" ]; then
|
||||
if [ -e "${BINDIR}pactl" ]; then
|
||||
echo "$SEPARATOR $ITEM4_ICON $(echo $(pactl get-sink-volume 0 | awk '{print $5;exit}'))"
|
||||
else
|
||||
echo "$SEPARATOR $ITEM4_ICON $(echo $(amixer -c 0 get Master | tail -n1 | sed -r "s/.*\[(.*)%\].*/\1/")%)"
|
||||
fi
|
||||
fi
|
||||
|
||||
# get mute
|
||||
if [ "$ITEM4_SHOW_MUTE" = "true" ]; then
|
||||
if [ -e "${BINDIR}pactl" ]; then
|
||||
pactl get-sink-mute 0 | grep -q yes && echo " $ITEM4_MUTE_TEXT"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Weather
|
||||
ITEM5() {
|
||||
if [ "$ENABLE_ITEM5" = "true" ]; then
|
||||
if [ -e "${BINDIR}curl" ]; then
|
||||
if [ -e "/tmp/itest" ]; then
|
||||
if [ -e "/tmp/wstatus" ]; then
|
||||
grep -q "<html>" /tmp/wstatus || echo "$SEPARATOR $ITEM5_ICON $(cat /tmp/wstatus)"
|
||||
else
|
||||
echo "$(curl -s wttr.in/?format="%C"), $(curl -s wttr.in/?format=3 | sed 's/.* //; s/.*\(.....\)/\1/')" > /tmp/wstatus
|
||||
echo "$SEPARATOR $ITEM5_ICON $(cat /tmp/wstatus)"
|
||||
fi
|
||||
else
|
||||
curl -so /tmp/itest wttr.in && hasinternet=true
|
||||
|
||||
if [ "$hasinternet" != "true" ]; then
|
||||
rm -f /tmp/itest
|
||||
rm -f /tmp/wstatus
|
||||
ITEMCMD5=""
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Network traffic
|
||||
ITEM6() {
|
||||
if [ "$ENABLE_ITEM6" = "true" ]; then
|
||||
if [ -e "${BINDIR}awk" ]; then
|
||||
echo "$SEPARATOR $ITEM6_ICON $(awk '{$1=$1/1024000; print $1"B";}' /sys/class/net/[ew]*/statistics/tx_bytes | sed "s/.*\(....\)/\1/; s|B|B/s |; s/[.]/0./")"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Dfmpeg status
|
||||
ITEM7() {
|
||||
# Check if we're recording with dfmpeg or not
|
||||
if [ "$ENABLE_ITEM7" = "true" ]; then
|
||||
if [ -e "/tmp/dfmpeg-recording" ]; then
|
||||
echo "$SEPARATOR $ITEM7_ICON $ITEM7_RECORDING_TEXT"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# CPU temp
|
||||
ITEM8() {
|
||||
if [ "$ENABLE_ITEM8" = "true" ]; then
|
||||
if [ -e "${BINDIR}sensors" ]; then
|
||||
if [ "$ITEM8_FORMAT_CELSIUS" = "true" ]; then
|
||||
echo "$SEPARATOR $ITEM8_ICON $(sensors | grep temp1 | awk '{ print $2 }')"
|
||||
touch /tmp/iscelsius
|
||||
else
|
||||
echo "$SEPARATOR $ITEM8_ICON $(sensors -f | grep temp1 | awk '{ print $2 }')"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# mocp/cmus status
|
||||
ITEM9() {
|
||||
# Auto set backend if set to auto
|
||||
if [ "$ITEM9_BACKEND" = "auto" ]; then
|
||||
if [ -e "${BINDIR}cmus" ]; then
|
||||
ITEM9_BACKEND="cmus"
|
||||
elif [ -e "${BINDIR}mocp" ]; then
|
||||
ITEM9_BACKEND="mocp"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ENABLE_ITEM9" = "true" ]; then
|
||||
if [ "$ITEM9_BACKEND" = "mocp" ]; then
|
||||
if [ -e "${BINDIR}mocp" ]; then
|
||||
if [ "$(echo $(mocp -Q %file))" != "" ]; then
|
||||
|
||||
# filename
|
||||
if [ "$ITEM9_DISPLAY_FILE" = "true" ]; then
|
||||
if [ "$(mocp -Q %file | head -n 1)" != "" ]; then
|
||||
echo "$SEPARATOR $ITEM9_ICON $ITEM9_PRE_FILE$(basename "$(mocp -Q %file)" | sed 's|\(.*\)[.].*|\1|')$ITEM9_POST_FILE"
|
||||
fi
|
||||
else
|
||||
|
||||
# artist
|
||||
if [ "$ITEM9_DISPLAY_ARTIST" = "true" ]; then
|
||||
if [ "$(mocp -Q %artist | head -n 1)" != "" ]; then
|
||||
MUSIC_ARTIST="$(mocp -Q %artist)"
|
||||
fi
|
||||
fi
|
||||
|
||||
# title
|
||||
if [ "$ITEM9_DISPLAY_TITLE" = "true" ]; then
|
||||
if [ "$(mocp -Q %song | head -n 1)" != "" ]; then
|
||||
MUSIC_SONG="$(mocp -Q %song)"
|
||||
fi
|
||||
fi
|
||||
|
||||
# album
|
||||
if [ "$ITEM9_DISPLAY_ALBUM" = "true" ]; then
|
||||
if [ "$(mocp -Q %album | head -n 1)" != "" ]; then
|
||||
MUSIC_ALBUM="$(mocp -Q %album)"
|
||||
fi
|
||||
fi
|
||||
|
||||
# time elapsed
|
||||
if [ "$ITEM9_DISPLAY_TIMEELAPSED" = "true" ]; then
|
||||
if [ "$(mocp -Q %tl | head -n 1)" != "" ]; then
|
||||
MUSIC_TIMEELAPSED="$(mocp -Q %ct)"
|
||||
fi
|
||||
fi
|
||||
|
||||
# total time
|
||||
if [ "$ITEM9_DISPLAY_TIMETOTAL" = "true" ]; then
|
||||
if [ "$(mocp -Q %tt | head -n 1)" != "" ]; then
|
||||
MUSIC_TIMETOTAL="$(mocp -Q %tt)"
|
||||
fi
|
||||
fi
|
||||
|
||||
data="$(printf "$ITEM9_FORMAT" | sed "s|@ab|$MUSIC_ALBUM|; s|@t|$MUSIC_SONG|; s|@g||; s|@a|$MUSIC_ARTIST|; s|@tt|$MUSIC_TIMETOTAL|; s|@te|$MUSIC_TIMEELAPSED|; s| ||g")"
|
||||
|
||||
# actually print it
|
||||
echo "$SEPARATOR $ITEM9_ICON $data"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ENABLE_ITEM9" = "true" ]; then
|
||||
if [ -e "${BINDIR}cmus-remote" ]; then
|
||||
if [ "$(cmus-remote -C status | head -n 1 | awk '{ print $2 }')" = "playing" ]; then
|
||||
if [ "$ITEM9_DISPLAY_FILE" = "true" ]; then
|
||||
echo "$SEPARATOR $ITEM9_ICON $ITEM9_PRE_FILE$(basename "$(cmus-remote -C status | grep file)"| sed 's|\(.*\)[.].*|\1|')$ITEM9_POST_FILE"
|
||||
else
|
||||
|
||||
# artist
|
||||
if [ "$ITEM9_DISPLAY_ARTIST" = "true" ]; then
|
||||
if [ "$(cmus-remote -C status | grep "tag artist")" != "" ]; then
|
||||
MUSIC_ARTIST="$(cmus-remote -C status | grep "tag artist" | sed "s/tag artist //g")"
|
||||
fi
|
||||
fi
|
||||
|
||||
# title
|
||||
if [ "$ITEM9_DISPLAY_TITLE" = "true" ]; then
|
||||
if [ "$(cmus-remote -C status | grep "tag title")" != "" ]; then
|
||||
MUSIC_SONG="$(cmus-remote -C status | grep "tag title" | sed "s/tag title //g")"
|
||||
fi
|
||||
fi
|
||||
|
||||
# album
|
||||
if [ "$ITEM9_DISPLAY_ALBUM" = "true" ]; then
|
||||
if [ "$(cmus-remote -C status | grep "tag album")" != "" ]; then
|
||||
MUSIC_ALBUM="$(cmus-remote -C status | grep "tag album" | head -n 1 | sed "s/tag album //g")"
|
||||
fi
|
||||
fi
|
||||
|
||||
# genre
|
||||
if [ "$ITEM9_DISPLAY_GENRE" = "true" ]; then
|
||||
if [ "$(cmus-remote -C status | grep "tag genre")" != "" ]; then
|
||||
MUSIC_GENRE="$(cmus-remote -C status | grep "tag genre" | sed "s/tag genre //g")"
|
||||
fi
|
||||
fi
|
||||
|
||||
# time elapsed
|
||||
if [ "$ITEM9_DISPLAY_TIMEELAPSED" = "true" ]; then
|
||||
if [ "$(cmus-remote -Q | grep position | sed "s/position //g")" != "" ]; then
|
||||
MUSIC_TIMEELAPSED="$(cmus-remote -Q | grep position | sed "s/position //g" | awk '{printf "%02d:%02d:%02d",$0/3600,$0%3600/60,$0%60}' | sed "s/00://")"
|
||||
fi
|
||||
fi
|
||||
|
||||
# total time
|
||||
if [ "$ITEM9_DISPLAY_TIMETOTAL" = "true" ]; then
|
||||
if [ "$(cmus-remote -Q | grep duration | sed "s/duration //g")" != "" ]; then
|
||||
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://")"
|
||||
fi
|
||||
fi
|
||||
|
||||
data="$(printf "$ITEM9_FORMAT" | sed "s|@ab|$MUSIC_ALBUM|; s|@t|$MUSIC_SONG|; s|@g|$MUSIC_GENRE|; s|@a|$MUSIC_ARTIST|; s|@tt|$MUSIC_TIMETOTAL|; s|@te|$MUSIC_TIMEELAPSED|; s| ||g")"
|
||||
|
||||
# actually print it
|
||||
if [ "$data" != "" ]; then
|
||||
echo "$SEPARATOR $ITEM9_ICON $data"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Newsboat unreads
|
||||
ITEM10() {
|
||||
if [ "$ENABLE_ITEM10" = "true" ]; then
|
||||
if [ -e "${BINDIR}newsboat" ]; then
|
||||
NEWSCOUNT="$(newsboat -x print-unread | awk '{ print $1 }')"
|
||||
|
||||
if [ "$NEWSCOUNT" != "Error:" ]; then
|
||||
echo "$SEPARATOR $ITEM10_ICON $NEWSCOUNT $ITEM10_TEXT"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Battery percentage/charging status
|
||||
ITEM11() {
|
||||
if [ "$ENABLE_ITEM11" = "true" ]; then
|
||||
# print capacity
|
||||
if [ -e "/sys/class/power_supply/BAT0/capacity" ]; then
|
||||
echo "$SEPARATOR $ITEM11_ICON $(cat /sys/class/power_supply/BAT0/capacity)%"
|
||||
fi
|
||||
|
||||
# print capacity for second battery if it exists
|
||||
if [ -e "/sys/class/power_supply/BAT1/capacity" ]; then
|
||||
echo "$SEPARATOR $ITEM11_ICON $(cat /sys/class/power_supply/BAT1/capacity)%"
|
||||
fi
|
||||
|
||||
# show charging status
|
||||
if [ -e "${BINDIR}acpi" ]; then
|
||||
if [ "$ITEM11_SHOW_CHARGING_STATUS" = "true" ]; then
|
||||
CHARGESTATUS=$(echo ", $(acpi | awk '{ print $3 }' | sed "s|,||g" | sed "s|Discharging|$ITEM11_DISCHARGING_TEXT|g; s|Charging|$ITEM11_CHARGING_TEXT|g; s|Fully charged|$ITEM11_FULL_TEXT|g")") && echo $CHARGESTATUS
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# base
|
||||
BASE() {
|
||||
PRINT_TEXT
|
||||
base() {
|
||||
ptext
|
||||
sleep $REFRESHDELAY
|
||||
BASE
|
||||
base
|
||||
}
|
||||
|
||||
setloading
|
||||
|
||||
SETCOLORS_CMD
|
||||
PRINT_TEXT
|
||||
BASE
|
||||
setcolors2d
|
||||
ptext
|
||||
base
|
||||
|
||||
echo "status: Stopped printing."
|
||||
printf "$0: Stopped printing."
|
||||
exit 0
|
||||
|
|
18
statusbar.h
18
statusbar.h
|
@ -20,13 +20,13 @@
|
|||
*
|
||||
*/
|
||||
static const StatusCmd statuscmds[] = {
|
||||
{ "module_ram", 1 },
|
||||
{ "module_time", 2 },
|
||||
{ "module_date", 3 },
|
||||
{ "module_vol", 4 },
|
||||
{ "module_weather", 5 },
|
||||
{ "module_net", 6 },
|
||||
{ "module_dfmpeg", 7 },
|
||||
{ "module_temp", 8 },
|
||||
{ "module_music", 9 },
|
||||
{ "module_ram --click", 1 },
|
||||
{ "module_time --click", 2 },
|
||||
{ "module_date --click", 3 },
|
||||
{ "module_vol --click", 4 },
|
||||
{ "module_weather --click", 5 },
|
||||
{ "module_net --click", 6 },
|
||||
{ "module_dfmpeg --click", 7 },
|
||||
{ "module_temp --click", 8 },
|
||||
{ "module_music --click", 9 },
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue