From 34906469b9c2f91f6ebeccbbdbd88b442d778304 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Thu, 30 Apr 2026 00:47:59 -0700 Subject: [PATCH] hyprland: match Element scratchpad Wayland class --- dotfiles/config/hypr/hyprland.lua | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/dotfiles/config/hypr/hyprland.lua b/dotfiles/config/hypr/hyprland.lua index a77adbd9..5aaed885 100644 --- a/dotfiles/config/hypr/hyprland.lua +++ b/dotfiles/config/hypr/hyprland.lua @@ -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