Dmenu (advanced) - Dynamic Menu System

Stuff that has yet to be sorted into a category.
Message
Author
aragon
Posts: 1698
Joined: Mon 15 Oct 2007, 12:18
Location: Germany

Dmenu (advanced) - Dynamic Menu System

#1 Post by aragon »

Home: http://tools.suckless.org/dmenu
Version: 4.0
dynamic menu is a generic menu for X, originally designed for dwm. It manages huge amounts (up to 10,000 and more) of user defined menu items efficiently.
Dmenu parses your apps-path and presents the found applications as a menu. Downside is, that it launches (by default) every app directly, so if you got a cli-app, it will be launched, but somewhere out there, not visible.

So i've added two alternative starter (dmenu_run is the std)
1. dmenu_termrun: runs everything in a rxvt-window
2. dmenu_roxrun: gives you a menu with all *.desktop-files in /usr/share/applications and /usr/local/share/application

To use dmenu, you should add keyboard-shortcuts to your wm-config.As an example you could add the following to your /root/.jwm/jwmrc_personal

Code: Select all

<Key mask="C" key="F5">exec:dmenu_roxrun</Key>
<Key mask="C" key="F6">exec:dmenu_run</Key>
<Key mask="C" key="F7">exec:dmenu_termrun</Key>
To use dmenu_roxrun, you will first have to run /root/Startup/00_dmenudeskupdate. This script will later run on every startup to build/renew the symlinks that the dmenu_roxrun-script is based on.

usage is simple: you launch dmenu and type in some characters of the application, you're looking for (or simple browse the list with the left/right button). to launch the (found) app, simply press return.

It's not that clear (i know black on black...), dmenu is the upper bar and my input was screen and roxrun found the shown apps.

EDIT 2009-11-11: Due to some posts in this thread, i've searched for some patches for dmenu (thanks to jemimah and amigo).
I was able to apply xft, vertical, history and dockapp patches.

Used patches:
1. vertical+xft: http://aur.archlinux.org/packages.php?ID=27334
2. history (applied by hand): http://www.murga-linux.com/puppy/viewto ... 070#349070
3. dockapp (applied by hand): http://www.murga-linux.com/puppy/viewto ... 070#349070

You'll now find attached the patched source, a diff (orig. source to full patched version) and an additional pet with the new 'dmenu-base'.
Settings are (nearly) the same as before. You'll find a help-file at /usr/share/doc (also containing the new abilities). If you want to change the settings, you'll have to modify the starter-apps

Code: Select all

/usr/bin/dmenu_run 
/usr/bin/dmenu_roxrun
/usr/bin/dmenu_termrun
aragon
Attachments
dmenu-4.0-vxhd-patches_seperate.tar.gz
all patches in seperate patch-files
(8.36 KiB) Downloaded 848 times
dmenu-vxhd-4.0.pet
(12.83 KiB) Downloaded 962 times
dmenu-4.0-vxhd.patch.gz
all patches in one patch file
(7.76 KiB) Downloaded 792 times
dmenu-vxhd-src-4.0.tar.gz
(11.32 KiB) Downloaded 793 times
dmenu.png
(30.16 KiB) Downloaded 5190 times
dmenu-advanced-4.0.pet
contains the standard-dmenu
(9.43 KiB) Downloaded 915 times
Last edited by aragon on Fri 13 Nov 2009, 15:15, edited 4 times in total.

User avatar
trapster
Posts: 2117
Joined: Mon 28 Nov 2005, 23:14
Location: Maine, USA
Contact:

#2 Post by trapster »

Good timing with this. I've been playing with dwm for the past week.

But...

Code: Select all

05:18 PM ~ # dmenu_run
/usr/bin/dmenu_path: line 17: cd: /root/bin: No such file or directory
Ok, seems I onlt got that message the first run.
Seems good now, app starts when chosen but then the menu dies.
trapster
Maine, USA

Asus eeepc 1005HA PU1X-BK
Frugal install: Slacko
Currently using full install: DebianDog

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#3 Post by jemimah »


seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#4 Post by seaside »

aragon,

Thanks for posting this. I played around with Dmenu a bit and was going to post a pet at some point and didn't get around to it - (I got sidetracked trying to get Launchy to work on puppy) :D

