PDA

View Full Version : [SOLVED] [lua] AwesomeWM cpu-widget doesnt start 'htop' when clicked



sea
5th February 2016, 07:54 PM
Hello

As the title says, and i do not know why.
These i have tried:

cpuwidget:buttons(awful.util.table.join(
-- Since the right mouse button starts a sub application, i dont test with this, but with the left mouse button

awful.button({ }, 2 , function() os.execute("tui-terminal 'tui-asroot htop'" )end), -- Error start (invisible) & freeze

-- None of these will work as expected, start a terminal command and htop running in there...

awful.button({ }, 1 , function() os.execute("tui-terminal \"htop -u $USER\"")end) -- Error start (invisible) & freeze
-- awful.button({ }, 1 , function() os.execute("tui-terminal \"htop -u $USER\"") end) -- Error start (invisible) & freeze
-- awful.button({ }, 1 , function() os.execute("tui-terminal htop -u $USER") end) -- Error start (invisible) & freeze
-- awful.button({ }, 1 , function() os.execute("tui-terminal htop") end) -- Error start (invisible) & freeze
-- awful.button({ }, 1 , function() os.execute("lxterminal -e \"htop\"") end) -- Error start (invisible) & freeze
-- awful.button({ }, 1 , function() os.execute("lxterminal -e htop") end) -- Error start (invisible) & freeze
-- awful.button({ }, 1 , function() os.execute("lxterminal htop") end) -- Error - no error but no start either
-- awful.button({ }, 1 , function() os.execute("lxterminal \"htop\"") end) -- Error - no error but no start either
-- awful.button({ }, 1 , function() os.execute(term_cmd .. " htop") end) -- Error start (invisible) & freeze
-- awful.button({ }, 1 , function() term_cmd .. " htop" end) -- Error loading at ..
-- awful.button({ }, 1 , function() "tui-terminal htop" ) -- Error loading at "tui-terminal ...." )
-- awful.button({ }, 1 , "tui-terminal \"htop -u $USER\"" ) -- Error loading at "tui-terminal ...." )
-- awful.button({ }, 1 , "tui-terminal htop" ) -- Error at click ("upvalue 'pres')
-- awful.button({ }, 1 , term_cmd .. " htop" ) -- Error loading at ..
-- awful.button({ }, 1 , os.execute(term_cmd .. " htop" )) -- Error freeze at reload
-- awful.button({ }, 1 , "tui-terminal htop") -- -u $USER\"" end ) -- Error at click ("upvalue 'pres')

))

However, these 2 work as expected (colored lines):

mpdwidget:buttons(awful.util.table.join(
awful.button({ },1,function() os.execute("mpc volume +25") end),
awful.button({ },2,function() os.execute("tui-filemgr " .. DIR_HOME .. "/mm/snds" ) end),
awful.button({ },3,function() os.execute("mpc volume -25") end),
awful.button({ },4,function() os.execute("mpc volume +5") end),
awful.button({ },5,function() os.execute("mpc volume -5") end)
))

menusystem = {
{ "Date & Time", "system-config-date" },
-- { "Firewall", "system-config-firewall" },
{ "Keyboard", "system-config-keyboard" },
{ "Language", "system-config-language" },
{ "Partitions", "gnome-disk-utility" },
-- { "Users", "system-config-users" },
{ "Screensaver", "xscreensaver-demo" },
-- { "services-config", "system-config-services" },
{ "Task Manager", "tui-terminal htop" },
--{ "Wireless", "wicd-curses" },
{ "Networks", "connect setup" },
-- { "Yum Extender", "yumex" }
}
And yes, when i type:

tui-terminal "htop -u $USER"
It starts a new terminal window with htop running in there, it does work as well when i click on the "Task Manager" menu entry, and to my eyes, the (mouse-)key-bindings of the mpd and cpu widget look the same.
Also note, 'term_cmd' is set to 'lxterminal -e ' within the same file, but doesnt seem to be reckognized.

Any idea what I am missing here?
Thank you in advance

sea
5th February 2016, 08:03 PM
Well, got buttons working, seems i had too few (missing) spaces for both of them... :doh:

awful.button({ }, 1 , function() os.execute("tui-terminal \"htop -u " .. USER .. "\"") end)
awful.button({ }, 3 , function() os.execute("tui-terminal 'tui-asroot htop'" ) end ),

Have a great weekend :)