This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

sway: expose gotoWorkspace as a package

+23 -4
+18 -3
2configs/desktops/sway/default.nix
··· 8 8 9 9 term = "/run/current-system/sw/bin/alacritty"; 10 10 11 + # Unified script: switch to workspace and move it to current output 12 + gotoWorkspace = pkgs.writeShellApplication { 13 + name = "goto-workspace"; 14 + runtimeInputs = [ 15 + pkgs.sway 16 + pkgs.jq 17 + ]; 18 + text = '' 19 + WS="$1" 20 + CURRENT_OUTPUT=$(swaymsg -r -t get_outputs | jq -r '.[] | select(.focused == true).name') 21 + swaymsg workspace "$WS" 22 + swaymsg move workspace to output "$CURRENT_OUTPUT" 23 + ''; 24 + }; 25 + 11 26 in 12 27 { 28 + # Make goto-workspace available system-wide for eww and workspace-popup 29 + environment.systemPackages = [ gotoWorkspace ]; 13 30 imports = [ 14 31 ../lib/wayland.nix 15 32 ./eww.nix ··· 258 275 259 276 bindsym $mod+q exec ${pkgs.writers.writeDash "goto_workspace" '' 260 277 set -efux 261 - CURRENT_OUTPUT=$(swaymsg -r -t get_outputs | jq '.[] | select(.focused == true).name') 262 278 WS=$(swaymsg -r -t get_workspaces | 263 279 jq -r '.[].name' | 264 280 menu -p 'Workspace name: ' 265 281 ) 266 282 if [ -n "$WS" ]; then 267 - swaymsg workspace "$WS" 268 - swaymsg move workspace to output "$CURRENT_OUTPUT" 283 + ${lib.getExe gotoWorkspace} "$WS" 269 284 fi 270 285 ''} 271 286
+5 -1
2configs/desktops/sway/eww.nix
··· 5 5 }: 6 6 let 7 7 8 + # Reference to goto-workspace (defined in default.nix, available at /run/current-system/sw/bin/) 9 + gotoWorkspace = "/run/current-system/sw/bin/goto-workspace"; 10 + 8 11 # eww configuration 9 12 ewwYuck = pkgs.writeText "eww.yuck" '' 10 13 ; Magic variables (built-in, no polling needed) ··· 55 58 (box :class "workspaces" :orientation "h" :space-evenly false :spacing 0 56 59 (for ws in workspaces 57 60 (button :class {ws.urgent ? "workspace urgent" : (ws.focused ? "workspace focused" : "workspace")} 58 - :onclick "swaymsg workspace ''${ws.name}" 61 + :onclick "${gotoWorkspace} ''${ws.name}" 59 62 {ws.name})))) 60 63 61 64 (defwidget graph-widget [value icon class unit ?tooltip] ··· 503 506 RestartSec = 1; 504 507 }; 505 508 }; 509 + 506 510 }