Add some really fun rofi scripts
This commit is contained in:
@ -7,8 +7,9 @@ set $mod Mod4
|
||||
font pango:Go Mono 8
|
||||
|
||||
# APP VARIABLES
|
||||
set $browser qutebrowser
|
||||
set $term kitty
|
||||
set $browser qutebrowser
|
||||
set $solobrowser surf
|
||||
set $term kitty
|
||||
|
||||
# DIR VARIABLES
|
||||
set $bin ~/bin
|
||||
@ -46,16 +47,7 @@ gaps outer $outer
|
||||
exec_always --no-startup-id ~/.config/polybar/launch.sh
|
||||
|
||||
# CUSTOM BINDINGS
|
||||
#bindsym $mod+Return exec --no-startup-id kitty
|
||||
#bindsym $mod+shift+Return exec --no-startup-id qutebrowser
|
||||
#bindsym $mod+shift+space exec --no-startup-id rofi-pass --insert
|
||||
#bindsym $mod+m exec --no-startup-id surf play.unbl.ink/iris
|
||||
#bindsym $mod+shift+m exec --no-startup-id surf https://15five-dev.atlassian.net/secure/Dashboard.jspa
|
||||
#bindsym $mod+i exec --no-startup-id surf https://15five.15five.com/report/current/
|
||||
#bindsym $mod+g exec --no-startup-id surf https://github.com/15five/fifteen5/pulls?utf8=%E2%9C%93&q=is%3Aopen+is%3Apr+label%3Abackend+-reviewed-by%3Apowellc
|
||||
#bindsym Print exec --no-startup-id gnome-screenshot
|
||||
#bindsym $mod+Delete exec --no-startup-id "i3lock-fancy"
|
||||
#bindsym $mod+End exec --no-startup-id "i3lock-fancy" && systemctl suspend
|
||||
|
||||
# SCRATCHPAD
|
||||
bindsym $mod+Return exec $term
|
||||
@ -263,7 +255,22 @@ exec feh --bg-scale ~/var/inbox/astrobin/`ls -Ar ~/var/inbox/astrobin | tail -n
|
||||
|
||||
bindsym $mod+n exec $browser
|
||||
bindsym $mod+Ctrl+n exec marcador rofi ~/.config/rofi/marcador.db
|
||||
#bindsym $mod+Shift+n exec rofi-search
|
||||
bindsym $mod+Shift+n exec ~/.config/rofi/web-search.sh
|
||||
bindsym $mod+Shift+b exec ~/.config/rofi/books-search.sh
|
||||
bindsym $mod+Shift+c exec ~/.config/rofi/github-repos.sh
|
||||
|
||||
bindsym Print exec --no-startup-id gnome-screenshot
|
||||
bindsym $mod+Shift+f exec --no-startup-id $browser https://15five.15five.com/report/current/
|
||||
bindsym $mod+Shift+g exec --no-startup-id $browser https://github.com/15five/fifteen5/pulls?utf8=%E2%9C%93&q=is%3Aopen+is%3Apr+label%3Abackend+-reviewed-by%3Apowellc
|
||||
bindsym $mod+Shift+e exec --no-startup-id $browser https://github.com/15five/fifteen5/pulls?utf8=%E2%9C%93&q=is%3Aopen+is%3Apr+label%3Abackend+-reviewed-by%3Apowellc
|
||||
|
||||
bindsym $mod+Ctrl+b exec $solobrowser https://www.astrobin.com/iotd/archive/
|
||||
bindsym $mod+Shift+m exec $solobrowser https://play.unbl.ink/iris
|
||||
bindsym $mod+Shift+p exec $solobrowser https://15five-dev.atlassian.net/secure/Dashboard.jspa
|
||||
|
||||
bindsym $mod+i exec emacsclient -c
|
||||
bindsym $mod+Ctrl+i exec pkill emacs && emacs --daemon && emacsclient -c
|
||||
bindsym $mod+Shift+i exec emacs -ib 16
|
||||
|
||||
#bindsym $mod+y exec
|
||||
#bindsym $mod+Ctrl+y exec
|
||||
@ -273,19 +280,11 @@ bindsym $mod+Ctrl+n exec marcador rofi ~/.config/rofi/marcador.db
|
||||
#bindsym $mod+Ctrl+u exec
|
||||
#bindsym $mod+Shift+u exec
|
||||
|
||||
bindsym $mod+i exec emacsclient -c
|
||||
bindsym $mod+Ctrl+i exec pkill emacs && emacs --daemon && emacsclient -c
|
||||
bindsym $mod+Shift+i exec emacs -ib 16
|
||||
|
||||
bindsym $mod+o exec rofi-now
|
||||
bindsym $mod+Ctrl+o exec rofi-vol
|
||||
bindsym $mod+Shift+o exec rofi-bat
|
||||
|
||||
bindsym $mod+Ctrl+b exec surf https://www.astrobin.com/iotd/archive/
|
||||
bindsym $mod+m exec surf https://play.unbl.ink/iris
|
||||
bindsym $mod+Shift+p exec surf https://15five-dev.atlassian.net/secure/Dashboard.jspa
|
||||
|
||||
##### LAUNCH ######################################
|
||||
##### LAUNCH ######################################
|
||||
|
||||
# STARTUP
|
||||
exec --no-startup-id emacs --daemon
|
||||
|
||||
73
rofi/.config/rofi/books-search.sh
Executable file
73
rofi/.config/rofi/books-search.sh
Executable file
@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Info:
|
||||
# author: Miroslav Vidovic
|
||||
# file: books-search.sh
|
||||
# created: 13.08.2017.-08:06:54
|
||||
# revision: ---
|
||||
# version: 1.0
|
||||
# -----------------------------------------------------------------------------
|
||||
# Requirements:
|
||||
# rofi
|
||||
# Description:
|
||||
# Use rofi to search my books.
|
||||
# Usage:
|
||||
# books-search.sh
|
||||
# -----------------------------------------------------------------------------
|
||||
# Script:
|
||||
|
||||
# Books directory
|
||||
BOOKS_DIR=~/var/calibre
|
||||
mkdir -p ~/var/calibre
|
||||
|
||||
# Save find result to F_ARRAY
|
||||
readarray -t F_ARRAY <<< "$(find "$BOOKS_DIR" -type f -name '*.epub')"
|
||||
|
||||
# Associative array for storing books
|
||||
# key => book name
|
||||
# value => absolute path to the file
|
||||
# BOOKS['filename']='path'
|
||||
declare -A BOOKS
|
||||
|
||||
# Add elements to BOOKS array
|
||||
get_books() {
|
||||
|
||||
# if [ ${#F_ARRAY[@]} != 0 ]; then
|
||||
if [[ ! -z ${F_ARRAY[@]} ]]; then
|
||||
for i in "${!F_ARRAY[@]}"
|
||||
do
|
||||
path=${F_ARRAY[$i]}
|
||||
file=$(basename "${F_ARRAY[$i]}")
|
||||
BOOKS+=(["$file"]="$path")
|
||||
done
|
||||
else
|
||||
echo "$BOOKS_DIR is empty!"
|
||||
echo "Please put some books in it."
|
||||
echo "Only .pdf files are accepted."
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
}
|
||||
|
||||
# List for rofi
|
||||
gen_list(){
|
||||
for i in "${!BOOKS[@]}"
|
||||
do
|
||||
echo "$i"
|
||||
done
|
||||
}
|
||||
|
||||
main() {
|
||||
get_books
|
||||
book=$( (gen_list) | rofi -dmenu -i -matching fuzzy -no-custom -location 0 -p "Book > " )
|
||||
|
||||
if [ -n "$book" ]; then
|
||||
xdg-open "${BOOKS[$book]}"
|
||||
fi
|
||||
}
|
||||
|
||||
main
|
||||
|
||||
exit 0
|
||||
57
rofi/.config/rofi/github-repos.sh
Executable file
57
rofi/.config/rofi/github-repos.sh
Executable file
@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Info:
|
||||
# author: Miroslav Vidovic
|
||||
# file: github-repos.sh
|
||||
# created: 04.04.2017.-09:18:34
|
||||
# revision: ---
|
||||
# version: 1.0
|
||||
# -----------------------------------------------------------------------------
|
||||
# Requirements:
|
||||
# rofi, git
|
||||
# Description:
|
||||
# Display all repositories connected with a GitHub user account in rofi and
|
||||
# clone the selected repository.
|
||||
# Usage:
|
||||
# github-repos.sh
|
||||
# -----------------------------------------------------------------------------
|
||||
# Script:
|
||||
|
||||
# GitHub username
|
||||
USER="powellc"
|
||||
|
||||
# GitHub user account URL
|
||||
URL="https://github.com/$USER/"
|
||||
|
||||
# Clone a repository into the current directory
|
||||
clone_repository(){
|
||||
local repository=$1
|
||||
if [ -z "$repository" ]; then
|
||||
echo "ERROR: You need to enter the name of the repository you wish to clone."
|
||||
else
|
||||
git clone ~/src/"$URL$repository"
|
||||
fi
|
||||
}
|
||||
|
||||
# Get all the repositories for the user with curl and GitHub API and filter only
|
||||
# the repository name from the output with sed substitution
|
||||
all_my_repositories_short_name(){
|
||||
curl -s "https://api.github.com/users/$USER/repos?per_page=1000" | grep -o 'git@[^"]*' |\
|
||||
sed "s/git@github.com:$USER\///g"
|
||||
}
|
||||
|
||||
# Rofi dmenu
|
||||
rofi_dmenu(){
|
||||
rofi -dmenu -matching fuzzy -no-custom -p "Select a repository > "\
|
||||
-location 0 -bg "#F8F8FF" -fg "#000000" -hlbg "#ECECEC" -hlfg "#0366d6"
|
||||
}
|
||||
|
||||
main(){
|
||||
repository=$(all_my_repositories_short_name | rofi_dmenu )
|
||||
clone_repository "$repository"
|
||||
}
|
||||
|
||||
main
|
||||
|
||||
exit 0
|
||||
72
rofi/.config/rofi/web-search.sh
Executable file
72
rofi/.config/rofi/web-search.sh
Executable file
@ -0,0 +1,72 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Info:
|
||||
# author: Miroslav Vidovic
|
||||
# file: web-search.sh
|
||||
# created: 24.02.2017.-08:59:54
|
||||
# revision: ---
|
||||
# version: 1.0
|
||||
# -----------------------------------------------------------------------------
|
||||
# Requirements:
|
||||
# rofi
|
||||
# Description:
|
||||
# Use rofi to search the web.
|
||||
# Usage:
|
||||
# web-search.sh
|
||||
# -----------------------------------------------------------------------------
|
||||
# Script:
|
||||
|
||||
declare -A URLS
|
||||
|
||||
URLS=(
|
||||
["search"]="https://search.unbl.ink/?q="
|
||||
["google"]="https://www.google.com/search?q="
|
||||
["ddg"]="https://www.duckduckgo.com/?q="
|
||||
["amazon"]="https://www.amazon.com/s?k="
|
||||
["github"]="https://github.com/search?q="
|
||||
["goodreads"]="https://www.goodreads.com/search?q="
|
||||
["stackoverflow"]="http://stackoverflow.com/search?q="
|
||||
["symbolhound"]="http://symbolhound.com/?q="
|
||||
["searchcode"]="https://searchcode.com/?q="
|
||||
["imdb"]="http://www.imdb.com/find?ref_=nv_sr_fn&q="
|
||||
["rottentomatoes"]="https://www.rottentomatoes.com/search/?search="
|
||||
["invidous"]="https://invidio.us/search?q="
|
||||
["vimawesome"]="http://vimawesome.com/?q="
|
||||
["beer"]="https://www.beeradvocate.com/search/?qt=beer&q="
|
||||
["jira"]="https://15five-dev.atlassian.net/plugins/servlet/mobile#issue/ENG-"
|
||||
["books"]="https://b-ok.cc/s/?q="
|
||||
["maps"]="https://www.openstreetmap.com/search?query="
|
||||
["pirate"]="https://thepirateboat.info/s/?q="
|
||||
)
|
||||
|
||||
# List for rofi
|
||||
gen_list() {
|
||||
for i in "${!URLS[@]}"
|
||||
do
|
||||
echo "$i"
|
||||
done
|
||||
}
|
||||
|
||||
main() {
|
||||
# Pass the list to rofi
|
||||
platform=$( (gen_list) | rofi -dmenu -matching fuzzy -no-custom -location 0 -p "Search > " )
|
||||
|
||||
if [[ -n "$platform" ]]; then
|
||||
query=$( (echo ) | rofi -dmenu -matching fuzzy -location 0 -p "Query > " )
|
||||
|
||||
if [[ -n "$query" ]]; then
|
||||
url=${URLS[$platform]}$query
|
||||
xdg-open "$url"
|
||||
else
|
||||
exit
|
||||
fi
|
||||
|
||||
else
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
main
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user