diff options
author | ene <ene@sils.li> | 2023-03-12 15:01:33 +0100 |
---|---|---|
committer | ene <ene@sils.li> | 2023-03-12 15:01:33 +0100 |
commit | a6d319f865e36f1ad51532614ba74585802aebcd (patch) | |
tree | bd72deddb9f96e04adb7095f615a14d2f4010d63 /home-manager/config/lf | |
parent | Fix(hm/conf/lf): Rewrite some of the cmds (diff) | |
download | nixos-config-a6d319f865e36f1ad51532614ba74585802aebcd.tar.gz nixos-config-a6d319f865e36f1ad51532614ba74585802aebcd.zip |
Fix(hm/conf/lf): Update to new shell lib version
Diffstat (limited to 'home-manager/config/lf')
21 files changed, 29 insertions, 36 deletions
diff --git a/home-manager/config/lf/cmds/archive b/home-manager/config/lf/cmds/archive index b25cb3e1..d9a0e88c 100755 --- a/home-manager/config/lf/cmds/archive +++ b/home-manager/config/lf/cmds/archive @@ -4,7 +4,7 @@ # . ~/.local/lib/shell/lib . %SHELL_LIBRARY_PATH -LIB_TEMP_DIR_FOR_SCRIPT=$(mktemp -d) + # Option '-f' disables pathname expansion which can be useful when $f, $fs, and # $fx variables contain names with '*' or '?' characters. However, this option @@ -12,8 +12,7 @@ LIB_TEMP_DIR_FOR_SCRIPT=$(mktemp -d) # times. set -f -archivers=$(mktmp) -echo "gzip xz 7z zip" > $archivers; +archivers=$(tmp 'echo "gzip xz 7z zip"'); readp "File Name: " name diff --git a/home-manager/config/lf/cmds/broot_jump b/home-manager/config/lf/cmds/broot_jump index 01273507..51d21368 100755 --- a/home-manager/config/lf/cmds/broot_jump +++ b/home-manager/config/lf/cmds/broot_jump @@ -4,7 +4,7 @@ # . ~/.local/lib/shell/lib . %SHELL_LIBRARY_PATH -LIB_TEMP_DIR_FOR_SCRIPT=$(mktemp -d) + tmp=$(mktmp) res="$(broot --outcmd $tmp && cat $tmp | sed 's/cd //')" diff --git a/home-manager/config/lf/cmds/chmod b/home-manager/config/lf/cmds/chmod index 9cdebffc..ef7aeb3f 100755 --- a/home-manager/config/lf/cmds/chmod +++ b/home-manager/config/lf/cmds/chmod @@ -4,16 +4,13 @@ # . ~/.local/lib/shell/lib . %SHELL_LIBRARY_PATH -LIB_TEMP_DIR_FOR_SCRIPT=$(mktemp -d) -readp "Mode Bits: " bits -files=$(mktmp); -echo "$fx" > $files; +readp "Mode Bits: " bits while read -r file; do chmod "$bits" "$file" -done < "$files" +done < "$(tmp "echo $fx")" lf -remote 'send reload' diff --git a/home-manager/config/lf/cmds/clear_trash b/home-manager/config/lf/cmds/clear_trash index 1de81b7f..f6372606 100755 --- a/home-manager/config/lf/cmds/clear_trash +++ b/home-manager/config/lf/cmds/clear_trash @@ -4,7 +4,7 @@ # . ~/.local/lib/shell/lib . %SHELL_LIBRARY_PATH -LIB_TEMP_DIR_FOR_SCRIPT=$(mktemp -d) + # could also use --force, for instand removal trash list | fzf --multi | awk '{print $NF}' | xargs trash empty --match=exact diff --git a/home-manager/config/lf/cmds/dl_file b/home-manager/config/lf/cmds/dl_file index dfd11f69..e7a1fbcb 100755 --- a/home-manager/config/lf/cmds/dl_file +++ b/home-manager/config/lf/cmds/dl_file @@ -4,26 +4,26 @@ # . ~/.local/lib/shell/lib . %SHELL_LIBRARY_PATH -LIB_TEMP_DIR_FOR_SCRIPT=$(mktemp -d) + # Provides the ability to download a file by dropping it into a window url=$(dragon -t -x) if [ -n "$url" ]; then - printf "File Name: " + prompt "File Name: " name="" while [ -z $name ] || [ -e $name ] do read -r name if [ -e "$name" ]; then - printf "File already exists, overwrite (y|n): " + prompt "File already exists, overwrite [y|N]: " read -r ans if [ "$ans" = "y" ]; then break else - printf "File Name: " + prompt "File Name: " fi fi done @@ -31,7 +31,7 @@ if [ -n "$url" ]; then # Download the file with curl [ -n "$name" ] && curl -o "$name" "$url" || die "curl failed" else - die "Url is not valid!" + die "Url is null!" fi if [ -d "$LIB_TEMP_DIR_FOR_SCRIPT" ];then rm -r "$LIB_TEMP_DIR_FOR_SCRIPT"; fi diff --git a/home-manager/config/lf/cmds/dragon b/home-manager/config/lf/cmds/dragon index 512d04b0..52d3b49a 100755 --- a/home-manager/config/lf/cmds/dragon +++ b/home-manager/config/lf/cmds/dragon @@ -4,7 +4,7 @@ # . ~/.local/lib/shell/lib . %SHELL_LIBRARY_PATH -LIB_TEMP_DIR_FOR_SCRIPT=$(mktemp -d) + dragon -a -x "$fx" diff --git a/home-manager/config/lf/cmds/dragon_individual b/home-manager/config/lf/cmds/dragon_individual index bcda1288..4a9fd497 100755 --- a/home-manager/config/lf/cmds/dragon_individual +++ b/home-manager/config/lf/cmds/dragon_individual @@ -4,7 +4,7 @@ # . ~/.local/lib/shell/lib . %SHELL_LIBRARY_PATH -LIB_TEMP_DIR_FOR_SCRIPT=$(mktemp -d) + dragon "$fx" diff --git a/home-manager/config/lf/cmds/dragon_stay b/home-manager/config/lf/cmds/dragon_stay index be75e233..595a671d 100755 --- a/home-manager/config/lf/cmds/dragon_stay +++ b/home-manager/config/lf/cmds/dragon_stay @@ -4,7 +4,7 @@ # . ~/.local/lib/shell/lib . %SHELL_LIBRARY_PATH -LIB_TEMP_DIR_FOR_SCRIPT=$(mktemp -d) + dragon -a "$fx" diff --git a/home-manager/config/lf/cmds/fzf_jump b/home-manager/config/lf/cmds/fzf_jump index 464a9fd4..e3058810 100755 --- a/home-manager/config/lf/cmds/fzf_jump +++ b/home-manager/config/lf/cmds/fzf_jump @@ -4,7 +4,7 @@ # . ~/.local/lib/shell/lib . %SHELL_LIBRARY_PATH -LIB_TEMP_DIR_FOR_SCRIPT=$(mktemp -d) + res="$(fd . --maxdepth 3 | fzf --header='Jump to location')" if [ -f "$res" ]; then diff --git a/home-manager/config/lf/cmds/help b/home-manager/config/lf/cmds/help index d7a28f71..4291c2bd 100755 --- a/home-manager/config/lf/cmds/help +++ b/home-manager/config/lf/cmds/help @@ -4,7 +4,7 @@ # . ~/.local/lib/shell/lib . %SHELL_LIBRARY_PATH -LIB_TEMP_DIR_FOR_SCRIPT=$(mktemp -d) + cat ~/.config/lf/lfrc | less # TODO make this better diff --git a/home-manager/config/lf/cmds/mk_dir b/home-manager/config/lf/cmds/mk_dir index bfd6b2df..23175596 100755 --- a/home-manager/config/lf/cmds/mk_dir +++ b/home-manager/config/lf/cmds/mk_dir @@ -4,7 +4,7 @@ # . ~/.local/lib/shell/lib . %SHELL_LIBRARY_PATH -LIB_TEMP_DIR_FOR_SCRIPT=$(mktemp -d) + readp "Directory Name: " dir mkdir "$dir" diff --git a/home-manager/config/lf/cmds/mk_file b/home-manager/config/lf/cmds/mk_file index a7e4cacf..518caffc 100755 --- a/home-manager/config/lf/cmds/mk_file +++ b/home-manager/config/lf/cmds/mk_file @@ -4,7 +4,7 @@ # . ~/.local/lib/shell/lib . %SHELL_LIBRARY_PATH -LIB_TEMP_DIR_FOR_SCRIPT=$(mktemp -d) + readp "File Name: " name "$EDITOR" "$name" diff --git a/home-manager/config/lf/cmds/mk_ln b/home-manager/config/lf/cmds/mk_ln index 6b9e2b30..6b9e9761 100755 --- a/home-manager/config/lf/cmds/mk_ln +++ b/home-manager/config/lf/cmds/mk_ln @@ -4,7 +4,7 @@ # . ~/.local/lib/shell/lib . %SHELL_LIBRARY_PATH -LIB_TEMP_DIR_FOR_SCRIPT=$(mktemp -d) + while IFS= read -r i;do set -- "$@" "$i" @@ -25,8 +25,8 @@ case "$mode" in ans="$(basename "$file")" while [ -e "$ans" ];do - printf "\"%s\" already exists, new name for link: " "$ans" - read -r ans + prompt "$ans already exists, new name for link: " + read -r ans < /dev/tty done ln -s "$file" "$(pwd)/$ans" diff --git a/home-manager/config/lf/cmds/mk_scr b/home-manager/config/lf/cmds/mk_scr index 12efe315..82ea3733 100755 --- a/home-manager/config/lf/cmds/mk_scr +++ b/home-manager/config/lf/cmds/mk_scr @@ -4,7 +4,7 @@ # . ~/.local/lib/shell/lib . %SHELL_LIBRARY_PATH -LIB_TEMP_DIR_FOR_SCRIPT=$(mktemp -d) + script=$(mktmp) cat << EOF > $script @@ -13,9 +13,6 @@ cat << EOF > $script # shellcheck source=/dev/null . %SHELL_LIBRARY_PATH -LIB_TEMP_DIR_FOR_SCRIPT=\$(mktemp -d) - - if [ -d "\$LIB_TEMP_DIR_FOR_SCRIPT" ];then rm -r "\$LIB_TEMP_DIR_FOR_SCRIPT"; fi diff --git a/home-manager/config/lf/cmds/open b/home-manager/config/lf/cmds/open index e7f1efd7..78cef374 100755 --- a/home-manager/config/lf/cmds/open +++ b/home-manager/config/lf/cmds/open @@ -4,7 +4,7 @@ # . ~/.local/lib/shell/lib . %SHELL_LIBRARY_PATH -LIB_TEMP_DIR_FOR_SCRIPT=$(mktemp -d) + case $(file --mime-type "$f" -bL) in text/*|application/json) "$EDITOR" "$f";; diff --git a/home-manager/config/lf/cmds/open_config b/home-manager/config/lf/cmds/open_config index 342183e0..d04f01b9 100755 --- a/home-manager/config/lf/cmds/open_config +++ b/home-manager/config/lf/cmds/open_config @@ -4,7 +4,7 @@ # . ~/.local/lib/shell/lib . %SHELL_LIBRARY_PATH -LIB_TEMP_DIR_FOR_SCRIPT=$(mktemp -d) + "$EDITOR" "$(bookmenu -b ~/.config/bookmenu/configs -f fzf -o)" # TODO implement this diff --git a/home-manager/config/lf/cmds/restore_trash b/home-manager/config/lf/cmds/restore_trash index 02527b48..fff7cb6c 100755 --- a/home-manager/config/lf/cmds/restore_trash +++ b/home-manager/config/lf/cmds/restore_trash @@ -4,7 +4,7 @@ # . ~/.local/lib/shell/lib . %SHELL_LIBRARY_PATH -LIB_TEMP_DIR_FOR_SCRIPT=$(mktemp -d) + trash list | fzf --multi | awk '{print $NF}' | xargs trash restore --match=exact diff --git a/home-manager/config/lf/cmds/set_wall_paper b/home-manager/config/lf/cmds/set_wall_paper index 637dddd5..2d9e0b4a 100755 --- a/home-manager/config/lf/cmds/set_wall_paper +++ b/home-manager/config/lf/cmds/set_wall_paper @@ -4,7 +4,7 @@ # . ~/.local/lib/shell/lib . %SHELL_LIBRARY_PATH -LIB_TEMP_DIR_FOR_SCRIPT=$(mktemp -d) + die "No yet implemented" # TODO do what the 'die' says #sed -i "s,export AWMWALLPAPER='.*',export AWMWALLPAPER='${f}'," ${ZDOTDIR}/.zshenv diff --git a/home-manager/config/lf/cmds/stripspace b/home-manager/config/lf/cmds/stripspace index bcbfa018..7cefdf93 100755 --- a/home-manager/config/lf/cmds/stripspace +++ b/home-manager/config/lf/cmds/stripspace @@ -4,7 +4,7 @@ # . ~/.local/lib/shell/lib . %SHELL_LIBRARY_PATH -LIB_TEMP_DIR_FOR_SCRIPT=$(mktemp -d) + files=$(mktmp); echo "$fx" > $files; diff --git a/home-manager/config/lf/cmds/trash b/home-manager/config/lf/cmds/trash index ca68cfc1..e6e74505 100755 --- a/home-manager/config/lf/cmds/trash +++ b/home-manager/config/lf/cmds/trash @@ -4,7 +4,7 @@ # . ~/.local/lib/shell/lib . %SHELL_LIBRARY_PATH -LIB_TEMP_DIR_FOR_SCRIPT=$(mktemp -d) + #files=$(printf "$fx" | tr '\n' ';') # diff --git a/home-manager/config/lf/cmds/unarchive b/home-manager/config/lf/cmds/unarchive index a28879da..85cbf22b 100755 --- a/home-manager/config/lf/cmds/unarchive +++ b/home-manager/config/lf/cmds/unarchive @@ -4,7 +4,7 @@ # . ~/.local/lib/shell/lib . %SHELL_LIBRARY_PATH -LIB_TEMP_DIR_FOR_SCRIPT=$(mktemp -d) + # extract the current file with the right command # (xkcd link: https://xkcd.com/1168/) |