├── LICENSE.md ├── Makefile ├── README.md └── src ├── autotypemenu.sh ├── bukuaddmenu.sh ├── bukuaddtitlemenu.sh ├── bukumenu.sh ├── bukutagmenu.sh ├── downloadmenu.sh ├── htmltopdfmenu.sh ├── manmenu.sh ├── passmenu2.sh ├── pdfmenu.sh ├── recordmenu.sh ├── selsearchmenu.sh ├── shotmenu.sh ├── streammenu.sh ├── unicodemenu.sh └── ytmenu.sh /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Simon Hugh Moore 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | PROJECT_NAME := "dmenu-bin" 2 | PREFIX := /usr/local 3 | SRC_PREFIX := ./src 4 | SRC := $(patsubst $(SRC_PREFIX)/%, %, $(wildcard $(SRC_PREFIX)/*.sh)) 5 | INSTALL_PATH := $(patsubst %.sh, $(PREFIX)/bin/%, $(SRC)) 6 | 7 | .PHONY: all 8 | all: 9 | @echo "==== $(PROJECT_NAME) ====" 10 | @echo 11 | @echo "Run 'make install' to install all scripts." 12 | @echo 13 | @echo "Run 'make install-SCRIPT' to install individual scripts." 14 | @echo "For example: 'make install-$(word 1, $(SRC))' to install the $(word 1, $(SRC)) script." 15 | @echo 16 | @echo "Make has to have write permission to the install directory '$(PREFIX)'." 17 | @echo "This usually means running make with elevated privileges \`sudo make\`." 18 | 19 | ## install : Install all scripts. 20 | .PHONY: install 21 | install: $(patsubst %, install-%, $(SRC)) 22 | @echo 23 | @echo "Finished installing $(PROJECT_NAME)!" 24 | 25 | ## uninstall : Uninstall all scripts. 26 | .PHONY: uninstall 27 | uninstall: $(patsubst $(PREFIX)/bin/%, uninstall-%, $(INSTALL_PATH)) 28 | @echo 29 | @echo "Finished uninstalling $(PROJECT_NAME)!" 30 | 31 | ## install-SCRIPT : Install individual script. 32 | .PHONY: install-% 33 | install-%: $(SRC_PREFIX)/% 34 | @echo "Installing $@..." 35 | @cp -vp $< $(PREFIX)/bin/$(notdir $(basename $<)) 36 | @chmod 755 $(PREFIX)/bin/$(notdir $(basename $<)) 37 | 38 | ## uninstall-SCRIPT : Uninstall individual script. 39 | .PHONY: uninstall-% 40 | uninstall-%: $(PREFIX)/bin/% 41 | @echo "Uninstalling $<..." 42 | @rm -vf $< 43 | 44 | ## variables : Print variables. 45 | .PHONY: variables 46 | variables: 47 | @echo PROJECT_NAME: $(PROJECT_NAME) 48 | @echo SRC_PREFIX: $(SRC_PREFIX) 49 | @echo PREFIX: $(PREFIX) 50 | @echo SRC: $(SRC) 51 | @echo INSTALL_PATH: $(INSTALL_PATH) 52 | 53 | ## help : Print help message. 54 | .PHONY: help 55 | help: Makefile 56 | @sed -n 's/^## //p' $< | awk -F':' '{printf "%-30s: %s\n", $$1, $$2'} 57 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DMENU-BIN 2 | These are just a collection of scripts to use with dmenu for personal use. 3 | 4 | ## Install 5 | First you have to install dmenu. 6 | Either install it manually or it should be available in most repositories. 7 | 8 | Then clone the repo and run make install (you will likely have to run make install as sudo) 9 | ``` shell 10 | https://github.com/simonhughcom/dmenu-bin.git && sudo make install 11 | ``` 12 | You can also install individual scripts by running `make install` followed by the script name. For example: 13 | ``` shell 14 | sudo make install fgb.sh 15 | ``` 16 | -------------------------------------------------------------------------------- /src/autotypemenu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # AUTOTYPEMENU 4 | # Simon Hugh Moore 5 | # 6 | # Autotype input to selected window 7 | # Can autotype from clipboard 8 | 9 | # file to save autotype history to 10 | # keep it in /run to make it non persistent 11 | hfile="$XDG_RUNTIME_DIR/autotypehistory" 12 | 13 | # if hfile file doesn't exist make it 14 | [ -f "$hfile" ] || touch "$hfile" 15 | 16 | # get clipboard selection and search history from $hfile and pass into dmenu 17 | selection=$(echo "$(xclip -o -sel clip)" | tac - $hfile | awk 'NF' | dmenu -i -l 10 -p "Text to Autotype: ") || exit 1 18 | 19 | # autotype selection 20 | xdotool type --clearmodifiers "$selection" 21 | 22 | # append autotype to history file 23 | echo "$selection" >> $hfile 24 | -------------------------------------------------------------------------------- /src/bukuaddmenu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Add bookmark to buku with tags 4 | 5 | URL=$(xclip -sel clip) 6 | 7 | tags=$(echo "FOR $URL" | dmenu -i -p "TAGS: ") 8 | 9 | # if nothing is chosen then exit 10 | [ "$tags" != "" ] || exit 11 | 12 | # if no tags are chosen then exit 13 | [ "$tags" != "FOR $URL" ] || exit 14 | 15 | bukuadd $URL $tags 16 | -------------------------------------------------------------------------------- /src/bukuaddtitlemenu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Add bookmark to buku with tags and title 4 | 5 | URL=$(xclip -sel clip -o) 6 | 7 | 8 | title=$(gethtmltitle "$URL" | dmenu -i -p "TITLE for $URL: ") 9 | 10 | # if nothing is chosen then exit 11 | [ "$title" != "" ] || exit 12 | 13 | echo $title 14 | 15 | tags=$(echo "FOR $URL" | dmenu -i -p "TAGS: ") 16 | 17 | # if nothing is chosen then exit 18 | [ "$tags" != "" ] || exit 19 | 20 | echo $title 21 | echo $tags 22 | 23 | # if no title or tags are chosen then exit 24 | [ "$title" != "FOR $URL" ] || exit 25 | [ "$tags" != "FOR $URL" ] || exit 26 | 27 | echo $title 28 | echo $tags 29 | 30 | bukuadd "$URL" "$tags" --title "$title" 31 | -------------------------------------------------------------------------------- /src/bukumenu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Give a list of bookmarks to search and open them in current browser 4 | 5 | choice="$( buku --np $@ -f 4 | sed '/^waiting for input$/d' | awk -F'\t' '{printf "%-4i %-55.50s %s \n",$1,$3,$4}' | dmenu -i -l 10 | cut -d' ' -f1 )" 6 | 7 | # if nothing is chosen then exit 8 | [ "$choice" != "" ] || exit 9 | 10 | # buku -o $choice 11 | 12 | $BROWSER "$(buku --np -p "$choice" -f1 | tail -n1 | cut -f2)" # Visit URL 13 | -------------------------------------------------------------------------------- /src/bukutagmenu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Give a list of tags for bookmarks to search and open them in current browser 4 | 5 | choice="$(buku --np --stag | sed '/^.* [0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] .*$/d' | awk '{printf "%s %s\n",$2,$3}' | dmenu -i -l 10 | awk '{print $1}')" 6 | 7 | # if nothing is chosen then exit 8 | [ "$choice" != "" ] || exit 9 | 10 | bukumenu -t "$choice" 11 | -------------------------------------------------------------------------------- /src/downloadmenu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | # List all files in Downloads folder 5 | 6 | # get choice of downloads files 7 | choice=$(find $DOWNLOADS -type f | awk -F'/' '{print $NF}' | dmenu -i -l 10) 8 | 9 | # if nothing is chosen then exit 10 | [ "$choice" != "" ] || exit 11 | 12 | xdg-open "$DOWNLOADS/$choice" 13 | -------------------------------------------------------------------------------- /src/htmltopdfmenu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # HTMLTOPDFMENU 4 | # Simon H Moore 5 | # 6 | # Takes a URL through dmenu and downloads a html page as a pdf. 7 | # Can get the URL through clipboard. 8 | # Requires htmltopdf, dmenu and xclip. 9 | 10 | dir="$PDFS" # directory to store pdf in 11 | 12 | url=$(xclip -sel clip) # get URL through xclip 13 | 14 | title=$(gethtmltitle "$url" | tr '[:upper:]' '[:lower:]' \ 15 | | sed 's/&/ and /g; 16 | s/+/ plus /g; 17 | s/=/ equals /g; 18 | s/[[:punct:]]/ /g; 19 | s/[[:space:]]*-[[:space:]]*/-/g; 20 | s/[[:space:]][[:space:]]*/_/g; 21 | r/[^[:alnum:]_-]/g' \ 22 | | dmenu -i -l 10 -p "for: ") || exit 1 23 | 24 | # convert html to pdf and save in $dir. 25 | htmltopdf "$url" "$dir/${title}.pdf" 26 | -------------------------------------------------------------------------------- /src/manmenu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # MANMENU 4 | # Simon Hugh Moore 5 | # 6 | # Use dmenu to open man pages 7 | # As shown in video: 8 | # https://www.youtube.com/watch?v=C2HXfyYG5WE 9 | 10 | man $(apropos --long "$1" | dmenu -i -l 10 | awk '{print $2, $1}' | tr -d '()') 11 | -------------------------------------------------------------------------------- /src/passmenu2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # PASSMENU2 4 | # Simon Hugh Moore 5 | # 6 | # Passmenu script which gives you a choice between retrieving pass, login or OTP 7 | # Requires pass-otp to get the OTP 8 | 9 | pass_dir="$HOME/.password-store" 10 | lastpass="$XDG_RUNTIME_DIR/lastpass" # store last pass accessed (pun intended) 11 | 12 | # type out using xdotool 13 | write(){ 14 | xdotool type --clearmodifiers "$1" 15 | } 16 | 17 | # gets pass from password-store 18 | get_pass(){ 19 | pass show "$password" | head -n1 20 | } 21 | 22 | # gets login from password-store, login must have a prefix of `login: ` 23 | get_login(){ 24 | pass show "$password" | grep "login: " | cut -d' ' -f 2 25 | } 26 | 27 | # Exploits a common design pattern in login fields to 28 | # auto login by following the pattern of: 29 | # type login --> press tab key --> type pass --> press return 30 | auto_login(){ 31 | write $(get_login) 32 | sleep 0.1 33 | xdotool key Tab 34 | sleep 0.1 35 | write $(get_pass) 36 | sleep 0.1 37 | xdotool key Return 38 | } 39 | 40 | # got to password-store directory and get a list of files. 41 | cd $pass_dir 42 | password_files="$(find * -type f)" 43 | 44 | # get pass file using dmenu 45 | password=$(printf '%s\n' "$(cat $lastpass)" "${password_files}" | sed 's|.gpg||g' | dmenu -i) || exit 46 | 47 | # choose what to get from pass file using dmenu 48 | choice=$(printf '*\nURL\nOTP\nPass\nLogin' | dmenu -i) || exit 49 | 50 | # store the chosen pass file name in lastpass file 51 | echo "$password" > "$lastpass" 52 | 53 | case "$choice" in 54 | "*") auto_login;; # Writes both login and pass 55 | Pass) write $(get_pass);; # autotype pass 56 | Login) write $(get_login);; # autotype login 57 | OTP) write $(pass otp show "$password");; # autotype OTP 58 | URL) $BROWSER "$(pass url "$password")";; # Visit URL 59 | esac 60 | -------------------------------------------------------------------------------- /src/pdfmenu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # PDFMENU 4 | # Simon H Moore 5 | # 6 | # Gives a dmenu list of all files in the pdfs directory 7 | # and opens them using zathura. 8 | # Requires dmenu and zathura to work. 9 | 10 | # location of directory containing pdfs 11 | pdf_dir="$HOME/pdfs" 12 | 13 | # get choice of pdf 14 | choice=$(ls $pdf_dir | dmenu -i -l 10) || exit 15 | 16 | # open pdf using zathura 17 | zathura "$pdf_dir/$choice" 18 | -------------------------------------------------------------------------------- /src/recordmenu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | # Store recordings in dir 5 | dir="$HOME/rec/" 6 | 7 | # get current time and date to save to filename 8 | now="$(date '+%Y-%m-%d_%H:%M:%S')" 9 | 10 | res=2560x1440 11 | fps=30 12 | 13 | # file to store recording processor ID so that you can kill it later 14 | recpid_file="$XDG_RUNTIME_DIR/recordingpid" 15 | 16 | killrecording(){ 17 | recpid="$(cat "$recpid_file")" 18 | # kill with SIGTERM, allowing finishing touches. 19 | kill -15 "$recpid" 20 | rm -f "$recpid_file" 21 | sleep 3 22 | # even after SIGTERM, ffmpeg may still run, so SIGKILL it. 23 | kill -9 "$recpid" 24 | sleep 1 # no idea why but wont exit without sleep 25 | refbar 26 | exit 27 | } 28 | 29 | asktoend() { \ 30 | response=$(printf "No\\nYes" | dmenu -i -p "Recording still active. End recording?") 31 | [ "$response" = "Yes" ] && killrecording 32 | sleep 1 # no idea why but wont exit without sleep 33 | exit 34 | } 35 | 36 | askrecording() { \ 37 | choice=$(printf "screencast\\nwindow\\nvideo\\naudio\\nscreencast(cpu)\\nvideo(cpu)" | dmenu -i -p "Select recording style:") 38 | case "$choice" in 39 | screencast) screencast;; 40 | window) window;; 41 | audio) audio;; 42 | video) video;; 43 | "screencast(cpu)") cpucast;; 44 | "video(cpu)") cpuvideo;; 45 | esac 46 | exit 47 | } 48 | 49 | screencast(){ 50 | refbar 51 | ffmpeg -y \ 52 | -vaapi_device /dev/dri/renderD128 \ 53 | -f x11grab \ 54 | -video_size $res \ 55 | -framerate $fps \ 56 | -i $DISPLAY \ 57 | -f alsa -i default \ 58 | -vf 'hwupload,scale_vaapi=format=nv12' \ 59 | -c:v h264_vaapi \ 60 | -qp 24 \ 61 | -c:a aac \ 62 | -f mp4 "$dir/${now}_cast_rec.mp4" & 63 | echo $! > $recpid_file 64 | } 65 | 66 | window(){ 67 | refbar 68 | xid=$(xprop -root _NET_ACTIVE_WINDOW | awk '{print $5}') 69 | 70 | gst-launch-1.0 -q ximagesrc xid="$xid" use-damage=0 \ 71 | ! video/x-raw,framerate=60/1 \ 72 | ! queue ! videoconvert \ 73 | ! vaapisink ! vaapih265enc rate-control=cbr \ 74 | ! h265parse ! mkv. \ 75 | autoaudiosrc ! queue ! audioconvert ! mkv. \ 76 | matroskamux name=mkv ! filesink location="$dir/${now}_rec.mkv" & 77 | echo $! > $recpid_file 78 | } 79 | 80 | cpucast(){ 81 | refbar 82 | ffmpeg -y \ 83 | -f x11grab \ 84 | -video_size $res \ 85 | -framerate 30 \ 86 | -i $DISPLAY \ 87 | -f alsa -i default \ 88 | -c:v libx264 \ 89 | -preset ultrafast \ 90 | -c:a aac \ 91 | -f matroska "$dir/${now}_cast_rec.mkv" & 92 | echo $! > $recpid_file 93 | } 94 | 95 | video(){ 96 | refbar 97 | ffmpeg -y \ 98 | -vaapi_device /dev/dri/renderD128 \ 99 | -f x11grab \ 100 | -video_size $res \ 101 | -framerate $fps \ 102 | -i $DISPLAY \ 103 | -vf 'hwupload,scale_vaapi=format=nv12' \ 104 | -c:v h264_vaapi \ 105 | -qp 24 \ 106 | -f matroska "$dir/${now}_video_rec.mkv" & 107 | echo $! > $recpid_file 108 | } 109 | 110 | cpuvideo() { 111 | refbar 112 | ffmpeg \ 113 | -f x11grab \ 114 | -video_size $res \ 115 | -framerate $fps \ 116 | -i $DISPLAY \ 117 | -c:v libx264 \ 118 | -f matroska "$dir/${now}_video_rec.mkv" & 119 | echo $! > $recpid_file 120 | } 121 | 122 | audio() { \ 123 | refbar 124 | ffmpeg -y \ 125 | -f alsa -i default \ 126 | -c:a aac \ 127 | "$dir/${now}_audio_rec.aac" & 128 | echo $! > $recpid_file 129 | } 130 | 131 | list() { 132 | ls -r "$dir" 133 | } 134 | 135 | listmenu() { 136 | choice="$(list | dmenu -i -l 10)" 137 | 138 | # if nothing is chosen then exit 139 | [ "$choice" != "" ] || exit 140 | 141 | notify-send "Playing in mpv..." "$choice" 142 | mpv "$dir/$choice" || notify-send "Failed to play..." "$choice" 143 | } 144 | 145 | case "$1" in 146 | screencast) screencast;; 147 | audio) audio;; 148 | video) video;; 149 | kill) killrecording;; 150 | list) list;; 151 | listmenu) listmenu;; 152 | *) ([ -f "$recpid_file" ] && asktoend && exit) || askrecording;; 153 | esac 154 | -------------------------------------------------------------------------------- /src/selsearchmenu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Search using various search engines 4 | # Can search using primary selection 5 | 6 | # file to save search history to 7 | # keep it in /run to make it non persistant 8 | hfile="$XDG_RUNTIME_DIR/selsearchhistory" 9 | 10 | # if hfile file doesent exist make it 11 | [ -f "$hfile" ] || touch "$hfile" 12 | 13 | # get primary selection and search history from $hfile and pass into dmenu 14 | selection=$(echo "$(xclip -o)" | tac - $hfile | awk 'NF' | dmenu -i -l 10 -p "Search Term: " | tr ' ' '+' ) || exit 1 15 | 16 | 17 | se[0]="Start Page" 18 | se[1]="You Tube" 19 | se[2]="Git Hub" 20 | se[3]="Wikipedia" 21 | se[4]="Arch Wiki" 22 | se[5]="HTTP" 23 | se[6]="Images" 24 | se[7]="IMDB" 25 | se[8]="Duck Duck Go" 26 | se[9]="google" 27 | se[10]="Amazon" 28 | se[11]="Map" 29 | se[12]="GMaps" 30 | se[13]="Ebay" 31 | 32 | # get choice of search engine using dmenu 33 | #choice=$(printf "$ddg\\n$yt\\n$git\\n$wiki\\n$aw\\n$http\\n$imdb\\n$sp\\n$google\\n$az" | dmenu -i -p "Search \"$(echo "$selection" | trunk -c 30 -e)\": ") || exit 1 34 | choice=$(printf "%s\n" "${se[@]}" | dmenu -i -p "Search \"$(echo "$selection" | trunk -c 30 -e)\": ") || exit 1 35 | 36 | 37 | # get apropriate url for choice 38 | if [ "$choice" = "${se[0]}" ]; then 39 | url="https://www.startpage.com/do/search?query=$selection" 40 | elif [ "$choice" = "${se[1]}" ]; then 41 | url="https://www.youtube.com/results?search_query=$selection" 42 | elif [ "$choice" = "${se[2]}" ]; then 43 | url="https://github.com/search?utf8=%E2%9C%93&q=$selection" 44 | elif [ "$choice" = "${se[3]}" ]; then 45 | url="https://en.wikipedia.org/wiki/$selection" 46 | elif [ "$choice" = "${se[4]}" ]; then 47 | url="https://wiki.archlinux.org/index.php?search=$selection" 48 | elif [ "$choice" = "${se[5]}" ]; then 49 | url="$selection" 50 | elif [ "$choice" = "${se[6]}" ]; then 51 | url="https://duckduckgo.com/?q=$selection&kae=d&kp=-2&kz=1&kav=1&kn=1&k1=-1&kaj=m&kam=osm&kay=b&kak=-1&kax=-1&kaq=-1&kap=-1&kao=-1&kau=-1&kba=-1&kw=n&kh=1&k5=2&t=h_&iax=images&ia=images" 52 | elif [ "$choice" = "${se[7]}" ]; then 53 | url="https://www.imdb.com/find?ref_=nv_sr_fn&q=$selection&s=all" 54 | elif [ "$choice" = "${se[8]}" ]; then 55 | url="https://duckduckgo.com/?q=$selection&kae=d&kp=-2&kz=1&kav=1&kn=1&k1=-1&kaj=m&kam=osm&kay=b&kak=-1&kax=-1&kaq=-1&kap=-1&kao=-1&kau=-1&kba=-1&kw=n&kh=1&k5=2&t=h_&ia=web" 56 | elif [ "$choice" = "${se[9]}" ]; then 57 | url="https://www.google.com/search?q=$selection" 58 | elif [ "$choice" = "${se[10]}" ]; then 59 | url="https://www.amazon.co.uk/s?k=$selection" 60 | elif [ "$choice" = "${se[11]}" ]; then 61 | url="https://www.openstreetmap.org/search?&query=$selection" 62 | elif [ "$choice" = "${se[12]}" ]; then 63 | url="https://www.google.com/maps/search/$selection" 64 | elif [ "$choice" = "${se[13]}" ]; then 65 | url="https://www.ebay.co.uk/sch/i.html?_nkw=$selection" 66 | fi 67 | 68 | $BROWSER "$url" 69 | 70 | # append searchterm to history file 71 | echo "$selection" >> $hfile 72 | -------------------------------------------------------------------------------- /src/shotmenu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # SHOTMENU 4 | # Simon H Moore 5 | # 6 | # Takes a screenshot or opens screenshot from screenshot dir using dmenu. 7 | # 8 | # Requires dmenu, scrot and sxiv to work. 9 | 10 | screenshot() { 11 | # Gives a list of screen shot options: 12 | 13 | # Get user choice 14 | choice=$(echo "Window\nSelect" | dmenu -p "choose") 15 | 16 | # Perform chosen screen shot 17 | case "$choice" in 18 | Window) shot -u && exit & ;; # screenshot currently focused window 19 | Select) shot -s && exit & ;; # screenshot selected area 20 | esac 21 | } 22 | 23 | list() { 24 | # list all screenshots and open selected screenshot in sxiv 25 | shots_dir=~/Pictures/shots/ 26 | 27 | # get choice of screenshot 28 | choice=$(ls -r $shots_dir | dmenu -i -l 10) || exit 29 | 30 | # open selected screenshot in sxiv 31 | sxiv "$shots_dir/$choice" 32 | } 33 | 34 | 35 | case "$1" in 36 | list | -l) list;; 37 | screenshot | -s) screenshot;; 38 | esac 39 | -------------------------------------------------------------------------------- /src/streammenu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Get list of mpv friendly urls for streaming from buku 4 | 5 | # get primary selection and history from $hfile and pass into dmenu 6 | 7 | choice="$(buku --np -t stream,mpv -f 4 | sed '/^waiting for input$/d' | awk -F'\t' '{printf "%-4i %-55.50s %s \n",$1,$3,$4}' | dmenu -i -l 10)" 8 | 9 | id="$(echo "$choice" | awk '{print $1}')" 10 | 11 | ytp $(buku -p "$id" -f 1 | awk '{print $2}') 12 | -------------------------------------------------------------------------------- /src/unicodemenu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # UNICODEMENU 4 | # Simon H Moore 5 | # 6 | # Gives a list of Unicode characters from a file using dmenu 7 | # and puts the character in primary and clipboard selection 8 | # 9 | # Requires dmenu to work. 10 | 11 | # location of file containing Unicode characters 12 | uc_file=$1 13 | 14 | # get chosen Unicode characters from dmenu 15 | # lines beginning with `#` will be ignored 16 | chosen=$(grep -v "#" "$uc_file" | dmenu -i -l 20) || exit 17 | 18 | # get Unicode character from chosen 19 | uc=$(echo "$chosen" | awk '{print $1}') 20 | 21 | # put Unicode character in both primary and clipboard selection 22 | echo "$uc" | xclip -r -f | xclip -sel clip 23 | 24 | # notify user of event 25 | notify-send "$uc copied to primary and clipboard selection" 26 | -------------------------------------------------------------------------------- /src/ytmenu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Search using various search engines 4 | # Can search using primary selection 5 | 6 | # file to save search history to 7 | # keep it in /run to make it non persistant 8 | hfile="$XDG_RUNTIME_DIR/youtube_watch_history" 9 | 10 | # if hfile file doesent exist make it 11 | [ -f "$hfile" ] || touch "$hfile" 12 | 13 | # get primary selection and history from $hfile and pass into dmenu 14 | url=$(echo "$(xclip -sel clip)" | tac - $hfile | awk 'NF' | dmenu -i -l 10 -p "URL: ") || exit 1 15 | 16 | #pass url to ytp script 17 | ytp $url 18 | 19 | # append url to fistory file 20 | echo "$url" >> $hfile 21 | --------------------------------------------------------------------------------