diff options
| -rw-r--r-- | sway/config | 2 | ||||
| -rw-r--r-- | waybar/config | 12 | ||||
| -rwxr-xr-x | waybar/rat.sh | 31 | ||||
| -rw-r--r-- | waybar/style.css | 11 |
4 files changed, 50 insertions, 6 deletions
diff --git a/sway/config b/sway/config index 558a1a2..5f1015a 100644 --- a/sway/config +++ b/sway/config @@ -210,7 +210,7 @@ for_window [app_id="float"] floating enable; resize set 50 ppt 50 ppt for_window [app_id="numbat"] floating enable; resize set 40 ppt 35 ppt for_window [app_id="xoppdoggin"] floating enable; resize set 90 ppt 90 ppt for_window [app_id="wallpicker"] floating enable; resize set 90 ppt 90 ppt -for_window [app_id="ration"] floating enable; resize set 30 ppt 30 ppt +for_window [app_id="ration"] floating enable; resize set 600 350 for_window [class="Inkscape"] floating enable; resize set 90 ppt 90 ppt for_window [class="vimscape"] floating enable; resize set 30 ppt 25 ppt; move down 300; move left 550 diff --git a/waybar/config b/waybar/config index 8da3977..9c89b95 100644 --- a/waybar/config +++ b/waybar/config @@ -3,9 +3,8 @@ "spacing": 4, // Gaps between modules (4px) // Choose the order of the modules - "modules-left": ["sway/workspaces", "sway/mode", "sway/scratchpad", "custom/media"], - "modules-center": ["sway/window"], - "modules-right": ["mpd", "idle_inhibitor", "backlight", "pulseaudio", "network", "temperature", "memory", "battery", "clock", "tray"], + "modules-left": ["sway/workspaces", "sway/mode", "sway/scratchpad", "sway/window"], + "modules-right": ["idle_inhibitor", "backlight", "pulseaudio", "custom/rat", "network", "temperature", "memory", "battery", "clock", "tray"], // Modules configuration "sway/workspaces": { @@ -25,6 +24,13 @@ "tooltip": true, "tooltip-format": "{app}: {title}" }, + "custom/rat": { + "format": " {text}", + "return-type": "json", + "exec": "$HOME/.config/waybar/rat.sh 2> /dev/null", + "on-click": "kitty --app-id ration bash -i ration", + "signal": 1, + }, "idle_inhibitor": { "format": "{icon}", "format-icons": { diff --git a/waybar/rat.sh b/waybar/rat.sh new file mode 100755 index 0000000..04cb579 --- /dev/null +++ b/waybar/rat.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +SHARE=$HOME/.local/share/rat + +return_json () { + echo '{"text": "'"$1"'", "class": "'"$2"'"}' +} + +get_time () { + endtime=$(cat $SHARE/data) + remaining=$(($endtime-$(date +%s))) + timer=$(date -u -d @$remaining +%T) + timer=${timer#00:} + timer=${timer#0} + return_json $timer "" +} + +get_program () { + name=$(cat $SHARE/data) + return_json $name "" +} + +status=$(cat $SHARE/status) + +case $status in + 0) return_json caged "" ;; + 1) get_time ;; + 2) return_json waiting waiting ;; + 3) get_program ;; + 4) return_json working "" ;; +esac diff --git a/waybar/style.css b/waybar/style.css index 92c4d65..082ed20 100644 --- a/waybar/style.css +++ b/waybar/style.css @@ -73,7 +73,7 @@ button { #network, #pulseaudio, #wireplumber, -#custom-media, +#custom-rat, #tray, #mode, #idle_inhibitor, @@ -84,11 +84,14 @@ button { border-top: 3px solid @color7; } -#window, #workspaces { margin: 0 4px; } +#window { + margin: 0 20px; +} + /* If workspaces is the leftmost module, omit left margin */ .modules-left > widget:first-child > #workspaces { margin-left: 0; @@ -127,12 +130,15 @@ button { @keyframes blink { to { background-color: #ffffff; + border-top: 3px solid #ffffff; color: #000000; } } +#custom-rat.waiting, #battery.critical:not(.charging) { background-color: #f53c3c; + border-top: 3px solid #f53c3c; color: #ffffff; animation-name: blink; animation-duration: 0.5s; @@ -155,6 +161,7 @@ button { color: #ffffff; } + #network { padding-right: 15px; } |