niri window switcher

This commit is contained in:
Matt Nish-Lapidus 2025-04-07 12:31:09 -04:00
parent e613e8c8b3
commit 2c84007997
6 changed files with 53 additions and 23 deletions

30
flake.lock generated
View file

@ -49,11 +49,11 @@
]
},
"locked": {
"lastModified": 1740725613,
"narHash": "sha256-j6HoX1k4+alRX35/Z/K+kfqfWytNLcO+eBOnyoh42iw=",
"lastModified": 1744007427,
"narHash": "sha256-eccCwW7GQVSk/WOCxt5izY5VdVknheI3oAXa0Xg9k9U=",
"owner": "slotThe",
"repo": "emacs-lsp-booster-flake",
"rev": "007bdf3f48a28f611fdfe0b480534cc110637043",
"rev": "8229947cf6d2f565a9aa882b7946c643099e1ef0",
"type": "github"
},
"original": {
@ -70,11 +70,11 @@
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1743959986,
"narHash": "sha256-PmR93ZHN6CfJVBNalg+zl2M78mNA8LWIfMLhdtT/C3A=",
"lastModified": 1743991507,
"narHash": "sha256-sRyA1LOsRSeF8W2drXEuGU2U+actcYEKdk1f+2kDKb8=",
"owner": "nix-community",
"repo": "emacs-overlay",
"rev": "c7e8e7beb913fcdde90239c009bf3f7c21a3fdda",
"rev": "ac8af15c5f586879c08cd257b69749f791d94e68",
"type": "github"
},
"original": {
@ -357,11 +357,11 @@
]
},
"locked": {
"lastModified": 1743948087,
"narHash": "sha256-B6cIi2ScgVSROPPlTti6len+TdR0K25B9R3oKvbw3M8=",
"lastModified": 1744038920,
"narHash": "sha256-9a4V1wQXS8hXZtc7mRtz0qINkGW+C99aDrmXY6oYBFg=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "ef3b2a6b602c3f1a80c6897d6de3ee62339a3eb7",
"rev": "a4d8020820a85b47f842eae76ad083b0ec2a886a",
"type": "github"
},
"original": {
@ -519,11 +519,11 @@
"systems": "systems_2"
},
"locked": {
"lastModified": 1743624959,
"narHash": "sha256-xsSVHatubv6MFexuqZsYQJgjjQ1Mlwn+L8FtGGBhVDs=",
"lastModified": 1744017341,
"narHash": "sha256-XrPSoAn5Kf1nk1Q+G9s+PtPNOhRpiyEpo3h1uJxqEP8=",
"owner": "hyprwm",
"repo": "hyprlock",
"rev": "0b1f2a97ef10cfd10669cbfbb3e45d1cab1073a0",
"rev": "854235e1c8cf8f439a3d166de5a658bae0931b81",
"type": "github"
},
"original": {
@ -1562,11 +1562,11 @@
"rust-overlay": "rust-overlay_3"
},
"locked": {
"lastModified": 1743929988,
"narHash": "sha256-XSE6fOEr0/W7NTIKAFiBJZTZ3Esc7rUbON6qLW3FDWY=",
"lastModified": 1744038118,
"narHash": "sha256-yeB6uYQ4CCP/iUODybbtKDquVh0aI4JG0lHgzWf4Q5o=",
"owner": "sxyazi",
"repo": "yazi",
"rev": "be00881403922f8dfd34840252649978fc75b5d6",
"rev": "5ad40d9b97192ff471d8d3004e2e1899eb2ad17b",
"type": "github"
},
"original": {

View file

@ -294,10 +294,6 @@ in
hotkey-overlay.title = "Clipboard History";
action = wezlaunch "clipse";
};
"Mod+Ctrl+P" = {
hotkey-overlay.title = "Bitwarden Search";
action = wezlaunch "/home/emenel/.local/bin/sway-launcher-rbw";
};
"Mod+Ctrl+F" = {
hotkey-overlay.title = "Yazi";
action = wez "yazi";
@ -328,6 +324,16 @@ in
};
"Mod+P" = {
hotkey-overlay.title = "Bitwarden Search";
action = wezlaunch "/home/emenel/.local/bin/sway-launcher-rbw";
};
"Mod+W" = {
hotkey-overlay.title = "window switcher";
action = wezlaunch "/home/emenel/.local/bin/sway-launcher-niri-windows";
};
"Mod+Shift+A" = {
hotkey-overlay.title = "Lock Session";
action = spawn "hyprlock";

View file

@ -6,6 +6,25 @@
wl-clipboard
];
xdg.configFile."sway-launcher-desktop/providers".source = ./sway-launcher-providers;
home.file.".local/bin/sway-launcher-rbw".source = ./sway-launcher-providers/sway-launcher-rbw.fish;
home.file.".local/bin/sway-launcher-rbw" = {
executable = true;
text = ''
#!/usr/bin/env fish
PROVIDERS_FILE=providers/rbw.conf sway-launcher-desktop
'';
};
home.file.".local/bin/sway-launcher-niri-windows" = {
executable = true;
text = ''
#!/usr/bin/env fish
HIST_FILE="" PROVIDERS_FILE=providers/niri-windows.conf sway-launcher-desktop
'';
};
xdg.configFile."sway-launcher-desktop/providers" = {
source = ./sway-launcher-providers;
recursive = true;
};
}

View file

@ -0,0 +1,2 @@
#!/usr/bin/env fish
niri msg -j windows | jq -r '.[] | "\(.id)'\034'niri-windows'\034'\(.title) - (\(.app_id))"'

View file

@ -0,0 +1,5 @@
[niri-windows]
list_cmd=fish /home/emenel/.config/sway-launcher-desktop/providers/niri-windows-list.fish
preview_cmd=echo -e ' Switch to application:'
launch_cmd=fish -c "niri msg action focus-window --id {1}"
purge_cmd=command -v '{1}' || exit 43

View file

@ -1,2 +0,0 @@
#!/usr/bin/env fish
PROVIDERS_FILE=providers/rbw.conf sway-launcher-desktop