aboutsummaryrefslogtreecommitdiff
path: root/.local/share/bin
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2025-01-20 16:44:22 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2025-01-20 16:44:22 +0100
commit6031a7a9204f11c2acc44ab33552576375ba8c28 (patch)
tree2478f35fd6abd9507ecbd325d516f3412ce44cd0 /.local/share/bin
parent926a1588d1f726e8bbe32f025f3bf04d076601b8 (diff)
WIP remove oh-my-zsh
Diffstat (limited to '.local/share/bin')
-rwxr-xr-x.local/share/bin/addtoqueue2
-rwxr-xr-x.local/share/bin/fv2
-rwxr-xr-x.local/share/bin/open12
-rwxr-xr-x.local/share/bin/preview40
4 files changed, 55 insertions, 1 deletions
diff --git a/.local/share/bin/addtoqueue b/.local/share/bin/addtoqueue
index c021c95..535e250 100755
--- a/.local/share/bin/addtoqueue
+++ b/.local/share/bin/addtoqueue
@@ -1,3 +1,3 @@
#!/bin/sh
-st -T "[floating]" -g 120x20 -e fzmp -A
+exec st -T "[floating]" -g 120x20 -e fzmp
diff --git a/.local/share/bin/fv b/.local/share/bin/fv
new file mode 100755
index 0000000..5ce4f2e
--- /dev/null
+++ b/.local/share/bin/fv
@@ -0,0 +1,2 @@
+#!/bin/sh
+fzf --multi --print0 | exec xargs -r0 $EDITOR
diff --git a/.local/share/bin/open b/.local/share/bin/open
new file mode 100755
index 0000000..7856488
--- /dev/null
+++ b/.local/share/bin/open
@@ -0,0 +1,12 @@
+#!/bin/sh
+case "$(file --mime-type -Lb "$1")" in
+ text/*)
+ exec $EDITOR -- "$@"
+ ;;
+ *)
+ for file in "$@"; do
+ fork xdg-open "$file"
+ done
+ ;;
+esac
+
diff --git a/.local/share/bin/preview b/.local/share/bin/preview
new file mode 100755
index 0000000..0225848
--- /dev/null
+++ b/.local/share/bin/preview
@@ -0,0 +1,40 @@
+#!/bin/sh
+[ $# -ne 5 ] && exit 1
+FILE="$1"
+WIDTH="$2"
+HEIGHT="$3"
+POS_X="$4"
+POS_Y="$5"
+
+MIMETYPE="$(file --mime-type -Lb "$FILE")"
+
+case "$MIMETYPE" in
+ image/*)
+ echo '{
+ "action": "add",
+ "x": 0,
+ "y": 0,
+ "path": "/home/loek/docs/frob.jpg"
+ }' | ueberzug layer --parser json
+ ;;
+ text/*)
+ bat \
+ --terminal-width="$WIDTH" \
+ --paging=never \
+ --color=always \
+ -- "$FILE"
+ ;;
+ application/x-tar|\
+ application/x-bzip|\
+ application/x-bzip2|\
+ application/zip|\
+ application/x-7z-compressed|\
+ application/vnd.rar)
+ bsdtar -tf "$FILE"
+ ;;
+ *)
+ echo "$MIMETYPE"
+ file -b "$FILE" | fold --width="$WIDTH" --spaces
+ ;;
+esac
+