WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [INFO] dmenu -dynamic menu launcher for X some info  (Read 2878 times)

aus9

  • Guest
[INFO] dmenu -dynamic menu launcher for X some info
« on: August 05, 2018, 06:03:28 AM »
My local login name is tc in examples below. I have no plans to submit a 32 bit package so unable to create a wiki page
I include links to some screenshots taken by hand held camera. I can not type screenshot.sh while menu is active.

What is it?
dmenu is a tool that searches your PATH or executables against your keyboard input and displays hits for you to choose from.

The first entry by default is highlighted, so if you press Enter, dmenu will attempt to launch that executable
and the menu will disappear. You can type more letters or use arrow keys to change the highlighted item.

You may see this inside your terminal
Code: [Select]
dmenu_run
tc@box:~$ /home/tc/.cache/dmenu_run: No such file or directory

https://imgur.com/a/xGmDWkJ

This is informational as "/home/tc/.cache/dmenu_run" is not created until you run dmenu.
If you run dmenu_run a second time, this session you will not see that info again.

dmenu can be used with wbar running.....but it works well without it. It is not designed to
replace wbar. wbar can launch desktop entries that are displayed, while dmenu launches more.

There is nothing stopping you from not loading wbar or dmenu and knowing how a command is spelt,
type the beginning of that command and use the TAB key to auto-complete the command and
then press Enter key to launch it.

Search results
It is not a fuzzy search but an exact search for keyboard input. Some examples follow:
input "le"  hits will show multiple hits starting with the left hit hightlighted against leafpad
and list is in spell order hits including locale and sleep. Second image with my monitor
so wide....is not showing the left hand hits.

https://imgur.com/a/noWiFm3
https://imgur.com/a/uLGLYjm

Obviously if you input more letters you get fewer results or no results. eg
leaf gives me only one hit for leafpad

top or bottom display
Code: [Select]
$ dmenu_rundefaults to menu showing at top of monitor
Code: [Select]
$ dmenu_run -b displays menu at botton of monitor
https://imgur.com/a/Fv4Ma19

Horizontal or vertical display of hits
The default behaviour is for hits to show on one line, horizontally. The number of hits may be so
large you might have to use navigation keys to scroll thru list. You can change that to
Code: [Select]
$ dmenu_run -l <number of lines> 
eg
Code: [Select]
dmenu_run -l 20https://imgur.com/a/J3z3DIW

In this example it does not matter that your opened terminal is covered up, partially or completely.
When you launch something like a terminal command eg ls, dmenu closes and launches the ls command
inside your terminal.

Use arrow keys to navigate
If you are not sure the exact spelling of a command, you can use left or right arrows keys to scroll horizontal menu. Or up or down arrows for vertical menu. Obvously if you know more of the spelling input more letters to reduce hits displayed.

keyboard is controlled by active dmenu
Be aware that while the menu is displayed on the monitor, dmenu thinks all input is meant for dmenu and attempts to search for those keyboard inputs. If you use a mouse to open another terminal, it is useless until you either press Escape key to exit dmenu or press Enter key to launch a highlighted selection, in the menu

press Enter after successful launch
If I launch a command like ls....dmenu closes and outputs ls results in the terminal
But for me, I have to press Enter key to get back an input prompt. YMMV
https://imgur.com/a/yirmvIy

read the man page please
If after your initial tests, you feel this might be an useful tool, I suggest you read the man page.

Keyboard combos
After reading the man page you will know various keyboard combinations. Let me reveal one. Say in your web browser, you read about a command worth investigating...eg dmesg So copy that term into your clipboard. Then when you run dmenu_run use kb combo of Ctrl (AND) y to paste directly into search input area.

Actually you have 2 clipboards. Lets pretend you have something in your terminal so you highlight selection with your mouse. So depending what is in your clipboard either Ctrl Shift y .....or Ctrl y will paste the correct terms.

Font stuff
I sometimes forget to wear my googles, so prefer to increase font size. man page to the rescue? But as we TC users, better still I use a .local/bin script to do this like a wrapper script. Naturally you have to have a font TCZ loaded. Try out some fonts and sizes eg
Code: [Select]
dmenu_run -fn DejaVuSans-18
Suggest you use LOCAL BIN to save typing etc
Create a local bin file to save above that as a shortcut command, first use dmenu to see if you can use rare letters like jj

Code: [Select]
echo '#!/bin/sh
dmenu_run -fn DejaVuSans-18' > /home/tc/.local/bin/jj
chmod +x /home/tc/.local/bin/jj

and to test it
Code: [Select]
jjhttps://imgur.com/a/p1zIkko

Of course you might add -b or other options to your local bin file.

There is nothing stopping you from using your command history and pressing the up arrow a number of times
to find your preferred command.

Hope that helps
« Last Edit: August 05, 2018, 06:11:42 AM by aus9 »

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: [INFO] dmenu -dynamic menu launcher for X some info
« Reply #1 on: August 10, 2018, 11:47:55 AM »
Maybe you like this approach to load extensions via dmenu.
http://forum.tinycorelinux.net/index.php/topic,6781.msg121978.html#msg121978
Download a copy and keep it handy: Core book ;)

aus9

  • Guest
Re: [INFO] dmenu -dynamic menu launcher for X some info
« Reply #2 on: August 10, 2018, 05:36:46 PM »
Hi

I think you mistake me for a real coder but appreciate the thought.

slightly offtopic, when I was building sway....it was only then that I saw it mentioned dmenu, which I had not been aware of in the past AFAIK.

secondly, some of the suggestions especially coreplayer2 appear to relate to speed and you appear to load heaps of TCZs while I do not.

thirdly there is another menu app that claims to be 25 times faster than dmenu which is
https://github.com/enkore/j4-dmenu-desktop.

and it appears j4-dmenu appears to search only desktops files?

cheers