summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzachir <zachir@librem.one>2022-10-09 01:19:04 -0500
committerzachir <zachir@librem.one>2022-10-09 01:19:04 -0500
commit0ad890bae271b17a7eaf76f70b2c462e4ca10333 (patch)
treee81457c2d4cf414a66edb010b4cfbc2e0974e400
parentd36e7cd095371deb8b70115fc7817d351bcfa645 (diff)
reorganize .local/bin folder
-rwxr-xr-xbrowser-tofi18
-rwxr-xr-xbsc-tofi5
-rwxr-xr-xdragon_rec3
-rwxr-xr-xfdc-tofi5
-rwxr-xr-xffc-tofi5
-rwxr-xr-xffuifix3
-rwxr-xr-xlwc-tofi5
-rwxr-xr-xmaim_active4
-rwxr-xr-xmonattach-tofi22
-rwxr-xr-xmondetach-tofi10
-rwxr-xr-xmprisctl-tofi59
-rwxr-xr-xmwarp.py22
-rwxr-xr-xpassmenu35
-rwxr-xr-xqbc-tofi18
-rwxr-xr-xshasum22
-rwxr-xr-xsortsongs10
-rwxr-xr-xtofimpv46
17 files changed, 89 insertions, 203 deletions
diff --git a/browser-tofi b/browser-tofi
deleted file mode 100755
index e2c5d32..0000000
--- a/browser-tofi
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/sbin/sh
-[ -z "$BROWSER" ] && BROWSER="qbc"
-BROWSERS="qbc
-fdc
-bsc
-ffc
-lwc
-brave"
-if [ `echo "$@" | cut -d'/' -f3` == "yewtu.be" ]; then
- BROWSERS=`printf "mpv\n%s" "$BROWSERS"`
-fi
-brow=`printf "xclip\n%s" "$BROWSERS" | tofi`
-[ -z "$brow" ] && exit
-if [ "$brow" = "xclip" ]; then
- echo -n $@ | tr -d "\n" | xclip -selection clipboard
-else
- $brow $@
-fi
diff --git a/bsc-tofi b/bsc-tofi
deleted file mode 100755
index 9b368fb..0000000
--- a/bsc-tofi
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/sbin/sh
-PROFILES=`grep 'Path=' ~/.moonchild\ productions/basilisk/profiles.ini | cut -d'.' -f2`
-CHOSEN=`echo "$PROFILES" | tofi`
-[ -z "$CHOSEN" ] && exit 2
-basilisk -P "$CHOSEN"
diff --git a/dragon_rec b/dragon_rec
new file mode 100755
index 0000000..183ff0a
--- /dev/null
+++ b/dragon_rec
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+cp -rv $(dragon-drop -x -t | sed 's_^file://__') .
diff --git a/fdc-tofi b/fdc-tofi
deleted file mode 100755
index 7dfa14d..0000000
--- a/fdc-tofi
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/sbin/sh
-PROFILES=`grep 'Path=' ~/.firedragon/profiles.ini | cut -d'.' -f2`
-CHOSEN=`echo "$PROFILES" | tofi`
-[ -z "$CHOSEN" ] && exit 2
-firedragon -P "$CHOSEN"
diff --git a/ffc-tofi b/ffc-tofi
deleted file mode 100755
index 3131694..0000000
--- a/ffc-tofi
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/sbin/sh
-PROFILES=`grep 'Path=' ~/.mozilla/firefox/profiles.ini | cut -d'.' -f2`
-CHOSEN=`echo "$PROFILES" | tofi`
-[ -z "$CHOSEN" ] && exit 2
-firefox -P "$CHOSEN"
diff --git a/ffuifix b/ffuifix
new file mode 100755
index 0000000..59afb20
--- /dev/null
+++ b/ffuifix
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+bash -c "$(curl -fsSL https://raw.githubusercontent.com/black7375/Firefox-UI-Fix/master/install.sh)"
diff --git a/lwc-tofi b/lwc-tofi
deleted file mode 100755
index 7307f74..0000000
--- a/lwc-tofi
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/sbin/sh
-PROFILES=`grep 'Path=' ~/.librewolf/profiles.ini | cut -d'.' -f2`
-CHOSEN=`echo "$PROFILES" | tofi`
-[ -z "$CHOSEN" ] && exit 2
-librewolf -P "$CHOSEN"
diff --git a/maim_active b/maim_active
new file mode 100755
index 0000000..e742c2c
--- /dev/null
+++ b/maim_active
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+FNAME="$(echo "" | dmenu -p 'filename: ')"
+maim -i $(xdotool getactivewindow) "$FNAME"
diff --git a/monattach-tofi b/monattach-tofi
deleted file mode 100755
index f796355..0000000
--- a/monattach-tofi
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/sbin/sh
-
-XSTATS="$(xrandr)"
-
-PRIMARY="$(echo "$XSTATS" | grep "primary" | awk '{print $1}')"
-RIGHT=false
-
-for i in $@; do
- case "$i" in
- "right")
- RIGHT="TRUE" ;;
- "left")
- RIGHT="FALSE" ;;
- esac
-done
-
-OUTPUT="$(echo "$XSTATS" | grep ' connected ' | grep -v '[0-9]*x[0-9]*+[0-9]*+[0-9]' | awk '{print $1}' | tofi --height 24 --prompt 'Which output?')"
-[ -z "$OUTPUT" ] && exit 2
-
-[ "$RIGHT" = "TRUE" ] && ARGS="--right-of $PRIMARY" || ARGS="--left-of $PRIMARY"
-
-xrandr --output "$OUTPUT" --mode 1920x1080 $ARGS
diff --git a/mondetach-tofi b/mondetach-tofi
deleted file mode 100755
index 1512b88..0000000
--- a/mondetach-tofi
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/sbin/sh
-
-XSTATS="$(xrandr)"
-
-PRIMARY="$(echo "$XSTATS" | grep "primary" | awk '{print $1}')"
-
-OUTPUT="$(echo "$XSTATS" | grep '[0-9]*x[0-9]*+[0-9]*+[0-9]' | grep -v 'primary' | awk '{print $1}' | tofi --height 24 --prompt 'Which output?')"
-[ -z "$OUTPUT" ] && exit 2
-
-xrandr --output "$OUTPUT" --off
diff --git a/mprisctl-tofi b/mprisctl-tofi
deleted file mode 100755
index f8c3691..0000000
--- a/mprisctl-tofi
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/sbin/sh
-
-DMENU_PROMPT=$(playerctl -l | tofi --prompt 'Players:')
-[ -z "$DMENU_PROMPT" ] && exit 1
-
-PLAYERCONTROLS_PROMPT=$(echo "play
-pause
-play-pause
-stop
-next
-previous
-position
-volume
-status
-shuffle" | tofi --prompt 'Action:')
-[ -z "$PLAYERCONTROLS_PROMPT" ] && exit 1
-
-case "$PLAYERCONTROLS_PROMPT" in
- "pause"|"play"|"play-pause"|"stop"|"next"|"previous")
- playerctl -p "$DMENU_PROMPT" "$PLAYERCONTROLS_PROMPT"
- ;;
- "position")
- VALUE=$(seq -100 5 +100 | grep -v '^0$' | sed 's/^[0-9]/\+&/' | tofi --prompt 'Position:')
- [ -z "$VALUE" ] && exit 1
- playerctl -p "$DMENU_PROMPT" "$PLAYERCONTROLS_PROMPT" "$VALUE"
- ;;
- "volume")
- VALUE=$(set 0 5 100 |tofi --prompt 'Volume:')
- [ -z "$VALUE" ] && exit 1
- playerctl -p "$DMENU_PROMPT" "$PLAYERCONTROLS_PROMPT" "$VALUE"
- ;;
- "status")
- STATUS_MSG=$(playerctl -p "$DMENU_PROMPT" "$PLAYERCONTROLS_PROMPT")
- notify-send "$DMENU_PROMPT status" "$STATUS_MSG"
- ;;
- "shuffle")
- VALUE=$(echo "On
-Off
-Toggle
-Status" | tofi --prompt "Shuffle:")
- [ -z "$VALUE" ] && exit 1
- case "$VALUE" in
- "On"|"Off"|"Toggle")
- playerctl -p "$DMENU_PROMPT" "$PLAYERCONTROLS_PROMPT" "$VALUE"
- ;;
- "Status")
- STATUS_MSG=$(playerctl -p "$DMENU_PROMPT" "$PLAYERCONTROLS_PROMPT")
- notify-send "$DMENU_PROMPT shuffle status" "$STATUS_MSG"
- ;;
- *)
- exit 1
- ;;
- esac
- ;;
- *)
- exit 1
- ;;
-esac
-exit 0
diff --git a/mwarp.py b/mwarp.py
new file mode 100755
index 0000000..abe34b8
--- /dev/null
+++ b/mwarp.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python3
+import subprocess
+import sys
+
+arg = sys.argv[1]
+
+screeninfo = [
+ s for s in subprocess.check_output("xrandr").decode("utf-8").split()\
+ if s.count("+") == 2
+ ]
+
+if arg == "left":
+ match = [s for s in screeninfo if s.endswith("+0+0")][0]
+elif arg == "right":
+ match = [s for s in screeninfo if not s.endswith("+0+0")][0]
+
+data = [item.split("x") for item in match.split("+")]
+numbers = [int(n) for n in [item for sublist in data for item in sublist]]
+coord = [str(int(n)) for n in [(numbers[0]/2)+numbers[2], (numbers[1]/2)+numbers[3]]]
+
+subprocess.Popen(["xdotool", "mousemove", coord[0], coord[1]])
+
diff --git a/passmenu b/passmenu
new file mode 100755
index 0000000..fd91178
--- /dev/null
+++ b/passmenu
@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+
+shopt -s nullglob globstar
+
+typeit=0
+if [[ $1 == "--type" ]]; then
+ typeit=1
+ shift
+fi
+
+if [[ -n $WAYLAND_DISPLAY ]]; then
+ barmenu=tofi
+ xdotool="ydotool type --file -"
+elif [[ -n $DISPLAY ]]; then
+ barmenu=dmenu
+ xdotool="xdotool type --clearmodifiers --file -"
+else
+ echo "Error: No Wayland or X11 display detected" >&2
+ exit 1
+fi
+
+prefix=${PASSWORD_STORE_DIR-~/.password-store}
+password_files=( "$prefix"/**/*.gpg )
+password_files=( "${password_files[@]#"$prefix"/}" )
+password_files=( "${password_files[@]%.gpg}" )
+
+password=$(printf '%s\n' "${password_files[@]}" | "$barmenu" "$@")
+
+[[ -n $password ]] || exit
+
+if [[ $typeit -eq 0 ]]; then
+ pass show -c "$password" 2>/dev/null
+else
+ pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } | $xdotool
+fi
diff --git a/qbc-tofi b/qbc-tofi
deleted file mode 100755
index b53255f..0000000
--- a/qbc-tofi
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/sbin/sh
-
-SESSIONS=`qbpm list`
-[ -z "$SESSIONS" ] && qutebrowser $@
-CHOSEN=`printf "default\n$SESSIONS" | tofi`
-[ -z "$CHOSEN" ] && exit 2
-if [ -n "$CHOSEN" ]; then
- if [ "$CHOSEN" = "default" ]; then
- qutebrowser $@
- else
- if [ -z `echo "$SESSIONS" | grep "$CHOSEN"` ]; then
- qbpm new "$CHOSEN"
- fi
- qbpm launch "$CHOSEN" $@
- #qutebrowser -B "$HOME/.local/share/$CHOSEN"
- fi
-fi
-
diff --git a/shasum b/shasum
new file mode 100755
index 0000000..18efefd
--- /dev/null
+++ b/shasum
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+for i in "$@"; do
+ case $i in
+ "-a") BITS="y"
+ continue
+ ;;
+ *)
+ ARGS="$i "
+ ;;
+ esac
+ if [ -n "$BITS" ]; then
+ case $i in
+ 256|512)
+ PROGRAM="sha"$i"sum"
+ ;;
+ esac
+ unset BITS
+ fi
+done
+cat - | "$PROGRAM" $ARGS
+echo "$PROGRAM $ARGS"
diff --git a/sortsongs b/sortsongs
deleted file mode 100755
index 510af26..0000000
--- a/sortsongs
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/sbin/sh
-
-ls *.mp3 | while read i; do
- DATA="$(gettags "$i")"
- ARTIST=$(echo "$DATA" | cut -d'|' -f2)
- ALBUM=$(echo "$DATA" | cut -d'|' -f1)
- [ ! -d "$ARTIST"/"$ALBUM" ] && mkdir -p "$ARTIST"/"$ALBUM"
- mv "$i" "$ARTIST"/"$ALBUM"/.
- echo "$i"
-done
diff --git a/tofimpv b/tofimpv
deleted file mode 100755
index 1d935d0..0000000
--- a/tofimpv
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/sbin/sh
-
-cd ~/Videos
-case "$@" in
- "-l")
- LOOP="true"
- ;;
- "-h")
- HELP="true"
- ;;
-esac
-
-playvid () {
- while true; do
- VIDEO=$(printf ".\n%s\n" "$(ls)" | uniq | tofi "$@")
- [ -z $VIDEO ] && exit
- if [ "$VIDEO" = "." ]; then
- break;
- fi
- [ -d $VIDEO ] && cd $VIDEO && continue
- [ -f "$VIDEO" ] && break
- pwd
- done
- mpv "$VIDEO"
-}
-
-printhelp () {
- printf \
- "Usage: dmpv [-l] [-h]\n" \
- "dmpv is a simple tofi interface for playing content with mpv\n" \
- "dmpv assumes videos are stored in ~/Videos\n" \
- " -h\t\tprint this help message\n" \
- " -l\t\trun the prompt again after mpv exits\n"
-}
-
-if [ -n "$HELP" ]; then
- printhelp && exit 0
-elif [ -n "$LOOP" ]; then
- while true; do
- playvid || exit 0
- done
-fi
-
-playvid
- done
-fi