You are not logged in.

#1 2013-03-01 17:49:32

w201
Member
Registered: 2012-10-04
Posts: 289

[SOLVED] How to Add Items in the Awesome Menu?

I hate to ask, but I've gotta say I've read the manuals extensively, and can't figure out certain things in awesome... I want to purchase a lua programming manual to have around, but in the meantime... I'm hoping one of you guys can throw me a bone here and help me figure out this one thing...

I've added firefox to my awesome menu so now it's like awesome > open terminal > firefox. However, nothing happens when I select firefox, and here's my code:

-- {{{ Menu

-- Create a launcher widget and a main menu
myawesomemenu = {
   { "manual", terminal .. " -e man awesome" },
   { "edit config", editor_cmd .. " " .. awesome.conffile },
   { "restart", awesome.restart },
   { "quit", awesome.quit }
}

mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
                                { "open terminal", terminal },
                { "firefox", awful.util.getdir("config") .. "/firefox.png" }
                    }
            })
                       

mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
                                     menu = mymainmenu })

-- Menubar configuration
menubar.utils.terminal = terminal -- Set the terminal for applications that require it
-- }}}

Anyone know what I'm doing wrong?

Last edited by w201 (2013-03-02 04:49:11)

Offline

#2 2013-03-01 21:16:41

dcalacci
Member
From: Boston
Registered: 2013-03-01
Posts: 1

Re: [SOLVED] How to Add Items in the Awesome Menu?

The syntax for adding a menu item to awesome goes like this:

mywebmenu = {
  {" Chromium", "chromium-browser", beautiful.chromium_icon},
  {" Dropbox", "dropbox", beautiful.dropbox_icon}
}

or

mysettingsmenu = {
  {" WICD", "urxvt -x wicd-curses", beautiful.wicd_icon}
}

As you can see, the first item in the list is the name of the menu item, the second is the command to be run, and the third is the icon to be displayed. If there's no third field, no icon is displayed.

Your code for adding firefox to your menu will correctly show "firefox" as the menu name being displayed, since that's the first field you added, but will attempt to execute "awful.util.getdir("config") .. "/firefox.png"  when you click the menu item, since that's what you provided as the second argument. Since that's not an executable command, nothing happens.
Since the "awful.util..." bit seems to be you trying to get the proper icon for firefox, I suggest adding an element to the list between the two you already have that is just "firefox". This will ensure that when you click on "firefox" in your menu, the command that is run is "firefox", which should launch your browser.

Last edited by dcalacci (2013-03-01 21:21:01)


Dan Calacci

Offline

#3 2013-03-02 03:27:00

w201
Member
Registered: 2012-10-04
Posts: 289

Re: [SOLVED] How to Add Items in the Awesome Menu?

Hey, thanks for putting that into perspective. I tried your suggestion so that my code now looks like this:

{ "firefox", "firefox", awful.util.getdir("config") .. "/firefox.png" }

The above just removes firefox from the menu options. I also tried:

{ "firefox", firefox }

so it would be essentially firefox without the icon. With the above configuration I get firefox back but again, nothing happens. I'm thinking firefox is the wrong command. When I first started using linux I remember having to enter firefox& from the CLI to run firefox, so I tried that with no luck. Any ideas?

Last edited by w201 (2013-03-02 03:30:01)

Offline

#4 2013-03-02 04:21:57

cookies
Member
Registered: 2013-01-17
Posts: 253

Re: [SOLVED] How to Add Items in the Awesome Menu?

w201 wrote:

I also tried:

{ "firefox", firefox }

so it would be essentially firefox without the icon. With the above configuration I get firefox back but again, nothing happens. I'm thinking firefox is the wrong command.

firefox is the right command, you just need to quote it (just like the menu entry)! Without the quotes awesome searches for some undefined variable, obviously can't it and does nothing.

As for the icon, try using the explicit path and see if that works.

Offline

#5 2013-03-02 04:48:44

w201
Member
Registered: 2012-10-04
Posts: 289

Re: [SOLVED] How to Add Items in the Awesome Menu?

cookies wrote:

firefox is the right command, you just need to quote it (just like the menu entry)!

That did it. Thanks man! It's so easy once you understand the syntax.

Last edited by w201 (2013-03-02 04:58:12)

Offline

Board footer

Powered by FluxBB