diff options
Diffstat (limited to 'home-manager/soispha/config/lf/commands/scripts')
23 files changed, 0 insertions, 471 deletions
diff --git a/home-manager/soispha/config/lf/commands/scripts/archive b/home-manager/soispha/config/lf/commands/scripts/archive deleted file mode 100755 index 48fe25fc..00000000 --- a/home-manager/soispha/config/lf/commands/scripts/archive +++ /dev/null @@ -1,54 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="1.1.4" . %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"')"; - -prompt "Archive name: " -name="" -while [ -z "$name" ] || [ -e "$name" ] -do - read -r name - if [ -e "$name" ]; then - prompt "Archive already exists, overwrite [y|N]: " - read -r ans - - if [ "$ans" = "y" ]; then - break - else - prompt "Archive name: " - fi - fi -done - -root="$(if [ "$(pwd)" = "/" ]; then pwd; else echo "$(pwd)/";fi)"; - -# fx contains all selected file name separated by a newline -while read -r raw_file; do - file="$(echo "$raw_file" | sed "s|$root||")"; - set -- "$@" "$file"; -done < "$(tmp "echo '$fx'")"; - -case "$(awk '{for (i=1; i<=NF; i++) print $i}' "$archivers" | fzf)" in - "gzip") - tar -czf "$name".tar.gz "$@" - ;; - "xz") - tar -cf "$name".tar "$@" - xz -z -9 -e -T0 "$name".tar - ;; - "7z") - 7z a "$name".7z "$@" - ;; - "zip") - zip --symlinks -r "$name".zip "$@" - ;; -esac -# vim: ft=sh diff --git a/home-manager/soispha/config/lf/commands/scripts/broot_jump b/home-manager/soispha/config/lf/commands/scripts/broot_jump deleted file mode 100755 index abefc616..00000000 --- a/home-manager/soispha/config/lf/commands/scripts/broot_jump +++ /dev/null @@ -1,16 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH - -tmp=$(mktmp) -res="$(broot --outcmd "$tmp" && sed 's/cd //' "$tmp")" - -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/soispha/config/lf/commands/scripts/chmod b/home-manager/soispha/config/lf/commands/scripts/chmod deleted file mode 100755 index 07bc37cc..00000000 --- a/home-manager/soispha/config/lf/commands/scripts/chmod +++ /dev/null @@ -1,13 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="1.1.4" . %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/soispha/config/lf/commands/scripts/clear_trash b/home-manager/soispha/config/lf/commands/scripts/clear_trash deleted file mode 100755 index f2571fcc..00000000 --- a/home-manager/soispha/config/lf/commands/scripts/clear_trash +++ /dev/null @@ -1,8 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="1.1.4" . %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/soispha/config/lf/commands/scripts/dl_file b/home-manager/soispha/config/lf/commands/scripts/dl_file deleted file mode 100755 index 54518049..00000000 --- a/home-manager/soispha/config/lf/commands/scripts/dl_file +++ /dev/null @@ -1,33 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="1.1.4" . %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/soispha/config/lf/commands/scripts/dragon b/home-manager/soispha/config/lf/commands/scripts/dragon deleted file mode 100755 index 7e2d9ba6..00000000 --- a/home-manager/soispha/config/lf/commands/scripts/dragon +++ /dev/null @@ -1,11 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH - -while read -r file; do - set -- "$@" "$file" -done < "$(tmp "echo '$fx'")" - -dragon -a -x "$@" -# vim: ft=sh diff --git a/home-manager/soispha/config/lf/commands/scripts/dragon_individual b/home-manager/soispha/config/lf/commands/scripts/dragon_individual deleted file mode 100755 index 5d55aaa8..00000000 --- a/home-manager/soispha/config/lf/commands/scripts/dragon_individual +++ /dev/null @@ -1,11 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH - -while read -r file; do - set -- "$@" "$file" -done < "$(tmp "echo '$fx'")" - -dragon "$@" -# vim: ft=sh diff --git a/home-manager/soispha/config/lf/commands/scripts/dragon_stay b/home-manager/soispha/config/lf/commands/scripts/dragon_stay deleted file mode 100755 index f3483483..00000000 --- a/home-manager/soispha/config/lf/commands/scripts/dragon_stay +++ /dev/null @@ -1,11 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH - -while read -r file; do - set -- "$@" "$file"; -done < "$(tmp "echo '$fx'")" - -dragon -a "$@" -# vim: ft=sh diff --git a/home-manager/soispha/config/lf/commands/scripts/fzf_jump b/home-manager/soispha/config/lf/commands/scripts/fzf_jump deleted file mode 100755 index 0e53d7ca..00000000 --- a/home-manager/soispha/config/lf/commands/scripts/fzf_jump +++ /dev/null @@ -1,16 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="1.1.4" . %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/soispha/config/lf/commands/scripts/go_project_root b/home-manager/soispha/config/lf/commands/scripts/go_project_root deleted file mode 100755 index 555caaf9..00000000 --- a/home-manager/soispha/config/lf/commands/scripts/go_project_root +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH - -flake_base_dir="$(search_flake_base_dir)"; -if [ "$flake_base_dir" ]; then - lf -remote "send $id cd $flake_base_dir" || die "Bug: No base dir ($flake_base_dir)" -else - die "Unable to locate base dir"; -fi - -# vim: ft=sh diff --git a/home-manager/soispha/config/lf/commands/scripts/mk_dir b/home-manager/soispha/config/lf/commands/scripts/mk_dir deleted file mode 100755 index 4dca06dc..00000000 --- a/home-manager/soispha/config/lf/commands/scripts/mk_dir +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH - -prompt "Directory Name: " -name="" -while [ -z "$name" ] || [ -e "$name" ] -do - read -r name - if [ -e "$name" ]; then - prompt "Directory already exists, overwrite [y|N]: " - read -r ans - - if [ "$ans" = "y" ]; then - break - else - prompt "Directory Name: " - fi - fi -done - -mkdir "$name" -# vim: ft=sh diff --git a/home-manager/soispha/config/lf/commands/scripts/mk_file b/home-manager/soispha/config/lf/commands/scripts/mk_file deleted file mode 100755 index 5f245396..00000000 --- a/home-manager/soispha/config/lf/commands/scripts/mk_file +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH - -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 - -touch "$name" -# vim: ft=sh diff --git a/home-manager/soispha/config/lf/commands/scripts/mk_file_and_edit b/home-manager/soispha/config/lf/commands/scripts/mk_file_and_edit deleted file mode 100755 index 2e5a2deb..00000000 --- a/home-manager/soispha/config/lf/commands/scripts/mk_file_and_edit +++ /dev/null @@ -1,25 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH - -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 - -touch "$name" -"$EDITOR" "$name" -# vim: ft=sh diff --git a/home-manager/soispha/config/lf/commands/scripts/mk_ln b/home-manager/soispha/config/lf/commands/scripts/mk_ln deleted file mode 100755 index 1e97517f..00000000 --- a/home-manager/soispha/config/lf/commands/scripts/mk_ln +++ /dev/null @@ -1,36 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH - -while IFS= read -r i;do - set -- "$@" "$i" -done < "$HOME"/.local/share/lf/files - -mode="$1" -shift - -if [ "$#" -eq 0 ]; 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/soispha/config/lf/commands/scripts/mk_scr_default b/home-manager/soispha/config/lf/commands/scripts/mk_scr_default deleted file mode 100755 index b13ca9f5..00000000 --- a/home-manager/soispha/config/lf/commands/scripts/mk_scr_default +++ /dev/null @@ -1,31 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH - - -prompt "Script name: " -name="" -while [ -z "$name" ] || [ -e "$name" ] -do - read -r name - if [ -e "$name" ]; then - prompt "Script already exists, overwrite [y|N]: " - read -r ans - - if [ "$ans" = "y" ]; then - break - else - prompt "Script Name: " - fi - fi -done - -script="$(pwd)"/"$name" - -cat "%SHELL_LIBRARY_TEMPLATE" > "$script" -chmod +x "$script" -"$VISUAL" "$script" - - -# vim: ft=sh diff --git a/home-manager/soispha/config/lf/commands/scripts/mk_scr_temp b/home-manager/soispha/config/lf/commands/scripts/mk_scr_temp deleted file mode 100755 index a520469c..00000000 --- a/home-manager/soispha/config/lf/commands/scripts/mk_scr_temp +++ /dev/null @@ -1,31 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH - - -prompt "Script name: " -name="" -while [ -z "$name" ] || [ -e "$name" ] -do - read -r name - if [ -e "$name" ]; then - prompt "Script already exists, overwrite [y|N]: " - read -r ans - - if [ "$ans" = "y" ]; then - break - else - prompt "Script Name: " - fi - fi -done - -script="$(pwd)"/"$name" - -sed 's|%TO_BE_SHELL_LIBRARY_PATH|%SHELL_LIBRARY_PATH|' "%SHELL_LIBRARY_TEMPLATE" > "$script" -chmod +x "$script" -"$VISUAL" "$script" - - -# vim: ft=sh diff --git a/home-manager/soispha/config/lf/commands/scripts/open b/home-manager/soispha/config/lf/commands/scripts/open deleted file mode 100755 index c507482b..00000000 --- a/home-manager/soispha/config/lf/commands/scripts/open +++ /dev/null @@ -1,11 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH - -case $(file --mime-type "$f" -bL) in - text/*|application/json|application/vnd.hp-HPGL) "$EDITOR" "$f";; - image/*) "$IVIEWER" "$f";; - *) xdg-open "$f";; -esac -# vim: ft=sh diff --git a/home-manager/soispha/config/lf/commands/scripts/open_config b/home-manager/soispha/config/lf/commands/scripts/open_config deleted file mode 100755 index 35e5165d..00000000 --- a/home-manager/soispha/config/lf/commands/scripts/open_config +++ /dev/null @@ -1,7 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH - -"$EDITOR" "$(bookmenu -b ~/.config/bookmenu/configs -f fzf -o)" # TODO: implement this -# vim: ft=sh diff --git a/home-manager/soispha/config/lf/commands/scripts/restore_trash b/home-manager/soispha/config/lf/commands/scripts/restore_trash deleted file mode 100755 index a7bf0094..00000000 --- a/home-manager/soispha/config/lf/commands/scripts/restore_trash +++ /dev/null @@ -1,7 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH - -trash list | fzf --multi | awk '{print $NF}' | xargs trash restore --match=exact -# vim: ft=sh diff --git a/home-manager/soispha/config/lf/commands/scripts/set_wall_paper b/home-manager/soispha/config/lf/commands/scripts/set_wall_paper deleted file mode 100755 index c493e773..00000000 --- a/home-manager/soispha/config/lf/commands/scripts/set_wall_paper +++ /dev/null @@ -1,10 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH - -die "No yet implemented" # TODO: do what the 'die' says -#sed -i "s,export AWMWALLPAPER='.*',export AWMWALLPAPER='${f}'," ${ZDOTDIR}/.zshenv -#nohub swaybg -i "$f" -#feh --bg-max --no-fehbg "$f" -# vim: ft=sh diff --git a/home-manager/soispha/config/lf/commands/scripts/stripspace b/home-manager/soispha/config/lf/commands/scripts/stripspace deleted file mode 100755 index 91714712..00000000 --- a/home-manager/soispha/config/lf/commands/scripts/stripspace +++ /dev/null @@ -1,31 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="1.1.4" . %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/soispha/config/lf/commands/scripts/trash b/home-manager/soispha/config/lf/commands/scripts/trash deleted file mode 100755 index 8dd6033d..00000000 --- a/home-manager/soispha/config/lf/commands/scripts/trash +++ /dev/null @@ -1,26 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH - -trash_output=$(mktmp); -expected_error_output=$(mktmp); - -while read -r file; do - set -- "$@" "$file" -done < "$(tmp "echo '$fx'")" - -# TODO: why are we using trashy at all, when trash-cli can do everything? -# try trashy first, trough nix because both trashy and trash-cli provide a trash command, which conflicts -nix run nixpkgs#trashy -- put "$@" 2> "$trash_output"; - -cat << EOF > "$expected_error_output"; -[1;31merror:[0m 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 - trash-put "$@"; -fi -# vim: ft=sh diff --git a/home-manager/soispha/config/lf/commands/scripts/unarchive b/home-manager/soispha/config/lf/commands/scripts/unarchive deleted file mode 100755 index ee97f3b1..00000000 --- a/home-manager/soispha/config/lf/commands/scripts/unarchive +++ /dev/null @@ -1,22 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH - -# extract the current file with the right command -# (xkcd link: https://xkcd.com/1168/) -set -f -# TODO: add support for multiple files at once -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 |