diff --git a/awesome/keys.lua b/awesome/keys.lua index 26698f5..c9fe554 100644 --- a/awesome/keys.lua +++ b/awesome/keys.lua @@ -187,12 +187,12 @@ keys.globalkeys = gears.table.join( end, {description = "Open lock", group = "launcher"} ), - -- Generate IMEC TOTP - awful.key({modkey}, "i", + -- Generate TOTP + awful.key({modkey}, "y", function() - awful.spawn.with_shell("ykman oath accounts code \"Microsoft (IMEC)\" | cut -d ' ' -f 4 | xsel --clipboard") + awful.spawn.with_shell(os.getenv("XDG_CONFIG_HOME") .. "/rofi/rofi-ykman.sh") end, - {description = "Generate IMEC TOTP", group = "launcher"} + {description = "Generate TOTP", group = "launcher"} ), -- Spawn file manager awful.key({modkey}, "a", diff --git a/awesome/theme.lua b/awesome/theme.lua index 1efea4e..a74637b 100644 --- a/awesome/theme.lua +++ b/awesome/theme.lua @@ -19,7 +19,7 @@ theme.fg_urgent = "#ffffff" theme.fg_minimize = "#ffffff" -- Window Gap Distance -theme.useless_gap = dpi(3) +theme.useless_gap = dpi(2) -- Show Gaps if Only One Client is Visible theme.gap_single_client = false diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index fc3f28e..cc5a065 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -6,21 +6,21 @@ "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp-snippy": { "branch": "master", "commit": "c4dc31232c510cd32d4708701e6f06746d46df90" }, - "diffview.nvim": { "branch": "main", "commit": "db97e667e03294bfa9f15e544e78f3082247bf79" }, + "diffview.nvim": { "branch": "main", "commit": "7e5a85c186027cab1e825d018f07c350177077fc" }, "formatter.nvim": { "branch": "master", "commit": "44c89f09dcc220dc2a9b056e93c3a87c86e79804" }, - "lazy.nvim": { "branch": "main", "commit": "dac844ed617dda4f9ec85eb88e9629ad2add5e05" }, + "lazy.nvim": { "branch": "main", "commit": "3ad55ae678876516156cca2f361c51f7952a924b" }, "leap.nvim": { "branch": "main", "commit": "5efe985cf68fac3b6a6dfe7a75fbfaca8db2af9c" }, "lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" }, "lush.nvim": { "branch": "main", "commit": "a8f0f7b9f837887f13a61d67b40ae26188fe4d62" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "e86a4c84ff35240639643ffed56ee1c4d55f538e" }, - "mason.nvim": { "branch": "main", "commit": "b5bb138312dbd3f7729197ca659cbe5221d36a03" }, - "neogit": { "branch": "master", "commit": "b3c15c5dba0e76a3524029785d02fc897149259d" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "2997f467881ac4faa6f8c5e7065e3a672297c8ad" }, + "mason.nvim": { "branch": "main", "commit": "a51c2d063c5377ee9e58c5f9cda7c7436787be72" }, + "neogit": { "branch": "master", "commit": "00b4486197e7ad7cf98e128a3c663d79a2cc962f" }, "nvim-autopairs": { "branch": "master", "commit": "ae5b41ce880a6d850055e262d6dfebd362bb276e" }, "nvim-cmp": { "branch": "main", "commit": "51f1e11a89ec701221877532ee1a23557d291dd5" }, - "nvim-lspconfig": { "branch": "master", "commit": "0d29cad8de3b2c654315203fc1fe12fde722a18a" }, + "nvim-lspconfig": { "branch": "master", "commit": "1cfb96490c3889a2c57d1ef5e1acc59e9b47c455" }, "nvim-snippy": { "branch": "master", "commit": "ee3b830787538f259b84867c8971c4284abc4a8d" }, "nvim-tree.lua": { "branch": "master", "commit": "59e65d88db177ad1e6a8cffaafd4738420ad20b6" }, - "nvim-treesitter": { "branch": "master", "commit": "add1864bbf2d3b8e789ec6b4715bb5a4073e3b60" }, + "nvim-treesitter": { "branch": "master", "commit": "9ea7559ea99701c900b08c1f977eca6ca57eadd2" }, "nvim-web-devicons": { "branch": "master", "commit": "cfc8824cc1db316a276b36517f093baccb8e799a" }, "plenary.nvim": { "branch": "master", "commit": "267282a9ce242bbb0c5dc31445b6d353bed978bb" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" }, @@ -31,6 +31,6 @@ "vim-bracketed-paste": { "branch": "master", "commit": "45411da73cc159e4fc2138d930553d247bbfbcdc" }, "vim-rooter": { "branch": "master", "commit": "4f52ca556a0b9e257bf920658714470ea0320b7a" }, "vim-snippets": { "branch": "master", "commit": "d37486881a0a771b844a235bc3e025046088690d" }, - "vimtex": { "branch": "master", "commit": "e3d0bea39dbcb6e064db751b646c958342a3460f" }, + "vimtex": { "branch": "master", "commit": "534fd725f2475a9083b032e402c7e73b8a3fc6bb" }, "vimwiki": { "branch": "dev", "commit": "f0fe154ede6b11e3db9b058b930005a056a3d1c6" } } \ No newline at end of file diff --git a/rofi/rofi-ykman.sh b/rofi/rofi-ykman.sh new file mode 100755 index 0000000..6a6b78c --- /dev/null +++ b/rofi/rofi-ykman.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash + +# rofi-ykman +# YubiKey OATH utility + +#2019 nukeop + +print_usage() { + echo "Usage: rofi-ykman [command]" + echo + echo "Commands:" + echo " clipboard Copy the code to the clipboard. (default)" + echo " type Type the code." + echo +} + +clipboard () { + if [ $XDG_SESSION_TYPE == "wayland" ] + then + wl-copy + else + xsel --clipboard + fi +} + +type () { + if [ $XDG_SESSION_TYPE == "wayland" ] + then + wtype - + else + xargs xdotool type + fi +} + +# shortcuts +type="Alt+1" +clipboard="Alt+2" + +main() { + accounts=$(ykman oath accounts list) + + shortcuts=( + -kb-custom-1 "$type" + -kb-custom-2 "$clipboard" + ) + prompt="YubiKey OATH" + + account=$(echo "${accounts/, TOTP/\n}" | awk '{ print $0 "\0icon\x1fyubioath"; }' | rofi -dmenu -i -p "$prompt" ${shortcuts[@]}) + case $? in + 1) exit ;; + 10) command=type ;; + 11) command=clipboard ;; + *) command=$default_command ;; + esac + + code=$(ykman oath accounts code "$account") + IFS=', ' read -r -a code <<< "$code" + + case $command in + clipboard) echo -n "${code[-1]}" | clipboard;; + type) echo -n "${code[-1]}" | type;; + esac +} + +default_command="${1:-type}" + +case $default_command in + clipboard|type) ;; + *) print_usage; exit 1;; +esac + +main