Anyway, your implementation is much better by using links to .desktop files. Nice idea.

There are many ways to use Dmenu other than running programs. As a file selector for other programs you can do this

Code: Select all

 #!/bin/bash
DIR=whateverdirhasfiles
DMENU_ARGS="-b"

FILE=`ls $DIR | /usr/bin/dmenu ${DMENU_ARGS}`

if [ -f ${DIR}/${FILE} ]; then
  DO SOMETHING HERE WITH THE SELECTED $FILE
fi
trapster,

Yes, the cache has to be filled before it works and I think that Dmenu leaves by default.

How do you like DWM? I tried it and liked it but for some reason it doesn't keep me there. :D

jemimah,

That's an interesting discussion on WM's. I'll definitely have to try out that one.

Cheers,
s

aragon
Posts: 1698
Joined: Mon 15 Oct 2007, 12:18
Location: Germany

#5 Post by aragon »

@trapster
i think this just happens if a path in PATH does not exist. but it's uncritical.

and yes dmenu 'dies' after command execution, what is positive in my opinion.

@jemimah
will look at the vertical later. thanks for the link.

@seaside
yes, dmenu is kind of swiss army knife for opening/starting things. i do like it very much. i've posted a kind of 'base-version'. i'm also using the awesome-windowmanager that has dmenu 'inbuild'. there i use the functionality to also have a Favourites-Menu and a Places-Menu.

I think you could realize everything for what you have a list (with cat) or a folder (with ls) and for that you are able to define a starter.

aragon

ragaman
Posts: 186
Joined: Sun 14 Jan 2007, 12:55

#6 Post by ragaman »

Does this work the same way as GNOME-DO? If so, thanks a million. I've been waiting for a Puppy version (light) of the said utility.

User avatar
trapster
Posts: 2117
Joined: Mon 28 Nov 2005, 23:14
Location: Maine, USA
Contact:

#7 Post by trapster »

Is there any way to keep it running after a selection is made?
I have been using MU's GtkBasic-Panel which is nice because you can minimize it when it gets in the way.
trapster
Maine, USA

Asus eeepc 1005HA PU1X-BK
Frugal install: Slacko
Currently using full install: DebianDog

aragon
Posts: 1698
Joined: Mon 15 Oct 2007, 12:18
Location: Germany

#8 Post by aragon »

@ragaman
on a very basic-level: yes i think so... but i think with gnome-do you could also search in dokuments and such things. you might be able to do something similar with dmenu, but this is not implemented in my package.

@trapster
Is there any way to keep it running after a selection is made?
not that i know. but allow me a counterquestion: what would be the benefit? it's not running if you don't need it and if you need it, you launch it with a shortcut. as i see it, you won't have it quicker or simpler 'present' if it would run all the time?

please give me the missing link ;-)

aragon

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#9 Post by amigo »

There's a patch which adds support for Xft (anti-aliased fonts) here:
http://www.rootshell.be/~polachok/code/ ... 4-xft.diff

Somewhere I have some other patches for it, but I can't find them right now. They come from deli linux which uses dmenu extensively.

aragon
Posts: 1698
Joined: Mon 15 Oct 2007, 12:18
Location: Germany

#10 Post by aragon »

@amigo
found some different xft-patches for dmenu-4.0

http://aur.archlinux.org/packages.php?ID=28745&detail=1
http://lists.suckless.org/dwm/0905/8236.html

and will try to add one of them.

there are some other in aur for vertical and history? will look at them also.

aragon

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#11 Post by amigo »

Ah yes, thanks for the tip -I found lots of goodies there (starting)on aur -even a dmenu-based file-manager.
dmenu is alos in debian, so I am looking at that to see if there are any critical patches.

aragon
Posts: 1698
Joined: Mon 15 Oct 2007, 12:18
Location: Germany

#12 Post by aragon »

The first post now also has a package with a patched dmenu (amongst others vertical usage).

@ amigo
i've tried to patch with the vertical-patch AND the xft-patch, but that gave errors, so i decided to only use the vertical as this seems to be more 'usefull' to me.

but one question: is there a way to merge patches (to not have to do it by hand)?
even a dmenu-based file-manager
i've just tested dmenfm, it works but to me it looks more like a gimmick (i hope the arch-guys will forgive me...)

