diff --git a/.config/waybar/config b/.config/waybar/config index 849cfce3..49178514 100755 --- a/.config/waybar/config +++ b/.config/waybar/config @@ -1,5 +1,16 @@ [ { + "custom/workspaces": { + "exec": "sh $HOME/.config/waybar/scripts/workspaces", + "return-type": "json", + "format": "{}", + "markup": "pango", + "env": { + "NUMBER": "4", + "SYMBOLS": ";;;" + } + }, + "battery": { "format": "{capacity}% {icon}", "format-charging": "{capacity}% ", @@ -15,6 +26,7 @@ "warning": 30 } }, + "bluetooth": { "format": "On ", "format-connected": "{device_alias} ", @@ -22,36 +34,7 @@ "on-click": "blueman-manager", "on-click-right": "sh $HOME/.config/waybar/scripts/toggle_bluetooth" }, - "cava": { - "actions": { - "on-click-right": "mode" - }, - "autosens": 1, - "bar_delimiter": 0, - "bars": 14, - "format-icons": [ - "▁", - "▂", - "▃", - "▄", - "▅", - "▆", - "▇", - "█" - ], - "framerate": 30, - "higher_cutoff_freq": 10000, - "input_delay": 2, - "lower_cutoff_freq": 50, - "method": "pulse", - "monstercat": false, - "noise_reduction": 0.77, - "reverse": false, - "sensitivity": 100, - "source": "auto", - "stereo": true, - "waves": false - }, + "clock": { "calendar": { "format": { @@ -69,15 +52,18 @@ "timezone": "Europe/Brussels", "tooltip-format": "{calendar}" }, + "cpu":{ "format": "{}% " }, + "custom/media": { "escape": true, "exec": "waybar-mpris --autofocus --order 'SYMBOL:ARTIST:TITLE'", "on-click": "waybar-mpris --send toggle", "return-type": "json" }, + "custom/weather": { "exec": "sh $HOME/.dotfiles/scripts/wittr.sh", "format": "{}", @@ -86,6 +72,7 @@ "spacing": 10, "tooltip": true }, + "wlr/taskbar": { "format": "{icon} {app_id}", "icon-theme": "McMojave-circle-brown", @@ -101,16 +88,22 @@ "org.kde.dolphin": "dolphin" }, }, + "layer": "bottom", + + "height": "28", + "margin": "5", + "modules-center": [ + "custom/workspaces", ], + "modules-left": [ "wlr/taskbar" ], + "modules-right": [ - "cpu", - "temperature", "network", "bluetooth", "battery", @@ -118,20 +111,24 @@ "clock", "tray" ], + "network": { "format-disabled": "Off 睊", "format-disconnected": "Disconnected 睊", - "format-wifi": "{essid} [{signalStrength}%] 直", + "format-wifi": "[{signalStrength}%] 直", "on-click": "kitty -e nmtui", "on-click-right": "$HOME/.config/waybar/scripts/toggle_wifi", - "tooltip-format": "{ifname} @ {ipaddr}" + "tooltip-format": "{ipaddr} @ {essid}" }, + "output": [ "HDMI-A-1", "DP-1", "eDP-1" ], + "position": "top", + "pulseaudio": { "format": "{volume}% {icon}", "format-bluetooth": "{volume}% {icon} ", @@ -141,11 +138,14 @@ ], "format-muted": "婢", "on-click": "amixer sset Master toggle", - "on-click-right": "pavucontrol", + "on-click-right": "kitty -e pulsemixer", "scroll-step": 1 }, + "reload_style_on_change": true, + "spacing": 0, + "temperature": { "critical-threshold": 90, "format": "{temperatureC}°C {icon}", @@ -157,6 +157,7 @@ "" ] }, + "tray": { "icon-size": 18, "show-passive-items": true, diff --git a/.config/waybar/scripts/toggle_bluetooth b/.config/waybar/scripts/toggle_bluetooth old mode 100644 new mode 100755 diff --git a/.config/waybar/scripts/toggle_wifi b/.config/waybar/scripts/toggle_wifi old mode 100644 new mode 100755 diff --git a/.config/waybar/scripts/workspaces b/.config/waybar/scripts/workspaces old mode 100644 new mode 100755 index 5b8c7cb1..fd945155 --- a/.config/waybar/scripts/workspaces +++ b/.config/waybar/scripts/workspaces @@ -1,46 +1,69 @@ #!/usr/bin/env bash -# -NUMBER=4 -SYMBOL_CURRENT="  " -SYMBOL_OTHER="  " +# Read configuration from environment variables +NUMBER=${NUMBER:-4} # Default to 4 if not set +SYMBOLS=${SYMBOLS:-";;;"} # Default symbols if not set + +IFS=';' read -r -a CUSTOM_SYMBOLS <<< "$SYMBOLS" + PIPE=/tmp/workspace WRAP=true -# -# format_line takes the current workspace number [1..N] and prints a string -# representing the list of workspaces (e.g. 4 -> "0 0 0 1 0") format_line() { - before=`yes $SYMBOL_OTHER 2>/dev/null | head -n $(($1 - 1))` - after=`yes $SYMBOL_OTHER 2>/dev/null | head -n $(($NUMBER - $1))` - echo $before $SYMBOL_CURRENT $after + local current_workspace=$1 + local output_text="{\"text\": \"" + + # Iterate through the workspace symbols + for i in $(seq 1 $NUMBER); do + local symbol="${CUSTOM_SYMBOLS[$((i-1))]}" + + # Determine the span for the current symbol + if (( i == current_workspace )); then + output_text+="[$symbol]" # Indicate active workspace + else + output_text+="$symbol" # Indicate inactive workspace + fi + + # Add a separator only if it's not the last element + if (( i < NUMBER )); then + output_text+="|" + fi + done + + output_text+="\"}" + # Output the JSON object with a "text" field + echo "$output_text" } -# remove an existing pipe and make a new one + + +# Remove existing pipe and create a new one rm -f $PIPE mkfifo $PIPE -# print initial state +# Print initial state current=1 format_line $current -while true -do - if read input <$PIPE; then - if [ $input == "right" ]; then input=$((current + 1)); fi - if [ $input == "left" ]; then input=$((current - 1)); fi +# Main loop to handle input and update workspaces +while true; do + if read -t 0.1 input <$PIPE; then + if [ "$input" == "right" ]; then input=$((current + 1)); fi + if [ "$input" == "left" ]; then input=$((current - 1)); fi - if (( $input < 1 )); then + if (( input < 1 )); then if [ "$WRAP" == false ]; then continue; fi input=$NUMBER fi - if (( $input > $NUMBER )); then + if (( input > NUMBER )); then if [ "$WRAP" == false ]; then continue; fi input=1 fi - if (( $input == $current )); then continue; fi + if (( input == current )); then continue; fi - format_line $input current=$input fi + format_line $current + done + diff --git a/.config/waybar/style.css b/.config/waybar/style.css index 29b27555..2eb672b8 100755 --- a/.config/waybar/style.css +++ b/.config/waybar/style.css @@ -1,7 +1,7 @@ /* General settings */ * { font-family: FontAwesome, 'MonoLisa Nerd Font Mono', sans serif; - font-size: 11px; + font-size: 14px; } window#waybar { @@ -19,6 +19,7 @@ window#waybar { #tray, #network, #custom-media, +#custom-workspaces, #custom-weather { background-color: #2A2A2A; color: #EDE6DB; @@ -26,6 +27,7 @@ window#waybar { padding-bottom: 0px; padding-left: 7px; padding-right: 7px; + border: 1px solid #C1A550; } #battery, @@ -60,11 +62,12 @@ button { #taskbar { background-color: #2A2A2A; - border-radius:15px; + border-radius:10px; padding-left: 0px; padding-right: 0px; padding-top: 0px; padding-bottom: 0px; + min-width: 100px; } #taskbar button { @@ -92,3 +95,9 @@ button { min-width: 10px; margin-right: 0px; } + +#custom-workspaces { + font-size:23px; + border-radius: 10px; + border: 2px solid #C1A550; +}