diff options
Diffstat (limited to 'users/ryan/linux/waybar')
| -rw-r--r-- | users/ryan/linux/waybar/config | 167 | ||||
| -rwxr-xr-x | users/ryan/linux/waybar/modules/check-for-music.sh | 7 | ||||
| -rwxr-xr-x | users/ryan/linux/waybar/modules/spotify.sh | 19 | ||||
| -rwxr-xr-x | users/ryan/linux/waybar/modules/storage.sh | 25 | ||||
| -rwxr-xr-x | users/ryan/linux/waybar/modules/weather.sh | 77 | ||||
| -rw-r--r-- | users/ryan/linux/waybar/style.css | 77 |
6 files changed, 372 insertions, 0 deletions
diff --git a/users/ryan/linux/waybar/config b/users/ryan/linux/waybar/config new file mode 100644 index 0000000..62e6b20 --- /dev/null +++ b/users/ryan/linux/waybar/config | |||
| @@ -0,0 +1,167 @@ | |||
| 1 | { | ||
| 2 | "layer": "top", | ||
| 3 | "position": "top", | ||
| 4 | "height": 30, | ||
| 5 | |||
| 6 | "modules-left": ["hyprland/workspaces", "hyprland/submap"], | ||
| 7 | "modules-center": ["hyprland/window"], | ||
| 8 | "modules-right": ["tray", "custom/spotify", "privacy", "custom/weather", "custom/mail", "custom/storage", "backlight", "bluetooth", "pulseaudio", "network", "idle_inhibitor", "battery", "battery#num2", "clock"], | ||
| 9 | "hyprland/submap": { | ||
| 10 | "format": " {}" | ||
| 11 | }, | ||
| 12 | "hyprland/workspaces": { | ||
| 13 | "format": "{id}", | ||
| 14 | "all-outputs": false, | ||
| 15 | "disable-scroll": true | ||
| 16 | }, | ||
| 17 | "hyprland/window": { | ||
| 18 | "max-length": 80, | ||
| 19 | "tooltip": false, | ||
| 20 | "separate-outputs": true | ||
| 21 | }, | ||
| 22 | "clock": { | ||
| 23 | "format": "{:%a %d %b %H:%M}", | ||
| 24 | "tooltip": false | ||
| 25 | }, | ||
| 26 | "battery": { | ||
| 27 | "format": "{capacity}% {icon}", | ||
| 28 | "format-alt": "{time} {icon}", | ||
| 29 | "format-icons": ["", "", "", "", ""], | ||
| 30 | "format-charging": "{capacity}% ", | ||
| 31 | "interval": 30, | ||
| 32 | "states": { | ||
| 33 | "warning": 25, | ||
| 34 | "critical": 10 | ||
| 35 | }, | ||
| 36 | "tooltip": false, | ||
| 37 | "bat":"BAT0" | ||
| 38 | }, | ||
| 39 | "battery#num2": { | ||
| 40 | "format": "{capacity}% {icon}", | ||
| 41 | "format-alt": "{time} {icon}", | ||
| 42 | "format-icons": ["", "", "", "", ""], | ||
| 43 | "format-charging": "{capacity}% ", | ||
| 44 | "interval": 30, | ||
| 45 | "states": { | ||
| 46 | "warning": 25, | ||
| 47 | "critical": 10 | ||
| 48 | }, | ||
| 49 | "tooltip": false, | ||
| 50 | "bat":"BAT1" | ||
| 51 | }, | ||
| 52 | "bluetooth": { | ||
| 53 | "format": "", | ||
| 54 | "format-disabled": "", | ||
| 55 | "format-connected": "", | ||
| 56 | "format-connected-battery": " {device_battery_percentage}%", | ||
| 57 | "on-click": "foot bluetui", | ||
| 58 | "tooltip-format": "{controller_alias}\t{controller_address}\n\n{num_connections} connected", | ||
| 59 | "tooltip-format-connected": "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}", | ||
| 60 | "tooltip-format-enumerate-connected": "{device_alias}\t{device_address}", | ||
| 61 | "tooltip-format-enumerate-connected-battery": "{device_alias}\t{device_address}\t{device_battery_percentage}%" | ||
| 62 | }, | ||
| 63 | "network": { | ||
| 64 | "format-alt": "{ipaddr}/{cidr} {icon} {bandwidthTotalBytes}", | ||
| 65 | "format": "{ipaddr}/{cidr} {icon}", | ||
| 66 | "format-alt-click": "click-right", | ||
| 67 | "format-icons": { | ||
| 68 | "wifi": ["", "" ,"", ""], | ||
| 69 | "ethernet": [""], | ||
| 70 | "disconnected": [""] | ||
| 71 | }, | ||
| 72 | "on-click": "foot -t alacritty doas nmtui", | ||
| 73 | "tooltip": false | ||
| 74 | }, | ||
| 75 | "privacy": { | ||
| 76 | "icon-spacing":4, | ||
| 77 | "icon-size":18, | ||
| 78 | "transition-duration":250, | ||
| 79 | "modules": [ | ||
| 80 | { | ||
| 81 | "type":"screenshare", | ||
| 82 | "tooltip":true, | ||
| 83 | "tooltip-icon-size":24 | ||
| 84 | }, | ||
| 85 | { | ||
| 86 | "type":"audio-in", | ||
| 87 | "tooltip":true, | ||
| 88 | "tooltip-icon-size":24 | ||
| 89 | } | ||
| 90 | ] | ||
| 91 | }, | ||
| 92 | "pulseaudio": { | ||
| 93 | "format-alt": "{icon}", | ||
| 94 | "format": "{volume} {icon}", | ||
| 95 | "format-alt-click": "click-right", | ||
| 96 | "format-muted": "", | ||
| 97 | "format-icons": { | ||
| 98 | "phone": [" ", " ", " ", " "], | ||
| 99 | "default": ["", "", "", ""] | ||
| 100 | }, | ||
| 101 | "scroll-step": 1, | ||
| 102 | "on-click": "pavucontrol", | ||
| 103 | "tooltip": false | ||
| 104 | }, | ||
| 105 | "custom/spotify": { | ||
| 106 | "interval": 2, | ||
| 107 | "return-type": "json", | ||
| 108 | "exec": "~/.config/waybar/modules/spotify.sh", | ||
| 109 | "exec-if": "~/.config/waybar/modules/check-for-music.sh", | ||
| 110 | "escape": true, | ||
| 111 | "on-click": "playerctl play-pause" | ||
| 112 | }, | ||
| 113 | "custom/storage": { | ||
| 114 | "format-alt": "{} ", | ||
| 115 | "format": "{percentage}% ", | ||
| 116 | "format-alt-click": "click-right", | ||
| 117 | "return-type": "json", | ||
| 118 | "interval": 60, | ||
| 119 | "exec": "~/.config/waybar/modules/storage.sh" | ||
| 120 | }, | ||
| 121 | "backlight": { | ||
| 122 | "format-alt": "{icon}", | ||
| 123 | "format": "{percent}% {icon}", | ||
| 124 | "format-alt-click": "click-right", | ||
| 125 | "format-icons": ["", ""], | ||
| 126 | "on-scroll-up": "light -A 1", | ||
| 127 | "on-scroll-down": "light -U 1" | ||
| 128 | }, | ||
| 129 | "custom/weather_OLD": { | ||
| 130 | "format-alt": "{}", | ||
| 131 | "format": "{alt}: {}", | ||
| 132 | "format-alt-click": "click-right", | ||
| 133 | "interval": 1800, | ||
| 134 | "return-type": "json", | ||
| 135 | "on-click": "foot -a ala-wttr -H curl https://v2.wttr.in", | ||
| 136 | "exec": "~/.config/waybar/modules/weather.sh", | ||
| 137 | "exec-if": "ping wttr.in -c1" | ||
| 138 | }, | ||
| 139 | "custom/weather": { | ||
| 140 | "format": "{} °F", | ||
| 141 | "tooltip": true, | ||
| 142 | "interval": 3600, | ||
| 143 | "exec": "exit=101; while [ $exit = 101 ]; do wttrbar --main-indicator temp_F --fahrenheit; exit=$(echo $?); sleep 1; done", | ||
| 144 | "on-click": "foot -a ala-wttr -H curl https://v2.wttr.in", | ||
| 145 | "return-type": "json" | ||
| 146 | }, | ||
| 147 | "idle_inhibitor": { | ||
| 148 | "format": "{icon}", | ||
| 149 | "format-icons": { | ||
| 150 | "activated": "", | ||
| 151 | "deactivated": "" | ||
| 152 | }, | ||
| 153 | "tooltip": false | ||
| 154 | }, | ||
| 155 | "custom/mail": { | ||
| 156 | "format": "", | ||
| 157 | "format-alt": "{alt} ", | ||
| 158 | "format-alt-click": "click-right", | ||
| 159 | "interval": 60, | ||
| 160 | "return-type": "json", | ||
| 161 | "exec": "~/.config/waybar/modules/mail.py", | ||
| 162 | "tooltip": false | ||
| 163 | }, | ||
| 164 | "tray": { | ||
| 165 | "icon-size": 18 | ||
| 166 | } | ||
| 167 | } | ||
diff --git a/users/ryan/linux/waybar/modules/check-for-music.sh b/users/ryan/linux/waybar/modules/check-for-music.sh new file mode 100755 index 0000000..3b735a2 --- /dev/null +++ b/users/ryan/linux/waybar/modules/check-for-music.sh | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | if [[ $(playerctl metadata --format '{{lc(status)}}' | grep playing) -eq 0 ]]; then | ||
| 4 | exit 0 | ||
| 5 | else | ||
| 6 | exit 1 | ||
| 7 | fi | ||
diff --git a/users/ryan/linux/waybar/modules/spotify.sh b/users/ryan/linux/waybar/modules/spotify.sh new file mode 100755 index 0000000..fc732a1 --- /dev/null +++ b/users/ryan/linux/waybar/modules/spotify.sh | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | class=$(playerctl metadata --format '{{lc(status)}}') | ||
| 4 | icon="" | ||
| 5 | |||
| 6 | if [[ $class == "playing" ]]; then | ||
| 7 | info=$(playerctl metadata --format '{{artist}} - {{title}}') | ||
| 8 | if [[ ${#info} > 40 ]]; then | ||
| 9 | info=$(playerctl metadata --format '{{title}}' | cut -c1-40)"..." | ||
| 10 | fi | ||
| 11 | text=$info" "$icon | ||
| 12 | elif [[ $class == "paused" ]]; then | ||
| 13 | text=$icon | ||
| 14 | elif [[ $class == "stopped" ]]; then | ||
| 15 | text="" | ||
| 16 | fi | ||
| 17 | |||
| 18 | echo -e "{\"text\":\""$text"\", \"class\":\""$class"\"}" | ||
| 19 | |||
diff --git a/users/ryan/linux/waybar/modules/storage.sh b/users/ryan/linux/waybar/modules/storage.sh new file mode 100755 index 0000000..90cc3dc --- /dev/null +++ b/users/ryan/linux/waybar/modules/storage.sh | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | mount="/" | ||
| 4 | warning=20 | ||
| 5 | critical=10 | ||
| 6 | |||
| 7 | df -h -P -l "$mount" | awk -v warning=$warning -v critical=$critical ' | ||
| 8 | /\/.*/ { | ||
| 9 | text=$4 | ||
| 10 | tooltip="Filesystem: "$1"\rSize: "$2"\rUsed: "$3"\rAvail: "$4"\rUse%: "$5"\rMounted on: "$6 | ||
| 11 | use=$5 | ||
| 12 | exit 0 | ||
| 13 | } | ||
| 14 | END { | ||
| 15 | class="" | ||
| 16 | gsub(/%$/,"",use) | ||
| 17 | if ((100 - use) < critical) { | ||
| 18 | class="critical" | ||
| 19 | } else if ((100 - use) < warning) { | ||
| 20 | class="warning" | ||
| 21 | } | ||
| 22 | print "{\"text\":\""text"\", \"percentage\":"use",\"tooltip\":\""tooltip"\", \"class\":\""class"\"}" | ||
| 23 | } | ||
| 24 | ' | ||
| 25 | |||
diff --git a/users/ryan/linux/waybar/modules/weather.sh b/users/ryan/linux/waybar/modules/weather.sh new file mode 100755 index 0000000..01faffc --- /dev/null +++ b/users/ryan/linux/waybar/modules/weather.sh | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | cachedir=~/.cache/rbn | ||
| 2 | cachefile=${0##*/}-$1 | ||
| 3 | |||
| 4 | if [ ! -d $cachedir ]; then | ||
| 5 | mkdir -p $cachedir | ||
| 6 | fi | ||
| 7 | |||
| 8 | if [ ! -f $cachedir/$cachefile ]; then | ||
| 9 | touch $cachedir/$cachefile | ||
| 10 | fi | ||
| 11 | |||
| 12 | # Save current IFS | ||
| 13 | SAVEIFS=$IFS | ||
| 14 | # Change IFS to new line. | ||
| 15 | IFS=$'\n' | ||
| 16 | |||
| 17 | cacheage=$(($(date +%s) - $(stat -c '%Y' "$cachedir/$cachefile"))) | ||
| 18 | if [ $cacheage -gt 1740 ] || [ ! -s $cachedir/$cachefile ]; then | ||
| 19 | data=($(curl -s https://en.wttr.in/$1\?0qnT 2>&1)) | ||
| 20 | echo ${data[0]} | cut -f1 -d, > $cachedir/$cachefile | ||
| 21 | echo ${data[1]} | sed -E 's/^.{15}//' >> $cachedir/$cachefile | ||
| 22 | echo ${data[2]} | sed -E 's/^.{15}//' >> $cachedir/$cachefile | ||
| 23 | fi | ||
| 24 | |||
| 25 | weather=($(cat $cachedir/$cachefile)) | ||
| 26 | |||
| 27 | # Restore IFSClear | ||
| 28 | IFS=$SAVEIFS | ||
| 29 | |||
| 30 | temperature=$(echo ${weather[2]} | sed -E 's/([[:digit:]]+)\.\./\1 to /g') | ||
| 31 | |||
| 32 | #echo ${weather[1]##*,} | ||
| 33 | |||
| 34 | # https://fontawesome.com/icons?s=solid&c=weather | ||
| 35 | case $(echo ${weather[1]##*,} | tr '[:upper:]' '[:lower:]') in | ||
| 36 | "clear" | "sunny") | ||
| 37 | condition="" | ||
| 38 | ;; | ||
| 39 | "partly cloudy") | ||
| 40 | condition="" | ||
| 41 | ;; | ||
| 42 | "cloudy") | ||
| 43 | condition="" | ||
| 44 | ;; | ||
| 45 | "overcast") | ||
| 46 | condition="" | ||
| 47 | ;; | ||
| 48 | "mist" | "fog" | "freezing fog") | ||
| 49 | condition="敖" | ||
| 50 | ;; | ||
| 51 | "patchy rain possible" | "patchy light drizzle" | "light drizzle" | "patchy light rain" | "light rain" | "light rain shower" | "rain") | ||
| 52 | condition="殺" | ||
| 53 | ;; | ||
| 54 | "moderate rain at times" | "moderate rain" | "heavy rain at times" | "heavy rain" | "moderate or heavy rain shower" | "torrential rain shower" | "rain shower") | ||
| 55 | condition="" | ||
| 56 | ;; | ||
| 57 | "patchy snow possible" | "patchy sleet possible" | "patchy freezing drizzle possible" | "freezing drizzle" | "heavy freezing drizzle" | "light freezing rain" | "moderate or heavy freezing rain" | "light sleet" | "ice pellets" | "light sleet showers" | "moderate or heavy sleet showers") | ||
| 58 | condition="流" | ||
| 59 | ;; | ||
| 60 | "blowing snow" | "moderate or heavy sleet" | "patchy light snow" | "light snow" | "light snow showers") | ||
| 61 | condition="ﰕ" | ||
| 62 | ;; | ||
| 63 | "blizzard" | "patchy moderate snow" | "moderate snow" | "patchy heavy snow" | "heavy snow" | "moderate or heavy snow with thunder" | "moderate or heavy snow showers") | ||
| 64 | condition="" | ||
| 65 | ;; | ||
| 66 | "thundery outbreaks possible" | "patchy light rain with thunder" | "moderate or heavy rain with thunder" | "patchy light snow with thunder") | ||
| 67 | condition="" | ||
| 68 | ;; | ||
| 69 | *) | ||
| 70 | condition="" | ||
| 71 | echo -e "{\"text\":\""$condition"\", \"alt\":\""${weather[0]}"\", \"tooltip\":\""${weather[0]}: $temperature ${weather[1]}"\"}" | ||
| 72 | ;; | ||
| 73 | esac | ||
| 74 | |||
| 75 | #echo $temp $condition | ||
| 76 | |||
| 77 | echo -e "{\"text\":\""$temperature $condition"\", \"alt\":\""${weather[0]}"\", \"tooltip\":\""${weather[0]}: $temperature ${weather[1]}"\"}" | ||
diff --git a/users/ryan/linux/waybar/style.css b/users/ryan/linux/waybar/style.css new file mode 100644 index 0000000..682a14e --- /dev/null +++ b/users/ryan/linux/waybar/style.css | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | * { | ||
| 2 | border: none; | ||
| 3 | border-radius: 0; | ||
| 4 | font-family: AnonymicePro Nerd Font; | ||
| 5 | font-size: 15px; | ||
| 6 | box-shadow: none; | ||
| 7 | text-shadow: none; | ||
| 8 | transition-duration: 0s; | ||
| 9 | color: white; | ||
| 10 | } | ||
| 11 | |||
| 12 | #waybar { | ||
| 13 | background-color:rgba(0,0,0,0.25); | ||
| 14 | color: white; | ||
| 15 | } | ||
| 16 | |||
| 17 | window { | ||
| 18 | color: rgba(217, 216, 216, 1); | ||
| 19 | background: rgba(35, 31, 32, 0.00); | ||
| 20 | } | ||
| 21 | |||
| 22 | window#waybar.solo { | ||
| 23 | color: rgba(217, 216, 216, 1); | ||
| 24 | background: rgba(35, 31, 32, 0.85); | ||
| 25 | } | ||
| 26 | |||
| 27 | #workspaces { | ||
| 28 | margin: 0 5px; | ||
| 29 | } | ||
| 30 | |||
| 31 | #workspaces button { | ||
| 32 | padding: 0 5px; | ||
| 33 | color: rgba(217, 216, 216, 0.4); | ||
| 34 | } | ||
| 35 | |||
| 36 | #workspaces button.visible { | ||
| 37 | color: rgba(217, 216, 216, 1); | ||
| 38 | } | ||
| 39 | |||
| 40 | #workspaces button.active { | ||
| 41 | border-top: 3px solid rgba(217, 216, 216, 1); | ||
| 42 | border-bottom: 3px solid rgba(217, 216, 216, 0); | ||
| 43 | } | ||
| 44 | |||
| 45 | #workspaces button.urgent { | ||
| 46 | color: rgba(238, 46, 36, 1); | ||
| 47 | } | ||
| 48 | |||
| 49 | #mode, #battery, #cpu, #memory, #network, #bluetooth, #pulseaudio, #idle_inhibitor, #backlight, #custom-storage, #custom-spotify, #custom-weather, #custom-mail { | ||
| 50 | margin: 0px 6px 0px 10px; | ||
| 51 | min-width: 25px; | ||
| 52 | } | ||
| 53 | |||
| 54 | #clock { | ||
| 55 | margin: 0px 16px 0px 10px; | ||
| 56 | min-width: 140px; | ||
| 57 | } | ||
| 58 | |||
| 59 | #battery.warning #battery.num2.warning { | ||
| 60 | color: rgba(255, 210, 4, 1); | ||
| 61 | } | ||
| 62 | |||
| 63 | #battery.critical #battery.bat2.critical { | ||
| 64 | color: rgba(238, 46, 36, 1); | ||
| 65 | } | ||
| 66 | |||
| 67 | #battery.charging #battery.bat2.charging { | ||
| 68 | color: rgba(217, 216, 216, 1); | ||
| 69 | } | ||
| 70 | |||
| 71 | #custom-storage.warning { | ||
| 72 | color: rgba(255, 210, 4, 1); | ||
| 73 | } | ||
| 74 | |||
| 75 | #custom-storage.critical { | ||
| 76 | color: rgba(238, 46, 36, 1); | ||
| 77 | } | ||
