···55 ...
66}:
77let
88- # Patch noctalia-shell to use workspace name instead of number for sway
99- # Quickshell's activate() sends "workspace number <num>" which fails for named workspaces (num=-1)
88+ sway-focus-workspace = pkgs.writeShellScript "sway-focus-workspace" ''
99+ # Bring a workspace to the currently focused output
1010+ ws="$1"
1111+ current_output=$(${pkgs.sway}/bin/swaymsg -t get_workspaces | ${pkgs.jq}/bin/jq -r '.[] | select(.focused) | .output')
1212+ ${pkgs.sway}/bin/swaymsg "workspace $ws, move workspace to output $current_output"
1313+ '';
1414+ # Patch noctalia-shell for sway:
1515+ # - Use workspace name instead of number (activate() sends "workspace number <num>" which fails for named workspaces)
1616+ # - Show all workspaces on all screens (globalWorkspaces)
1717+ # - Bring workspace to current screen on click instead of jumping to its screen
1018 noctalia-shell-patched = pkgs.noctalia-shell.overrideAttrs (old: {
1119 postInstall = (old.postInstall or "") + ''
1220 substituteInPlace $out/share/noctalia-shell/Services/Compositor/SwayService.qml \
1321 --replace-fail 'workspace.handle.activate();' \
1414- 'Quickshell.execDetached([msgCommand, "workspace", workspace.name]);' \
2222+ 'Quickshell.execDetached(["${sway-focus-workspace}", workspace.name]);' \
1523 --replace-fail 'property bool initialized: false' \
1624 'property bool globalWorkspaces: true
1725 property bool initialized: false'