From 6980360fe40b5f4f1f65d334509f2fe4cdce56c1 Mon Sep 17 00:00:00 2001 From: Michel Fedde Date: Sun, 13 Apr 2025 18:06:20 +0200 Subject: [PATCH] Made the waybar a sidebar --- .config/hypr/scripts/Weather.sh | 67 ++++++++++++----------- .config/theming/update.sh | 5 -- .config/waybar/ModulesCustom.json | 19 ++++++- .config/waybar/ModulesGroups.json | 5 +- .config/waybar/configurations/hidden.json | 20 ++++++- .config/waybar/scripts/pulseaudio.sh | 28 ++++++++++ .config/waybar/scss/_modules.scss | 14 +++++ .config/waybar/scss/style.scss | 8 +-- .config/yadm/hooks/pre_commit | 4 +- .gitignore | 1 + 10 files changed, 121 insertions(+), 50 deletions(-) create mode 100755 .config/waybar/scripts/pulseaudio.sh diff --git a/.config/hypr/scripts/Weather.sh b/.config/hypr/scripts/Weather.sh index 65613fc..61e697d 100755 --- a/.config/hypr/scripts/Weather.sh +++ b/.config/hypr/scripts/Weather.sh @@ -1,18 +1,18 @@ #!/bin/bash # /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## # weather info from wttr. https://github.com/chubin/wttr.in -# Remember to add city +# Remember to add city city= cachedir=~/.cache/rbn cachefile=${0##*/}-$1 if [ ! -d $cachedir ]; then - mkdir -p $cachedir + mkdir -p $cachedir fi if [ ! -f $cachedir/$cachefile ]; then - touch $cachedir/$cachefile + touch $cachedir/$cachefile fi # Save current IFS @@ -22,10 +22,10 @@ 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/"$city"$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 + data=($(curl -s https://en.wttr.in/"$city"$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)) @@ -40,42 +40,42 @@ temperature=$(echo ${weather[2]} | sed -E 's/([[:digit:]]+)\.\./\1 to /g') # https://fontawesome.com/icons?s=solid&c=weather case $(echo ${weather[1]##*,} | tr '[:upper:]' '[:lower:]') in "clear" | "sunny") - condition="" - ;; + condition="" + ;; "partly cloudy") - condition="󰖕" - ;; + condition="󰖕" + ;; "cloudy") - condition="" - ;; + condition="" + ;; "overcast") - condition="" - ;; + condition="" + ;; "fog" | "freezing fog") - condition="" - ;; + condition="" + ;; "patchy rain possible" | "patchy light drizzle" | "light drizzle" | "patchy light rain" | "light rain" | "light rain shower" | "mist" | "rain") - condition="󰼳" - ;; + condition="󰼳" + ;; "moderate rain at times" | "moderate rain" | "heavy rain at times" | "heavy rain" | "moderate or heavy rain shower" | "torrential rain shower" | "rain shower") - condition="" - ;; + 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="󰼴" - ;; + condition="󰼴" + ;; "blowing snow" | "moderate or heavy sleet" | "patchy light snow" | "light snow" | "light snow showers") - condition="󰙿" - ;; + condition="󰙿" + ;; "blizzard" | "patchy moderate snow" | "moderate snow" | "patchy heavy snow" | "heavy snow" | "moderate or heavy snow with thunder" | "moderate or heavy snow showers") - condition="" - ;; + condition="" + ;; "thundery outbreaks possible" | "patchy light rain with thunder" | "moderate or heavy rain with thunder" | "patchy light snow with thunder") - condition="" - ;; + condition="" + ;; *) - condition="" - echo -e "{\"text\":\""$condition"\", \"alt\":\""${weather[0]}"\", \"tooltip\":\""${weather[0]}: $temperature ${weather[1]}"\"}" - ;; + condition="" + echo -e "{\"text\":\""$condition"\", \"alt\":\""${weather[0]}"\", \"tooltip\":\""${weather[0]}: $temperature ${weather[1]}"\"}" + ;; esac #echo $temp $condition @@ -84,4 +84,5 @@ echo -e "{\"text\":\""$temperature $condition"\", \"alt\":\""${weather[0]}"\", \ cached_weather=" $temperature \n$condition ${weather[1]}" -echo -e $cached_weather > ~/.cache/.weather_cache \ No newline at end of file +echo -e $cached_weather >~/.cache/.weather_cache + diff --git a/.config/theming/update.sh b/.config/theming/update.sh index 9b3b34b..38c06ed 100755 --- a/.config/theming/update.sh +++ b/.config/theming/update.sh @@ -2,11 +2,6 @@ swaync-client --reload-css -# Reload waybar -killall waybar -killall pactl -nohup waybar & - # Reload hyprswitch killall hyprswitch nohup hyprswitch init --custom-css "$HOME/.config/hyprswitch/style.css" & diff --git a/.config/waybar/ModulesCustom.json b/.config/waybar/ModulesCustom.json index d7c7c12..22c2c7d 100644 --- a/.config/waybar/ModulesCustom.json +++ b/.config/waybar/ModulesCustom.json @@ -167,6 +167,16 @@ "interval": "once", "tooltip": false }, + "custom/hoz-separator": { + "format": " ", + "interval": "once", + "tooltip": false + }, + "custom/hoz-separator-dotted": { + "format": " ", + "interval": "once", + "tooltip": false + }, "custom/separator#line": { "format": "|", "interval": "once", @@ -188,7 +198,14 @@ "tooltip": false }, "custom/pulseaudio-control": { - "exec": "pulseaudio-control --icons-volume ' , ' --icon-muted ' ' --node-nicknames-from 'device.nick' --node-nickname 'alsa_output.pci-0000_08_00.0.iec958-ac3-surround-51.monitor:Speaker' --node-nickname 'alsa_output.usb-Razer_Razer_Nari-00.pro-output-1:Headphones' listen", + "exec": "$HOME/.config/waybar/scripts/pulseaudio.sh text", + "on-click": "pulseaudio-control --node-blacklist 'alsa_output.usb-Razer_Razer_Nari-00.pro-output-0' next-node", + "on-click-middle": "exec pavucontrol &", + "on-click-right": "pulseaudio-control togmute" + }, + + "custom/pulseaudio-control#icons": { + "exec": "$HOME/.config/waybar/scripts/pulseaudio.sh icons", "on-click": "pulseaudio-control --node-blacklist 'alsa_output.usb-Razer_Razer_Nari-00.pro-output-0' next-node", "on-click-middle": "exec pavucontrol &", "on-click-right": "pulseaudio-control togmute" diff --git a/.config/waybar/ModulesGroups.json b/.config/waybar/ModulesGroups.json index f2d0001..8b036d7 100644 --- a/.config/waybar/ModulesGroups.json +++ b/.config/waybar/ModulesGroups.json @@ -72,10 +72,9 @@ "transition-duration": 500, "children-class": "pulseaudio", "transition-left-to-right": true - }, + }, "modules": [ - "custom/pulseaudio-control", - "custom/separator#blank_2", + "custom/pulseaudio-control#icons", "pulseaudio#microphone", ] }, diff --git a/.config/waybar/configurations/hidden.json b/.config/waybar/configurations/hidden.json index 8c688e4..205fdd1 100644 --- a/.config/waybar/configurations/hidden.json +++ b/.config/waybar/configurations/hidden.json @@ -5,11 +5,27 @@ "layer": "overlay", "exclusive": false, - "position": "top", + "position": "right", "reload_style_on_change": true, "name": "semi-hidden", "id": "semi-hidden", "start_hidden": true, - "margin-top": 0 + "margin-right": 0, + + "modules-left": [ + "group/app_drawer", + "custom/hoz-separator-dotted", + "group/mobo_drawer", + ], + + "modules-right": [ + "group/laptop", + "custom/hoz-separator", + "tray", + "group/audio#pulsecontrol", + "custom/hoz-separator-dotted", + "group/status", + "custom/swaync", + ], } diff --git a/.config/waybar/scripts/pulseaudio.sh b/.config/waybar/scripts/pulseaudio.sh new file mode 100755 index 0000000..fe21b87 --- /dev/null +++ b/.config/waybar/scripts/pulseaudio.sh @@ -0,0 +1,28 @@ +#!/bin/env sh + +SPEAKER_ICON="󰓃 " +HEADPHONE_ICON=" " + +declare -A ICON_DEVICES +ICON_DEVICES[alsa_output.usb-Razer_Razer_Nari-00.pro-output-1]=$HEADPHONE_ICON +ICON_DEVICES[alsa_output.pci-0000_08_00.0.iec958-stereo]=$SPEAKER_ICON + +ICON_VOLMUES=" , " +ICON_VOLUME_MUTED=" " + +NICKNAME_SOURCE="device.nick" + +FORMAT_DEFAULT='$VOL_ICON ${VOL_LEVEL}% $ICON_NODE $NODE_NICKNAME' +FORMAT_ICONS='$VOL_ICON $ICON_NODE $NODE_NICKNAME' + +icon_devices_parameters="" +for device in "${!ICON_DEVICES[@]}"; do + icon_devices_parameters="${icon_devices_parameters} --node-nickname "${device}:${ICON_DEVICES[$device]}"" +done + +format=$FORMAT_DEFAULT +if [[ $1 == 'icons' ]]; then + format=$FORMAT_ICONS +fi + +pulseaudio-control ${icon_devices_parameters} --icons-volume "${ICON_VOLMUES}" --icon-muted "${ICON_VOLUME_MUTED}" --node-nicknames-from "${NICKNAME_SOURCE}" --format "${format}" --color-muted "" listen diff --git a/.config/waybar/scss/_modules.scss b/.config/waybar/scss/_modules.scss index 48df3dd..5e3b662 100644 --- a/.config/waybar/scss/_modules.scss +++ b/.config/waybar/scss/_modules.scss @@ -107,3 +107,17 @@ #custom-updates.pending-updates { background-color: dodgerblue; } + +#custom-hoz-separator { + font-size: 0px; + border-radius: 0; + border-bottom: 1px solid $foreground +} + + +#custom-hoz-separator-dotted { + padding: 0 3px; + font-size: 0px; + border-radius: 0; + border-bottom: 1px dashed $foreground +} diff --git a/.config/waybar/scss/style.scss b/.config/waybar/scss/style.scss index b942fd7..48c8967 100644 --- a/.config/waybar/scss/style.scss +++ b/.config/waybar/scss/style.scss @@ -29,15 +29,15 @@ window { window.semi-hidden { background-color: transparent; - * { - border-radius: 0 0 $border-radius $border-radius; - } .modules-left, .modules-center, .modules-right { + border-radius: $border-radius 0 0 $border-radius; + + border-right: none; background-color: $background; border-bottom: 1px solid rgba($foreground, 0.4); border-left: 1px solid rgba($foreground, 0.4); - border-right: 1px solid rgba($foreground, 0.4); + border-top: 1px solid rgba($foreground, 0.4); } .modules-center { diff --git a/.config/yadm/hooks/pre_commit b/.config/yadm/hooks/pre_commit index 26a9a28..bb84dff 100755 --- a/.config/yadm/hooks/pre_commit +++ b/.config/yadm/hooks/pre_commit @@ -5,13 +5,13 @@ foundSymlinks=false for file in $(yadm diff --name-only --cached); do lsResult=$(ls -1 -l "$file") if [[ $lsResult != *"->"* ]]; then - break + continue fi symlinkTarget=$(echo "$lsResult" | awk '{print $NF}') if [[ $lsResult != *"##"* ]]; then - break + continue fi echo "$file is a YADM symlink. Telling git to ignore it..." diff --git a/.gitignore b/.gitignore index 0a0d915..fd21550 100644 --- a/.gitignore +++ b/.gitignore @@ -62,3 +62,4 @@ .config/waybar/Output.config.json .config/evremap/evremap.toml .config/hypr/config/Autostart.conf +.config/yadm/bootstrap.d/02-AMDGPUDrivers.sh