From c2cb2c2fb680dedfa370fb856c128c7e6d40909a Mon Sep 17 00:00:00 2001 From: Charlotte Van Petegem Date: Mon, 2 May 2022 13:46:25 +0200 Subject: [PATCH] Add command to launcher to `nix run` --- modules/graphical/sway/launcher.nix | 1 + modules/graphical/sway/launcher.zsh | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/modules/graphical/sway/launcher.nix b/modules/graphical/sway/launcher.nix index b25cc276..62ba1e63 100644 --- a/modules/graphical/sway/launcher.nix +++ b/modules/graphical/sway/launcher.nix @@ -33,6 +33,7 @@ let jq kitty libqalculate + nix pass slurp sway diff --git a/modules/graphical/sway/launcher.zsh b/modules/graphical/sway/launcher.zsh index fff30cbe..6c27f9a7 100644 --- a/modules/graphical/sway/launcher.zsh +++ b/modules/graphical/sway/launcher.zsh @@ -27,6 +27,14 @@ emoji() { @sway@/bin/swaymsg exec -- "echo -n $char | @wlClipboard@/bin/wl-copy --foreground" } +nrun_options() { + echo "nrun " +} + +nrun() { + @sway@/bin/swaymsg exec -- @nix@/bin/nix run nixpkgs\#$1 +} + pass_options(){ prefix=${PASSWORD_STORE_DIR-~/.password-store} password_files=( "$prefix"/**/*.gpg ) @@ -81,14 +89,6 @@ run() { @sway@/bin/swaymsg exec $1 } -ssh_options() { - cat $HOME/.ssh/config | grep "^Host [a-zA-Z]\+" | sed "s/Host /ssh /" -} - -ssh() { - @sway@/bin/swaymsg exec "@kitty@/bin/kitty -e ssh $1" -} - systemctl_options() { echo systemctl hibernate echo systemctl poweroff @@ -105,7 +105,7 @@ windows() { @sway@/bin/swaymsg \[con_id="$window"\] focus } -CHOSEN=$(cat <(windows_options) <(ssh_options) <(systemctl_options) <(pass_options) <(run_options) <(record_options) <(calc_options) <(emoji_options) | @fzy@/bin/fzy --lines 40 | tail -n1) +CHOSEN=$(cat <(windows_options) <(systemctl_options) <(pass_options) <(nrun_options) <(run_options) <(record_options) <(calc_options) <(emoji_options) | @fzy@/bin/fzy --lines 40 | tail -n1) if [ -n "$CHOSEN" ] then