From 0c8fa3a2a270747f3dbb54fe8792f3f0aec997e3 Mon Sep 17 00:00:00 2001 From: Ryan Schanzenbacher Date: Mon, 3 Aug 2026 01:22:44 -0400 Subject: Initial commit: combined darwin + guix-linux home-manager flake Supersedes nix-dotfiles (darwin) and guix-dotfiles' ad-hoc nix-home-manager flake (linux). See README.md/MIGRATION.md. --- users/ryan/linux/waybar/config | 167 +++++++++++++++++++++ users/ryan/linux/waybar/modules/check-for-music.sh | 7 + users/ryan/linux/waybar/modules/spotify.sh | 19 +++ users/ryan/linux/waybar/modules/storage.sh | 25 +++ users/ryan/linux/waybar/modules/weather.sh | 77 ++++++++++ users/ryan/linux/waybar/style.css | 77 ++++++++++ 6 files changed, 372 insertions(+) create mode 100644 users/ryan/linux/waybar/config create mode 100755 users/ryan/linux/waybar/modules/check-for-music.sh create mode 100755 users/ryan/linux/waybar/modules/spotify.sh create mode 100755 users/ryan/linux/waybar/modules/storage.sh create mode 100755 users/ryan/linux/waybar/modules/weather.sh create mode 100644 users/ryan/linux/waybar/style.css (limited to 'users/ryan/linux/waybar') 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 @@ +{ + "layer": "top", + "position": "top", + "height": 30, + + "modules-left": ["hyprland/workspaces", "hyprland/submap"], + "modules-center": ["hyprland/window"], + "modules-right": ["tray", "custom/spotify", "privacy", "custom/weather", "custom/mail", "custom/storage", "backlight", "bluetooth", "pulseaudio", "network", "idle_inhibitor", "battery", "battery#num2", "clock"], + "hyprland/submap": { + "format": " {}" + }, + "hyprland/workspaces": { + "format": "{id}", + "all-outputs": false, + "disable-scroll": true + }, + "hyprland/window": { + "max-length": 80, + "tooltip": false, + "separate-outputs": true + }, + "clock": { + "format": "{:%a %d %b %H:%M}", + "tooltip": false + }, + "battery": { + "format": "{capacity}% {icon}", + "format-alt": "{time} {icon}", + "format-icons": ["", "", "", "", ""], + "format-charging": "{capacity}% ", + "interval": 30, + "states": { + "warning": 25, + "critical": 10 + }, + "tooltip": false, + "bat":"BAT0" + }, + "battery#num2": { + "format": "{capacity}% {icon}", + "format-alt": "{time} {icon}", + "format-icons": ["", "", "", "", ""], + "format-charging": "{capacity}% ", + "interval": 30, + "states": { + "warning": 25, + "critical": 10 + }, + "tooltip": false, + "bat":"BAT1" + }, + "bluetooth": { + "format": "󰂯", + "format-disabled": "󰂲", + "format-connected": "󰂯", + "format-connected-battery": "󰂱 {device_battery_percentage}%", + "on-click": "foot bluetui", + "tooltip-format": "{controller_alias}\t{controller_address}\n\n{num_connections} connected", + "tooltip-format-connected": "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}", + "tooltip-format-enumerate-connected": "{device_alias}\t{device_address}", + "tooltip-format-enumerate-connected-battery": "{device_alias}\t{device_address}\t{device_battery_percentage}%" + }, + "network": { + "format-alt": "{ipaddr}/{cidr} {icon} {bandwidthTotalBytes}󰹹", + "format": "{ipaddr}/{cidr} {icon}", + "format-alt-click": "click-right", + "format-icons": { + "wifi": ["󰤟", "󰤢" ,"󰤥", "󰤨"], + "ethernet": [""], + "disconnected": ["󰤭"] + }, + "on-click": "foot -t alacritty doas nmtui", + "tooltip": false + }, + "privacy": { + "icon-spacing":4, + "icon-size":18, + "transition-duration":250, + "modules": [ + { + "type":"screenshare", + "tooltip":true, + "tooltip-icon-size":24 + }, + { + "type":"audio-in", + "tooltip":true, + "tooltip-icon-size":24 + } + ] + }, + "pulseaudio": { + "format-alt": "{icon}", + "format": "{volume} {icon}", + "format-alt-click": "click-right", + "format-muted": "", + "format-icons": { + "phone": [" ", " ", " ", " "], + "default": ["", "", "", ""] + }, + "scroll-step": 1, + "on-click": "pavucontrol", + "tooltip": false + }, + "custom/spotify": { + "interval": 2, + "return-type": "json", + "exec": "~/.config/waybar/modules/spotify.sh", + "exec-if": "~/.config/waybar/modules/check-for-music.sh", + "escape": true, + "on-click": "playerctl play-pause" + }, + "custom/storage": { + "format-alt": "{} ", + "format": "{percentage}% ", + "format-alt-click": "click-right", + "return-type": "json", + "interval": 60, + "exec": "~/.config/waybar/modules/storage.sh" + }, + "backlight": { + "format-alt": "{icon}", + "format": "{percent}% {icon}", + "format-alt-click": "click-right", + "format-icons": ["", ""], + "on-scroll-up": "light -A 1", + "on-scroll-down": "light -U 1" + }, + "custom/weather_OLD": { + "format-alt": "{}", + "format": "{alt}: {}", + "format-alt-click": "click-right", + "interval": 1800, + "return-type": "json", + "on-click": "foot -a ala-wttr -H curl https://v2.wttr.in", + "exec": "~/.config/waybar/modules/weather.sh", + "exec-if": "ping wttr.in -c1" + }, + "custom/weather": { + "format": "{} °F", + "tooltip": true, + "interval": 3600, + "exec": "exit=101; while [ $exit = 101 ]; do wttrbar --main-indicator temp_F --fahrenheit; exit=$(echo $?); sleep 1; done", + "on-click": "foot -a ala-wttr -H curl https://v2.wttr.in", + "return-type": "json" + }, + "idle_inhibitor": { + "format": "{icon}", + "format-icons": { + "activated": "", + "deactivated": "" + }, + "tooltip": false + }, + "custom/mail": { + "format": "", + "format-alt": "{alt} ", + "format-alt-click": "click-right", + "interval": 60, + "return-type": "json", + "exec": "~/.config/waybar/modules/mail.py", + "tooltip": false + }, + "tray": { + "icon-size": 18 + } +} 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 @@ +#!/bin/sh + +if [[ $(playerctl metadata --format '{{lc(status)}}' | grep playing) -eq 0 ]]; then + exit 0 +else + exit 1 +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 @@ +#!/bin/sh + +class=$(playerctl metadata --format '{{lc(status)}}') +icon="󰎆" + +if [[ $class == "playing" ]]; then + info=$(playerctl metadata --format '{{artist}} - {{title}}') + if [[ ${#info} > 40 ]]; then + info=$(playerctl metadata --format '{{title}}' | cut -c1-40)"..." + fi + text=$info" "$icon +elif [[ $class == "paused" ]]; then + text=$icon +elif [[ $class == "stopped" ]]; then + text="" +fi + +echo -e "{\"text\":\""$text"\", \"class\":\""$class"\"}" + 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 @@ +#!/bin/sh + +mount="/" +warning=20 +critical=10 + +df -h -P -l "$mount" | awk -v warning=$warning -v critical=$critical ' +/\/.*/ { + text=$4 + tooltip="Filesystem: "$1"\rSize: "$2"\rUsed: "$3"\rAvail: "$4"\rUse%: "$5"\rMounted on: "$6 + use=$5 + exit 0 +} +END { + class="" + gsub(/%$/,"",use) + if ((100 - use) < critical) { + class="critical" + } else if ((100 - use) < warning) { + class="warning" + } + print "{\"text\":\""text"\", \"percentage\":"use",\"tooltip\":\""tooltip"\", \"class\":\""class"\"}" +} +' + 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 @@ +cachedir=~/.cache/rbn +cachefile=${0##*/}-$1 + +if [ ! -d $cachedir ]; then + mkdir -p $cachedir +fi + +if [ ! -f $cachedir/$cachefile ]; then + touch $cachedir/$cachefile +fi + +# Save current IFS +SAVEIFS=$IFS +# Change IFS to new line. +IFS=$'\n' + +cacheage=$(($(date +%s) - $(stat -c '%Y' "$cachedir/$cachefile"))) +if [ $cacheage -gt 1740 ] || [ ! -s $cachedir/$cachefile ]; then + data=($(curl -s https://en.wttr.in/$1\?0qnT 2>&1)) + echo ${data[0]} | cut -f1 -d, > $cachedir/$cachefile + echo ${data[1]} | sed -E 's/^.{15}//' >> $cachedir/$cachefile + echo ${data[2]} | sed -E 's/^.{15}//' >> $cachedir/$cachefile +fi + +weather=($(cat $cachedir/$cachefile)) + +# Restore IFSClear +IFS=$SAVEIFS + +temperature=$(echo ${weather[2]} | sed -E 's/([[:digit:]]+)\.\./\1 to /g') + +#echo ${weather[1]##*,} + +# https://fontawesome.com/icons?s=solid&c=weather +case $(echo ${weather[1]##*,} | tr '[:upper:]' '[:lower:]') in +"clear" | "sunny") + condition="" + ;; +"partly cloudy") + condition="" + ;; +"cloudy") + condition="" + ;; +"overcast") + condition="" + ;; +"mist" | "fog" | "freezing fog") + condition="敖" + ;; +"patchy rain possible" | "patchy light drizzle" | "light drizzle" | "patchy light rain" | "light rain" | "light rain shower" | "rain") + condition="殺" + ;; +"moderate rain at times" | "moderate rain" | "heavy rain at times" | "heavy rain" | "moderate or heavy rain shower" | "torrential rain shower" | "rain shower") + condition="" + ;; +"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") + condition="流" + ;; +"blowing snow" | "moderate or heavy sleet" | "patchy light snow" | "light snow" | "light snow showers") + condition="ﰕ" + ;; +"blizzard" | "patchy moderate snow" | "moderate snow" | "patchy heavy snow" | "heavy snow" | "moderate or heavy snow with thunder" | "moderate or heavy snow showers") + condition="" + ;; +"thundery outbreaks possible" | "patchy light rain with thunder" | "moderate or heavy rain with thunder" | "patchy light snow with thunder") + condition="" + ;; +*) + condition="" + echo -e "{\"text\":\""$condition"\", \"alt\":\""${weather[0]}"\", \"tooltip\":\""${weather[0]}: $temperature ${weather[1]}"\"}" + ;; +esac + +#echo $temp $condition + +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 @@ +* { + border: none; + border-radius: 0; + font-family: AnonymicePro Nerd Font; + font-size: 15px; + box-shadow: none; + text-shadow: none; + transition-duration: 0s; + color: white; +} + +#waybar { + background-color:rgba(0,0,0,0.25); + color: white; +} + +window { + color: rgba(217, 216, 216, 1); + background: rgba(35, 31, 32, 0.00); +} + +window#waybar.solo { + color: rgba(217, 216, 216, 1); + background: rgba(35, 31, 32, 0.85); +} + +#workspaces { + margin: 0 5px; +} + +#workspaces button { + padding: 0 5px; + color: rgba(217, 216, 216, 0.4); +} + +#workspaces button.visible { + color: rgba(217, 216, 216, 1); +} + +#workspaces button.active { + border-top: 3px solid rgba(217, 216, 216, 1); + border-bottom: 3px solid rgba(217, 216, 216, 0); +} + +#workspaces button.urgent { + color: rgba(238, 46, 36, 1); +} + +#mode, #battery, #cpu, #memory, #network, #bluetooth, #pulseaudio, #idle_inhibitor, #backlight, #custom-storage, #custom-spotify, #custom-weather, #custom-mail { + margin: 0px 6px 0px 10px; + min-width: 25px; +} + +#clock { + margin: 0px 16px 0px 10px; + min-width: 140px; +} + +#battery.warning #battery.num2.warning { + color: rgba(255, 210, 4, 1); +} + +#battery.critical #battery.bat2.critical { + color: rgba(238, 46, 36, 1); +} + +#battery.charging #battery.bat2.charging { + color: rgba(217, 216, 216, 1); +} + +#custom-storage.warning { + color: rgba(255, 210, 4, 1); +} + +#custom-storage.critical { + color: rgba(238, 46, 36, 1); +} -- cgit v1.3.1