From c813c6193855c0078dbae4a3f729be657b742ee8 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Mon, 5 Jul 2021 13:16:34 -0500 Subject: [PATCH] Some nyxt changes, rbw and pass changes. --- awesome/init.fnl | 2 +- awesome/keybindings.fnl | 2 +- fish/config.fish | 104 +++++++++++++++++++++++++-- fish/fish_variables | 2 +- nyxt/init.lisp | 57 +++++++++++---- nyxt/{my-slynk.lisp => slynk.lisp} | 0 qutebrowser/qsettings/QtProject.conf | 4 +- qutebrowser/quickmarks | 1 + scripts/rbw-rofi | 5 ++ scripts/{rrbw => rofi-rbw} | 28 +++++--- 10 files changed, 174 insertions(+), 31 deletions(-) rename nyxt/{my-slynk.lisp => slynk.lisp} (100%) create mode 100755 scripts/rbw-rofi rename scripts/{rrbw => rofi-rbw} (53%) diff --git a/awesome/init.fnl b/awesome/init.fnl index 53458f3..1874031 100644 --- a/awesome/init.fnl +++ b/awesome/init.fnl @@ -605,8 +605,8 @@ (awful.spawn "picom --experimental-backend") (awful.spawn "/usr/lib/polkit-kde-authentication-agent-1") (awful.spawn "feh --bg-fill /home/chris/Pictures/wallpapers/RoyalKing.png") -(awful.spawn "flameshot") (awful.spawn "caffeine") (awful.spawn "libinput-gestures-setup start") (awful.spawn "bluetoothctl power on") +(awful.spawn "nextcloud --background") (awful.spawn "xset r rate 220 90") diff --git a/awesome/keybindings.fnl b/awesome/keybindings.fnl index df504eb..83c93cf 100644 --- a/awesome/keybindings.fnl +++ b/awesome/keybindings.fnl @@ -145,7 +145,7 @@ {:description "launch eshell in new emacs frame" :group "apps" }) (awful.key [ modkey ] "e" (fn [] (awful.spawn "emacsclient -c -a 'emacs'")) {:description "launch new emacs frame" :group "apps" }) - (awful.key [ modkey ] "p" (fn [] (awful.spawn "rofi-pass")) + (awful.key [ modkey ] "p" (fn [] (awful.spawn "rofi-rbw")) {:description "select pass" :group "apps" }) (awful.key [ modkey shift ] "w" (fn [] (awful.spawn "libreoffice --writer")) {:description "Open Writer" :group "apps" }) diff --git a/fish/config.fish b/fish/config.fish index 6b039e5..7b262a2 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -1,6 +1,6 @@ #!/usr/bin/env fish -set -U fish_user_paths $HOME/.local/bin $HOME/scripts $HOME/.doom-emacs/bin $HOME/.emacs.d/bin +set -U fish_user_paths $HOME/.local/bin $HOME/scripts $HOME/.doom-emacs/bin $HOME/.emacs.d/bin $HOME/.cargo/bin set TERM "xterm-256color" set EDITOR "emacsclient -c -a" set VISUAL "emacsclient -c -a emacs" @@ -202,12 +202,108 @@ starship init fish | source ### ALIASES alias yay "paru" alias yeet "paru -Rns" -alias ls "exa -l" -alias la "exa -la" +alias ls "exa --icons" +alias ll "exa -l --icons" +alias la "exa -la --icons" + +# ============================================================================= +# +# Utility functions for zoxide. +# + +# pwd based on the value of _ZO_RESOLVE_SYMLINKS. +function __zoxide_pwd + builtin pwd -L +end + +# A copy of fish's internal cd function. This makes it possible to use +# `alias cd=z` without causing an infinite loop. +if ! builtin functions -q __zoxide_cd_internal + if builtin functions -q cd + builtin functions -c cd __zoxide_cd_internal + else + alias __zoxide_cd_internal="builtin cd" +end +end + +# cd + custom logic based on the value of _ZO_ECHO. +function __zoxide_cd + __zoxide_cd_internal $argv + and builtin commandline -f repaint +end + +# ============================================================================= +# +# Hook configuration for zoxide. +# + +# Initialize hook to add new entries to the database. +if test "$__zoxide_hooked" != 1 + set __zoxide_hooked 1 + function __zoxide_hook --on-variable PWD + test -z "$fish_private_mode" + and command zoxide add -- (__zoxide_pwd) +end +end + +# ============================================================================= +# +# When using zoxide with --no-aliases, alias these internal functions as +# desired. +# + +# Jump to a directory using only keywords. +function __zoxide_z + set argc (count $argv) + if test $argc -eq 0 + __zoxide_cd $HOME + else if test "$argv" = - + __zoxide_cd - + else if begin + test $argc -eq 1; and test -d $argv[1] +end +__zoxide_cd $argv[1] +else + set -l __zoxide_result (command zoxide query --exclude (__zoxide_pwd) -- $argv) + and __zoxide_cd $__zoxide_result +end +end + +# Jump to a directory using interactive search. +function __zoxide_zi + set -l __zoxide_result (command zoxide query -i -- $argv) + and __zoxide_cd $__zoxide_result +end + +# ============================================================================= +# +# Convenient aliases for zoxide. Disable these using --no-aliases. +# + +# Remove definitions. +function __zoxide_unset + set --erase $argv >/dev/null 2>&1 + abbr --erase $argv >/dev/null 2>&1 + builtin functions --erase $argv >/dev/null 2>&1 +end + +__zoxide_unset z +alias z="__zoxide_z" + +__zoxide_unset zi +alias zi="__zoxide_zi" + +# ============================================================================= +# +# To initialize zoxide, add this to your configuration (usually +# ~/.config/fish/config.fish): +# +# zoxide init fish | source ### Start X at login if status is-login if test -z "$DISPLAY" -a "$XDG_VTNR" = 1 exec startx - end end +end + diff --git a/fish/fish_variables b/fish/fish_variables index 28e76eb..b05f60a 100644 --- a/fish/fish_variables +++ b/fish/fish_variables @@ -30,4 +30,4 @@ SETUVAR fish_pager_color_completion:\x1d SETUVAR fish_pager_color_description:B3A06D\x1eyellow SETUVAR fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan -SETUVAR fish_user_paths:/home/chris/\x2elocal/bin\x1e/home/chris/scripts\x1e/home/chris/\x2edoom\x2demacs/bin\x1e/home/chris/\x2eemacs\x2ed/bin +SETUVAR fish_user_paths:/home/chris/\x2elocal/bin\x1e/home/chris/scripts\x1e/home/chris/\x2edoom\x2demacs/bin\x1e/home/chris/\x2eemacs\x2ed/bin\x1e/home/chris/\x2ecargo/bin diff --git a/nyxt/init.lisp b/nyxt/init.lisp index 3a28b2e..0a06688 100644 --- a/nyxt/init.lisp +++ b/nyxt/init.lisp @@ -1,7 +1,27 @@ -(in-package :nyxt-user) ; While implicit, this allows SLY to know which package we are in. +(in-package #:nyxt-user) ; While implicit, this allows SLY to know which package we are in. + +(dolist (file (list (nyxt-init-file "slynk.lisp")))) + +(load-after-system :slynk (nyxt-init-file "slynk.lisp")) +;; (defvar *chris-prompt-keymap (make-keymap "chris-prompt-map")) +;; (define-key *chris-prompt-keymap* +;; "escape" 'cancel-input +;; "C-j" 'select-next +;; "C-k" 'select-previous) + +;; (define-mode chris-prompt-mode () +;; "Dummy mode for the custom key bindings in `*chris-prompt-keymap*'." +;; ((keymap-scheme (keymap:make-scheme +;; scheme:vi-insert *chris-prompt-keymap*)) +;; (visible-in-status-p nil))) + +;; Always restore history and don't ask +(define-configuration browser + ((session-restore-prompt :always-restore))) (define-configuration (prompt-buffer) - ((default-modes (append '(vi-insert-mode) %slot-default%)))) + ((default-modes (append '(vi-insert-mode + ) %slot-default%)))) ;; Create a function to launch mpv with given url (defun mpv (url) @@ -13,16 +33,22 @@ "Show a set of element hints, and copy the URL of the user inputted one." (nyxt/web-mode:query-hints "Copy element URL" (lambda (nyxt/web-mode::result) - (echo (first nyxt/web-mode::result))) + (mpv nyxt/web-mode::result)) :annotate-visible-only-p nyxt/web-mode::annotate-visible-only-p)) +;; These are my own keys that are layered over vi-normal. A lot of these +;; are similar to qutebrowser. (defvar *chris-keymap* (make-keymap "chris-map")) (define-key *chris-keymap* "K" 'switch-buffer-next "J" 'switch-buffer-previous "b" 'switch-buffer - "v" 'hint-mpv) + "v" 'hint-mpv + "d" 'delete-current-buffer + "D" 'delete-buffer + "r" 'reload-current-buffer + "R" 'reload-buffers) (define-mode chris-mode () "Dummy mode for the custom key bindings in `*chris-keymap*'." @@ -38,6 +64,14 @@ chris-mode) %slot-default%)))) +(define-configuration buffer + ((search-engines + (list + (make-instance 'search-engine + :shortcut "s" + :search-url "https://search.tfcconnection.org/?q=~a" + :fallback-url "https://search.tfcconnection.org"))))) + (define-configuration status-buffer ((style @@ -48,7 +82,7 @@ :background "#282a36" :color "#e2e4e5") ("#container" - :grid-template-columns "0px 0px 1.5fr 0px 2fr 0px 1fr 0px") + :grid-template-columns "0px 4fr 0px 2fr 0px 0px") ("#controls" :background-color "#282a36" :color "#f3f99d" @@ -135,22 +169,21 @@ (.source-content :background-color "#282a36" :color "#e2e4e5") - (".source-content td" - :background-color "#282a36" - :color "#e2e4e5") + ;; (".source-content td" + ;; :background-color "#282a36" + ;; :color "#e2e4e5") (".source-content th" :background-color "#43454f" :color "#e2e4e5") ("#selection" :background-color "#57c7ff" - :color "#e2e4e5") + :color "#34353e") (.marked :background-color "#5af78e" - :color "#e2e4e5") + :color "#34353e") (.selected :background-color "#57c7ff" - :color "#e2e4e5") + :color "#34353e") (.button :color "#e2e4e5"))))))) -(load-after-system :slynk (nyxt-init-file "my-slynk.lisp")) diff --git a/nyxt/my-slynk.lisp b/nyxt/slynk.lisp similarity index 100% rename from nyxt/my-slynk.lisp rename to nyxt/slynk.lisp diff --git a/qutebrowser/qsettings/QtProject.conf b/qutebrowser/qsettings/QtProject.conf index 0b1032d..e7c287f 100644 --- a/qutebrowser/qsettings/QtProject.conf +++ b/qutebrowser/qsettings/QtProject.conf @@ -1,6 +1,6 @@ [FileDialog] -history=file:///home/chris/Videos, file:///home/chris, file:///home/chris/Downloads, file:///home/chris/tfc, file:///home/chris/Pictures/Phone/Camera, file:///run/media/chris/LUMIX/DCIM/110_PANA -lastVisited=file:///run/media/chris/LUMIX/DCIM/110_PANA +history=file:///home/chris, file:///home/chris/Downloads, file:///home/chris/tfc, file:///home/chris/Pictures/Phone/Camera, file:///run/media/chris/LUMIX/DCIM/110_PANA +lastVisited=file:///home/chris/Downloads qtVersion=5.15.2 shortcuts=file:, file:///home/chris sidebarWidth=116 diff --git a/qutebrowser/quickmarks b/qutebrowser/quickmarks index 767160a..5a009ad 100644 --- a/qutebrowser/quickmarks +++ b/qutebrowser/quickmarks @@ -20,3 +20,4 @@ ha https://home.cochrun.xyz/lovelace/default_view tfc https://www.tfcconnection.org/ nvtfc https://www.facebook.com/NorthernValleyTFC tnc https://staff.tfcconnection.org/apps/dashboard/ +nc https://nc.cochrun.xyz/apps/files/ diff --git a/scripts/rbw-rofi b/scripts/rbw-rofi new file mode 100755 index 0000000..14460f3 --- /dev/null +++ b/scripts/rbw-rofi @@ -0,0 +1,5 @@ +#!/bin/bash +set -eu +set -o pipefail + +rbw ls --fields folder,name,user | sed 's/\t/\//g' | sort | rofi -dmenu | sed 's/^[^\/]*\///' | sed 's/\// /' | xargs -r rbw get | xclip -l 1 \ No newline at end of file diff --git a/scripts/rrbw b/scripts/rofi-rbw similarity index 53% rename from scripts/rrbw rename to scripts/rofi-rbw index 227a3a7..14ee87d 100755 --- a/scripts/rrbw +++ b/scripts/rofi-rbw @@ -1,9 +1,17 @@ #!/usr/bin/env bash -# Very basic Rofi RBW finder +# Very basic interface for pass using rofi + +# Get all password files and create an array +root=~/.password-store +CACHE=~/.local/tmp/pass_rofi +seat=seat0 + +list_passwords() { + rbw list +} prompt='search for passwords...' -ENTRY=$(rbw-list | rofi --prompt="${prompt}" -dmenu) -SECRET=$(rbw get $ENTRY) +SECRET=$(list_passwords | rofi -i -p="${prompt}" -dmenu) # Ask whether pass, user or both are required @@ -13,22 +21,22 @@ options=("Password" \ "QR-Code" \ "OTP") -option=$(printf '%s\n' "${options[@]%}" | rofi -dmenu --width 400 --lines 4 --prompt="..." --cache-file /dev/null) +option=$(printf '%s\n' "${options[@]%}" | rofi -i -dmenu -width 400 -lines 4 -prompt="...") echo $option case ${option} in Password ) echo "Test" - wtype $(pass ${SECRET} | head -n 1) + xdotool type $(rbw get ${SECRET}) ;; User ) - wtype $(pass ${SECRET} | rg user: | awk '{$1 = ""; print $0}') + xdotool type $(rbw get --full ${SECRET} | rg Username: | awk '{$1 = ""; print $0}') ;; "User and password" ) - wtype $(pass ${SECRET} | rg user: | awk '{$1 = ""; print $0}') - wtype -k TAB - wtype $(pass ${SECRET} | head -n 1) + xdotool type $(rbw get --full ${SECRET} | rg Username: | awk '{$1 = ""; print $0}') + xdotool key Tab + xdotool type $(rbw get ${SECRET}) ;; "QR-Code" ) if [[ $SECRET =~ wifi$ ]]; then @@ -43,7 +51,7 @@ case ${option} in fi ;; "OTP" ) - wtype $(pass otp ${SECRET}) + xdotool type $(rbw code ${SECRET}) ;; esac