You are not logged in.

#1 2011-08-31 12:25:33

rafunchi
Member
Registered: 2010-03-14
Posts: 16

slmenu - dmenu spinoff for the console

Hi,

I put together a dmenu(1) spinoff to use in the console. It takes input from stdin, reopens the tty, prints the UI to stderr, gets your input (again from stdin) and prints the result to stdout, so it mostly works as a drop-in replacement for dmenu. In fact, 90% of the code is dmenu's.

Stuff I don't use such as the multiline menu and runtime selectable colors is not implemented (yet?).

Should anyone be interested, the source is at
https://bitbucket.org/rafaelgg/slmenu/

And the AUR link
http://aur.archlinux.org/packages.php?ID=52017

Offline

#2 2011-08-31 22:31:36

Wintervenom
Member
Registered: 2008-08-20
Posts: 1,011

Re: slmenu - dmenu spinoff for the console

This is a great utility.  I've [already found a use for it].
Along the way, I think I may have found a bug that I'm not sure is actually a bug, but the [Home] and [End] keys aren't working as expected (URxvt), and, instead, print '~'.

Last edited by Wintervenom (2011-08-31 22:31:56)

Offline

#3 2011-08-31 22:35:43

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: slmenu - dmenu spinoff for the console

Wintervenom wrote:

the [Home] and [End] keys aren't working as expected (URxvt), and, instead, print '~'.

https://wiki.archlinux.org/index.php/Ho … ot_working ?

Offline

#4 2011-08-31 22:53:52

Wintervenom
Member
Registered: 2008-08-20
Posts: 1,011

Re: slmenu - dmenu spinoff for the console

karol wrote:
Wintervenom wrote:

the [Home] and [End] keys aren't working as expected (URxvt), and, instead, print '~'.

https://wiki.archlinux.org/index.php/Ho … ot_working ?

ArchWiki excerpt wrote:
URxvt*keysym.Home: \033[1~
URxvt*keysym.End: \033[4~

Thanks.

Offline

#5 2011-08-31 22:54:00

rafunchi
Member
Registered: 2010-03-14
Posts: 16

Re: slmenu - dmenu spinoff for the console

Wintervenom wrote:

Along the way, I think I may have found a bug that I'm not sure is actually a bug, but the [Home] and [End] keys aren't working as expected (URxvt), and, instead, print '~'.

I just fixed this (and the same problem for xterm) in hg tip with a couple of case lines. I assumed that since both TERM=linux and TERM=st-256colors worked, everything else would do too. This could be avoided by reading terminfo (via curses?), but I'm sure there are not that many cases.

About the inputrc fix, I'm not sure it applies here: slmenu does not link libreadline, and nor do any of the shells I use (dash for scripting, mksh for interactive use).

Thanks for the report, I'll keep an eye for keys not working on the main terminal emulators out there. I might even install konsole or gnome-terminal.

Offline

#6 2011-08-31 22:57:51

rafunchi
Member
Registered: 2010-03-14
Posts: 16

Re: slmenu - dmenu spinoff for the console

Eh! I didn't read that far. Of course you can redefine what URxvt sends as Home/End.... well, I'll keep the fix just in case.

Apologies for the noise,
Rafa.

Offline

#7 2011-09-01 13:25:43

Dieter@be
Forum Fellow
From: Belgium
Registered: 2006-11-05
Posts: 2,000
Website

Re: slmenu - dmenu spinoff for the console

FWIW, a similar program is kingbash (https://bbs.archlinux.org/viewtopic.php?id=101010) it's in python, runs in the console and has a dmenu mode.


< Daenyth> and he works prolifically
4 8 15 16 23 42

Offline

#8 2011-09-13 14:05:51

Dieter@be
Forum Fellow
From: Belgium
Registered: 2006-11-05
Posts: 2,000
Website

Re: slmenu - dmenu spinoff for the console

btw rafunchi, did you show this to the people on the suckless mailing list?
maybe it's worth considering/discussing making the matching stuff into a library so that dmenu and slmenu could share more code and only have the UI stuff separate.


< Daenyth> and he works prolifically
4 8 15 16 23 42

Offline

#9 2011-09-14 00:21:18

rafunchi
Member
Registered: 2010-03-14
Posts: 16

Re: slmenu - dmenu spinoff for the console

Dieter@be wrote:

btw rafunchi, did you show this to the people on the suckless mailing list?
maybe it's worth considering/discussing making the matching stuff into a library so that dmenu and slmenu could share more code and only have the UI stuff separate.

I did indeed, see http://lists.suckless.org/dev/1108/9239.html

Actually I thought of presenting slmenu as a patch to dmenu, maybe an alternative draw.c file. However, there's some X11 code in dmenu.c that I did not want to mess with. Also, key codes are processed differently in the console and in X. E.g. you can't bind an action to Shift-RET or Ctrl-RET in the console, because it *does* report the same as RET in most terminals. Finally, I removed stuff I don't use and that was mildly troublesome to port to the console such as the multi-line menu.

In the end I grew lazy and did my own slmenu.c file.

You are right: it would be cool to have slmenu and dmenu build from the same source, so you could patch and fix bugs without having to port the changes. If you feel up to it give it a try. Otherwise, I'll try and do it when I get some free time. I doubt it will be accepted by the suckless community tho sad

Offline

#10 2015-03-15 16:40:06

chickenPie4tea
Member
Registered: 2012-08-21
Posts: 309

Re: slmenu - dmenu spinoff for the console

Hi this is great but as I am a complete and utter dumbass I had not a clue how to use it until I found
https://inconsolation.wordpress.com/201 … -wizardry/


You can like linux without becoming a fanatic!

Offline

#11 2015-11-07 10:35:24

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: slmenu - dmenu spinoff for the console

Could someone advise how to create submenus (nested menus) with this tool without starting new program instances with different input files?

Last edited by nbd (2015-11-07 10:37:26)


bing different

Offline

#12 2015-11-08 10:12:06

Rasi
Member
From: Germany
Registered: 2007-08-14
Posts: 1,914
Website

Re: slmenu - dmenu spinoff for the console

nbd wrote:

Could someone advise how to create submenus (nested menus) with this tool without starting new program instances with different input files?

you can't


He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.

Douglas Adams

Offline

Board footer

Powered by FluxBB