diff --git a/.config/eww/eww.scss b/.config/eww/eww.scss index aa5884b..b3a71fd 100644 --- a/.config/eww/eww.scss +++ b/.config/eww/eww.scss @@ -306,6 +306,10 @@ tooltip label { background-color: rgba(00, 00, 00, 0.0); } +.works:hover { + background-color: $base0D; +} + .empty_workspace { color: $base03; } diff --git a/.config/eww/eww.yuck b/.config/eww/eww.yuck index ca253fb..52c2950 100644 --- a/.config/eww/eww.yuck +++ b/.config/eww/eww.yuck @@ -21,6 +21,9 @@ (deflisten workspace "scripts/workspace") (deflisten appname "scripts/appname") +(deflisten workspaces :initial "[]" "bash ~/.config/eww/scripts/get-workspaces") +(deflisten current_workspace :initial "1" "bash ~/.config/eww/scripts/get-active-workspace") + (defvar vol_reveal false) (defvar br_reveal false) (defvar music_reveal false) @@ -39,12 +42,10 @@ :class "works" :orientation "h" :spacing 5 - :space-evenly "false" + :space-evenly "true" :valign "center" - (button :onclick "hyprctl dispatch workspace 1" :class "0$o1$f1" "") - (button :onclick "hyprctl dispatch workspace 2" :class "0$o2$f2" "") - (button :onclick "hyprctl dispatch workspace 3" :class "0$o3$f3" "󰍨") - (button :onclick "hyprctl dispatch workspace 4" :class "0$o4$f4" "󰈙")))) + (for workspace in workspaces + (button :onclick "hyprctl dispatch workspace ${workspace.id}" :class "works ${workspace.id == current_workspace ? "current" : ""} ${workspace.windows > 0 ? "occupied" : "empty"}" "${workspace.name}"))))) @@ -256,7 +257,7 @@ :valign "center" :class "left_modules" :spacing 8 - ;; (workspaces) + (workspaces) (appnames))) (defwidget center [] (box diff --git a/.config/eww/scripts/change-active-workspace b/.config/eww/scripts/change-active-workspace new file mode 100644 index 0000000..19b559a --- /dev/null +++ b/.config/eww/scripts/change-active-workspace @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +function clamp { + min=$1 + max=$2 + val=$3 + python -c "print(max($min, min($val, $max)))" +} + +direction=$1 +current=$2 +if test "$direction" = "down" +then + target=$(clamp 1 10 $(($current+1))) + echo "jumping to $target" + hyprctl dispatch workspace $target +elif test "$direction" = "up" +then + target=$(clamp 1 10 $(($current-1))) + echo "jumping to $target" + hyprctl dispatch workspace $target +fi \ No newline at end of file diff --git a/.config/eww/scripts/get-active-workspace b/.config/eww/scripts/get-active-workspace new file mode 100644 index 0000000..6223a4f --- /dev/null +++ b/.config/eww/scripts/get-active-workspace @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +hyprctl monitors -j | jq '.[] | select(.focused) | .activeWorkspace.id' + +socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | + stdbuf -o0 awk -F '>>|,' -e '/^workspace>>/ {print $2}' -e '/^focusedmon>>/ {print $3}' diff --git a/.config/eww/scripts/get-workspaces b/.config/eww/scripts/get-workspaces new file mode 100644 index 0000000..cdde821 --- /dev/null +++ b/.config/eww/scripts/get-workspaces @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +spaces (){ + WORKSPACE_WINDOWS=$(hyprctl workspaces -j | jq 'map({key: .id | tostring, value: .windows}) | from_entries') + seq 1 10 | jq --argjson windows "${WORKSPACE_WINDOWS}" --slurp -Mc 'map(tostring) | map({id: ., windows: ($windows[.]//0)})' +} + +spaces +socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | while read -r line; do + spaces +done diff --git a/.config/waybar/config b/.config/waybar/config index 097b6c6..f5bd2e1 100644 --- a/.config/waybar/config +++ b/.config/waybar/config @@ -5,7 +5,7 @@ "height": 35, // Waybar height (to be removed for auto height) "width": 1400, // Waybar width // Choose the order of the modules "custom/wintitle", - "modules-left": ["wlr/workspaces", "workspaces", "hyprland/window"], + "modules-left": ["wlr/workspaces", "hyprland/window"], "modules-center": ["clock"], "modules-right": ["pulseaudio", "backlight", "temperature", "memory", "cpu", "battery", "tray"], "margin-top": -5, @@ -13,30 +13,9 @@ "margin-left": 6, "margin-right": 6, // Modules configuration - "sway/workspaces": { - "disable-scroll": true, - "all-outputs": true, - "format": "{icon}", - "format-icons": { - "1": " ", - "2": " ", - "3": " ", - "4": " ", - "5": " ", - "urgent": " ", - "focused": " ", - "default": " " - } - }, - "river/tags": { - "num-tags": 8 - }, "hyprland/window": { "format": " {}" }, - "workspaces": { - "format": " {name} " - }, "wlr/workspaces": { "format": "{icon}", "on-scroll-up": "hyprctl dispatch workspace e+1", diff --git a/.config/waybar/style.css b/.config/waybar/style.css index deea35c..9dbc1cc 100644 --- a/.config/waybar/style.css +++ b/.config/waybar/style.css @@ -82,7 +82,7 @@ window#waybar > box { color: rgba(217, 216, 216, 1); } -#workspaces button.focused { +#workspaces button.active { color: @base0C; } diff --git a/home/modules/hyprland.nix b/home/modules/hyprland.nix index c020a18..94f122b 100644 --- a/home/modules/hyprland.nix +++ b/home/modules/hyprland.nix @@ -14,13 +14,13 @@ in home.file.".config/hypr/hyprland.conf" = { text = '' monitor=eDP-1,2256x1504@60,0x0,1.5 - workspace=eDP-1,1 monitor=HDMI-A-1,preferred,0x0,1 monitor=DP-1,preferred,1080x0,1.5 monitor=DP-2,preferred,3640,1 - workspace=DP-2,9 - workspace=DP-1,1 - workspace=HDMI-A-1,2 + workspace=1,name:,id:1,monitor:eDP-1,1,default:true + workspace=1,name:,id:2,monitor:HDMI-A-1,2,default:true + workspace=9,name:,id:9,monitor:DP-2,9,gapsout:0,default:true + workspace=2,name:,id:1,monitor:DP-1,1,default:true monitor=HDMI-A-1,transform,1 input { diff --git a/scripts/startup.sh b/scripts/startup.sh index ecdea6c..de779c2 100755 --- a/scripts/startup.sh +++ b/scripts/startup.sh @@ -13,3 +13,4 @@ rbw-agent & emacs --daemon & nextcloud --background & batmon & +swww img /home/chris/Pictures/wallpapers/nixorange.webp -t grow --transition-bezier .14,0,.14,.99