|
|
@ -3,6 +3,8 @@ local gears = require("gears") |
|
|
|
local awmtk2 = require("awmtk2") |
|
|
|
local wibox = require("wibox") |
|
|
|
local beautiful = require("beautiful") |
|
|
|
local pager_gen = require("pager") |
|
|
|
local asckey_context = require("asckey").context |
|
|
|
|
|
|
|
local icon = beautiful["applications-tab-symbolic"] |
|
|
|
|
|
|
@ -161,6 +163,37 @@ return function(args) |
|
|
|
sorting_method = "recent" |
|
|
|
end) |
|
|
|
local appgrid = widget:get_children_by_id("appgrid")[1] |
|
|
|
local pager = pager_gen(appgrid,{},args.rows*args.columns) |
|
|
|
local pager_context = asckey_context(gears.table.join( |
|
|
|
awful.key({},"Next",function() |
|
|
|
pager:next() |
|
|
|
end), |
|
|
|
awful.key({},"Prior",function() |
|
|
|
pager:prev() |
|
|
|
end), |
|
|
|
awful.key({},"Return",function() |
|
|
|
searchbox:emit_signal("button::press") |
|
|
|
end), |
|
|
|
awful.key({}," ",function() |
|
|
|
searchbox:emit_signal("button::press") |
|
|
|
end) |
|
|
|
)) |
|
|
|
supermenu:connect_signal("property::visible",function() |
|
|
|
if (not pager_context.active) and (supermenu.visible) then |
|
|
|
pager_context:activate() |
|
|
|
end |
|
|
|
if (pager_context.active) and (not supermenu.visible) then |
|
|
|
pager_context:deactivate() |
|
|
|
end |
|
|
|
end) |
|
|
|
local root = widget:get_children_by_id("root_ratio")[1] |
|
|
|
root:connect_signal("button::press",function(_,_,_,button) |
|
|
|
if button == 4 then |
|
|
|
pager:prev() |
|
|
|
elseif button == 5 then |
|
|
|
pager:next() |
|
|
|
end |
|
|
|
end) |
|
|
|
local icon_cache = gears.cache(function(icon,title,exec) |
|
|
|
local appicon = wibox.widget({ |
|
|
|
t.icon({ |
|
|
@ -177,7 +210,7 @@ return function(args) |
|
|
|
appicon:connect_signal("button::press",function(_,_,_,button) |
|
|
|
if button == 1 then |
|
|
|
supermenu.visible = false |
|
|
|
awful.spawn(exec) |
|
|
|
awful.spawn(exec:gsub("%%%w","")) |
|
|
|
end |
|
|
|
end) |
|
|
|
return appicon |
|
|
@ -190,19 +223,21 @@ return function(args) |
|
|
|
end |
|
|
|
end) |
|
|
|
searchbox:connect_signal("button::press",function() |
|
|
|
if prompt_open then return end |
|
|
|
prompt_open = true |
|
|
|
awful.prompt.run { |
|
|
|
textbox = searchtext, |
|
|
|
exe_callback = function(command) |
|
|
|
local results = xdg_search(command, args.rows*args.columns, sorting_method) |
|
|
|
appgrid:reset() |
|
|
|
pager.list = {} |
|
|
|
for _,v in pairs(results) do |
|
|
|
appgrid:add(icon_cache:get( |
|
|
|
table.insert(pager.list,icon_cache:get( |
|
|
|
v[2].icon or beautiful.icon_default, |
|
|
|
v[2].name, |
|
|
|
v[2].exec |
|
|
|
)) |
|
|
|
end |
|
|
|
pager:update() |
|
|
|
end, |
|
|
|
done_callback = function() |
|
|
|
prompt_open = false |
|
|
@ -211,13 +246,9 @@ return function(args) |
|
|
|
} |
|
|
|
end) |
|
|
|
awesome.connect_signal("xdg::all_finished",function() |
|
|
|
local count = 0 |
|
|
|
for _,v in pairs(xdg.apps) do |
|
|
|
count = count + 1 |
|
|
|
appgrid:add(icon_cache:get(v.icon or beautiful.icon_default,v.name,v.exec)) |
|
|
|
if count >= args.columns*args.rows then |
|
|
|
break |
|
|
|
end |
|
|
|
table.insert(pager.list,icon_cache:get(v.icon or beautiful.icon_default,v.name,v.exec)) |
|
|
|
pager:update() |
|
|
|
end |
|
|
|
end) |
|
|
|
return widget,icon |
|
|
|