menugen -> freedesktop
This commit is contained in:
parent
aaf7681509
commit
148dfe1589
|
@ -1,3 +1,7 @@
|
||||||
[submodule "lain"]
|
[submodule "lain"]
|
||||||
path = lain
|
path = lain
|
||||||
url = git://github.com/copycat-killer/lain.git
|
url = git://github.com/copycat-killer/lain.git
|
||||||
|
|
||||||
|
[submodule "freedesktop"]
|
||||||
|
path = freedesktop
|
||||||
|
url = git://github.com/copycat-killer/awesome-freedesktop.git
|
||||||
|
|
2
lain
2
lain
|
@ -1 +1 @@
|
||||||
Subproject commit 0727ed40e37f8b4ea10fa0a976dcd31e13eea443
|
Subproject commit 98bb2dc5ef25ce2b2ad330bca7e78d77125e7c72
|
|
@ -1,60 +0,0 @@
|
||||||
---------------------------------------------------------------------------
|
|
||||||
-- @author Harvey Mittens
|
|
||||||
-- @copyright 2014 Harvey Mittens
|
|
||||||
-- @email teknocratdefunct@riseup.net
|
|
||||||
-- @release v3.5.5
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
local menu_gen = require("menubar.menu_gen")
|
|
||||||
local menu_utils = require("menubar.utils")
|
|
||||||
local pairs = pairs
|
|
||||||
local ipairs = ipairs
|
|
||||||
local table = table
|
|
||||||
local string = string
|
|
||||||
local next = next
|
|
||||||
|
|
||||||
module("menugen")
|
|
||||||
|
|
||||||
-- Built in menubar should be checking local applications directory
|
|
||||||
menu_gen.all_menu_dirs = { '/usr/share/applications/', '/usr/local/share/applications/', '~/.local/share/applications', '~/.nix-profile/share/applications' }
|
|
||||||
|
|
||||||
-- Expecting an wm_name of awesome omits too many applications and tools
|
|
||||||
menu_utils.wm_name = ""
|
|
||||||
|
|
||||||
-- Use MenuBar Parsing Utils to build StartMenu for Awesome
|
|
||||||
-- @return awful.menu compliant menu items tree
|
|
||||||
function build_menu()
|
|
||||||
local result = {}
|
|
||||||
local menulist = menu_gen.generate()
|
|
||||||
|
|
||||||
for k,v in pairs(menu_gen.all_categories) do
|
|
||||||
table.insert(result, {k, {}, v["icon"] } )
|
|
||||||
end
|
|
||||||
|
|
||||||
for k, v in ipairs(menulist) do
|
|
||||||
for _, cat in ipairs(result) do
|
|
||||||
if cat[1] == v["category"] then
|
|
||||||
table.insert( cat[2] , { v["name"], v["cmdline"], v["icon"] } )
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Cleanup Things a Bit
|
|
||||||
for k,v in ipairs(result) do
|
|
||||||
-- Remove Unused Categories
|
|
||||||
if not next(v[2]) then
|
|
||||||
table.remove(result, k)
|
|
||||||
else
|
|
||||||
--Sort entries Alphabetically (by Name)
|
|
||||||
table.sort(v[2], function (a,b) return string.byte(a[1]) < string.byte(b[1]) end)
|
|
||||||
-- Replace Catagory Name with nice name
|
|
||||||
v[1] = menu_gen.all_categories[v[1]].name
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Sort Categories Alphabetically Also
|
|
||||||
table.sort(result, function(a,b) return string.byte(a[1]) < string.byte(b[1]) end)
|
|
||||||
|
|
||||||
return result
|
|
||||||
end
|
|
|
@ -103,7 +103,7 @@ end
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- {{{ Menu
|
-- {{{ Menu
|
||||||
mymainmenu = awful.menu.new({ items = require("menugen").build_menu(),
|
mymainmenu = awful.menu.new({ items = require("freedesktop").menu.build(),
|
||||||
theme = { height = 16, width = 130 }})
|
theme = { height = 16, width = 130 }})
|
||||||
-- Menubar configuration
|
-- Menubar configuration
|
||||||
--menubar.utils.terminal = terminal -- Set the terminal for applications that require it
|
--menubar.utils.terminal = terminal -- Set the terminal for applications that require it
|
||||||
|
|
|
@ -114,7 +114,7 @@ end
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- {{{ Menu
|
-- {{{ Menu
|
||||||
mymainmenu = awful.menu.new({ items = require("menugen").build_menu(),
|
mymainmenu = awful.menu.new({ items = require("freedesktop").menu.build(),
|
||||||
theme = { height = 16, width = 130 }})
|
theme = { height = 16, width = 130 }})
|
||||||
-- Menubar configuration
|
-- Menubar configuration
|
||||||
--menubar.utils.terminal = terminal -- Set the terminal for applications that require it
|
--menubar.utils.terminal = terminal -- Set the terminal for applications that require it
|
||||||
|
|
|
@ -103,7 +103,7 @@ end
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- {{{ Menu
|
-- {{{ Menu
|
||||||
mymainmenu = awful.menu.new({ items = require("menugen").build_menu(),
|
mymainmenu = awful.menu.new({ items = require("freedesktop").menu.build(),
|
||||||
theme = { height = 16, width = 130 }})
|
theme = { height = 16, width = 130 }})
|
||||||
-- Menubar configuration
|
-- Menubar configuration
|
||||||
--menubar.utils.terminal = terminal -- Set the terminal for applications that require it
|
--menubar.utils.terminal = terminal -- Set the terminal for applications that require it
|
||||||
|
|
|
@ -104,7 +104,7 @@ end
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- {{{ Menu
|
-- {{{ Menu
|
||||||
mymainmenu = awful.menu.new({ items = require("menugen").build_menu(),
|
mymainmenu = awful.menu.new({ items = require("freedesktop").menu.build(),
|
||||||
theme = { height = 16, width = 130 }})
|
theme = { height = 16, width = 130 }})
|
||||||
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
|
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
|
||||||
menu = mymainmenu })
|
menu = mymainmenu })
|
||||||
|
|
|
@ -110,7 +110,7 @@ end
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- {{{ Menu
|
-- {{{ Menu
|
||||||
mymainmenu = awful.menu.new({ items = require("menugen").build_menu(),
|
mymainmenu = awful.menu.new({ items = require("freedesktop").menu.build(),
|
||||||
theme = { height = 16, width = 130 }})
|
theme = { height = 16, width = 130 }})
|
||||||
-- Menubar configuration
|
-- Menubar configuration
|
||||||
--menubar.utils.terminal = terminal -- Set the terminal for applications that require it
|
--menubar.utils.terminal = terminal -- Set the terminal for applications that require it
|
||||||
|
|
|
@ -107,7 +107,7 @@ end
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- {{{ Menu
|
-- {{{ Menu
|
||||||
mymainmenu = awful.menu.new({ items = require("menugen").build_menu(),
|
mymainmenu = awful.menu.new({ items = require("freedesktop").menu.build(),
|
||||||
theme = { height = 16, width = 130 }})
|
theme = { height = 16, width = 130 }})
|
||||||
-- Menubar configuration
|
-- Menubar configuration
|
||||||
--menubar.utils.terminal = terminal -- Set the terminal for applications that require it
|
--menubar.utils.terminal = terminal -- Set the terminal for applications that require it
|
||||||
|
|
|
@ -109,7 +109,7 @@ end
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- {{{ Menu
|
-- {{{ Menu
|
||||||
mymainmenu = awful.menu.new({ items = require("menugen").build_menu(),
|
mymainmenu = awful.menu.new({ items = require("freedesktop").menu.build(),
|
||||||
theme = { height = 16, width = 130 }})
|
theme = { height = 16, width = 130 }})
|
||||||
-- Menubar configuration
|
-- Menubar configuration
|
||||||
--menubar.utils.terminal = terminal -- Set the terminal for applications that require it
|
--menubar.utils.terminal = terminal -- Set the terminal for applications that require it
|
||||||
|
|
|
@ -108,7 +108,7 @@ end
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- {{{ Menu
|
-- {{{ Menu
|
||||||
mymainmenu = awful.menu.new({ items = require("menugen").build_menu(),
|
mymainmenu = awful.menu.new({ items = require("freedesktop").menu.build(),
|
||||||
theme = { height = 16, width = 130 }})
|
theme = { height = 16, width = 130 }})
|
||||||
-- Menubar configuration
|
-- Menubar configuration
|
||||||
--menubar.utils.terminal = terminal -- Set the terminal for applications that require it
|
--menubar.utils.terminal = terminal -- Set the terminal for applications that require it
|
||||||
|
|
Loading…
Reference in New Issue