about summary refs log tree commit diff stats
path: root/home-manager/config/lf/cmds
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-05-06 22:10:50 +0200
committerSoispha <soispha@vhack.eu>2023-05-09 19:33:23 +0200
commite24fdf517619e84fbba268b0d90627b185665cd6 (patch)
treefee010c3a92fa0ef9ce22b6b1731a638fd6e9484 /home-manager/config/lf/cmds
parentFix(hm/conf/git): Remove credential cache (diff)
downloadnixos-config-e24fdf517619e84fbba268b0d90627b185665cd6.tar.gz
nixos-config-e24fdf517619e84fbba268b0d90627b185665cd6.zip
Refactor(hm/conf/lf): Separate keybindings and commands
Diffstat (limited to 'home-manager/config/lf/cmds')
-rwxr-xr-xhome-manager/config/lf/cmds/archive39
-rwxr-xr-xhome-manager/config/lf/cmds/broot_jump17
-rwxr-xr-xhome-manager/config/lf/cmds/chmod14
-rwxr-xr-xhome-manager/config/lf/cmds/clear_trash9
-rwxr-xr-xhome-manager/config/lf/cmds/dl_file34
-rwxr-xr-xhome-manager/config/lf/cmds/dragon8
-rwxr-xr-xhome-manager/config/lf/cmds/dragon_individual8
-rwxr-xr-xhome-manager/config/lf/cmds/dragon_stay8
-rwxr-xr-xhome-manager/config/lf/cmds/fzf_jump14
-rwxr-xr-xhome-manager/config/lf/cmds/help8
-rwxr-xr-xhome-manager/config/lf/cmds/mk_dir9
-rwxr-xr-xhome-manager/config/lf/cmds/mk_file9
-rwxr-xr-xhome-manager/config/lf/cmds/mk_ln37
-rwxr-xr-xhome-manager/config/lf/cmds/mk_scr31
-rwxr-xr-xhome-manager/config/lf/cmds/open12
-rwxr-xr-xhome-manager/config/lf/cmds/open_config8
-rwxr-xr-xhome-manager/config/lf/cmds/restore_trash8
-rwxr-xr-xhome-manager/config/lf/cmds/set_wall_paper11
-rwxr-xr-xhome-manager/config/lf/cmds/stripspace32
-rwxr-xr-xhome-manager/config/lf/cmds/trash22
-rwxr-xr-xhome-manager/config/lf/cmds/unarchive22
21 files changed, 0 insertions, 360 deletions
diff --git a/home-manager/config/lf/cmds/archive b/home-manager/config/lf/cmds/archive
deleted file mode 100755
index fd032dd4..00000000
--- a/home-manager/config/lf/cmds/archive
+++ /dev/null
@@ -1,39 +0,0 @@
-#! /usr/bin/env dash
-# shellcheck disable=SC2086
-# shellcheck source=/dev/null
-# . ~/.local/lib/shell/lib
-. %SHELL_LIBRARY_PATH
-
-# Option '-f' disables pathname expansion which can be useful when $f, $fs, and
-# $fx variables contain names with '*' or '?' characters. However, this option
-# is used selectively within individual commands as it can be limiting at
-# times.
-set -f
-
-archivers=$(tmp 'echo "gzip xz 7z zip"');
-
-readp "File Name: " name;
-
-FX="$(awk -v Root="$(if [ "$(pwd)" = "/" ]; then pwd; else echo "$(pwd)/";fi)" '{
-for (i=1; i<=NF; i++) {
-    gsub(Root, "", $i);
-    print $i;
-}
-}' "$(tmp "echo \"$fx\" | tr '\n' ' '")")";
-
-case $(awk '{for (i=1; i<=NF; i++) print $i}' $archivers | fzf) in
-    "gzip")
-        tar -czf "$name".tar.gz $FX
-        ;;
-    "xz")
-        tar -cf "$name".tar $FX
-        xz -z -9 -e -T0 "$name".tar
-        ;;
-    "7z")
-        7z a "$name".7z $FX
-        ;;
-    "zip")
-        zip --symlinks -r "$name".zip $FX
-        ;;
-esac
-# vim: ft=sh
diff --git a/home-manager/config/lf/cmds/broot_jump b/home-manager/config/lf/cmds/broot_jump
deleted file mode 100755
index ff62ec90..00000000
--- a/home-manager/config/lf/cmds/broot_jump
+++ /dev/null
@@ -1,17 +0,0 @@
-#! /usr/bin/env dash
-# shellcheck disable=SC2086
-# shellcheck source=/dev/null
-# . ~/.local/lib/shell/lib
-. %SHELL_LIBRARY_PATH
-
-tmp=$(mktmp)
-res="$(broot --outcmd $tmp && cat $tmp | sed 's/cd //')"
-
-if [ -f "$res" ]; then
-    cmd="select"
-elif [ -d "$res" ]; then
-    cmd="cd"
-fi
-
-lf -remote "send $id $cmd \"$res\""
-# vim: ft=sh
diff --git a/home-manager/config/lf/cmds/chmod b/home-manager/config/lf/cmds/chmod
deleted file mode 100755
index b1682090..00000000
--- a/home-manager/config/lf/cmds/chmod
+++ /dev/null
@@ -1,14 +0,0 @@
-#! /usr/bin/env dash
-# shellcheck disable=SC2086
-# shellcheck source=/dev/null
-# . ~/.local/lib/shell/lib
-. %SHELL_LIBRARY_PATH
-
-readp "Mode Bits: " bits
-
-while read -r file; do
-    chmod "$bits" "$file"
-done < "$(tmp "echo $fx")"
-
-lf -remote 'send reload'
-# vim: ft=sh
diff --git a/home-manager/config/lf/cmds/clear_trash b/home-manager/config/lf/cmds/clear_trash
deleted file mode 100755
index e1ee3d1e..00000000
--- a/home-manager/config/lf/cmds/clear_trash
+++ /dev/null
@@ -1,9 +0,0 @@
-#! /usr/bin/env dash
-# shellcheck disable=SC2086
-# shellcheck source=/dev/null
-# . ~/.local/lib/shell/lib
-. %SHELL_LIBRARY_PATH
-
-# could also use --force, for instand removal
-trash list | fzf --multi | awk '{print $NF}' | xargs trash empty --match=exact
-# vim: ft=sh
diff --git a/home-manager/config/lf/cmds/dl_file b/home-manager/config/lf/cmds/dl_file
deleted file mode 100755
index 373386f8..00000000
--- a/home-manager/config/lf/cmds/dl_file
+++ /dev/null
@@ -1,34 +0,0 @@
-#! /usr/bin/env dash
-# shellcheck disable=SC2086
-# shellcheck source=/dev/null
-# . ~/.local/lib/shell/lib
-. %SHELL_LIBRARY_PATH
-
-# Provides the ability to download a file by dropping it into a window
-
-url=$(dragon -t -x)
-
-if [ -n "$url" ]; then
-  prompt "File Name: "
-  name=""
-  while [ -z $name ] || [ -e $name ]
-  do
-    read -r name
-    if [ -e "$name" ]; then
-      prompt "File already exists, overwrite [y|N]: "
-      read -r ans
-
-      if [ "$ans" = "y" ]; then
-        break
-      else
-        prompt "File Name: "
-      fi
-    fi
-  done
-
-  # Download the file with curl
-  [ -n "$name" ] && curl -o "$name" "$url" || die "curl failed"
-else
-  die "Url is null!"
-fi
-# vim: ft=sh
diff --git a/home-manager/config/lf/cmds/dragon b/home-manager/config/lf/cmds/dragon
deleted file mode 100755
index fce161be..00000000
--- a/home-manager/config/lf/cmds/dragon
+++ /dev/null
@@ -1,8 +0,0 @@
-#! /usr/bin/env dash
-# shellcheck disable=SC2086
-# shellcheck source=/dev/null
-# . ~/.local/lib/shell/lib
-. %SHELL_LIBRARY_PATH
-
-dragon -a -x "$fx"
-# vim: ft=sh
diff --git a/home-manager/config/lf/cmds/dragon_individual b/home-manager/config/lf/cmds/dragon_individual
deleted file mode 100755
index 7adf6924..00000000
--- a/home-manager/config/lf/cmds/dragon_individual
+++ /dev/null
@@ -1,8 +0,0 @@
-#! /usr/bin/env dash
-# shellcheck disable=SC2086
-# shellcheck source=/dev/null
-# . ~/.local/lib/shell/lib
-. %SHELL_LIBRARY_PATH
-
-dragon "$fx"
-# vim: ft=sh
diff --git a/home-manager/config/lf/cmds/dragon_stay b/home-manager/config/lf/cmds/dragon_stay
deleted file mode 100755
index aff9d01d..00000000
--- a/home-manager/config/lf/cmds/dragon_stay
+++ /dev/null
@@ -1,8 +0,0 @@
-#! /usr/bin/env dash
-# shellcheck disable=SC2086
-# shellcheck source=/dev/null
-# . ~/.local/lib/shell/lib
-. %SHELL_LIBRARY_PATH
-
-dragon -a "$fx"
-# vim: ft=sh
diff --git a/home-manager/config/lf/cmds/fzf_jump b/home-manager/config/lf/cmds/fzf_jump
deleted file mode 100755
index e0995761..00000000
--- a/home-manager/config/lf/cmds/fzf_jump
+++ /dev/null
@@ -1,14 +0,0 @@
-#! /usr/bin/env dash
-# shellcheck disable=SC2086
-# shellcheck source=/dev/null
-# . ~/.local/lib/shell/lib
-. %SHELL_LIBRARY_PATH
-
-res="$(fd . --maxdepth 3 | fzf --header='Jump to location')"
-if [ -f "$res" ]; then
-    cmd="select"
-elif [ -d "$res" ]; then
-    cmd="cd"
-fi
-lf -remote "send $id $cmd \"$res\""
-# vim: ft=sh
diff --git a/home-manager/config/lf/cmds/help b/home-manager/config/lf/cmds/help
deleted file mode 100755
index 4ec06648..00000000
--- a/home-manager/config/lf/cmds/help
+++ /dev/null
@@ -1,8 +0,0 @@
-#! /usr/bin/env dash
-# shellcheck disable=SC2086
-# shellcheck source=/dev/null
-# . ~/.local/lib/shell/lib
-. %SHELL_LIBRARY_PATH
-
-cat ~/.config/lf/lfrc | less # TODO make this better
-# vim: ft=sh
diff --git a/home-manager/config/lf/cmds/mk_dir b/home-manager/config/lf/cmds/mk_dir
deleted file mode 100755
index fb69cf92..00000000
--- a/home-manager/config/lf/cmds/mk_dir
+++ /dev/null
@@ -1,9 +0,0 @@
-#! /usr/bin/env dash
-# shellcheck disable=SC2086
-# shellcheck source=/dev/null
-# . ~/.local/lib/shell/lib
-. %SHELL_LIBRARY_PATH
-
-readp "Directory Name: " dir
-mkdir "$dir"
-# vim: ft=sh
diff --git a/home-manager/config/lf/cmds/mk_file b/home-manager/config/lf/cmds/mk_file
deleted file mode 100755
index eef8df4b..00000000
--- a/home-manager/config/lf/cmds/mk_file
+++ /dev/null
@@ -1,9 +0,0 @@
-#! /usr/bin/env dash
-# shellcheck disable=SC2086
-# shellcheck source=/dev/null
-# . ~/.local/lib/shell/lib
-. %SHELL_LIBRARY_PATH
-
-readp "File Name: " name
-"$EDITOR" "$name"
-# vim: ft=sh
diff --git a/home-manager/config/lf/cmds/mk_ln b/home-manager/config/lf/cmds/mk_ln
deleted file mode 100755
index 066150bd..00000000
--- a/home-manager/config/lf/cmds/mk_ln
+++ /dev/null
@@ -1,37 +0,0 @@
-#! /usr/bin/env dash
-# shellcheck disable=SC2086
-# shellcheck source=/dev/null
-# . ~/.local/lib/shell/lib
-. %SHELL_LIBRARY_PATH
-
-while IFS= read -r i;do
-    set -- "$@" "$i"
-done < "$(tmp 'cat ~/.local/share/lf/files')"
-
-mode="$1"
-shift
-
-if [ "$#" -lt 1 ]; then
-    msg "no files to link"
-    exit 0
-fi
-
-case "$mode" in
-    copy)
-        while [ "$#" -gt 0 ]; do
-            file="$1"
-            ans="$(basename "$file")"
-
-            while [ -e "$ans" ];do
-                prompt "$ans already exists, new name for link: "
-                read -r ans
-            done
-
-            ln -s "$file" "$(pwd)/$ans"
-            shift
-        done
-        ;;
-esac
-rm ~/.local/share/lf/files
-# lf -remote "send clear"
-# vim: ft=sh
diff --git a/home-manager/config/lf/cmds/mk_scr b/home-manager/config/lf/cmds/mk_scr
deleted file mode 100755
index 6857e8f6..00000000
--- a/home-manager/config/lf/cmds/mk_scr
+++ /dev/null
@@ -1,31 +0,0 @@
-#! /usr/bin/env dash
-# shellcheck disable=SC2086
-# shellcheck source=/dev/null
-# . ~/.local/lib/shell/lib
-. %SHELL_LIBRARY_PATH
-
-script=$(mktmp)
-cat << EOF > $script
-#!/usr/bin/env dash
-# shellcheck disable=SC2086
-# shellcheck source=/dev/null
-. %SHELL_LIBRARY_PATH
-
-
-
-EOF
-
-readp "Script Name: " script_name
-scr="$(pwd)"/"$script_name"
-
-while [ -e "$scr" ];do
-    readp "$script_name already exists, new name for script: " script_name
-    scr="$(pwd)"/"$script_name"
-done
-
-cat "$script" > "$scr"
-chmod +x "$scr"
-
-
-"$VISUAL" "$scr"
-# vim: ft=sh
diff --git a/home-manager/config/lf/cmds/open b/home-manager/config/lf/cmds/open
deleted file mode 100755
index 2065eee3..00000000
--- a/home-manager/config/lf/cmds/open
+++ /dev/null
@@ -1,12 +0,0 @@
-#! /usr/bin/env dash
-# shellcheck disable=SC2086
-# shellcheck source=/dev/null
-# . ~/.local/lib/shell/lib
-. %SHELL_LIBRARY_PATH
-
-case $(file --mime-type "$f" -bL) in
-    text/*|application/json) "$EDITOR" "$f";;
-    image/*) "$IVIEWER" "$f";;
-    *) xdg-open "$f";;
-esac
-# vim: ft=sh
diff --git a/home-manager/config/lf/cmds/open_config b/home-manager/config/lf/cmds/open_config
deleted file mode 100755
index 55ae68cb..00000000
--- a/home-manager/config/lf/cmds/open_config
+++ /dev/null
@@ -1,8 +0,0 @@
-#! /usr/bin/env dash
-# shellcheck disable=SC2086
-# shellcheck source=/dev/null
-# . ~/.local/lib/shell/lib
-. %SHELL_LIBRARY_PATH
-
-"$EDITOR" "$(bookmenu -b ~/.config/bookmenu/configs -f fzf -o)" # TODO implement this
-# vim: ft=sh
diff --git a/home-manager/config/lf/cmds/restore_trash b/home-manager/config/lf/cmds/restore_trash
deleted file mode 100755
index 22c16888..00000000
--- a/home-manager/config/lf/cmds/restore_trash
+++ /dev/null
@@ -1,8 +0,0 @@
-#! /usr/bin/env dash
-# shellcheck disable=SC2086
-# shellcheck source=/dev/null
-# . ~/.local/lib/shell/lib
-. %SHELL_LIBRARY_PATH
-
-trash list | fzf --multi | awk '{print $NF}' | xargs trash restore --match=exact
-# vim: ft=sh
diff --git a/home-manager/config/lf/cmds/set_wall_paper b/home-manager/config/lf/cmds/set_wall_paper
deleted file mode 100755
index 50cc9656..00000000
--- a/home-manager/config/lf/cmds/set_wall_paper
+++ /dev/null
@@ -1,11 +0,0 @@
-#! /usr/bin/env dash
-# shellcheck disable=SC2086
-# shellcheck source=/dev/null
-# . ~/.local/lib/shell/lib
-. %SHELL_LIBRARY_PATH
-
-die "No yet implemented" # TODO do what the 'die' says
-#sed -i "s,export AWMWALLPAPER='.*',export AWMWALLPAPER='${f}'," ${ZDOTDIR}/.zshenv
-#swaybg -i "$f" &
-#feh --bg-max --no-fehbg "$f"
-# vim: ft=sh
diff --git a/home-manager/config/lf/cmds/stripspace b/home-manager/config/lf/cmds/stripspace
deleted file mode 100755
index 65dabc4c..00000000
--- a/home-manager/config/lf/cmds/stripspace
+++ /dev/null
@@ -1,32 +0,0 @@
-#! /usr/bin/env dash
-# shellcheck disable=SC2086
-# shellcheck source=/dev/null
-# . ~/.local/lib/shell/lib
-. %SHELL_LIBRARY_PATH
-
-files=$(mktmp);
-echo "$fx" > $files;
-
-awk_source=$(mktmp);
-cat << OFT > $awk_source
-BEGIN {FS=" "}
-{for (i=1; i != NF + 1; i++)
-    if (i == NF) {
-        parts[i]=tolower(\$i);
-    } else {
-        parts[i]=tolower(\$i"_");
-    }
-}
-END {for (i in parts) printf parts[i]}
-OFT
-
-while read -r file; do
-    dirty_name=$(mktmp)
-    basename "$file" > $dirty_name;
-    clean_name=$(awk -f "$awk_source" "$dirty_name");
-
-    [ -e "$clean_name" ] && die "file \"$clean_name\" already exists!";
-    mv "$(cat $dirty_name)" "$clean_name" || die "Move failed";
-    lf -remote 'send reload'
-done < "$files";
-# vim: ft=sh
diff --git a/home-manager/config/lf/cmds/trash b/home-manager/config/lf/cmds/trash
deleted file mode 100755
index 9e2e6aa4..00000000
--- a/home-manager/config/lf/cmds/trash
+++ /dev/null
@@ -1,22 +0,0 @@
-#! /usr/bin/env dash
-# shellcheck disable=SC2086
-# shellcheck source=/dev/null
-# . ~/.local/lib/shell/lib
-. %SHELL_LIBRARY_PATH
-
-trash_output=$(mktmp);
-expected_error_output=$(mktmp);
-
-# try trashy first
-nix run nixpkgs#trashy -- put "$fx" 2> $trash_output;
-
-cat << EOF > $expected_error_output;
-error: Error during a \`trash\` operation: Unknown { description: "Path: '\"/.Trash-1000\"'. Message: Permission denied (os error 13)" }
-EOF
-
-if [ "$(cat $expected_error_output)" = "$(cat $trash_output)" ];then
-    warning "Deleting with trash-cli to the /.Trash folder";
-    # this file could not be trashed because it is on the tempfs volume, trash-cli can do this this
-    printf "%s" "$fx" | tr '\n' ' ' | xargs trash-put;
-fi
-# vim: ft=sh
diff --git a/home-manager/config/lf/cmds/unarchive b/home-manager/config/lf/cmds/unarchive
deleted file mode 100755
index dfa82c9a..00000000
--- a/home-manager/config/lf/cmds/unarchive
+++ /dev/null
@@ -1,22 +0,0 @@
-#! /usr/bin/env dash
-# shellcheck disable=SC2086
-# shellcheck source=/dev/null
-# . ~/.local/lib/shell/lib
-. %SHELL_LIBRARY_PATH
-
-# extract the current file with the right command
-# (xkcd link: https://xkcd.com/1168/)
-set -f
-case "$f" in
-    *.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xjvf $f;;
-    *.tar.gz|*.tgz) tar xzvf $f;;
-    *.tar.xz|*.txz) tar xJvf $f;;
-    *.zip) unzip $f;;
-    *.rar)
-        die "rar is a unfree format!"
-        #unrar x $f
-        ;;
-    *.7z) 7z x $f;;
-    *) die "Unsupported format" ;;
-esac
-# vim: ft=sh