hyprland: match Element scratchpad Wayland class

This commit is contained in:
2026-04-30 00:47:59 -07:00
parent 3cb0301f9a
commit 34906469b9

View File

@@ -43,7 +43,8 @@ local scratchpads = {
},
element = {
command = "element-desktop",
class = "Element",
classes = { "Element", "electron" },
title = "Element",
},
slack = {
command = "slack",
@@ -261,9 +262,22 @@ local function lower_contains(value, needle)
return value:find(needle, 1, true) ~= nil
end
local function lower_contains_any(value, needles)
if type(needles) ~= "table" then
return lower_contains(value, needles)
end
for _, needle in ipairs(needles) do
if lower_contains(value, needle) then
return true
end
end
return false
end
local function scratchpad_window_matches(window, def)
return window
and lower_contains(window.class, def.class)
and lower_contains_any(window.class, def.classes or def.class)
and lower_contains(window.title, def.title)
end