Skip to content

Commit bc1b446

Browse files
committed
notch now is overlay
1 parent b89a994 commit bc1b446

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

modules/bar.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from fabric.widgets.datetime import DateTime
1313
from fabric.widgets.label import Label
1414
from fabric.widgets.revealer import Revealer
15-
from gi.repository import Gdk, Gtk
15+
from gi.repository import Gdk, GLib, Gtk
1616

1717
import config.data as data
1818
import modules.icons as icons
@@ -615,6 +615,10 @@ def toggle_hidden(self):
615615
self.bar_inner.add_style_class("hidden")
616616
else:
617617
self.bar_inner.remove_style_class("hidden")
618+
# Ensure notch is above bar when bar is shown
619+
if self.notch:
620+
# Focus the notch window to bring it to front
621+
GLib.idle_add(lambda: exec_shell_command_async("hyprctl dispatch focuswindow class:notch") if self.notch else None)
618622

619623
def chinese_numbers(self):
620624
if data.BAR_WORKSPACE_USE_CHINESE_NUMERALS:

modules/notch.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def __init__(self, monitor_id: int = 0, **kwargs):
129129

130130
super().__init__(
131131
name="notch",
132-
layer="top",
132+
layer="overlay",
133133
anchor=anchor_val,
134134
margin=current_margin_str,
135135
keyboard_mode="none",
@@ -425,9 +425,10 @@ def __init__(self, monitor_id: int = 0, **kwargs):
425425

426426
self._current_window_class = self._get_current_window_class()
427427

428-
if data.PANEL_THEME == "Notch" and data.BAR_POSITION != "Top":
429-
GLib.timeout_add(500, self._check_occlusion)
430-
elif data.PANEL_THEME == "Notch":
428+
# Always enable occlusion detection for fullscreen windows
429+
GLib.timeout_add(500, self._check_occlusion)
430+
431+
if data.PANEL_THEME == "Notch":
431432
self.notch_revealer.set_reveal_child(True)
432433
else:
433434
self.notch_revealer.set_reveal_child(False)

utils/occlusion.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ def check_occlusion(occlusion_region, workspace=None):
109109
occ_x2 = occ_x + occ_width
110110
occ_y2 = occ_y + occ_height
111111

112+
# Get screen dimensions for fullscreen check
113+
screen_width, screen_height = get_screen_dimensions()
114+
112115
for client in clients:
113116
# Check if client is mapped
114117
if not client.get("mapped", False):
@@ -130,6 +133,12 @@ def check_occlusion(occlusion_region, workspace=None):
130133
win_x1, win_y1 = x, y
131134
win_x2, win_y2 = x + width, y + height
132135

136+
# Check for fullscreen windows (size matches screen and positioned at 0,0)
137+
if (width, height) == (screen_width, screen_height) and (x, y) == (0, 0):
138+
# For fullscreen windows, check if occlusion region is the top area
139+
if occ_y == 0 and occ_height > 0: # Top region
140+
return True # Consider fullscreen as occluding the top
141+
133142
# Check for intersection between the window and occlusion region
134143
if not (win_x2 <= occ_x or win_x1 >= occ_x2 or win_y2 <= occ_y or win_y1 >= occ_y2):
135144
return True # Occlusion region is occupied

0 commit comments

Comments
 (0)