├── LICENSE ├── README.md ├── dmenu-recent-aliases ├── README.md └── dmenu_recent_aliases ├── dmenu_dwb ├── README.md └── dmenu_dwb ├── dmenu_edit ├── README.md └── dmenu_edit ├── dmenu_fm ├── README.md └── dmenu_fm ├── dmenu_fmenu └── README.md ├── dmenu_mpd └── README.md ├── dmenu_recent ├── README.md └── dmenu_recent ├── dmenu_running_apps ├── README.md └── dmenu_running_apps ├── dmenu_twich └── README.md └── qmenu_hud └── README.md /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Robert Orzanna 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | 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, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | dmenu_scripts collection 2 | ======================== 3 | 4 | Collection of optional dmenu hacking scripts, originating from this [Arch Linux forums thread](https://bbs.archlinux.org/viewtopic.php?id=80145), to provide an overview on the vast possibilities offered by dmenu. 5 | 6 | # Contribution 7 | 8 | Thanks and credits go to the individual authors of the scripts. 9 | -------------------------------------------------------------------------------- /dmenu-recent-aliases/README.md: -------------------------------------------------------------------------------- 1 | # Usage 2 | Run dmenu with custom aliases support, sorted by recent use, using the `dmenu_recent_aliases` script: 3 | 4 | ```bash 5 | dmenu_recent_aliases -fn 'Noto Sans-10' -sb '#3A81CC' -nb '#ffffff' -nf '#000000' 6 | ``` 7 | 8 | By default, aliases and functions need to be stored in `~/.zsh_aliases`. The location can be changed in the script: 9 | 10 | ```bash 11 | cache=~/.cache/dmenu_run 12 | freq=~/.dmenu_history 13 | aliases=~/.zsh_aliases 14 | ``` 15 | 16 | Over time, `dmenu_recent_aliases` will store your most frequently used files in `~/.dmenu_history`. By default, these entries will persist even on removal of applications. In order to clean your history, you have to manually run the following command: 17 | 18 | ```bash 19 | $ dmenu_recent_aliases remove 20 | ``` 21 | 22 | # Contributions 23 | 24 | * Samee Zhaur and his [propsed patch](https://groups.google.com/forum/#!topic/wmii/Mvv5i2CPo7A) 25 | * [dennis123123](https://bbs.archlinux.org/profile.php?id=26975) for his custom functions support 26 | * Ewan Coder for his [re-write](https://github.com/ewancoder/dotfiles/blob/master/bin/dm) 27 | -------------------------------------------------------------------------------- /dmenu-recent-aliases/dmenu_recent_aliases: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cache=~/.cache/dmenu_run 3 | freq=~/.dmenu_history 4 | aliases=~/.zsh_aliases 5 | source $aliases 6 | 7 | case "$1" in 8 | remove) 9 | # To remove a file from history: 10 | # $ dmenu_recent_aliases remove 11 | grep -v "$2" $freq > temp && mv temp $freq 12 | ;; 13 | *) 14 | (compgen -a; compgen -c | grep -vxF "$(compgen -a)") | sort | tail -n +10 > $cache 15 | 16 | sorted=$(sort $freq | uniq -c | sort -hr | colrm 1 8) 17 | cmd=`(echo "$sorted"; cat $cache | grep -vxF "$sorted") | dmenu "$@"` 18 | if ! [ "$cmd" == "" ] && ! [ "$(grep ${cmd/;/} $cache)" == "" ]; then 19 | echo ${cmd/;/} >> $freq 20 | 21 | cmdexec=$(alias | grep "${cmd/;/}=" | cut -f2 -d "'" | tr -d "'") 22 | if [ -z "$cmdexec" ]; then 23 | cmdexec=${cmd/;/} 24 | fi 25 | 26 | case $cmd in 27 | *\;) cmdexec="urxvt -e $cmdexec" ;; 28 | esac 29 | # Ugly workaround to run functions... 30 | echo "$cmdexec" | compgen -F "$cmdexec" | bash 31 | # ...and aliases 32 | echo "$cmdexec" | bash 33 | fi 34 | ;; 35 | esac -------------------------------------------------------------------------------- /dmenu_dwb/README.md: -------------------------------------------------------------------------------- 1 | # Installation 2 | 3 | Modify `` to your desired user. 4 | 5 | # Contribution 6 | 7 | Thanks to [cris9288](https://bbs.archlinux.org/viewtopic.php?pid=1377247#p1377247) 8 | -------------------------------------------------------------------------------- /dmenu_dwb/dmenu_dwb: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f $HOME/.dmenurc ]; then 4 | source $HOME/.dmenurc 5 | else 6 | DMENU="dmenu -i" 7 | fi 8 | 9 | DMENU="$DMENU -p 'Quickmarks:' -w 400" 10 | QUICKMARKS=/home//.config/dwb/default/quickmarks 11 | 12 | GOTO=$(cat $QUICKMARKS | awk '{print $1}' | eval $DMENU) 13 | 14 | if [ $? -eq 0 ]; then 15 | exec dwb $(cat $QUICKMARKS | grep "$GOTO" | awk '{print $2}') 16 | fi 17 | -------------------------------------------------------------------------------- /dmenu_edit/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | Use dmenu to open and edit a file from a given list. 4 | 5 | # Use 6 | 7 | Change the following global variables: 8 | 9 | * FILES=${1:-"/home/jared/code/dotfiles"} 10 | * DMENU='dmenu -l -i' 11 | * EDITOR='urxvtc -e vim' 12 | 13 | # [Source](https://bbs.archlinux.org/viewtopic.php?pid=1389440#p1389440) 14 | -------------------------------------------------------------------------------- /dmenu_edit/dmenu_edit: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # d-edit: Use dmenu to open and edit a file from a given list. 4 | 5 | # Global variables: 6 | FILES=${1:-"/home/jared/code/dotfiles"} 7 | DMENU='dmenu -l -i' 8 | EDITOR='urxvtc -e vim' 9 | # Show list of options 10 | choice=$(ls -a "${FILES}" | $DMENU -p "File to edit:") 11 | 12 | if [ $choice ]; then 13 | $EDITOR ${FILES}/${choice} 14 | fi 15 | -------------------------------------------------------------------------------- /dmenu_fm/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | A small file manager for dmenu. 4 | 5 | # [Source](https://bbs.archlinux.org/viewtopic.php?pid=1389530#p1389530) 6 | -------------------------------------------------------------------------------- /dmenu_fm/dmenu_fm: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | file=1 4 | while [ "$file" ]; do 5 | file=$(ls -1 --group-directories-first | /usr/bin/dmenu -l 10 -p "Blader: $(basename $(pwd))") 6 | if [ -e "$file" ]; then 7 | owd=$(pwd) 8 | if [ -d "$file" ]; then 9 | cd "$file" 10 | else [ -f "$file" ] 11 | if which xdg-open &> /dev/null; then 12 | exec xdg-open "$owd/$file" & 13 | unset file 14 | fi 15 | fi 16 | fi 17 | done 18 | -------------------------------------------------------------------------------- /dmenu_fmenu/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | A small bash-script for searching files in $HOME (or elsewhere) using dmenu. 4 | 5 | # Features 6 | 7 | * For performance, caches the file list and only updates the list if older than a predefined value (defaults to 5 minutes) 8 | * Exclude files (defaults to dot-files) 9 | * Select search directories (defaults to $HOME) 10 | 11 | # Example 12 | 13 | `$ ./fmenu -i /home/user -t +10` 14 | 15 | # Credits 16 | 17 | Thanks to isakkarlsson. The script can be found in his [Github repo](https://github.com/isakkarlsson/fmenu). 18 | 19 | 20 | -------------------------------------------------------------------------------- /dmenu_mpd/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | A feature-rich mpd script. 4 | 5 | # Features 6 | 7 | * Add/insert/replace album 8 | * Add/insert/replace track 9 | * Add Random album 10 | * Add X random tracks 11 | * Show current Playlist and select song to play 12 | * Add/insert/replae album/track by currently playing artist 13 | * Toggle various mpd settings (single, consume, repeat, random, replaygain, volume, outputs) 14 | * Lookup artist/album on allmusic.com (using surfraw) 15 | * search for lyrics of currently playing song (using surfraw) 16 | * enable/disable scrobbling ([lastfm script needed](http://git.53280.de/carnager/scripts/tree/lastfm)) 17 | * add/remove current artist to scrobbling blacklist ([lastfm script needed](http://git.53280.de/carnager/scripts/tree/lastfm)) 18 | 19 | # [Download](https://github.com/carnager/clerk) 20 | 21 | # Contribution 22 | 23 | Thanks to [Rasi](https://bbs.archlinux.org/viewtopic.php?pid=1384609#p1384609) 24 | -------------------------------------------------------------------------------- /dmenu_recent/README.md: -------------------------------------------------------------------------------- 1 | # dmenu_recent 2 | 3 | sh script to make dmenu keep a list of recent entries. Originally posted by mnzaki on the [Arch Linux Forums](https://bbs.archlinux.org/viewtopic.php?pid=1112966#p1112966). 4 | 5 | # Credits 6 | 7 | * [stelonix](https://gist.github.com/stelonix/6321841) 8 | * Dieter Plaetinck 9 | * Mina Nagy (mnzaki) 10 | -------------------------------------------------------------------------------- /dmenu_recent/dmenu_recent: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Originally based on code by Dieter Plaetinck. 4 | # Pretty much re-written by Mina Nagy (mnzaki) 5 | 6 | dmenu_cmd="dmenu $DMENU_OPTIONS" 7 | terminal="urxvtc -e" 8 | max_recent=199 # Number of recent commands to track 9 | 10 | cache_dir="${XDG_CACHE_HOME:-$HOME/.cache}/dmenu-recent" 11 | recent_cache="$cache_dir/recent" 12 | rest_cache="$cache_dir/all" 13 | known_types=" background terminal terminal_hold " 14 | 15 | config_dir="${XDG_CONFIG_HOME:-$HOME/.config}/dmenu-recent" 16 | mkdir -p "$cache_dir" 17 | mkdir -p "$config_dir" 18 | touch "$recent_cache" 19 | 20 | # Without this, it won't remember $type 21 | GREP_OPTIONS='--color=never' 22 | 23 | IFS=: 24 | if stest -dqr -n "$rest_cache" $PATH 2>/dev/null; then 25 | stest -flx $PATH | sort -u | grep -vf "$recent_cache" > "$rest_cache" 26 | fi 27 | 28 | IFS=" " 29 | cmd=$(cat "$recent_cache" "$rest_cache" | $dmenu_cmd -p Execute: "$@") || exit 30 | 31 | if ! grep -qx "$cmd" "$recent_cache" &> /dev/null; then 32 | grep -vx "$cmd" "$rest_cache" > "$rest_cache.$$" 33 | mv "$rest_cache.$$" "$rest_cache" 34 | fi 35 | 36 | echo "$cmd" > "$recent_cache.$$" 37 | grep -vx "$cmd" "$recent_cache" | head -n "$max_recent" >> "$recent_cache.$$" 38 | mv "$recent_cache.$$" "$recent_cache" 39 | 40 | # Figure out how to run the command based on the command name, disregarding 41 | # arguments, if any. 42 | word0=${cmd%% *} 43 | match="^$word0$" 44 | 45 | get_type () { 46 | while type=$(echo $known_types | xargs -n1 | $dmenu_cmd -p Type:); do 47 | [[ $known_types =~ " $type " ]] || continue 48 | echo "$word0" >> "$config_dir/$type" 49 | break 50 | done 51 | echo $type 52 | } 53 | 54 | if ! type=$(grep -lx "$match" -R "$config_dir"); then 55 | type=$(get_type) 56 | else 57 | type=${type##*/} 58 | if ! [[ $known_types =~ " $type " ]]; then 59 | rm "$config_dir/$type" 60 | type=$(get_type) 61 | fi 62 | fi 63 | 64 | [[ "$type" = "background" ]] && exec $cmd 65 | [[ "$type" = "terminal" ]] && exec $terminal "$cmd" 66 | [[ "$type" = "terminal_hold" ]] && 67 | exec $terminal sh -c "$cmd && echo Press Enter to kill me... && read line" -------------------------------------------------------------------------------- /dmenu_running_apps/README.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | List running applications and switch to the tag they are in. It depends on xdotool and dmenu. 4 | 5 | # [Source](https://bbs.archlinux.org/viewtopic.php?pid=1385575#p1385575) 6 | 7 | # Contribution 8 | 9 | Thanks to Army. 10 | -------------------------------------------------------------------------------- /dmenu_running_apps/dmenu_running_apps: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Search through open programs and switch to their tag 3 | application=$( 4 | # List all running programs 5 | xlsclients |\ 6 | # Fix Virtualbox and LibreOffice 7 | sed -e 's/.*VirtualBox/foobar virtualbox/g' -e 's/.*soffice/foobar libreoffice/g' |\ 8 | # Remove flash from results 9 | grep -v "plugin-container" |\ 10 | # Show only app-names 11 | cut -d" " -f3 |\ 12 | # Pipe to dmenu ($@ to include font settings from dwm/config.h) 13 | dmenu -i -p "Switch to" $@ 14 | ) 15 | 16 | # Switch to chosen application 17 | case $application in 18 | gimp | truecrypt) 19 | xdotool search --onlyvisible -classname "$application" windowactivate &> /dev/null 20 | ;; 21 | *) 22 | xdotool search ".*${application}.*" windowactivate &> /dev/null 23 | ;; 24 | esac 25 | -------------------------------------------------------------------------------- /dmenu_twich/README.md: -------------------------------------------------------------------------------- 1 | # [Stream twitch via livestreamer using dmenu for selection](https://github.com/Earnestly/dotfiles/blob/master/.local/bin/ditch) 2 | 3 | -------------------------------------------------------------------------------- /qmenu_hud/README.md: -------------------------------------------------------------------------------- 1 | # qmenu_hud 2 | 3 | a small menu search program, similar to Unity's HUD 4 | 5 | based on appmenu-runner, a krunner plugin for the same purpose 6 | 7 | Currently it just runs dmenu with the menu entries obtained from dbus. 8 | 9 | # [Read more](https://github.com/tetzank/qmenu_hud) 10 | --------------------------------------------------------------------------------