Made the waybar a sidebar

This commit is contained in:
Michel Fedde 2025-04-13 18:06:20 +02:00
parent 75f6e5bb47
commit 6980360fe4
10 changed files with 121 additions and 50 deletions

View file

@ -1,18 +1,18 @@
#!/bin/bash #!/bin/bash
# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## # /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ##
# weather info from wttr. https://github.com/chubin/wttr.in # weather info from wttr. https://github.com/chubin/wttr.in
# Remember to add city # Remember to add city
city= city=
cachedir=~/.cache/rbn cachedir=~/.cache/rbn
cachefile=${0##*/}-$1 cachefile=${0##*/}-$1
if [ ! -d $cachedir ]; then if [ ! -d $cachedir ]; then
mkdir -p $cachedir mkdir -p $cachedir
fi fi
if [ ! -f $cachedir/$cachefile ]; then if [ ! -f $cachedir/$cachefile ]; then
touch $cachedir/$cachefile touch $cachedir/$cachefile
fi fi
# Save current IFS # Save current IFS
@ -22,10 +22,10 @@ IFS=$'\n'
cacheage=$(($(date +%s) - $(stat -c '%Y' "$cachedir/$cachefile"))) cacheage=$(($(date +%s) - $(stat -c '%Y' "$cachedir/$cachefile")))
if [ $cacheage -gt 1740 ] || [ ! -s $cachedir/$cachefile ]; then if [ $cacheage -gt 1740 ] || [ ! -s $cachedir/$cachefile ]; then
data=($(curl -s https://en.wttr.in/"$city"$1\?0qnT 2>&1)) data=($(curl -s https://en.wttr.in/"$city"$1\?0qnT 2>&1))
echo ${data[0]} | cut -f1 -d, > $cachedir/$cachefile echo ${data[0]} | cut -f1 -d, >$cachedir/$cachefile
echo ${data[1]} | sed -E 's/^.{15}//' >> $cachedir/$cachefile echo ${data[1]} | sed -E 's/^.{15}//' >>$cachedir/$cachefile
echo ${data[2]} | sed -E 's/^.{15}//' >> $cachedir/$cachefile echo ${data[2]} | sed -E 's/^.{15}//' >>$cachedir/$cachefile
fi fi
weather=($(cat $cachedir/$cachefile)) 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 # https://fontawesome.com/icons?s=solid&c=weather
case $(echo ${weather[1]##*,} | tr '[:upper:]' '[:lower:]') in case $(echo ${weather[1]##*,} | tr '[:upper:]' '[:lower:]') in
"clear" | "sunny") "clear" | "sunny")
condition="" condition=""
;; ;;
"partly cloudy") "partly cloudy")
condition="󰖕" condition="󰖕"
;; ;;
"cloudy") "cloudy")
condition="" condition=""
;; ;;
"overcast") "overcast")
condition="" condition=""
;; ;;
"fog" | "freezing fog") "fog" | "freezing fog")
condition="" condition=""
;; ;;
"patchy rain possible" | "patchy light drizzle" | "light drizzle" | "patchy light rain" | "light rain" | "light rain shower" | "mist" | "rain") "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") "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") "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") "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") "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") "thundery outbreaks possible" | "patchy light rain with thunder" | "moderate or heavy rain with thunder" | "patchy light snow with thunder")
condition="" condition=""
;; ;;
*) *)
condition="" condition=""
echo -e "{\"text\":\""$condition"\", \"alt\":\""${weather[0]}"\", \"tooltip\":\""${weather[0]}: $temperature ${weather[1]}"\"}" echo -e "{\"text\":\""$condition"\", \"alt\":\""${weather[0]}"\", \"tooltip\":\""${weather[0]}: $temperature ${weather[1]}"\"}"
;; ;;
esac esac
#echo $temp $condition #echo $temp $condition
@ -84,4 +84,5 @@ echo -e "{\"text\":\""$temperature $condition"\", \"alt\":\""${weather[0]}"\", \
cached_weather="$temperature \n$condition ${weather[1]}" cached_weather="$temperature \n$condition ${weather[1]}"
echo -e $cached_weather > ~/.cache/.weather_cache echo -e $cached_weather >~/.cache/.weather_cache

