This commit is contained in:
2024-02-27 02:25:37 +01:00
parent 67a44a5ff8
commit 6d92c68425
14 changed files with 265 additions and 89 deletions

View File

@ -9,7 +9,7 @@
// Choose the order of the modules
"modules-left": ["hyprland/workspaces", "hyprland/window"],
"modules-center": ["custom/inhibit", "idle_inhibitor", "custom/dunst"],
"modules-right": ["hyprland/submap", "custom/wifionice", "custom/spotify", "pulseaudio", "custom/network", "cpu", "memory", "temperature", "backlight", "battery", "clock", "tray"],
"modules-right": ["hyprland/submap", "custom/wifionice", "mpd", "pulseaudio", "custom/fsi", "custom/fsm", "custom/network", "cpu", "memory", "temperature", "backlight", "battery", "clock", "tray"],
// Modules configuration
"hyprland/workspaces": {
"format-alt": "{name}",
@ -30,6 +30,32 @@
"default": ""
}
},
"mpd": {
"format": "[ {title} ]",
"format-disconnected": "Disconnected ",
"max-length": 40,
"server" : "localhost",
"format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ",
"interval": 2,
"consume-icons": {
"on": " " // Icon shows only when "consume" is on
},
"random-icons": {
"on": " "
},
"repeat-icons": {
"on": " "
},
"single-icons": {
"on": "1 "
},
"state-icons": {
"paused": "",
"playing": ""
},
"tooltip-format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon} [ {artist} ] - [ {title} ] on [ {album} ] [ {elapsedTime:%M:%S}/{totalTime:%M:%S} ]",
"tooltip-format-disconnected": "MPD (disconnected)"
},
"custom/spotify": {
"format-alt": "{status_icon} {title}",
"format-alt-click": "click-middle",
@ -48,6 +74,22 @@
"escape": true,
"interval": 3
},
"custom/fsi": {
"format": "FSI",
"exec": "~/.config/waybar/scripts/fsmi.sh fsi",
"return-type": "json",
"tooltip": false,
"on-click": "/bin/true", // Enables refresh on click
"interval": 600
},
"custom/fsm": {
"format": "FSM",
"exec": "~/.config/waybar/scripts/fsmi.sh fsm",
"return-type": "json",
"tooltip": false,
"on-click": "/bin/true", // Enables refresh on click
"interval": 600
},
"custom/inhibit": {
"format": "☕",
"on-click": "systemd-inhibit --what=handle-lid-switch --who=waybar --why='Inhibiting suspend' --mode=block sleep 120 & notify-send 'Inhibiting suspend' 'Waybar will prevent the system from suspending for 2 minutes'"

View File

@ -35,3 +35,9 @@
@define-color pink #f5c2e7;
@define-color flamingo #f2cdcd;
@define-color rosewater #f5e0dc;
@define-color bad @red;
@define-color good @green;
@define-color off @surface0;
@define-color on @yellow;

26
waybar/scripts/fsmi.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
if [ "$#" -ne 1 ]; then
echo "Usage: fsmi.sh <fsi|fsm>"
exit 1
fi
if [[ "$1" == "fsi" ]]; then
state=$(curl https://www-test.fsmi.org/spaceapi/fsi.json 2>/dev/null | jq .state.open)
elif [[ "$1" == "fsm" ]]; then
state=$(curl https://www-test.fsmi.org/spaceapi/fsm.json 2>/dev/null | jq .state.open)
fi
class="fs-closed"
if [[ "$state" == "true" ]]; then
class="fs-open"
elif [[ "$state" == "" ]]; then
class="fs-unknown"
fi
cat <<EOF | jq -r --unbuffered --compact-output
{
"text": "$state",
"alt": "$1",
"class": "$class"
}
EOF

View File

@ -13,10 +13,10 @@ print_train_info() {
wifionice_conn=$( echo "$wifionice" | jq -r .connectivity.currentState )
wifionice_nextConn=$( echo "$wifionice" | jq -r .connectivity.nextState )
wifionice_connTime=$( echo "$wifionice" | jq -r .connectivity.remainingTimeSeconds | awk '{printf "%d m", $1/60}' )
if [ "$wifionice_speed" -ne 0 ]; then
wifionice_speed=" - $wifionice_speed km/h"
else
if [ "$wifionice_speed" = "0" ]; then
wifionice_speed=""
else
wifionice_speed=" $wifionice_speed km/h"
fi
station=$(curl -sLf https://iceportal.de/api1/rs/tripInfo/trip | jq '[.[].stops[]? | select(.info.passed == false)][0]')
@ -41,7 +41,7 @@ print_train_info() {
net_text="Net: $wifionice_conn$wifionice_nextConn ($wifionice_connTime)"
fi
echo "$icon $station_arrival$station_delay - $station_name, Gl. $station_track$wifionice_speed | $net_text"
echo "$icon $station_arrival$station_delay - $station_name, Gl. $station_track$wifionice_speed"
fi
sleep 10
else

View File

@ -4,12 +4,13 @@
/* `otf-font-awesome` is required to be installed for icons */
font-family: FontAwesome, Roboto, Helvetica, Arial, sans-serif;
font-size: 13px;
color: @text;
}
window#waybar {
background-color: shade(@base, 0.9);
border: 2px solid alpha(@mantle, 0.3);
border-bottom: 3px solid alpha(@crust, 0.5);
/* border: 2px solid alpha(@mantle, 0.3); */
border-bottom: 1px solid alpha(@crust, 0.5);
color: @text;
transition-property: background-color;
transition-duration: .5s;
@ -66,7 +67,7 @@ button:hover {
}
#workspaces button.urgent {
background-color: @red;
background-color: @bad;
}
#mode {
@ -92,10 +93,14 @@ button:hover {
#mode,
#idle_inhibitor,
#custom-spotify,
#mpd,
#scratchpad,
#custom-fsi,
#custom-fsm,
#mpd {
padding: 0 10px;
color: @text;
background-color: @off;
border-bottom: 3px solid alpha(@crust, 0.5);
}
#window,
@ -120,20 +125,22 @@ button:hover {
#memory,
#clock,
#memory,
#disk,
#idle_inhibitor.activated {
background-color: @lavender;
color: @base;
#disk {
background-color: @off;
color: @text;
}
#battery {
background-color: @yellow;
#idle_inhibitor.activated {
background-color: @good;
color: @base;
}
#battery {
background-color: @off;
}
#battery.charging, #battery.plugged {
color: @base;
background-color: @green;
background-color: @good;
}
@keyframes blink {
@ -144,7 +151,7 @@ button:hover {
}
#battery.critical:not(.charging) {
background-color: @red;
background-color: @bad;
color: @base;
animation-name: blink;
animation-duration: 0.5s;
@ -153,8 +160,15 @@ button:hover {
animation-direction: alternate;
}
#custom-fsi.fs-closed,
#custom-fsm.fs-closed,
#custom-wifionice {
background-color: @red;
background-color: @off;
}
#custom-fsi.fs-unknown,
#custom-fsm.fs-unknown {
background-color: @bad;
color: @base;
}
@ -162,54 +176,56 @@ label:focus {
background-color: @base;
}
#cpu {
background-color: @green;
#custom-fsi.fs-open,
#custom-fsm.fs-open {
background-color: @good;
color: @base;
}
#backlight {
background-color: @overlay1;
background-color: @off;
}
#custom-network {
background-color: @sky;
color: @base;
background-color: @off;
}
#network.disconnected {
background-color: @overlay2;
background-color: @bad;
color: @base;
}
#pulseaudio {
background-color: @yellow;
color: @base;
background-color: @off;
}
#custom-dunst.disabled,
#pulseaudio.source-muted {
background-color: @red;
background-color: @bad;
color: @base;
}
#custom-media {
background-color: @base;
color: @text;
min-width: 100px;
background-color: @off;
}
#mpd.playing,
#custom-spotify {
background-color: @green;
background-color: @good;
color: @base;
}
#mpd.stopped,
#mpd.paused {
background-color: @off;
}
#temperature {
background-color: @peach;
color: @base;
background-color: @off;
}
#temperature.critical {
background-color: @red;
background-color: @bad;
}
#tray {
@ -222,5 +238,5 @@ label:focus {
#tray > .needs-attention {
-gtk-icon-effect: highlight;
background-color: @red;
background-color: @bad;
}