diff options
| author | Josh Rahm <rahm@google.com> | 2022-01-13 13:53:45 -0700 |
|---|---|---|
| committer | Josh Rahm <rahm@google.com> | 2022-01-13 13:53:45 -0700 |
| commit | bda81bc101bff7caf76d9a27aa31fccd24dcec84 (patch) | |
| tree | 1b0137a73016cab215ff2346a525c63894bd2bd1 | |
| parent | cd5f031e28ecda974e2f0515892e1b48a2a34170 (diff) | |
| download | rde-bda81bc101bff7caf76d9a27aa31fccd24dcec84.tar.gz rde-bda81bc101bff7caf76d9a27aa31fccd24dcec84.tar.bz2 rde-bda81bc101bff7caf76d9a27aa31fccd24dcec84.zip | |
Added library-view.sh and bound it to <C-z>o
| -rwxr-xr-x | extras/HOME/.local/bin/library-view.sh | 28 | ||||
| -rw-r--r-- | src/Internal/Keys.hs | 3 |
2 files changed, 31 insertions, 0 deletions
diff --git a/extras/HOME/.local/bin/library-view.sh b/extras/HOME/.local/bin/library-view.sh new file mode 100755 index 0000000..29925a8 --- /dev/null +++ b/extras/HOME/.local/bin/library-view.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +MENU=(rofi -i -dmenu -sort -theme-str '* {theme-color: #ff88ff;}' -p "Library") + +if (which zathura) ; then + pdfviewer=zathura +elif (which evince) ; then + pdfviewer=evince +else + pdfviewer='xdg-open' +fi + + +cd ~/Library + +files=(*.pdf) + +file_with_title="$(for file in "${files[@]}" ; do + echo "$file| $(echo "$file" | sed 's#\(^\|_\|\s\)\([a-z]\)#\1\U\2#g' | tr '_' ' ' | sed 's/.[^.]*$//')" +done)" + +selected=$(echo "$file_with_title" | (while read file ; do + echo "${file//*|}" +done) | "${MENU[@]}") + +if [ ! -z "${selected}" ] ; then + $pdfviewer "$(echo "$file_with_title" | grep "$selected" | sed 's/|.*//')" +fi diff --git a/src/Internal/Keys.hs b/src/Internal/Keys.hs index 3189ddb..936b12a 100644 --- a/src/Internal/Keys.hs +++ b/src/Internal/Keys.hs @@ -244,6 +244,9 @@ keymap = runKeys $ do bind xK_w $ (justMod -|- noMod) $ spawn "networkmanager_dmenu" + bind xK_o $ + (justMod -|- noMod) $ spawn "library-view.sh" + bind xK_v $ do (justMod -|- noMod) $ spawn "set-volume.sh" (shiftMod -|- rawMask shiftMask) $ spawn "set-volume.sh -a" |