aragon

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#13 Post by amigo »

"is there a way to merge patches (to not have to do it by hand)?" -Actually, some Revision Control Systems can do this, but I always work them out by hand -one at a time. It's a good way to go along reading lots of code, in order to understand lots -I mean more code...

But, I've saved you a bit of work by working out these:
dmenu-xft.diff
dmenu-xft-add-vertical.diff
dmenu-xft-vertical-add-history.diff
dmenu-4.0-DockApp.diff

Apply them in that order. There's a couple of more that I'm eyeing, but I'm busy creating patch sets for WindowMaker for over 65 bug-fixes. I'm creating a canonical tree for posterity since the original maintainers have quit and the new maintainer won't do anything. I've still got a few bug fix patches to 're-diff' and then I move onto the added feature patches for a more adventurous branch. I'm too old to set down and study code by the hour -but I can while away lots of time and still learn a little by working this way.

The dockapp patch may not do anything, depending on what WM you use. There are several version of the vertical patch(es) which mix/match the opitions available. When I get around to it, I'll get them all together and re-order them so it looks better. There's also a couple of forks or replacements on AUR - fmenu and awmenu which is a gtk runbox -I guess with dmenu guts.
Attachments
dmenu-4.0-DockApp.diff.gz
(329 Bytes) Downloaded 787 times
dmenu-xft-vertical-add-history.diff.gz
(1.55 KiB) Downloaded 784 times
dmenu-xft-add-vertical.diff.gz
(2.19 KiB) Downloaded 777 times
dmenu-4.0-xft.diff.gz
(2.46 KiB) Downloaded 792 times

aragon
Posts: 1698
Joined: Mon 15 Oct 2007, 12:18
Location: Germany

#14 Post by aragon »

amigo,

all i can say is whow! will go through the patches soon.

yes there are some forks fmenu for instance is just dmenu-4.0 with a vertical patch applied.

i greatly appreciate your work. i'm not competent in diff and patch.

thanks aragon

p.s. good luck with your windowmaker-project.

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#15 Post by jemimah »

So I had a brilliant idea yesterday. Wouldn't it be sweet if Dmenu could show application icons like Launchy and Gnome-Do? Well a streak of genius hit me and now it can! Well sort of...

Here's what you do: first modify dmenu so that instead of just returning a value when you hit enter, make it return a value every time the selection changes. Then pipe said output through a shell script that figures out which icon to use. Then you can use a program called xteddy to display a nifty shaped icon in the middle of the screen. When the selection changes, kill the old xteddy and open a new one with the new icon.

The only bummer is that most of the icons on puppy are a tiny size. I want to release this launcher with when I release Fluppy, but replacing all the tiny ugly icons is a daunting task.
Attachments
dmenu-icons.jpg
(65.03 KiB) Downloaded 989 times

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#16 Post by seaside »

jemimah,

Clever idea - is that a working snapshot?

Another thought - add an input box under the icon where you can add parameters and presto - a Gnome-do - Launchy clone. :D

Cheers,
s

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#17 Post by jemimah »

It's a working prototype that's currently too buggy to actually use. Tying the input box with the icon is the real problem. The correct way to do it would be to actually code the whole thing in C. But then that would take a great deal of effort.

Did you have any luck with Launchy, seaside? I was unable to get it to link with puppy system qt libraries. I copied Launchy binaries from Ubuntu successfully, but it was unstable and wouldn't actually launch anything.

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#18 Post by seaside »

jemimah,

Yes I did get Launchy working, made a pet and it's here-

http://www.murga-linux.com/puppy/viewto ... 5bec4cd0d7

Might be easier to just use Launchy - (about 6m with libs) :D

Cheers,
s

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#19 Post by jemimah »

That's great! Do you know why the qt from the repo won't work? I have other qt programs and I'd rather not have multiple versions of the same qt libs.

aragon
Posts: 1698
Joined: Mon 15 Oct 2007, 12:18
Location: Germany

#20 Post by aragon »

hi jemimah,

nice idea, especially for your planned puplet. personally i do like the 'blingless' standard more.

actually i've patched dmenu once again with the patchset kindly provided by amigo. i'm now testing it and will soon upload the new patched dmenu.

aragon

Post Reply