Extract more helpers

This commit is contained in:
David Heinemeier Hansson
2026-05-14 12:51:03 +02:00
parent 6840242c44
commit 84de3d3a2e
22 changed files with 90 additions and 106 deletions
+1 -1
View File
@@ -21,4 +21,4 @@ require("hypr.autostart")
require("default.hypr.toggles")
-- Add any other personal Hyprland configuration below.
-- hl.window_rule({ match = { class = "qemu" }, workspace = "5" })
-- o.window("qemu", { workspace = "5" })
+2 -2
View File
@@ -43,8 +43,8 @@ hl.config({
})
-- Scroll nicely in the terminal.
hl.window_rule({ match = { class = "(Alacritty|kitty|foot)" }, scroll_touchpad = 1.5 })
hl.window_rule({ match = { class = "com.mitchellh.ghostty" }, scroll_touchpad = 0.2 })
o.window("(Alacritty|kitty|foot)", { scroll_touchpad = 1.5 })
o.window("com.mitchellh.ghostty", { scroll_touchpad = 0.2 })
-- Enable touchpad gestures for changing workspaces.
-- See https://wiki.hypr.land/Configuring/Advanced-and-Cool/Gestures/
+1 -2
View File
@@ -1,2 +1 @@
hl.window_rule({ match = { class = "^(1[p|P]assword)$" }, no_screen_share = true })
hl.window_rule({ match = { class = "^(1[p|P]assword)$" }, tag = "+floating-window" })
o.window("^(1[p|P]assword)$", { no_screen_share = true, tag = "+floating-window" })
+5 -5
View File
@@ -1,6 +1,6 @@
hl.window_rule({ match = { class = "^(Bitwarden)$" }, no_screen_share = true })
hl.window_rule({ match = { class = "^(Bitwarden)$" }, tag = "+floating-window" })
o.window("^(Bitwarden)$", { no_screen_share = true, tag = "+floating-window" })
-- Bitwarden Chrome Extension.
hl.window_rule({ match = { class = "chrome-nngceckbapebfimnlniiiahkandclblb-Default" }, no_screen_share = true })
hl.window_rule({ match = { class = "chrome-nngceckbapebfimnlniiiahkandclblb-Default" }, tag = "+floating-window" })
o.window("chrome-nngceckbapebfimnlniiiahkandclblb-Default", {
no_screen_share = true,
tag = "+floating-window",
})
+9 -16
View File
@@ -1,19 +1,12 @@
-- Browser types.
hl.window_rule({ match = { class = "((google-)?[cC]hrom(e|ium)|[bB]rave-browser|[mM]icrosoft-edge|Vivaldi-stable|helium)" }, tag = "+chromium-based-browser" })
hl.window_rule({ match = { class = "([fF]irefox|zen|librewolf)" }, tag = "+firefox-based-browser" })
hl.window_rule({ match = { tag = "chromium-based-browser" }, tag = "-default-opacity" })
hl.window_rule({ match = { tag = "firefox-based-browser" }, tag = "-default-opacity" })
-- Browser tags and styling.
o.window("((google-)?[cC]hrom(e|ium)|[bB]rave-browser|[mM]icrosoft-edge|Vivaldi-stable|helium)", { tag = "+chromium-based-browser" })
o.window("([fF]irefox|zen|librewolf)", { tag = "+firefox-based-browser" })
o.window({ tag = "chromium-based-browser" }, { tag = "-default-opacity", tile = true, opacity = "1.0 0.97" })
o.window({ tag = "firefox-based-browser" }, { tag = "-default-opacity", opacity = "1.0 0.97" })
-- Video apps: remove chromium browser tag so they don't get opacity applied.
hl.window_rule({ match = { class = "(chrome-youtube.com__-Default|chrome-app.zoom.us__wc_home-Default)" }, tag = "-chromium-based-browser" })
hl.window_rule({ match = { class = "(chrome-youtube.com__-Default|chrome-app.zoom.us__wc_home-Default)" }, tag = "-default-opacity" })
o.window("(chrome-youtube.com__-Default|chrome-app.zoom.us__wc_home-Default)", { tag = "-chromium-based-browser" })
o.window("(chrome-youtube.com__-Default|chrome-app.zoom.us__wc_home-Default)", { tag = "-default-opacity" })
-- Force chromium-based browsers into a tile to deal with --app bug.
hl.window_rule({ match = { tag = "chromium-based-browser" }, tile = true })
-- Only a subtle opacity change, but not for video sites.
hl.window_rule({ match = { tag = "chromium-based-browser" }, opacity = "1.0 0.97" })
hl.window_rule({ match = { tag = "firefox-based-browser" }, opacity = "1.0 0.97" })
-- Hide the screen-sharing notification bar (the "Hide" button on it is broken on Wayland).
hl.window_rule({ match = { title = ".*is sharing.*" }, workspace = "special silent" })
-- Hide screen sharing notification windows.
o.window({ title = ".*is sharing.*" }, { workspace = "special silent" })
+2 -2
View File
@@ -1,2 +1,2 @@
-- Focus floating DaVinci Resolve dialog windows.
hl.window_rule({ match = { class = ".*[Rr]esolve.*", float = true }, stay_focused = true })
-- DaVinci Resolve dialog focus handling.
o.window(".*[Rr]esolve.*", { float = true, stay_focused = true })
+1 -5
View File
@@ -1,5 +1 @@
hl.window_rule({
name = "geforce",
match = { class = "GeForceNOW" },
idle_inhibit = "fullscreen",
})
o.window("GeForceNOW", { idle_inhibit = "fullscreen" })
+1 -5
View File
@@ -1,6 +1,2 @@
-- Disable mouse focus (see https://github.com/basecamp/omarchy/pull/5183#issuecomment-4189299971).
hl.window_rule({
name = "jetbrains-focus",
match = { class = "^(jetbrains-.*)$" },
no_follow_mouse = true,
})
o.window("^(jetbrains-.*)$", { no_follow_mouse = true })
+2 -3
View File
@@ -1,4 +1,3 @@
-- Float LocalSend and fzf file picker.
hl.window_rule({ match = { class = "(Share|localsend)" }, float = true })
hl.window_rule({ match = { class = "(Share|localsend)" }, center = true })
hl.window_rule({ match = { class = "localsend" }, size = { 1100, 700 } })
o.window("(Share|localsend)", { float = true, center = true })
o.window("localsend", { size = { 1100, 700 } })
+1 -6
View File
@@ -1,6 +1 @@
hl.window_rule({
name = "moonlight",
match = { class = "com.moonlight_stream.Moonlight" },
fullscreen = true,
idle_inhibit = "fullscreen",
})
o.window("com.moonlight_stream.Moonlight", { fullscreen = true, idle_inhibit = "fullscreen" })
+11 -9
View File
@@ -1,10 +1,12 @@
-- Picture-in-picture overlays.
hl.window_rule({ match = { title = "(Picture.?in.?[Pp]icture)" }, tag = "+pip" })
hl.window_rule({ match = { tag = "pip" }, tag = "-default-opacity" })
hl.window_rule({ match = { tag = "pip" }, float = true })
hl.window_rule({ match = { tag = "pip" }, pin = true })
hl.window_rule({ match = { tag = "pip" }, size = { 600, 338 } })
hl.window_rule({ match = { tag = "pip" }, keep_aspect_ratio = true })
hl.window_rule({ match = { tag = "pip" }, border_size = 0 })
hl.window_rule({ match = { tag = "pip" }, opacity = "1 1" })
hl.window_rule({ match = { tag = "pip" }, move = { "(monitor_w-window_w-40)", "(monitor_h*0.04)" } })
o.window({ title = "(Picture.?in.?[Pp]icture)" }, { tag = "+pip" })
o.window({ tag = "pip" }, {
tag = "-default-opacity",
float = true,
pin = true,
size = { 600, 338 },
keep_aspect_ratio = true,
border_size = 0,
opacity = "1 1",
move = { "(monitor_w-window_w-40)", "(monitor_h*0.04)" },
})
+1 -2
View File
@@ -1,2 +1 @@
hl.window_rule({ match = { class = "qemu" }, tag = "-default-opacity" })
hl.window_rule({ match = { class = "qemu" }, opacity = "1 1" })
o.window("qemu", { tag = "-default-opacity", opacity = "1 1" })
+6 -4
View File
@@ -1,4 +1,6 @@
hl.window_rule({ match = { class = "com.libretro.RetroArch" }, fullscreen = true })
hl.window_rule({ match = { class = "com.libretro.RetroArch" }, tag = "-default-opacity" })
hl.window_rule({ match = { class = "com.libretro.RetroArch" }, opacity = "1 1" })
hl.window_rule({ match = { class = "com.libretro.RetroArch" }, idle_inhibit = "fullscreen" })
o.window("com.libretro.RetroArch", {
fullscreen = true,
tag = "-default-opacity",
opacity = "1 1",
idle_inhibit = "fullscreen",
})
+4 -8
View File
@@ -1,8 +1,4 @@
-- Float Steam.
hl.window_rule({ match = { class = "steam" }, float = true })
hl.window_rule({ match = { class = "steam", title = "Steam" }, center = true })
hl.window_rule({ match = { class = "steam.*" }, tag = "-default-opacity" })
hl.window_rule({ match = { class = "steam.*" }, opacity = "1 1" })
hl.window_rule({ match = { class = "steam", title = "Steam" }, size = { 1100, 700 } })
hl.window_rule({ match = { class = "steam", title = "Friends List" }, size = { 460, 800 } })
hl.window_rule({ match = { class = "steam" }, idle_inhibit = "fullscreen" })
o.window("steam", { float = true, idle_inhibit = "fullscreen" })
o.window({ class = "steam", title = "Steam" }, { center = true, size = { 1100, 700 } })
o.window("steam.*", { tag = "-default-opacity", opacity = "1 1" })
o.window({ class = "steam", title = "Friends List" }, { size = { 460, 800 } })
+12 -20
View File
@@ -1,26 +1,18 @@
-- Floating windows.
hl.window_rule({ match = { tag = "floating-window" }, float = true })
hl.window_rule({ match = { tag = "floating-window" }, center = true })
hl.window_rule({ match = { tag = "floating-window" }, size = { 875, 600 } })
o.window({ tag = "floating-window" }, { float = true, center = true, size = { 875, 600 } })
hl.window_rule({ match = { class = "(org.omarchy.bluetui|org.omarchy.impala|org.omarchy.wiremix|org.omarchy.btop|org.omarchy.terminal|org.omarchy.bash|org.codeberg.dnkl.foot|org.gnome.NautilusPreviewer|org.gnome.Evince|com.gabm.satty|Omarchy|About|TUI.float|imv|mpv)" }, tag = "+floating-window" })
hl.window_rule({ match = { class = "(xdg-desktop-portal-gtk|sublime_text|DesktopEditors|org.gnome.Nautilus)", title = "^(Open.*Files?|Open [F|f]older.*|Save.*Files?|Save.*As|Save|All Files|.*wants to [open|save].*|[C|c]hoose.*)" }, tag = "+floating-window" })
hl.window_rule({ match = { class = "org.gnome.Calculator" }, float = true })
o.window("(org.omarchy.bluetui|org.omarchy.impala|org.omarchy.wiremix|org.omarchy.btop|org.omarchy.terminal|org.omarchy.bash|org.codeberg.dnkl.foot|org.gnome.NautilusPreviewer|org.gnome.Evince|com.gabm.satty|Omarchy|About|TUI.float|imv|mpv)", { tag = "+floating-window" })
o.window({ class = "(xdg-desktop-portal-gtk|sublime_text|DesktopEditors|org.gnome.Nautilus)", title = "^(Open.*Files?|Open [F|f]older.*|Save.*Files?|Save.*As|Save|All Files|.*wants to [open|save].*|[C|c]hoose.*)" }, { tag = "+floating-window" })
o.window("org.gnome.Calculator", { float = true })
-- Fullscreen screensaver.
hl.window_rule({ match = { class = "org.omarchy.screensaver" }, fullscreen = true })
hl.window_rule({ match = { class = "org.omarchy.screensaver" }, float = true })
hl.window_rule({ match = { class = "org.omarchy.screensaver" }, animation = "slide" })
-- Screen saver should always cover the screen and not be tiled.
o.window("org.omarchy.screensaver", { fullscreen = true, float = true, animation = "slide" })
-- No transparency on media windows.
hl.window_rule({ match = { class = "^(zoom|vlc|mpv|org.kde.kdenlive|com.obsproject.Studio|com.github.PintaProject.Pinta|imv|org.gnome.NautilusPreviewer)$" }, tag = "-default-opacity" })
hl.window_rule({ match = { class = "^(zoom|vlc|mpv|org.kde.kdenlive|com.obsproject.Studio|com.github.PintaProject.Pinta|imv|org.gnome.NautilusPreviewer)$" }, opacity = "1 1" })
-- Media/image/video apps should be opaque.
o.window("^(zoom|vlc|mpv|org.kde.kdenlive|com.obsproject.Studio|com.github.PintaProject.Pinta|imv|org.gnome.NautilusPreviewer)$", { tag = "-default-opacity", opacity = "1 1" })
-- Popped window rounding.
hl.window_rule({ match = { tag = "pop" }, rounding = 8 })
-- Common app-controlled tags.
o.window({ tag = "pop" }, { rounding = 8 })
o.window({ tag = "noidle" }, { idle_inhibit = "always" })
-- Prevent idle while open.
hl.window_rule({ match = { tag = "noidle" }, idle_inhibit = "always" })
-- Image selector.
-- Disable animations for image selector overlay.
hl.layer_rule({ match = { namespace = "omarchy-image-selector" }, no_anim = true })
+1 -1
View File
@@ -1,2 +1,2 @@
-- Prevent Telegram from stealing focus on new messages.
hl.window_rule({ match = { class = "org.telegram.desktop" }, focus_on_activate = false })
o.window("org.telegram.desktop", { focus_on_activate = false })
+2 -3
View File
@@ -1,4 +1,3 @@
-- Define terminal tag to style them uniformly.
hl.window_rule({ match = { class = "(Alacritty|kitty|com.mitchellh.ghostty|foot)" }, tag = "+terminal" })
hl.window_rule({ match = { tag = "terminal" }, tag = "-default-opacity" })
hl.window_rule({ match = { tag = "terminal" }, opacity = "0.97 0.9" })
o.window("(Alacritty|kitty|com.mitchellh.ghostty|foot)", { tag = "+terminal" })
o.window({ tag = "terminal" }, { tag = "-default-opacity", opacity = "0.97 0.9" })
+2 -2
View File
@@ -1,2 +1,2 @@
-- Float Typora print dialog.
hl.window_rule({ match = { class = "^Typora$", title = "^Print$" }, float = true, center = true })
-- Typora print dialog.
o.window({ class = "^Typora$", title = "^Print$" }, { float = true, center = true })
+8 -6
View File
@@ -1,6 +1,8 @@
-- Webcam overlay for screen recording.
hl.window_rule({ match = { title = "WebcamOverlay" }, float = true })
hl.window_rule({ match = { title = "WebcamOverlay" }, pin = true })
hl.window_rule({ match = { title = "WebcamOverlay" }, no_initial_focus = true })
hl.window_rule({ match = { title = "WebcamOverlay" }, no_dim = true })
hl.window_rule({ match = { title = "WebcamOverlay" }, move = { "(monitor_w-window_w-40)", "(monitor_h-window_h-40)" } })
-- Webcam overlay window.
o.window({ title = "WebcamOverlay" }, {
float = true,
pin = true,
no_initial_focus = true,
no_dim = true,
move = { "(monitor_w-window_w-40)", "(monitor_h-window_h-40)" },
})
+14
View File
@@ -65,3 +65,17 @@ end
function o.notify(message)
return "notify-send -u low " .. shell_quote(message)
end
function o.window(match, rules)
rules.match = rules.match or {}
if type(match) == "string" then
rules.match.class = match
else
for key, value in pairs(match) do
rules.match[key] = value
end
end
hl.window_rule(rules)
end
+3 -3
View File
@@ -1,9 +1,9 @@
-- See https://wiki.hypr.land/Configuring/Basics/Window-Rules/
hl.window_rule({ match = { class = ".*" }, suppress_event = "maximize" })
o.window(".*", { suppress_event = "maximize" })
-- Tag all windows for default opacity (apps can override with -default-opacity tag).
hl.window_rule({ match = { class = ".*" }, tag = "+default-opacity" })
o.window(".*", { tag = "+default-opacity" })
-- Fix some dragging issues with XWayland.
hl.window_rule({
@@ -22,4 +22,4 @@ hl.window_rule({
require("default.hypr.apps")
-- Apply default opacity after apps have had a chance to opt out.
hl.window_rule({ match = { tag = "default-opacity" }, opacity = "0.97 0.9" })
o.window({ tag = "default-opacity" }, { opacity = "0.97 0.9" })
+1 -1
View File
@@ -15,4 +15,4 @@ hl.config({
})
-- Kanagawa backdrop is too strong for default opacity.
hl.window_rule({ match = { tag = "terminal" }, opacity = "0.98 0.95" })
o.window({ tag = "terminal" }, { opacity = "0.98 0.95" })