Dmenu (advanced) - Dynamic Menu System

Stuff that has yet to be sorted into a category.
Message
Author
musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#41 Post by musher0 »

Hi!

Here is dmenu2, dated Nov. 2013. This version can be used
horizontally or vertically. It also has transparency, if you like, and some
new features.

Also included is my configuration in the dmenu_run launcher:

Code: Select all

#!/bin/sh
# dmenu_run
# Adapt. par musher0, 11 mars 2015
####
cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"}
if [ -d "$cachedir" ]; then
	cache=$cachedir/dmenu_run
else
	cache=$HOME/.dmenu_cache # if no xdg dir, fall back to dotfile in ~
fi
(
	IFS=:
	if stest -dqr -n "$cache" $PATH; then
		stest -flx $PATH | sort -u | tee "$cache" | dmenu -i -l 15 -p dmenu-wmx -t -name dmenu2-wmx -i -l 15 -p dmenu2-wmx -nb '#8B795E' -nf '#FFFFF0' -sb '#FFFFF0' -sf '#8B795E' -b -y 605 -x 515 -o 0.7 -h 24 -w 300 -fn 'Monaco-11:italic' "$@"
	else
		 dmenu -t -name dmenu2-wmx -i -l 15 -p dmenu2-wmx -nb '#8B795E' -nf '#FFFFF0' -sb '#FFFFF0' -sf '#8B795E' -b -y 605 -x 515 -o 0.7 -h 24 -w 300 -fn 'Monaco-11:italic' "$@" < "$cache"
	fi
) | ${SHELL:-"/bin/sh"} &

One (small) problem I encountered with that script was that I couldn't
make the dmenu parameters into a re-usable variable like you can for
urxvt, for example. I couldn't figure out why. It would have saved a few
bytes.

Another small annoyance was that the -y (yoffset) parameter didn't work.
I would have like dmenu to appear just below my conky one-liner.
(Edit, March 12. It does now. The trick is to insert the -b [bottom]
parameter as well as the -y parameter, and to calculate where you want
your dmenu to appear from the bottom. Calculating the y offset directly
from the top of the screen doesn't work.)


But it's minor stuff, it doesn't really matter, it works great even if you
have to type things twice.

The result is in the screen capture below. One thing I like about dmenu is
that when it has finished presenting the files that begin with the letters
you've input, it provides suggestions where the same letters are inside
the file name. That really helps when you can't remember exactly the
name of a file that you don't use that often.

If you search the web a bit, you'll find that some people at archlinux have
a thread for dmenu scripts. Apparently you can use dmenu to launch a lot
of things, including songs, which transforms dmenu into a juke box.

Enjoy!

musher0
Attachments
dmenu2-vertical-15h_on_wmx_2015-03-12.jpg
(16.85 KiB) Downloaded 1188 times
dmenu2-0.2.pet
(16.77 KiB) Downloaded 427 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

Post Reply