Finally 'fixed' workspaces

This commit is contained in:
aethrvmn 2024-10-22 18:33:54 +02:00
parent 9f82974923
commit 75c8aed064
5 changed files with 91 additions and 58 deletions

View file

@ -1,5 +1,16 @@
[ [
{ {
"custom/workspaces": {
"exec": "sh $HOME/.config/waybar/scripts/workspaces",
"return-type": "json",
"format": "{}",
"markup": "pango",
"env": {
"NUMBER": "4",
"SYMBOLS": ";;;"
}
},
"battery": { "battery": {
"format": "{capacity}% {icon}", "format": "{capacity}% {icon}",
"format-charging": "{capacity}% ", "format-charging": "{capacity}% ",
@ -15,6 +26,7 @@
"warning": 30 "warning": 30
} }
}, },
"bluetooth": { "bluetooth": {
"format": "On ", "format": "On ",
"format-connected": "{device_alias} ", "format-connected": "{device_alias} ",
@ -22,36 +34,7 @@
"on-click": "blueman-manager", "on-click": "blueman-manager",
"on-click-right": "sh $HOME/.config/waybar/scripts/toggle_bluetooth" "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": { "clock": {
"calendar": { "calendar": {
"format": { "format": {
@ -69,15 +52,18 @@
"timezone": "Europe/Brussels", "timezone": "Europe/Brussels",
"tooltip-format": "<tt>{calendar}</tt>" "tooltip-format": "<tt>{calendar}</tt>"
}, },
"cpu":{ "cpu":{
"format": "{}% " "format": "{}% "
}, },
"custom/media": { "custom/media": {
"escape": true, "escape": true,
"exec": "waybar-mpris --autofocus --order 'SYMBOL:ARTIST:TITLE'", "exec": "waybar-mpris --autofocus --order 'SYMBOL:ARTIST:TITLE'",
"on-click": "waybar-mpris --send toggle", "on-click": "waybar-mpris --send toggle",
"return-type": "json" "return-type": "json"
}, },
"custom/weather": { "custom/weather": {
"exec": "sh $HOME/.dotfiles/scripts/wittr.sh", "exec": "sh $HOME/.dotfiles/scripts/wittr.sh",
"format": "{}", "format": "{}",
@ -86,6 +72,7 @@
"spacing": 10, "spacing": 10,
"tooltip": true "tooltip": true
}, },
"wlr/taskbar": { "wlr/taskbar": {
"format": "{icon} {app_id}", "format": "{icon} {app_id}",
"icon-theme": "McMojave-circle-brown", "icon-theme": "McMojave-circle-brown",
@ -101,16 +88,22 @@
"org.kde.dolphin": "dolphin" "org.kde.dolphin": "dolphin"
}, },
}, },
"layer": "bottom", "layer": "bottom",
"height": "28",
"margin": "5", "margin": "5",
"modules-center": [ "modules-center": [
"custom/workspaces",
], ],
"modules-left": [ "modules-left": [
"wlr/taskbar" "wlr/taskbar"
], ],
"modules-right": [ "modules-right": [
"cpu",
"temperature",
"network", "network",
"bluetooth", "bluetooth",
"battery", "battery",
@ -118,20 +111,24 @@
"clock", "clock",
"tray" "tray"
], ],
"network": { "network": {
"format-disabled": "Off 睊", "format-disabled": "Off 睊",
"format-disconnected": "Disconnected 睊", "format-disconnected": "Disconnected 睊",
"format-wifi": "{essid} [{signalStrength}%] 直", "format-wifi": "[{signalStrength}%] 直",
"on-click": "kitty -e nmtui", "on-click": "kitty -e nmtui",
"on-click-right": "$HOME/.config/waybar/scripts/toggle_wifi", "on-click-right": "$HOME/.config/waybar/scripts/toggle_wifi",
"tooltip-format": "{ifname} @ {ipaddr}" "tooltip-format": "{ipaddr} @ {essid}"
}, },
"output": [ "output": [
"HDMI-A-1", "HDMI-A-1",
"DP-1", "DP-1",
"eDP-1" "eDP-1"
], ],
"position": "top", "position": "top",
"pulseaudio": { "pulseaudio": {
"format": "{volume}% {icon}", "format": "{volume}% {icon}",
"format-bluetooth": "{volume}% {icon} ", "format-bluetooth": "{volume}% {icon} ",
@ -141,11 +138,14 @@
], ],
"format-muted": "婢", "format-muted": "婢",
"on-click": "amixer sset Master toggle", "on-click": "amixer sset Master toggle",
"on-click-right": "pavucontrol", "on-click-right": "kitty -e pulsemixer",
"scroll-step": 1 "scroll-step": 1
}, },
"reload_style_on_change": true, "reload_style_on_change": true,
"spacing": 0, "spacing": 0,
"temperature": { "temperature": {
"critical-threshold": 90, "critical-threshold": 90,
"format": "{temperatureC}°C {icon}", "format": "{temperatureC}°C {icon}",
@ -157,6 +157,7 @@
"" ""
] ]
}, },
"tray": { "tray": {
"icon-size": 18, "icon-size": 18,
"show-passive-items": true, "show-passive-items": true,

0
.config/waybar/scripts/toggle_bluetooth Normal file → Executable file
View file

0
.config/waybar/scripts/toggle_wifi Normal file → Executable file
View file

65
.config/waybar/scripts/workspaces Normal file → Executable file
View file

@ -1,46 +1,69 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# <config> # Read configuration from environment variables
NUMBER=4 NUMBER=${NUMBER:-4} # Default to 4 if not set
SYMBOL_CURRENT="  " SYMBOLS=${SYMBOLS:-";;;"} # Default symbols if not set
SYMBOL_OTHER="  "
IFS=';' read -r -a CUSTOM_SYMBOLS <<< "$SYMBOLS"
PIPE=/tmp/workspace PIPE=/tmp/workspace
WRAP=true WRAP=true
# </config>
# 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() { format_line() {
before=`yes $SYMBOL_OTHER 2>/dev/null | head -n $(($1 - 1))` local current_workspace=$1
after=`yes $SYMBOL_OTHER 2>/dev/null | head -n $(($NUMBER - $1))` local output_text="{\"text\": \""
echo $before $SYMBOL_CURRENT $after
# 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+="<span>[$symbol]</span>" # Indicate active workspace
else
output_text+="<span>$symbol</span>" # 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 rm -f $PIPE
mkfifo $PIPE mkfifo $PIPE
# print initial state # Print initial state
current=1 current=1
format_line $current format_line $current
while true # Main loop to handle input and update workspaces
do while true; do
if read input <$PIPE; then if read -t 0.1 input <$PIPE; then
if [ $input == "right" ]; then input=$((current + 1)); fi if [ "$input" == "right" ]; then input=$((current + 1)); fi
if [ $input == "left" ]; 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 if [ "$WRAP" == false ]; then continue; fi
input=$NUMBER input=$NUMBER
fi fi
if (( $input > $NUMBER )); then if (( input > NUMBER )); then
if [ "$WRAP" == false ]; then continue; fi if [ "$WRAP" == false ]; then continue; fi
input=1 input=1
fi fi
if (( $input == $current )); then continue; fi if (( input == current )); then continue; fi
format_line $input
current=$input current=$input
fi fi
format_line $current
done done

View file

@ -1,7 +1,7 @@
/* General settings */ /* General settings */
* { * {
font-family: FontAwesome, 'MonoLisa Nerd Font Mono', sans serif; font-family: FontAwesome, 'MonoLisa Nerd Font Mono', sans serif;
font-size: 11px; font-size: 14px;
} }
window#waybar { window#waybar {
@ -19,6 +19,7 @@ window#waybar {
#tray, #tray,
#network, #network,
#custom-media, #custom-media,
#custom-workspaces,
#custom-weather { #custom-weather {
background-color: #2A2A2A; background-color: #2A2A2A;
color: #EDE6DB; color: #EDE6DB;
@ -26,6 +27,7 @@ window#waybar {
padding-bottom: 0px; padding-bottom: 0px;
padding-left: 7px; padding-left: 7px;
padding-right: 7px; padding-right: 7px;
border: 1px solid #C1A550;
} }
#battery, #battery,
@ -60,11 +62,12 @@ button {
#taskbar { #taskbar {
background-color: #2A2A2A; background-color: #2A2A2A;
border-radius:15px; border-radius:10px;
padding-left: 0px; padding-left: 0px;
padding-right: 0px; padding-right: 0px;
padding-top: 0px; padding-top: 0px;
padding-bottom: 0px; padding-bottom: 0px;
min-width: 100px;
} }
#taskbar button { #taskbar button {
@ -92,3 +95,9 @@ button {
min-width: 10px; min-width: 10px;
margin-right: 0px; margin-right: 0px;
} }
#custom-workspaces {
font-size:23px;
border-radius: 10px;
border: 2px solid #C1A550;
}