From df539b056645c2409cebc54e1a264974700bcf33 Mon Sep 17 00:00:00 2001 From: Artemis Tosini Date: Thu, 26 Aug 2021 18:36:49 +0000 Subject: [PATCH] Add ykclip-wofi --- externals/packages/sway-scripts/default.nix | 26 +++++++++++++++++++++ home/sway.nix | 2 ++ private | 2 +- 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 externals/packages/sway-scripts/default.nix diff --git a/externals/packages/sway-scripts/default.nix b/externals/packages/sway-scripts/default.nix new file mode 100644 index 0000000..9a179fb --- /dev/null +++ b/externals/packages/sway-scripts/default.nix @@ -0,0 +1,26 @@ +{ stdenv, +lib, +writeScriptBin, +runtimeShell, +yubikey-manager, +wofi, +wl-clipboard, +gawk, +gnugrep, +coreutils }: + +writeScriptBin "ykclip-wofi" '' +#! ${runtimeShell} +PATH=${lib.makeBinPath [ yubikey-manager wofi wl-clipboard gawk gnugrep coreutils ]} +set -euo pipefail + +ykman list --serials | grep $1 > /dev/null + +name=$(ykman -d $1 oath accounts list | wofi -k /dev/null -i -d) + +line=$(ykman -d $1 oath accounts code "$name" | head -n 1) +if test -n "$line" +then + echo $line | awk '{print $NF}' | wl-copy +fi +'' diff --git a/home/sway.nix b/home/sway.nix index 7b6d45b..25e9682 100644 --- a/home/sway.nix +++ b/home/sway.nix @@ -1,6 +1,7 @@ { pkgs, lib, config, ... }: let rustybar = pkgs.callPackage ../externals/packages/rustybar { }; + sway-scripts = pkgs.callPackage ../externals/packages/sway-scripts { }; cfg = config.wayland.windowManager.sway; mod = cfg.config.modifier; extraWorkspaces = { @@ -31,6 +32,7 @@ let extraWorkspaces; in { + home.packages = [ sway-scripts ]; wayland.windowManager.sway = { enable = true; wrapperFeatures.gtk = true; diff --git a/private b/private index 5f10132..2d2356d 160000 --- a/private +++ b/private @@ -1 +1 @@ -Subproject commit 5f1013222aec99bc16bf611a24ae6605f97fb64a +Subproject commit 2d2356dc284d8cbee99f7835a7e52b9e325747ed