update any-term-dropdown, mountjutsu, fzf-nova
parent
495b13a580
commit
7fb4781e28
@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
# AUTHOR: gotbletu (@gmail|twitter|youtube|github|lbry)
|
||||
# https://www.youtube.com/user/gotbletu
|
||||
# DESC: turn any terminal into a dropdown terminal
|
||||
# DEMO: https://www.youtube.com/watch?v=mVw2gD9iiOg
|
||||
# DEPEND: coreutils xdotool wmutils (https://github.com/wmutils/core | https://aur.archlinux.org/packages/wmutils-git/)
|
||||
# CLOG: 2021-02-10 use comm to match window name and class, this avoids terminal windows with different names
|
||||
# 2015-02-15 0.1
|
||||
|
||||
# get screen resolution width and height
|
||||
ROOT=$(lsw -r)
|
||||
width=$(wattr w "$ROOT")
|
||||
height=$(wattr h "$ROOT")
|
||||
|
||||
# option 1: set terminal emulator manually
|
||||
# my_term=urxvt
|
||||
# my_term=sakura
|
||||
my_term="xterm"
|
||||
# my_term="alacritty"
|
||||
# my_term=terminator
|
||||
# my_term=gnome-terminal
|
||||
|
||||
# option 2: auto detect terminal emulator (note: make sure to only open one)
|
||||
# my_term="urxvt|xterm|uxterm|termite|sakura|lxterminal|terminator|mate-terminal|pantheon-terminal|konsole|gnome-terminal|xfce4-terminal"
|
||||
|
||||
# get terminal emulator pid ex: 44040485
|
||||
# pid=$(xdotool search --class "$my_term" | tail -n1)
|
||||
|
||||
# get terminal emulator and matching name pid ex: 44040485
|
||||
pid=$(comm -12 <(xdotool search --name "$my_term" | sort) <(xdotool search --class "$my_term" | sort))
|
||||
|
||||
# get windows id from pid ex: 0x2a00125%
|
||||
wid=$(printf 0x%x "$pid")
|
||||
|
||||
# maximize terminal emulator
|
||||
wrs "$width" "$height" "$wid"
|
||||
|
||||
# toggle show/hide terminal emulator
|
||||
mapw -t "$wid"
|
@ -1,45 +0,0 @@
|
||||
#!/bin/bash
|
||||
# any_term_dropdown.sh - turns any terminal into a dropdown terminal
|
||||
# tutorial video: https://www.youtube.com/watch?v=mVw2gD9iiOg
|
||||
# License GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt
|
||||
# _ _ _ _
|
||||
# __ _ ___ | |_| |__ | | ___| |_ _ _
|
||||
# / _` |/ _ \| __| '_ \| |/ _ \ __| | | |
|
||||
#| (_| | (_) | |_| |_) | | __/ |_| |_| |
|
||||
# \__, |\___/ \__|_.__/|_|\___|\__|\__,_|
|
||||
# |___/
|
||||
# http://www.youtube.com/user/gotbletu
|
||||
# https://twitter.com/gotbletu
|
||||
# https://github.com/gotbletu
|
||||
|
||||
# requires:
|
||||
# xdotool
|
||||
# wmutils https://github.com/wmutils/core
|
||||
# https://aur.archlinux.org/packages/wmutils-git/
|
||||
|
||||
# get screen resolution width and height
|
||||
ROOT=$(lsw -r)
|
||||
width=$(wattr w $ROOT)
|
||||
height=$(wattr h $ROOT)
|
||||
|
||||
# option 1: set terminal emulator manually
|
||||
# my_term=urxvt
|
||||
# my_term=xterm
|
||||
# my_term=terminator
|
||||
# my_term=gnome-terminal
|
||||
|
||||
# option 2: auto detect terminal emulator (note: make sure to only open one)
|
||||
my_term="urxvt|xterm|uxterm|termite|sakura|lxterminal|terminator|mate-terminal|pantheon-terminal|konsole|gnome-terminal|xfce4-terminal"
|
||||
|
||||
# get terminal emulator pid ex: 44040485
|
||||
pid=$(xdotool search --class "$my_term" | tail -n1)
|
||||
|
||||
# get windows id from pid ex: 0x2a00125%
|
||||
wid=$(printf 0x%x "$pid")
|
||||
|
||||
# maximize terminal emulator
|
||||
wrs "$width" "$height" "$wid"
|
||||
|
||||
# toggle show/hide terminal emulator
|
||||
mapw -t "$wid"
|
||||
|
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env sh
|
||||
# AUTHOR: gotbletu (@gmail|twitter|youtube|github|lbry)
|
||||
# https://www.youtube.com/user/gotbletu
|
||||
# DESC: launch app(s) with fzf like dmenu/rofi
|
||||
# DEPEND: fzf sed coreutils findutils xdg-utils util-linux
|
||||
|
||||
desktop_file() {
|
||||
find /usr/share/applications -name "*.desktop" 2>/dev/null \
|
||||
&& find /usr/local/share/applications -name "*.desktop" 2>/dev/null \
|
||||
&& find "$HOME/.local/share/applications" -name "*.desktop" 2>/dev/null \
|
||||
&& find /var/lib/flatpak/exports/share/applications -name "*.desktop" 2>/dev/null \
|
||||
&& find "$HOME/.local/share/flatpak/exports/share/applications" -name "*.desktop" 2>/dev/null
|
||||
}
|
||||
|
||||
selected="$(desktop_file | sed 's/.desktop//g' | sort | fzf -e -i -m --reverse --delimiter / --with-nth -1)"
|
||||
[ -z "$selected" ] && exit
|
||||
cd || return
|
||||
echo "$selected" | while read -r line ; do setsid xdg-open "$line".desktop ; done
|
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env sh
|
||||
# AUTHOR: gotbletu (@gmail|twitter|youtube|github|lbry)
|
||||
# https://www.youtube.com/user/gotbletu
|
||||
# DESC: open surfraw bookmarks with your deafult web browser ($BROWSER)
|
||||
# DEPEND: fzf surfraw grep gawk coreutils
|
||||
# REQD: make sure to set your browser variable in your shellrc
|
||||
# vim ~/.bashrc
|
||||
# export BROWSER=chromium
|
||||
|
||||
selected="$(grep -E '^([[:alnum:]])' ~/.config/surfraw/bookmarks | sort -n | fzf -e -i -m --reverse | awk '{print $1}')"
|
||||
[ -z "$selected" ] && exit
|
||||
echo "$selected" | while read -r line ; do surfraw -browser="$BROWSER" "$line" ; done
|
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env sh
|
||||
# AUTHOR: gotbletu (@gmail|twitter|youtube|github|lbry)
|
||||
# https://www.youtube.com/user/gotbletu
|
||||
# DESC: open surfraw bookmarks with your deafult web browser private mode ($BROWSER_PRIVATE)
|
||||
# DEPEND: fzf surfraw grep gawk coreutils util-linux
|
||||
# REQD: make sure to set your private browser variable in your shellrc
|
||||
# $EDITOR ~/.bashrc
|
||||
# export BROWSER_PRIVATE="chromium --incognito"
|
||||
|
||||
selected="$(grep -E '^([[:alnum:]])' ~/.config/surfraw/bookmarks | sort -n | fzf -e -i -m --reverse | awk '{print $1}')"
|
||||
[ -z "$selected" ] && exit
|
||||
echo "$selected" | while read -r line ; do URL="$(surfraw -p "$line")" && setsid -f $BROWSER_PRIVATE "$URL" ; done
|
@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env sh
|
||||
# AUTHOR: gotbletu (@gmail|twitter|youtube|github|lbry)
|
||||
# https://www.youtube.com/user/gotbletu
|
||||
# DESC: open only calibre ebooks
|
||||
# DEPEND: fzf mlocate xdg-utils util-linux
|
||||
|
||||
selected="$(locate -ir 'calibre.*\.\(cbz\|cbr\|epub\|pdf\|mobi\|azw3\)$' | fzf -e -i -m --reverse --delimiter / --with-nth -4,-3,-2,-1)"
|
||||
[ -z "$selected" ] && exit
|
||||
echo "$selected" | while read -r line ; do setsid xdg-open "$line" ; done
|
@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
# AUTHOR: Junegunn Choi (https://github.com/junegunn)
|
||||
# DESC: open chromium web history
|
||||
# DEPEND: fzf chromium
|
||||
# REFF: https://junegunn.kr/2015/04/browsing-chrome-history-with-fzf/
|
||||
# https://github.com/junegunn/fzf/wiki/examples#browsing-history
|
||||
|
||||
|
||||
local cols sep
|
||||
cols=$(( COLUMNS / 3 ))
|
||||
sep='{::}'
|
||||
|
||||
# MacOS
|
||||
# \cp -f ~/Library/Application\ Support/Google/Chrome/Default/History /tmp/h
|
||||
|
||||
# Linux
|
||||
\cp -f ~/.config/chromium/Default/History /tmp/h
|
||||
|
||||
sqlite3 -separator $sep /tmp/h \
|
||||
"select substr(title, 1, $cols), url
|
||||
from urls order by last_visit_time desc" |
|
||||
awk -F $sep '{printf "%-'$cols's \x1b[36m%s\x1b[m\n", $1, $2}' |
|
||||
fzf --ansi --multi --reverse | sed 's#.*\(https*://\)#\1#' | xargs setsid xdg-open
|
||||
|
||||
# MacOS
|
||||
# fzf --ansi --multi | sed 's#.*\(https*://\)#\1#' | xargs open
|
||||
|
||||
# selected="$(grep -E '^([[:alnum:]])' ~/.config/surfraw/bookmarks | sort -n | fzf -e -i -m | awk '{print $1}')"
|
||||
# [ -z "$selected" ] && exit
|
||||
# echo "$selected" | tr ' ' '\n' | while read -r line ; do surfraw -browser="$BROWSER" "$line" ; done
|
||||
|
||||
|
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env sh
|
||||
# AUTHOR: gotbletu (@gmail|twitter|youtube|github|lbry)
|
||||
# https://www.youtube.com/user/gotbletu
|
||||
# DESC: fuzzy find a song in cmus library and play
|
||||
# DEPEND: fzf cmus coreutils
|
||||
|
||||
selected="$( sort ~/.cmus/lib.pl | fzf -e -i +s -m --reverse --delimiter / --with-nth -2,-1 )"
|
||||
[ -z "$selected" ] && exit
|
||||
|
||||
# clear cmus queue
|
||||
cmus-remote -c -q
|
||||
|
||||
# add songs
|
||||
echo "$selected" | while read -r line ; do cmus-remote -q "$line" ; done
|
||||
|
||||
# play queued song
|
||||
cmus-remote -n -p
|
@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env sh
|
||||
cmus-remote --next
|
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env sh
|
||||
# toggle pause/play
|
||||
cmus-remote --pause
|
@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env sh
|
||||
cmus-remote --prev
|
@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env sh
|
||||
cmus-remote --stop
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
# AUTHOR: gotbletu (@gmail|twitter|youtube|github|lbry)
|
||||
# https://www.youtube.com/user/gotbletu
|
||||
# DESC: copy from your clipboard history
|
||||
# DEMO: https://www.youtube.com/watch?v=Vzt0tVNrJ0A
|
||||
# DEPEND: fzf greenclip coreutils xsel (or tmux)
|
||||
# REFF: https://github.com/erebe/greenclip
|
||||
# NOTE: not good with multiline at the moment
|
||||
|
||||
selected="$(greenclip print | fzf -e -i --reverse)"
|
||||
[ -z "$selected" ] && exit
|
||||
printf "%s" "$selected" | xsel -b
|
||||
printf "%s" "$selected" | tmux load-buffer -
|
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# AUTHOR: gotbletu (@gmail|twitter|youtube|github|lbry)
|
||||
# https://www.youtube.com/user/gotbletu
|
||||
# DESC: locate files in home or media folder only
|
||||
# DEMO: https://www.youtube.com/watch?v=AbveiTAymy0
|
||||
# DEPEND: fzf mlocate xdg-utils util-linux
|
||||
# REQD: # update system database
|
||||
# sudo updatedb
|
||||
#
|
||||
# # optional: include external hdd or other mounted partition to be in the database
|
||||
# 1. sudo vim /etc/updatedb.conf
|
||||
# 2. Remove /media from PRUNEPATHS
|
||||
# 3. sudo updatedb
|
||||
|
||||
selected="$(locate home media | fzf -e -i -m --reverse --delimiter / --with-nth -3,-2,-1)"
|
||||
[ -z "$selected" ] && exit
|
||||
echo "$selected" | while read -r line ; do setsid xdg-open "$line" ; done
|
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env sh
|
||||
# youtube viewer not using API
|
||||
pipe-viewer
|
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# AUTHOR: gotbletu (@gmail|twitter|youtube|github|lbry)
|
||||
# https://www.youtube.com/user/gotbletu
|
||||
# DESC: launch playonlinux programs (winehq)
|
||||
# DEMO: https://www.youtube.com/watch?v=AbveiTAymy0
|
||||
# DEPEND: fzf nohup playonlinux coreutils findutils
|
||||
|
||||
selected="$(find ~/.PlayOnLinux/shortcuts -type f -exec basename {} \; | fzf -e -i --reverse )"
|
||||
[ -z "$selected" ] && exit
|
||||
# nohup playonlinux --run "$selected" >/dev/null 2>&1 & disown
|
||||
# setsid playonlinux --run "$selected" >/dev/null 2>&1 & disown
|
||||
setsid playonlinux --run "$selected" >/dev/null & disown
|
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
# AUTHOR: gotbletu (@gmail|twitter|youtube|github|lbry)
|
||||
# https://www.youtube.com/user/gotbletu
|
||||
# DESC: locate a file and go to that directory with ranger file manager
|
||||
# DEMO: https://www.youtube.com/watch?v=C64LKCZFzME
|
||||
# DEPEND: ranger locate
|
||||
|
||||
ranger --cmd=fzf_locate
|
@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env sh
|
||||
# AUTHOR: gotbletu (@gmail|twitter|youtube|github|lbry)
|
||||
# https://www.youtube.com/user/gotbletu
|
||||
# DESC: open a cheatsheet to read notes
|
||||
# DEPEND: fzf findutils coreutils
|
||||
|
||||
selected="$(find ~/.config/redpill/ -type f | sort | fzf -e -i --reverse --delimiter / --with-nth -1 --preview 'cat {}')"
|
||||
[ -z "$selected" ] && exit
|
||||
"$EDITOR" "$selected"
|
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# AUTHOR: gotbletu (@gmail|twitter|youtube|github|lbry)
|
||||
# https://www.youtube.com/user/gotbletu
|
||||
# DESC: copy text snippet to clipboard
|
||||
# DEMO: https://www.youtube.com/watch?v=Zew0mgJwAh8
|
||||
# DEPEND: fzf sed coreutils xsel (or tmux)
|
||||
|
||||
# sort, delete empty line, remove tags, leading and trailing spaces, also no newline
|
||||
selected="$(sort -n ~/.snippetrc | sed '/^$/d' | fzf -e -i --reverse | sed -e s/\;\;\.\*\$// | sed 's/^[ \t]*//;s/[ \t]*$//' | tr -d '\n')"
|
||||
[ -z "$selected" ] && exit
|
||||
printf "%s" "$selected" | xsel -b
|
||||
printf "%s" "$selected" | tmux load-buffer -
|
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
# AUTHOR: gotbletu (@gmail|twitter|youtube|github|lbry)
|
||||
# https://www.youtube.com/user/gotbletu
|
||||
# DESC: copy textblock to clipboard
|
||||
# DEMO: https://www.youtube.com/watch?v=Zew0mgJwAh8
|
||||
# DEPEND: fzf sed coreutils findutils (xsel or tmux)
|
||||
|
||||
selected="$(find ~/.multisnippet/ -type f | sort | fzf -e -i --reverse --delimiter / --with-nth -1 --preview 'cat {}')"
|
||||
[ -z "$selected" ] && exit
|
||||
|
||||
# add to tmux and X11 clipboard
|
||||
xsel -b < "$selected"
|
||||
tmux load-buffer "$selected"
|
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# AUTHOR: gotbletu (@gmail|twitter|youtube|github|lbry)
|
||||
# https://www.youtube.com/user/gotbletu
|
||||
# DESC: search internet from a list of search engines
|
||||
# DEPEND: fzf surfraw grep gawk coreutils util-linux
|
||||
# REQD: make sure to set your browser variable in your shellrc
|
||||
# vim ~/.bashrc
|
||||
# export BROWSER=chromium
|
||||
|
||||
# select your elvi
|
||||
PREFIX=$(surfraw -elvi | grep -v 'LOCAL\|GLOBAL'| fzf -e -m --reverse | awk '{print $1}')
|
||||
[ -z "$PREFIX" ] && exit
|
||||
echo "Search Engine(s): $PREFIX" | tr '\n' ' '
|
||||
echo
|
||||
read -r -e -p "Enter Keywords: " INPUT
|
||||
# Note: dont qoute $INPUT it will mess up results
|
||||
echo "$PREFIX" | while read -r line; do setsid -f surfraw -browser="$BROWSER" "$line" $INPUT ; done
|
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
# AUTHOR: gotbletu (@gmail|twitter|youtube|github|lbry)
|
||||
# https://www.youtube.com/user/gotbletu
|
||||
# DESC: search internet from a list of search engines (private/incognito mode)
|
||||
# DEPEND: fzf surfraw grep gawk coreutils util-linux
|
||||
# REQD: make sure to set your private browser variable in your shellrc
|
||||
# vim ~/.bashrc
|
||||
# export BROWSER_PRIVATE="chromium --incognito"
|
||||
|
||||
# select your elvi
|
||||
PREFIX=$(surfraw -elvi | grep -v 'LOCAL\|GLOBAL'| fzf -e -m --reverse | awk '{print $1}')
|
||||
[ -z "$PREFIX" ] && exit
|
||||
echo "Search Engine(s): $PREFIX" | tr '\n' ' '
|
||||
echo
|
||||
read -r -e -p "[Private Mode] Enter Keywords: " INPUT
|
||||
|
||||
# workaround: surfraw does not like multiple flags in -browser option
|
||||
# e.g surfraw -browser="chromium --incognito" "$PREFIX" $INPUT
|
||||
echo "$PREFIX" | while read -r line; do URL="$(surfraw -p "$line" $INPUT)" && setsid -f $BROWSER_PRIVATE "$URL" ; done
|
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env sh
|
||||
# AUTHOR: gotbletu (@gmail|twitter|youtube|github|lbry)
|
||||
# https://www.youtube.com/user/gotbletu
|
||||
# DESC: launch other fzf scripts
|
||||
# DEMO: https://youtu.be/8SqakfCSzQk
|
||||
# DEPEND: fzf grep findutils coreutils
|
||||
# REFF: Xterm config https://www.youtube.com/watch?v=mAUQsNUnk9I
|
||||
|
||||
# Hotkey Binding Examples ~/.xbindkeysrc
|
||||
# "xterm -T fzf-nova -geometry 90x25+350+200 -fs 16 -e /path/to/script/fzf-nova"
|
||||
# Mod4+space
|
||||
#
|
||||
# "alacritty -t fzf-nova --dimensions 90 20 --position 350 200 -e /path/to/script/fzf-nova"
|
||||
# Mod4+space
|
||||
|
||||
DIR="${0%/*}"
|
||||
"$DIR"/"$(find "$DIR" -type f -exec basename {} \; | grep '^_' | sort | fzf -e -i --delimiter _ --with-nth='2..' --reverse --prompt="fzf-nova: ")"
|
Loading…
Reference in New Issue