Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Fix the layoutbox and systray #131

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions config/awesome/helpers/misc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,74 @@ function _misc.prompt(action, textbox, prompt, callback)
end
end

function _misc.dump(o, args)
args = args or {}
args.pretty = args.pretty or false
args.depth = args.depth or 0
args.max_depth = args.max_depth or -1
if args.max_depth > 0 and args.depth > args.max_depth then
return "..."
end
if type(o) == 'table' then
local s = '{ '
for k,v in pairs(o) do
s = s .. (args.pretty == true and "\n" or "")
if type(k) ~= 'number' then k = '"'..k..'"' end
s = s .. '['..k..'] = ' .. _misc.dump(v, args) .. ','
end
s = s .. (args.pretty == true and "\n" or "")
return s .. '} '
elseif type(o) == 'string' then
return '"'..o..'"'
else
return tostring(o)
end
end

function _misc.table_contains(table, elem, strify)
strify = strify or false
for _, val in pairs(table) do
if strify then
val = tostring(val)
end
if val == elem then
return true
end
end
return false
end

function _misc.table_contains_any(table, elems, strify)
strify = strify or false
for _, elem in pairs(elems) do
if _misc.table_contains(table, elem, strify) then
return true
end
end
return false
end

function _misc.table_contains_all(table, elems, strify)
strify = strify or false
for _, elem in pairs(elems) do
if not _misc.table_contains(table, elem, strify) then
return false
end
end
return true
end

function _misc.table_contains_only(table, elems, strify)
strify = strify or false
for _, val in pairs(table) do
if strify then
val = tostring(val)
end
if not _misc.table_contains(elems, val) then
return false
end
end
return true
end

return _misc
5 changes: 4 additions & 1 deletion config/awesome/ui/panels/top-panel/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ return function(s)
size = 18,
text = "",
on_turn_on = function(self)
mysystray:set_screen(awful.screen.focused())
system_tray_animation:set(400)
self:set_text("")
end,
Expand Down Expand Up @@ -229,7 +230,9 @@ return function(s)
end)
)

s.mylayoutbox = awful.widget.layoutbox()
s.mylayoutbox = awful.widget.layoutbox({
screen = s
})
s.mylayoutbox:buttons(layoutbox_buttons)

local widget = wbutton.elevated.state({
Expand Down
2 changes: 1 addition & 1 deletion config/awesome/ui/widgets/button/elevated.lua
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ function elevated_button.state(args)
end)

widget:connect_signal("button::press", function(self, lx, ly, button, mods, find_widgets_result)
if #mods > 0 then
if #mods > 0 and not helpers.misc.table_contains_only(mods, {"Lock", "Mod2",}) then
return
end

Expand Down