mirror of
https://github.com/traxys/Nixfiles.git
synced 2026-02-13 19:00:19 +01:00
Introduce ssh picker
This commit is contained in:
parent
90fd6dc35e
commit
817d89e4e7
2 changed files with 26 additions and 0 deletions
25
home.nix
25
home.nix
|
|
@ -68,12 +68,37 @@ in {
|
|||
zoxide = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
ssh = {
|
||||
enable = true;
|
||||
matchBlocks = {
|
||||
};
|
||||
};
|
||||
};
|
||||
home.file = {
|
||||
"bin" = {
|
||||
source = ./scripts;
|
||||
recursive = true;
|
||||
};
|
||||
"bin/ssh-picker" = let
|
||||
ssh_hosts = builtins.attrNames config.programs.ssh.matchBlocks;
|
||||
ssh_specific = builtins.filter (h: !(lib.strings.hasInfix "*" h)) ssh_hosts;
|
||||
ssh_specific_echo = builtins.map (h: "echo ${h}") ssh_specific;
|
||||
|
||||
picker =
|
||||
if config.wm.kind == "sway"
|
||||
then "${pkgs.wofi}/bin/wofi -S dmenu"
|
||||
else "${pkgs.rofi}/bin/rofi -dmenu";
|
||||
in {
|
||||
text = ''
|
||||
#!/usr/bin/env bash
|
||||
|
||||
{
|
||||
${lib.strings.concatStringsSep "\n" ssh_specific_echo}
|
||||
} | ${picker} | xargs ${config.terminal.command} ssh
|
||||
'';
|
||||
executable = true;
|
||||
};
|
||||
".zfunc" = {
|
||||
source = ./zfunc;
|
||||
recursive = true;
|
||||
|
|
|
|||
|
|
@ -171,6 +171,7 @@
|
|||
"${mod}+Return" = "exec ${config.terminal.command}";
|
||||
"${mod}+p" = "mode resize";
|
||||
"${mod}+Shift+P" = "restart";
|
||||
"${mod}+Shift+S" = "exec ~/bin/ssh-picker";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue