diff options
Diffstat (limited to '')
| -rw-r--r-- | Makefile | 1 | ||||
| -rw-r--r-- | TODO | 9 | ||||
| -rwxr-xr-x | clip | 18 | ||||
| -rwxr-xr-x | dmenu-bookmarks | 7 | ||||
| -rwxr-xr-x | dmenu-dwm-sessionmanager | 18 | ||||
| -rwxr-xr-x | dmenu-filepicker | 16 | ||||
| -rwxr-xr-x | dmenu-mail-aliases | 13 | ||||
| -rwxr-xr-x | dmenu-screenshot | 17 | ||||
| -rwxr-xr-x | dmenu-unmount | 18 | ||||
| -rwxr-xr-x | dmenu-urlselect | 15 | ||||
| -rwxr-xr-x | old/xkboptions (renamed from xkboptions) | 0 | ||||
| -rwxr-xr-x | open-file | 15 |
12 files changed, 104 insertions, 43 deletions
| @@ -41,7 +41,6 @@ SCRIPTS = addressgrep \ | |||
| 41 | websearch \ | 41 | websearch \ |
| 42 | xedit \ | 42 | xedit \ |
| 43 | xedit-filter \ | 43 | xedit-filter \ |
| 44 | xkboptions \ | ||
| 45 | xplumb \ | 44 | xplumb \ |
| 46 | xprop-active-window-id \ | 45 | xprop-active-window-id \ |
| 47 | xwallpaper-random-notify | 46 | xwallpaper-random-notify |
| @@ -1,11 +1,6 @@ | |||
| 1 | * Modify all dmenu-* scripts to optionally use another menu, like vis-menu (slmenu) | 1 | * dmenu-bookmarks: add option for different directory |
| 2 | Do this by taking an optional $1 which is the name of the program to use | ||
| 3 | (optional $dir argument is removed: fix dmenu-bookmarks simply using cd) | ||
| 4 | * Big problem: slmenu does not allow multiple selections; this is a problem | ||
| 5 | for my workflow for sel and for sfeed-menu (and sometimes for open-file) | ||
| 6 | * Solution: leave dmenu default option, use slmenu for a selected few aliases in .profile | ||
| 7 | 2 | ||
| 8 | * mblaze-extras: remove mmv, just use complete_mrefile=mail/... | 3 | * mblaze-extras: maybe remove script and just use aliases? |
| 9 | 4 | ||
| 10 | * sfeed-browser: optionally just write link to stdout (or to xsel -i) | 5 | * sfeed-browser: optionally just write link to stdout (or to xsel -i) |
| 11 | 6 | ||
| @@ -7,12 +7,20 @@ | |||
| 7 | # Bugs (wontfix): the program fails if it can't create the temporary | 7 | # Bugs (wontfix): the program fails if it can't create the temporary |
| 8 | # directory with the designated name. | 8 | # directory with the designated name. |
| 9 | 9 | ||
| 10 | # Requires: xsel, dmenu | 10 | # Usage: clip [-m menu] |
| 11 | 11 | ||
| 12 | # TODO: improve formatting in dmenu | 12 | # Requires: xsel, dmenu (or similar) |
| 13 | 13 | ||
| 14 | menu="dmenu" | 14 | menu="dmenu -i -l 25" |
| 15 | menuopts="-l 25" | 15 | |
| 16 | while getopts "m:" opt; do | ||
| 17 | case "$opt" in | ||
| 18 | m) | ||
| 19 | menu="$OPTARG" | ||
| 20 | ;; | ||
| 21 | esac | ||
| 22 | done | ||
| 23 | shift `expr $OPTIND - 1` | ||
| 16 | 24 | ||
| 17 | dir="/tmp/clipdir" | 25 | dir="/tmp/clipdir" |
| 18 | mkdir -p "$dir" | 26 | mkdir -p "$dir" |
| @@ -38,7 +46,7 @@ for f in $dir/*; do | |||
| 38 | printf "$fclean ($nlines) | $(head -n 1 $f)\n" >> "$lines" | 46 | printf "$fclean ($nlines) | $(head -n 1 $f)\n" >> "$lines" |
| 39 | done | 47 | done |
| 40 | 48 | ||
| 41 | selected=$(sort -r $lines | $menu $menuopts | awk '{print $1}') | 49 | selected=$(sort -r $lines | $menu | awk '{print $1}') |
| 42 | if [ -n "$selected" ]; then | 50 | if [ -n "$selected" ]; then |
| 43 | xsel -ib < "$dir/$selected" | 51 | xsel -ib < "$dir/$selected" |
| 44 | fi | 52 | fi |
diff --git a/dmenu-bookmarks b/dmenu-bookmarks index 2088e11..2566e43 100755 --- a/dmenu-bookmarks +++ b/dmenu-bookmarks | |||
| @@ -2,10 +2,13 @@ | |||
| 2 | 2 | ||
| 3 | # A bookmark browser based on dmenu | 3 | # A bookmark browser based on dmenu |
| 4 | 4 | ||
| 5 | # Requires: dmenu-filepicker, open-url | 5 | # Usage: dmenu-bookmarks [picker options...] |
| 6 | |||
| 7 | # Requires: dmenu-filepicker (or similar), open-url | ||
| 6 | 8 | ||
| 7 | dir=$HOME/box/bookmarks | 9 | dir=$HOME/box/bookmarks |
| 10 | picker="dmenu-filepicker" | ||
| 8 | 11 | ||
| 9 | echo "$(dmenu-filepicker $dir)" | while read line; do | 12 | echo "$($picker "$@" $dir)" | while read line; do |
| 10 | cat "$line" | 13 | cat "$line" |
| 11 | done | xargs open-url | 14 | done | xargs open-url |
diff --git a/dmenu-dwm-sessionmanager b/dmenu-dwm-sessionmanager index 74ddcf0..f423a09 100755 --- a/dmenu-dwm-sessionmanager +++ b/dmenu-dwm-sessionmanager | |||
| @@ -1,18 +1,26 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | # Prompts menu to shutdown/reboot/close dwm | 3 | # Prompts menu to shutdown/reboot/close dwm |
| 4 | # Usage: dmenu-dwm-sessionmanager [-m menu] | ||
| 4 | # Requires: dmenu (or equivalent), dwm (optional) | 5 | # Requires: dmenu (or equivalent), dwm (optional) |
| 5 | 6 | ||
| 6 | menu=${MENU:-dmenu} | 7 | menu="dmenu -i" |
| 7 | menuopts="-i -p" | 8 | prompt="Do you want to quit?" |
| 8 | menuprompt="Do you want to quit?" | 9 | while getopts "m:" opt; do |
| 9 | wmname="dwm" | 10 | case "$opt" in |
| 11 | m) | ||
| 12 | menu="$OPTARG" | ||
| 13 | ;; | ||
| 14 | esac | ||
| 15 | done | ||
| 16 | shift `expr $OPTIND - 1` | ||
| 10 | 17 | ||
| 18 | wmname="dwm" | ||
| 11 | shutdown_cmd="sudo shutdown -h now" | 19 | shutdown_cmd="sudo shutdown -h now" |
| 12 | reboot_cmd="sudo reboot" | 20 | reboot_cmd="sudo reboot" |
| 13 | closewm_cmd="pkill $wmname" | 21 | closewm_cmd="pkill $wmname" |
| 14 | 22 | ||
| 15 | value=$(echo "Shutdown\nReboot\nQuit dwm" | $menu $menuopts "$menuprompt") | 23 | value=$(echo "Shutdown\nReboot\nQuit dwm" | $menu -p "$prompt") |
| 16 | 24 | ||
| 17 | if [ "$value" = "Shutdown" ]; then | 25 | if [ "$value" = "Shutdown" ]; then |
| 18 | $shutdown_cmd | 26 | $shutdown_cmd |
diff --git a/dmenu-filepicker b/dmenu-filepicker index 7a3da9f..e2642b2 100755 --- a/dmenu-filepicker +++ b/dmenu-filepicker | |||
| @@ -2,10 +2,18 @@ | |||
| 2 | 2 | ||
| 3 | # A dmenu-based file picker (prints selected file to stdout) | 3 | # A dmenu-based file picker (prints selected file to stdout) |
| 4 | # Requires: dmenu (or similar) | 4 | # Requires: dmenu (or similar) |
| 5 | # Usage: dmenu-filepicker [path] | 5 | # Usage: dmenu-filepicker [-m menu] [path] |
| 6 | 6 | ||
| 7 | menu=dmenu | 7 | menu="dmenu -i -l 15" |
| 8 | menuopts="-i -l 15" | 8 | |
| 9 | while getopts "m:" opt; do | ||
| 10 | case "$opt" in | ||
| 11 | m) | ||
| 12 | menu="$OPTARG" | ||
| 13 | ;; | ||
| 14 | esac | ||
| 15 | done | ||
| 16 | shift `expr $OPTIND - 1` | ||
| 9 | 17 | ||
| 10 | fullpath=$(realpath ${@:-"$(pwd)"}) | 18 | fullpath=$(realpath ${@:-"$(pwd)"}) |
| 11 | 19 | ||
| @@ -15,7 +23,7 @@ while true; do | |||
| 15 | break | 23 | break |
| 16 | elif [ -d "$fullpath" ] || [ -z "$fullpath" ]; then | 24 | elif [ -d "$fullpath" ] || [ -z "$fullpath" ]; then |
| 17 | if [ -z "$fullpath" ]; then fp="/"; else fp="$fullpath"; fi | 25 | if [ -z "$fullpath" ]; then fp="/"; else fp="$fullpath"; fi |
| 18 | sel=$(ls -a "$fp" | sed 's|.*/||' | $menu $menuopts) | 26 | sel=$(ls -a "$fp" | sed 's|.*/||' | $menu) |
| 19 | if [ "$sel" = ".." ]; then | 27 | if [ "$sel" = ".." ]; then |
| 20 | fullpath=$(echo "$fullpath" | sed "s|/[^/]*$||") | 28 | fullpath=$(echo "$fullpath" | sed "s|/[^/]*$||") |
| 21 | else | 29 | else |
diff --git a/dmenu-mail-aliases b/dmenu-mail-aliases index 483dffc..582f8e3 100755 --- a/dmenu-mail-aliases +++ b/dmenu-mail-aliases | |||
| @@ -2,10 +2,19 @@ | |||
| 2 | 2 | ||
| 3 | # Select mail alias via dmenu | 3 | # Select mail alias via dmenu |
| 4 | # The email address must be the second word in a line of $aliasfile | 4 | # The email address must be the second word in a line of $aliasfile |
| 5 | # Usage: dmenu-mail-aliases [-m menu] | ||
| 5 | # Requires: dmenu (or similar) | 6 | # Requires: dmenu (or similar) |
| 6 | 7 | ||
| 7 | menu=${MENU:-dmenu} | 8 | menu="dmenu -l 20" |
| 8 | menuopts="-l 20" | ||
| 9 | aliasfile="$HOME/.mblaze/aliases" | 9 | aliasfile="$HOME/.mblaze/aliases" |
| 10 | 10 | ||
| 11 | while getopts "m:" opt; do | ||
| 12 | case "$opt" in | ||
| 13 | m) | ||
| 14 | menu="$OPTARG" | ||
| 15 | ;; | ||
| 16 | esac | ||
| 17 | done | ||
| 18 | shift `expr $OPTIND - 1` | ||
| 19 | |||
| 11 | $menu $menuopts <"$aliasfile" | awk '{print $NF}' | 20 | $menu $menuopts <"$aliasfile" | awk '{print $NF}' |
diff --git a/dmenu-screenshot b/dmenu-screenshot index 1aab461..fb918fd 100755 --- a/dmenu-screenshot +++ b/dmenu-screenshot | |||
| @@ -1,17 +1,26 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | # Screenshot utility | 3 | # Screenshot utility |
| 4 | # Usage: dmenu-screenshot [-m menu] | ||
| 4 | # Requires: dmenu (or similar), imagemagick | 5 | # Requires: dmenu (or similar), imagemagick |
| 5 | 6 | ||
| 6 | menu=${MENU:-dmenu} | 7 | menu="dmenu -i" |
| 7 | menuopts="-i -p" | 8 | prompt="Select type of screenshot:" |
| 8 | menuprompt="Select type of screenshot:" | 9 | |
| 10 | while getopts "m:" opt; do | ||
| 11 | case "$opt" in | ||
| 12 | m) | ||
| 13 | menu="$OPTARG" | ||
| 14 | ;; | ||
| 15 | esac | ||
| 16 | done | ||
| 17 | shift `expr $OPTIND - 1` | ||
| 9 | 18 | ||
| 10 | folder="$HOME/Pictures/screenshots" | 19 | folder="$HOME/Pictures/screenshots" |
| 11 | filename="screenshot_$(date +%Y-%m-%d-%H%M%S).png" | 20 | filename="screenshot_$(date +%Y-%m-%d-%H%M%S).png" |
| 12 | filepath="${folder}/${filename}" | 21 | filepath="${folder}/${filename}" |
| 13 | 22 | ||
| 14 | t=$(echo "Full\nSelection" | $menu $menuopts "$menuprompt") | 23 | t=$(echo "Full\nSelection" | $menu -p "$prompt") |
| 15 | #op="" TODO: remove if not needed | 24 | #op="" TODO: remove if not needed |
| 16 | if [ "$t" = "Full" ]; then | 25 | if [ "$t" = "Full" ]; then |
| 17 | op="-window root" | 26 | op="-window root" |
diff --git a/dmenu-unmount b/dmenu-unmount index 2c59ec4..57f0c41 100755 --- a/dmenu-unmount +++ b/dmenu-unmount | |||
| @@ -1,10 +1,24 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | # Prompts selection for mounted devices and unmounts the selected one | 3 | # Prompts selection for mounted devices and unmounts the selected one |
| 4 | # Usage: dmenu-unmount [-m menu] [-w writer] | ||
| 5 | # Example: dmenu-unmount -m slmenu -w echo | ||
| 4 | # Requires: udevil, dmenu (or similar), notify-send or similar (optional) | 6 | # Requires: udevil, dmenu (or similar), notify-send or similar (optional) |
| 5 | 7 | ||
| 6 | menu=${MENU:-dmenu} | 8 | menu=dmenu |
| 7 | writeout=herbe # Change this to whatever you want, e.g. echo or notify-send | 9 | writeout=herbe |
| 10 | |||
| 11 | while getopts "m:w:" opt; do | ||
| 12 | case "$opt" in | ||
| 13 | m) | ||
| 14 | menu="$OPTARG" | ||
| 15 | ;; | ||
| 16 | w) | ||
| 17 | writeout="$OPTARG" | ||
| 18 | ;; | ||
| 19 | esac | ||
| 20 | done | ||
| 21 | shift `expr $OPTIND - 1` | ||
| 8 | 22 | ||
| 9 | listdev=$(grep "media" /proc/mounts | sed 's/\/media.*\///g' | \ | 23 | listdev=$(grep "media" /proc/mounts | sed 's/\/media.*\///g' | \ |
| 10 | awk '{print $1" ("$2")"}') | 24 | awk '{print $1" ("$2")"}') |
diff --git a/dmenu-urlselect b/dmenu-urlselect index e19ec7b..d4e1f59 100755 --- a/dmenu-urlselect +++ b/dmenu-urlselect | |||
| @@ -2,9 +2,18 @@ | |||
| 2 | 2 | ||
| 3 | # Finds all URLs in stdin and prompts a dmenu choice, then writes the selected | 3 | # Finds all URLs in stdin and prompts a dmenu choice, then writes the selected |
| 4 | # url to stdout. | 4 | # url to stdout. |
| 5 | # Usage: dmenu-urlselect [-m menu] | ||
| 5 | # Requires: dmenu (or similar), urlgrep | 6 | # Requires: dmenu (or similar), urlgrep |
| 6 | 7 | ||
| 7 | menu=${MENU:-dmenu} | 8 | menu="dmenu -i -l 20" |
| 8 | menuopts="-l 20" | ||
| 9 | 9 | ||
| 10 | urlgrep | $menu $menuopts | 10 | while getopts "m:" opt; do |
| 11 | case "$opt" in | ||
| 12 | m) | ||
| 13 | menu="$OPTARG" | ||
| 14 | ;; | ||
| 15 | esac | ||
| 16 | done | ||
| 17 | shift `expr $OPTIND - 1` | ||
| 18 | |||
| 19 | urlgrep | $menu | ||
diff --git a/xkboptions b/old/xkboptions index e63456d..e63456d 100755 --- a/xkboptions +++ b/old/xkboptions | |||
| @@ -2,9 +2,10 @@ | |||
| 2 | 2 | ||
| 3 | # Inspired by https://github.com/salman-abedin/launch.sh | 3 | # Inspired by https://github.com/salman-abedin/launch.sh |
| 4 | # Launches files based on their mimetypes | 4 | # Launches files based on their mimetypes |
| 5 | # Usage: open-file [-m menu] [-s launcher] [-t mimetype] [files...] | ||
| 5 | # Requires: dmenu_path or similar (fallback), dmenu-filepicker | 6 | # Requires: dmenu_path or similar (fallback), dmenu-filepicker |
| 6 | 7 | ||
| 7 | menu=${MENU:-dmenu} | 8 | menu="dmenu -i -l 15" |
| 8 | 9 | ||
| 9 | # Change default apps here | 10 | # Change default apps here |
| 10 | video="mpv" | 11 | video="mpv" |
| @@ -78,8 +79,11 @@ openfile() { | |||
| 78 | fi | 79 | fi |
| 79 | } | 80 | } |
| 80 | 81 | ||
| 81 | while getopts "s:t:" opt; do | 82 | while getopts "m:s:t:" opt; do |
| 82 | case "$opt" in | 83 | case "$opt" in |
| 84 | m) | ||
| 85 | menu="$OPTARG" | ||
| 86 | ;; | ||
| 83 | s) | 87 | s) |
| 84 | launcher="$OPTARG" | 88 | launcher="$OPTARG" |
| 85 | ;; | 89 | ;; |
| @@ -89,11 +93,6 @@ while getopts "s:t:" opt; do | |||
| 89 | esac | 93 | esac |
| 90 | done | 94 | done |
| 91 | 95 | ||
| 92 | # If launcher = "", assume running in terminal, so some programs change | ||
| 93 | #if [ -z "$launcher" ]; then | ||
| 94 | # xedit=${EDITOR:-vi} | ||
| 95 | #fi | ||
| 96 | |||
| 97 | shift `expr $OPTIND - 1` | 96 | shift `expr $OPTIND - 1` |
| 98 | toopen=$@ | 97 | toopen=$@ |
| 99 | 98 | ||
| @@ -103,7 +102,7 @@ if [ -n "$1" ]; then | |||
| 103 | shift | 102 | shift |
| 104 | done | 103 | done |
| 105 | else | 104 | else |
| 106 | dmenu-filepicker | while read line; do | 105 | dmenu-filepicker -m "$menu" | while read line; do |
| 107 | openfile "$line" & | 106 | openfile "$line" & |
| 108 | done | 107 | done |
| 109 | fi | 108 | fi |
