fullscreen fix and more features for applications-tab

This commit is contained in:
Yessiest 2023-05-21 14:33:49 +04:00
parent 230cac1891
commit 264032b182
2 changed files with 43 additions and 9 deletions

View File

@ -17,5 +17,8 @@ awful.rules.rules = gears.table.join(awful.rules.rules, {
c.minimized = true c.minimized = true
end) end)
end} end}
},
{ rule = { fullscreen = true },
properties = {placement = awful.placement.centered}
} }
}) })

View File

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