From 0c3dbadea5c353494f1a68e441f41f148ac283f1 Mon Sep 17 00:00:00 2001 From: Thomas Dehaeze Date: Sat, 22 Jun 2019 17:27:21 +0200 Subject: [PATCH] Add buku-dmenu --- dotfiles/binaries.org | 77 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 75 insertions(+), 2 deletions(-) diff --git a/dotfiles/binaries.org b/dotfiles/binaries.org index 1f6dac5..8b7c09b 100644 --- a/dotfiles/binaries.org +++ b/dotfiles/binaries.org @@ -478,10 +478,10 @@ mode=bookmarks main dm-tool switch-to-greeter ;; suspend) - ~/scripts/lockscreen.sh && $logind suspend + $logind suspend && ~/scripts/lockscreen.sh ;; hibernate) - ~/scripts/lockscreen.sh && $logind hibernate + $logind hibernate && ~/scripts/lockscreen.sh ;; reboot) $logind reboot @@ -497,6 +497,7 @@ mode=bookmarks main exit 0 #+end_src + * readbib :PROPERTIES: :header-args: :tangle ~/bin/readbib @@ -506,6 +507,7 @@ mode=bookmarks main #+begin_src bash cd ~/MEGA/These/Ressources/pdfs/ && ls | dmenu -l 20 | xargs -I {} zathura {} #+end_src + * askpass :PROPERTIES: :header-args: :tangle ~/bin/askpass-rofi @@ -520,3 +522,74 @@ The sed piece just removes the colon from the provided prompt: =rofi -p= already -no-fixed-num-lines \ -p "$(printf "$1" | sed s/://)" #+END_SRC + +* buku-dmenu + :PROPERTIES: + :header-args: :tangle ~/bin/buku-dmenu + :header-args+: :comments both :mkdirp yes + :header-args+: :shebang "#!/usr/bin/env bash" + :END: +#+BEGIN_SRC bash + if [ "$1" == "--help" ] ; then + echo "Run the script, start typing until the desired bookmark is selected." + echo "buku and dmenu must be installed." + exit 0 + fi + + #get all bmks | swap tabs for spaces | run dmenu | cut to ID | run buku if not empty + buku -p -f 3 | sed 's/\t/ /g' | dmenu -i -l 20 | cut -d ' ' -f 1 | xargs --no-run-if-empty buku -o +#+END_SRC + +* notifToggle + :PROPERTIES: + :header-args: :tangle ~/bin/notifToggle + :header-args+: :comments both :mkdirp yes + :header-args+: :shebang "#!/usr/bin/env bash" + :END: + +#+begin_src bash + tmpfile="/tmp/dunststatus"; + + if [ -f $tmpfile ]; then + if grep -q "on" $tmpfile; then + killall -SIGUSR1 dunst && echo "off" > $tmpfile; + elif grep -q "off" $tmpfile; then + killall -SIGUSR2 dunst && echo "on" > $tmpfile; + fi + else + killall -SIGUSR1 dunst && echo "off" > $tmpfile; + fi +#+end_src +* Take Screenshot + :PROPERTIES: + :header-args: :tangle ~/bin/screenshot + :header-args+: :comments both :mkdirp yes + :header-args+: :shebang "#!/usr/bin/env bash" + :END: + +#+begin_src bash + status=$(echo -e "All\nSelection\nCropped\nCopy\nShadow\nActive" | rofi -i -dmenu) + if [ -z "$status" ]; then + exit; + fi + + name=$(echo -e "screenshot-$(date +"%m-%d-%y_%H-%M-%S")" | rofi -i -dmenu) + if [ -z "$name" ]; then + exit; + fi + + case "$status" in + "All") + maim ~/Pictures/$name.png ;; + "Selection") + maim -s ~/Pictures/$name.png ;; + "Cropped") + maim -s ~/Pictures/$name.png && convert -trim ~/Pictures/$name.png ~/Pictures/$name.png;; + "Copy") + maim -s | xclip -selection clipboard -t image/png ;; + "Shadow") + maim -st 9999999 | convert - \( +clone -background black -shadow 80x3+5+5 \) +swap -background none -layers merge +repage ~/Pictures/$name.png ;; + "Active") + maim -i $(xdotool getactivewindow) ~/Pictures/$name.png ;; + esac +#+end_src