From 8986d060f2f308ba768758ef9c3077f00f3d6b2a Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sun, 23 Jun 2024 14:12:17 +0200 Subject: checkpoint --- config/essentials/zsh/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'config/essentials/zsh') diff --git a/config/essentials/zsh/.gitignore b/config/essentials/zsh/.gitignore index a13c79f..524b20e 100644 --- a/config/essentials/zsh/.gitignore +++ b/config/essentials/zsh/.gitignore @@ -1,3 +1,3 @@ histfile -zcompcache +zcompcache* .zcompdump -- cgit v1.2.3 From 44c011c5988077b515204159b6930c69c0475571 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Tue, 25 Jun 2024 01:10:02 +0200 Subject: checkpoint --- bin/guiscripts/osurf-fill | 46 +++++++++++++++++++-------------------- config/essentials/vis/visrc.lua | 10 +++++---- config/essentials/zsh/.zshrc | 7 ++++++ config/essentials/zsh/widgets.zsh | 11 ++++------ 4 files changed, 40 insertions(+), 34 deletions(-) (limited to 'config/essentials/zsh') diff --git a/bin/guiscripts/osurf-fill b/bin/guiscripts/osurf-fill index 6ea8e7e..52a410d 100755 --- a/bin/guiscripts/osurf-fill +++ b/bin/guiscripts/osurf-fill @@ -1,10 +1,11 @@ #!/bin/sh -# Fills a password for a given website +# Fills a password for a given website # original script by Avalon Williams (avalonwilliams@protonmail.com) # This version uses the window id to know the url of the surf window # and to know which fifo it must use. Then it injects javascript code. # that will fill the forms with the credentials +printf '\n\n' # dependencies: # - surf fifo patch (http://surf.suckless.org/patches/fifo/) @@ -13,10 +14,9 @@ # $1: winid -fifodir="$HOME/.config/surf/fifo" -if [ -z "${winid:=$1}" ] -then - winid="$(osurfls | dmenu -c -F -i | cut -f1 -d' ')" +fifodir="$HOME/.config/surf/fifo" +if [ -z "${winid:=$1}" ]; then + winid="$(osurfls | dmenu -c -F -i | cut -f1 -d' ')" fi [ "$winid" ] || exit 1 fifo="$fifodir/$winid" @@ -24,26 +24,24 @@ fifo="$fifodir/$winid" # Get only domain name + top-level domain url="$(xprop -id "$winid" _SURF_URI | - cut -f 2 -d'"' | - sed 's,^.*://\([^/]*\)/.*,\1,' | - sed -r -e 's/^([^.]+)\.([^.]+)\.([^.]+)$/\2.\3/')" + cut -f 2 -d'"' | + sed 's,^.*://\([^/]*\)/.*,\1,' | + sed -r -e 's/^([^.]+)\.([^.]+)\.([^.]+)$/\2.\3/')" [ "$url" ] || exit 3 ->&2 printf 'url: %s\n' "$url" +printf >&2 'url: %s\n' "$url" # get pass with url and ask if multiple are found pass="$({ find $PASSWORD_STORE_DIR/websites/ -type f -name '*.gpg' | - grep "$url/" || echo; } | head -n 1 | - sed "s,$PASSWORD_STORE_DIR/,,;s/\.gpg$//" | - dmenu -c)" + grep "$url/" || echo; } | head -n 1 | + sed "s,$PASSWORD_STORE_DIR/,,;s/\.gpg$//" | + dmenu -c)" # if dmenu was stopped, exit [ $? -gt 0 ] && exit 4 # if no password was found, search through password store manually with dmenu -if [ -z "$pass" ] -then - store="${PASSWORD_STORE_DIR:-$HOME/.password-store}" - while [ -d "$store/$file" ] - do +if [ -z "$pass" ]; then + store="${PASSWORD_STORE_DIR:-$HOME/.password-store}" + while [ -d "$store/$file" ]; do choice="$(find "$store/$file" \ -maxdepth 1 -mindepth 1 \ -not -name '.*' -type d -printf "%y\t%f\n" -o \ @@ -56,22 +54,24 @@ then done pass="$file" fi ->&2 printf 'pass: %s\n' "$pass" +printf >&2 'pass: %s\n' "$pass" herbe "filling ${pass#websites/}" & # Get password and username in variables with only one call to 'pass' # escape single quotes eval "$(pass show "$pass" | - sed -n "1s/'/'\\\\''/g;1s/.*/password='&'/p;s/^login: \?\(.\+\)/username='\1'/p")" + sed -n "1s/'/'\\\\''/g;1s/.*/password='&'/p;s/^login: \?\(.\+\)/username='\1'/p")" printf '%s : %s\n' "$username" "$password" # Escape quotes and backslashes for javascript javascript_escape() { - printf '%s' "$1" | sed -s 's,['\''"\\\\],\\&,g' + # The string will be inside double quotes + # we need to add 2 backslashes, one for shell (heredoc) and one for javascript + printf '%s' "$1" | sed -s 's,["\\],\\\\&,g' } js() { -cat <> "$fifo" +echo "inject $(printjs)" >>"$fifo" diff --git a/config/essentials/vis/visrc.lua b/config/essentials/vis/visrc.lua index 78f7cfe..f9242c8 100644 --- a/config/essentials/vis/visrc.lua +++ b/config/essentials/vis/visrc.lua @@ -119,10 +119,12 @@ end) vis.events.subscribe(vis.events.WIN_OPEN, function(win) -- luacheck: no unused args -- automatically cd in parent dir of file - if win.file and win.file.path then - local dir = win.file.path:match(".*/") - vis:command("cd " .. dir) - end + vis:command_register("cdp", function() + if win.file and win.file.path then + local dir = win.file.path:match(".*/") + vis:command("cd " .. dir) + end + end, "Cd to parent dir of file") win.options.relativenumbers = true diff --git a/config/essentials/zsh/.zshrc b/config/essentials/zsh/.zshrc index 5981fd9..63e3d62 100644 --- a/config/essentials/zsh/.zshrc +++ b/config/essentials/zsh/.zshrc @@ -113,6 +113,13 @@ add-zsh-hook -Uz precmd set_wt (){ print -Pn "\e]0;%n@%m on %~\a"; } ## automatic ls after cd add-zsh-hook -Uz chpwd (){ [ "$PWD" = "$HOME" ] || ls -A; } +bottom_margin() { + TBUFFER="$BUFFER" + BUFFER="\n\n\n" + BUFFER="\n\n\n $TBUFFER" +} +add-zsh-hook -Uz precmd bottom_margin + ### Variables ## Run menuscripts with fzf export MENUCMD='fzf' diff --git a/config/essentials/zsh/widgets.zsh b/config/essentials/zsh/widgets.zsh index 233ea65..cce9fbc 100644 --- a/config/essentials/zsh/widgets.zsh +++ b/config/essentials/zsh/widgets.zsh @@ -1,8 +1,7 @@ # Surround line in variable -surround_in_var() -{ - BUFFER=" \"\$($BUFFER)\"" - zle beginning-of-line +surround_in_var() { + BUFFER=" \"\$($BUFFER)\"" + zle beginning-of-line } zle -N surround_in_var bindkey '\ev' surround_in_var @@ -10,9 +9,7 @@ bindkey '\ev' surround_in_var # Insert output from the previous command zmodload -i zsh/parameter insert-last-command-output() { - LBUFFER+="$(eval $history[$((HISTCMD-1))])" + LBUFFER+="$(eval $history[$((HISTCMD - 1))])" } zle -N insert-last-command-output bindkey "^Xl" insert-last-command-output - -# -- cgit v1.2.3 From 9e5643ecedd802d870fa586d3104d509c3d7f2cb Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Tue, 25 Jun 2024 03:03:49 +0200 Subject: checkpoint --- config/essentials/zsh/.zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'config/essentials/zsh') diff --git a/config/essentials/zsh/.zshrc b/config/essentials/zsh/.zshrc index 63e3d62..3952cec 100644 --- a/config/essentials/zsh/.zshrc +++ b/config/essentials/zsh/.zshrc @@ -42,7 +42,7 @@ plug "zsh-users/zsh-completions" plug "MichaelAquilina/zsh-auto-notify" export AUTO_NOTIFY_TITLE="zsh" export AUTO_NOTIFY_BODY="%command [%exit_code]" -AUTO_NOTIFY_IGNORE+=("gurk" "ttyper" "pulsemixer" "tmux" "btop" "vis" "clock") +AUTO_NOTIFY_IGNORE+=("abduco" "gurk" "ttyper" "pulsemixer" "tmux" "btop" "vis" "clock") # Substring search settings export HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND="bg=blue,fg=black,bold" -- cgit v1.2.3