The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
2

menu in i3wm

asked 2012-10-31 21:38:43 +0000

tuna gravatar image

I mostly use dmenu or gmrun to open applications. Sometimes I'm missing the debian menu (or something similar) to view installed applications. For example sgt-puzzles installs a lot of games and I don't know all the names. Is there a way to get an auto-generated menu in i3wm?

edit retag flag offensive close merge delete

7 answers

Sort by ยป oldest newest most voted
5

answered 2013-07-06 23:12:53 +0000

joepd gravatar image

updated 2013-07-06 23:13:49 +0000

One answer is missing (quoting from man i3-dmenu-desktop):

i3-dmenu-desktop is a script which extracts the (localized) name from application .desktop files, offers the user a choice via dmenu(1) and then starts the chosen application via i3 (for startup notification support). The advantage of using .desktop files instead of dmenu_run(1) is that dmenu_run offers all binaries in your $PATH, including non-interactive utilities like sed. Also, .desktop files contain a proper name, information about whether the application runs in a terminal and whether it supports startup notifications.

See also this question.

edit flag offensive delete link more

Comments

Didn't know about that... awesome!

bruno.braga gravatar imagebruno.braga ( 2013-07-07 02:38:05 +0000 )edit
2

answered 2012-11-07 23:01:53 +0000

tuna gravatar image

After searching a lot I've also found gdmenu which can show the debian menu in a floating window. I'll stick to that for the moment.

edit flag offensive delete link more

Comments

Do you have a link for gdmenu?

ithcy gravatar imageithcy ( 2013-01-14 17:23:29 +0000 )edit

https://aur.archlinux.org/packages/gdmenu/

haobug gravatar imagehaobug ( 2015-05-10 01:58:37 +0000 )edit
1

answered 2013-07-06 20:34:12 +0000

Philippe gravatar image

I took adeskbar code to make rlmenu, bind it to a key and a menu similar to the debian menu will pop.

edit flag offensive delete link more

Comments

Looks very interesting! Can't get it to work though (Arch Linux, i3 & GNOME installed, i3 session). rlmenu.py gives me an AttributeError, and gmenu.lookup_tree('applications.menu') returns None. Are you running i3 as window manager for GNOME (i.e. with all its services up etc.)?

ack006 gravatar imageack006 ( 2013-07-13 19:22:27 +0000 )edit

In Arch, the menu file is at /etc/xdg/menus/gnome-applications.menu, perhaps you could make this configurable? Anyway, still no dice with the correct filename, still 'None' :-(

ack006 gravatar imageack006 ( 2013-07-13 19:28:14 +0000 )edit

Oomph. Since Arch has bleeding edge stuff all over, nothing barely uses python-gmenu, will need to port to g.i. all the way. If you dare, have a look at: http://searchcode.com/codesearch/raw/19113255 . That's too much for me on a humid hot Saturday night...

ack006 gravatar imageack006 ( 2013-07-13 21:23:06 +0000 )edit

Sorry, just noticed your messages. I had a hard time writing that provided how incomplete the documentation is, I'm not motivated either to port it to gi ^^

Philippe gravatar imagePhilippe ( 2013-08-28 21:37:35 +0000 )edit
0

answered 2013-05-16 20:40:44 +0000

matma6 gravatar image

You can use adeskmenu, but when it loses focus, it closes. On i3 moving mouse changes focus, so here is my solution:

  1. Go to empty workspace.
  2. Click on adeskmenu icon in tray.
  3. Move mouse into window.
  4. Make it floating (Shift+Mod+Space).
  5. Window disappears.
  6. Now, if you want use it, it will be fullscreen-sized (but floating)
edit flag offensive delete link more

Comments

Or you could just disable focus change on mouse move via focus\_follows\_mouse no in your config :-)

mschaefer gravatar imagemschaefer ( 2013-05-17 08:41:47 +0000 )edit

How exactly does the code tag work in the comment box? MeanEYE three above did it, I didn't get it working...

mschaefer gravatar imagemschaefer ( 2013-05-17 08:43:57 +0000 )edit

@mschaefer - but I like this feature

matma6 gravatar imagematma6 ( 2013-05-24 08:23:29 +0000 )edit

