Multiple monitor support #116
Replies: 5 comments 3 replies
-
🚨 Missing
|
Beta Was this translation helpful? Give feedback.
-
🚨 Bug Report: Tools (Power vs. etc.) Windows Open on Incorrect Monitor and Are UnclickableHi there, I encountered a bug where the tools windows (such as Power vs. etc.) open on the wrong monitor when clicked. These windows do not appear on the monitor where the click occurred, instead, they open on a different monitor. Additionally, the opened windows are not clickable, making them unusable, and this significantly impacts the user experience. This issue seems to be related to the window management or monitor handling, possibly due to incorrect focus behavior or window placement. It would be great to see this issue addressed, as it currently prevents smooth usage of the tools. I will take a look at it if I get a chance to work on it. Thank you for your work on this project! |
Beta Was this translation helpful? Give feedback.
-
✅ Fix for Notch Display and Clickability on Multi-Monitor SetupsHello! I have encountered an issue where clicking the
After reviewing the code, I realized that this is because only one instance of 🔧 SolutionTo fix this, I created a separate notches = []
for i, monitor in enumerate(monitors):
bar = Bar(monitor_id=monitor.id)
notch = Notch(monitor_id=monitor.id) # Create a separate Notch for each monitor
bar.notch = notch
notch.bar = bar
bars.append(bar)
notches.append(notch) With this change: ✅ Clicking on tools or power now or dashboard etc. will open the notch window on the correct monitor It seems to work for me. Please try it yourself. Just wanted to share this in case anyone else encounters the same issue or the maintainer considers updating the default behavior. 🙌 |
Beta Was this translation helpful? Give feedback.
-
Fix: Notch Windows Opening on Wrong Monitor with Keyboard Shortcuts ⌨️🖥️ProblemWhen using keyboard shortcuts (
Example:
SolutionModified
Full Modified Code
# ... other imports ...
import json
import subprocess
class Notch(Window):
_instances = {} # {monitor_id: Notch}
def __init__(self, monitor_id=None, **kwargs):
super().__init__(
name=f"notch-{monitor_id}",
layer="top",
anchor="top",
margin="-40px 0px 0px 0px" if not data.VERTICAL else "0px 0px 0px 0px",
monitor=monitor_id,
keyboard_mode="none",
exclusivity="none",
visible=True,
all_visible=True,
)
self.monitor_id = str(monitor_id)
Notch._instances[self.monitor_id] = self # ✨ Track instance
# ... rest of original __init__ code ...
# NEW METHOD
def open_notch(self, widget):
try:
# Get cursor position from Hyprland socket
cursor_result = subprocess.run(
['hyprctl', 'cursorpos', '-j'],
capture_output=True,
text=True
)
cursor_data = json.loads(cursor_result.stdout)
cursor_x, cursor_y = cursor_data["x"], cursor_data["y"]
# Get all monitor information
monitors_result = subprocess.run(
['hyprctl', 'monitors', '-j'],
capture_output=True,
text=True
)
monitors = json.loads(monitors_result.stdout)
# Find the monitor with the cursor
active_monitor = None
for monitor in monitors:
m_x = monitor["x"]
m_y = monitor["y"]
m_width = monitor["width"]
m_height = monitor["height"]
if (m_x <= cursor_x < m_x + m_width and
m_y <= cursor_y < m_y + m_height):
active_monitor = monitor
break
if not active_monitor: # Fallback
active_monitor = monitors[0]
# Call the corresponding Notch instance
active_id = str(active_monitor["id"])
if self.monitor_id != active_id:
active_notch = Notch._instances.get(active_id)
if active_notch:
active_notch._real_open_notch(widget)
return
self._real_open_notch(widget)
except Exception as e:
print(f"Error: {e}")
if Notch._instances:
next(iter(Notch._instances.values()))._real_open_notch(widget)
# RENAMED ORIGINAL METHOD
def _real_open_notch(self, widget):
# ORIGINAL CODE OF open_notch GOES HERE
# ... full original implementation ... Key Changes 🔄
How to Test 🧪1. Basic Test
2. Multi-Monitor Stress Test
Maybe better solutions can be found. I shared it to help friends who are dealing with more than one monitor. I am sure @Axenide will do better and share the update with us. |
Beta Was this translation helpful? Give feedback.
-
Woah guys, you've been busy, huh? I'll review these soon. Thank you for everything. :) |
Beta Was this translation helpful? Give feedback.
-
So, I use 2 monitors. When I installed the config, I could only see bar in 1 monitor. So I tweaked few things to get bar on both monitors.
Ax-Shell/main.py
Ax-Shell/modules/bar.py
I am not good at programming, this is my first time doing these things, so maybe I could have done this better.
Beta Was this translation helpful? Give feedback.
All reactions