summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzachir <zachir@librem.one>2022-10-09 00:42:32 -0500
committerzachir <zachir@librem.one>2022-10-09 00:42:32 -0500
commit0217995cda2e5b3700b911b5561e99c659fba92b (patch)
tree80abdcf81366ebf51432b406e5e0e3293930cf8f
parent5355ec2d7e7e79d636e62b70af7dbb39002e98d3 (diff)
add tofi scripts, replacing barmenu
-rwxr-xr-xbrowser-tofi18
-rwxr-xr-xbsc-tofi5
-rwxr-xr-xfdc-tofi5
-rwxr-xr-xffc-tofi5
-rwxr-xr-xlwc-tofi5
-rwxr-xr-xmonattach-tofi22
-rwxr-xr-xmondetach-tofi10
-rwxr-xr-xmprisctl-tofi59
-rwxr-xr-xqbc-tofi18
-rwxr-xr-xtofimpv46
10 files changed, 193 insertions, 0 deletions
diff --git a/browser-tofi b/browser-tofi
new file mode 100755
index 0000000..e2c5d32
--- /dev/null
+++ b/browser-tofi
@@ -0,0 +1,18 @@
+#!/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
new file mode 100755
index 0000000..9b368fb
--- /dev/null
+++ b/bsc-tofi
@@ -0,0 +1,5 @@
+#!/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/fdc-tofi b/fdc-tofi
new file mode 100755
index 0000000..7dfa14d
--- /dev/null
+++ b/fdc-tofi
@@ -0,0 +1,5 @@
+#!/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
new file mode 100755
index 0000000..3131694
--- /dev/null
+++ b/ffc-tofi
@@ -0,0 +1,5 @@
+#!/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/lwc-tofi b/lwc-tofi
new file mode 100755
index 0000000..7307f74
--- /dev/null
+++ b/lwc-tofi
@@ -0,0 +1,5 @@
+#!/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/monattach-tofi b/monattach-tofi
new file mode 100755
index 0000000..f796355
--- /dev/null
+++ b/monattach-tofi
@@ -0,0 +1,22 @@
+#!/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
new file mode 100755
index 0000000..1512b88
--- /dev/null
+++ b/mondetach-tofi
@@ -0,0 +1,10 @@
+#!/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
new file mode 100755
index 0000000..f8c3691
--- /dev/null
+++ b/mprisctl-tofi
@@ -0,0 +1,59 @@
+#!/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/qbc-tofi b/qbc-tofi
new file mode 100755
index 0000000..b53255f
--- /dev/null
+++ b/qbc-tofi
@@ -0,0 +1,18 @@
+#!/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/tofimpv b/tofimpv
new file mode 100755
index 0000000..1d935d0
--- /dev/null
+++ b/tofimpv
@@ -0,0 +1,46 @@
+#!/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