@mschaefer Use backquotes `

MeanEYE gravatar imageMeanEYE ( 2013-06-02 15:54:44 +0000 )edit
0

answered 2012-11-01 07:33:25 +0000

I have also looked for similar... especially because some of the applications I don't even remember their name, but I do know what they are about...

Synapse came as a good solution for me.

edit flag offensive delete link more

Comments

Thank you, Bruno. It's an option to use synapse, although it's not exactly what I was looking for. I hoped to get an auto-generated (debian) menu in the bar. Maybe by running dzen2 or fbpanel, but I can't get it right.

tuna gravatar imagetuna ( 2012-11-01 22:01:14 +0000 )edit

I had this problem of remembering what programs where for what till I used in terminal: man -k It's a keyword search of man -k so I want to see games I would do: man -k game

Marc gravatar imageMarc ( 2012-11-02 16:54:36 +0000 )edit

man -k is a cool trick (man man tells me it's equivalent to apropos).

tuna gravatar imagetuna ( 2012-11-03 23:32:57 +0000 )edit

Yeah. Nice one. Didn't know of that.

bruno.braga gravatar imagebruno.braga ( 2012-11-11 08:53:44 +0000 )edit
0

answered 2012-11-03 04:20:49 +0000

MeanEYE gravatar image

There are few ways to get what you need:

  • Use one of the available tools like Kumfer, GMRun, Launchy, etc;
  • Adapt dmenu to suite your needs.

Adapting dmenu

When you call dmenu_run, it's actually calling dmenu_path and piping it to dmenu itself. Which means you can pretty much pipe anything to dmenu. If you get an empty string (and different exit code) selection was canceled. Otherwise, you get a selected command.

You can write a script that would get information you would like to be presented with dmenu pipe it and wait for selection. This is a bit more complex than using one of the other launchers but it provides a lot of flexibility and further more I don't think there's anything lighter than dmenu.

For example, I have this script written:

#!/usr/bin/env python

import os
from subprocess import Popen, PIPE, STDOUT

# dmenu constants
DMENU_CACHE = os.path.expanduser('~/.dmenu_cache')
DMENU_COMMAND = [
            'dmenu', 
            '-p', 'command:',
            '-nb', '#151515',
            '-nf', '#888888',
            '-l', '10',
            '-fn', '-misc-fixed-medium-*-normal-*-14-*-*-*-*-*-*-*'
        ]

# our custom commands
commands = {
        'nautilus': 'nautilus --no-desktop'
    }

# check if local cache exists
if not os.path.exists(DMENU_CACHE):
    os.system('dmenu_path > /dev/null')

# load command cache and combine with our commands
with open(DMENU_CACHE, 'r') as raw_file:
    system_commands = raw_file.read()

output = commands.keys()
output.sort()

# create a process
process = Popen(DMENU_COMMAND, stdout=PIPE, stdin=PIPE, stderr=STDOUT)
selection = process.communicate(input='{0}\n{1}'.format('\n'.join(output), system_commands))[0]

# get command based on selection and execute it
if selection.strip() != '':
    command = commands[selection] if commands.has_key(selection) else selection
    os.system(command)

It uses dmenu cache generated by dmenu_path, but prioritizes items I've placed in commands dictionary. Also allows me to add custom commands I need.

edit flag offensive delete link more

Comments

Thanks for the suggestions. I was thinking of the dmenu option as well, as I use dmenu for many things already. Maybe I find some time to write a bash script for generating a file for dmenu, but I hoped such a thing was available

tuna gravatar imagetuna ( 2012-11-03 23:32:51 +0000 )edit

If you just want to get all installed applications Python's GIO bindings has function called `app_info_get_all`. Calling this will return all applications installed. So making a script should be fairly easy.

MeanEYE gravatar imageMeanEYE ( 2012-11-04 13:55:23 +0000 )edit
0

answered 2012-11-03 23:32:14 +0000

tuna gravatar image

Thanks for the suggestions. man -k is a cool trick (man man tells me it's equivalent to apropos). I was thinking of the dmenu option as well, as I use dmenu for many things already. Maybe I find some time to write a bash script for generating a file for dmenu, but I hoped such a thing was available already :)

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-10-31 21:38:43 +0000

Seen: 8,490 times

Last updated: Jul 06 '13