diff --git a/pkgs/scripts/clone-term.nix b/pkgs/scripts/clone-term.nix index 02a4ec8..79e623a 100644 --- a/pkgs/scripts/clone-term.nix +++ b/pkgs/scripts/clone-term.nix @@ -3,13 +3,18 @@ ps, procps, xdotool, + jq, }: writeShellApplication { name = "clone-term"; - runtimeInputs = [ps procps xdotool]; + runtimeInputs = [ps procps xdotool jq]; text = '' - PAREN=$(xdotool getwindowfocus getwindowpid) + if [[ $XDG_CURRENT_DESKTOP == sway ]]; then + PAREN=$(swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true).pid') + else + PAREN=$(xdotool getwindowfocus getwindowpid) + fi MAXDEPTH=0 SELECTED=0 diff --git a/users/common/graphical/Xorg/i3.nix b/users/common/graphical/Xorg/i3.nix index 9dbc754..d4dcc39 100644 --- a/users/common/graphical/Xorg/i3.nix +++ b/users/common/graphical/Xorg/i3.nix @@ -24,7 +24,6 @@ maim = "${pkgs.maim}/bin/maim -qs -b 1 --hidecursor"; in { "Menu" = "exec ${cfg.menu}"; - "${cfg.modifier}+c" = "exec ${lib.getExe pkgs.scripts.clone-term}"; "Ctrl+F9" = "exec ${config.xsession.wallpapers.script}"; "${cfg.modifier}+F12" = "exec " diff --git a/users/common/graphical/sway3.nix b/users/common/graphical/sway3.nix index edcf35c..ebbaeff 100644 --- a/users/common/graphical/sway3.nix +++ b/users/common/graphical/sway3.nix @@ -94,6 +94,7 @@ let "${modifier}+b" = "exec firefox"; "${modifier}+m" = "exec thunderbird"; "${modifier}+q" = "kill"; + "${modifier}+c" = "exec ${lib.getExe pkgs.scripts.clone-term}"; "XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause"; "XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl next"; "XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl previous";