View file

@ -2,11 +2,6 @@
swaync-client --reload-css swaync-client --reload-css
# Reload waybar
killall waybar
killall pactl
nohup waybar &
# Reload hyprswitch # Reload hyprswitch
killall hyprswitch killall hyprswitch
nohup hyprswitch init --custom-css "$HOME/.config/hyprswitch/style.css" & nohup hyprswitch init --custom-css "$HOME/.config/hyprswitch/style.css" &

View file

@ -167,6 +167,16 @@
"interval": "once", "interval": "once",
"tooltip": false "tooltip": false
}, },
"custom/hoz-separator": {
"format": " ",
"interval": "once",
"tooltip": false
},
"custom/hoz-separator-dotted": {
"format": " ",
"interval": "once",
"tooltip": false
},
"custom/separator#line": { "custom/separator#line": {
"format": "|", "format": "|",
"interval": "once", "interval": "once",
@ -188,7 +198,14 @@
"tooltip": false "tooltip": false
}, },
"custom/pulseaudio-control": { "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": "pulseaudio-control --node-blacklist 'alsa_output.usb-Razer_Razer_Nari-00.pro-output-0' next-node",
"on-click-middle": "exec pavucontrol &", "on-click-middle": "exec pavucontrol &",
"on-click-right": "pulseaudio-control togmute" "on-click-right": "pulseaudio-control togmute"

View file

@ -72,10 +72,9 @@
"transition-duration": 500, "transition-duration": 500,
"children-class": "pulseaudio", "children-class": "pulseaudio",
"transition-left-to-right": true "transition-left-to-right": true
}, },
"modules": [ "modules": [
"custom/pulseaudio-control", "custom/pulseaudio-control#icons",
"custom/separator#blank_2",
"pulseaudio#microphone", "pulseaudio#microphone",
] ]
}, },

View file

@ -5,11 +5,27 @@
"layer": "overlay", "layer": "overlay",
"exclusive": false, "exclusive": false,
"position": "top", "position": "right",
"reload_style_on_change": true, "reload_style_on_change": true,
"name": "semi-hidden", "name": "semi-hidden",
"id": "semi-hidden", "id": "semi-hidden",
"start_hidden": true, "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",
],
} }

View file

@ -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

View file

@ -107,3 +107,17 @@
#custom-updates.pending-updates { #custom-updates.pending-updates {
background-color: dodgerblue; 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
}

View file

@ -29,15 +29,15 @@ window {
window.semi-hidden { window.semi-hidden {
background-color: transparent; background-color: transparent;
* {
border-radius: 0 0 $border-radius $border-radius;
}
.modules-left, .modules-center, .modules-right { .modules-left, .modules-center, .modules-right {
border-radius: $border-radius 0 0 $border-radius;
border-right: none;
background-color: $background; background-color: $background;
border-bottom: 1px solid rgba($foreground, 0.4); border-bottom: 1px solid rgba($foreground, 0.4);
border-left: 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 { .modules-center {

View file

@ -5,13 +5,13 @@ foundSymlinks=false
for file in $(yadm diff --name-only --cached); do for file in $(yadm diff --name-only --cached); do
lsResult=$(ls -1 -l "$file") lsResult=$(ls -1 -l "$file")
if [[ $lsResult != *"->"* ]]; then if [[ $lsResult != *"->"* ]]; then
break continue
fi fi
symlinkTarget=$(echo "$lsResult" | awk '{print $NF}') symlinkTarget=$(echo "$lsResult" | awk '{print $NF}')
if [[ $lsResult != *"##"* ]]; then if [[ $lsResult != *"##"* ]]; then
break continue
fi fi
echo "$file is a YADM symlink. Telling git to ignore it..." echo "$file is a YADM symlink. Telling git to ignore it..."

1
.gitignore vendored
View file

@ -62,3 +62,4 @@
.config/waybar/Output.config.json .config/waybar/Output.config.json
.config/evremap/evremap.toml .config/evremap/evremap.toml
.config/hypr/config/Autostart.conf .config/hypr/config/Autostart.conf
.config/yadm/bootstrap.d/02-AMDGPUDrivers.sh