power menu, redshift, polybar
This commit is contained in:
16
.config/polybar/scripts/info-timew/README.md
Normal file
16
.config/polybar/scripts/info-timew/README.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# Script: info-timew
|
||||
|
||||
This script displays the daily tracked time. You can click it, to start tracking, using timew.
|
||||
|
||||
You can use the `--weekday` toggle, to view daily or weekly time spend. (may take the `interval` time to update)
|
||||
|
||||
## Module
|
||||
|
||||
```ini
|
||||
[module/info-timew]
|
||||
type = custom/script
|
||||
exec = ~/polybar-scripts/info-timew.sh
|
||||
interval = 10
|
||||
click-left = ~/polybar-scripts/info-timew.sh --toggle
|
||||
click-right = ~/polybar-scripts/info-timew.sh --weekday
|
||||
```
|
||||
40
.config/polybar/scripts/info-timew/info-timew.sh
Normal file
40
.config/polybar/scripts/info-timew/info-timew.sh
Normal file
@@ -0,0 +1,40 @@
|
||||
#!/bin/sh
|
||||
|
||||
MODE_FILE="$HOME/.config/polybar/info-timew.mode"
|
||||
|
||||
if [ ! -f "${MODE_FILE}" ]; then
|
||||
touch "${MODE_FILE}"
|
||||
echo "d" > "${MODE_FILE}"
|
||||
fi
|
||||
|
||||
ACTUAL_MODE=$(cat "${MODE_FILE}")
|
||||
|
||||
if timew > /dev/null 2>&1; then
|
||||
if [ "$ACTUAL_MODE" = "w" ]; then
|
||||
printf '%s/week' "$(timew summary :week | awk '{print $NF}' | tail -2 | head -1)"
|
||||
else
|
||||
printf '%s/day' "$(timew summary :day | awk '{print $NF}' | tail -2 | head -1)"
|
||||
fi
|
||||
else
|
||||
printf "no tracking"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ "${1}" = "--weekday" ]; then
|
||||
if [ "$ACTUAL_MODE" = "w" ]; then
|
||||
echo "d" > "${MODE_FILE}"
|
||||
else
|
||||
echo "w" > "${MODE_FILE}"
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ "${1}" = "--toggle" ]; then
|
||||
if timew; then
|
||||
timew stop;
|
||||
else
|
||||
timew start;
|
||||
fi
|
||||
fi
|
||||
Reference in New Issue
Block a user