mihirlad55 / polybar-dwm-module

A dwm module for polybar
MIT License
116 stars 15 forks source link

Cursor sometimes doesn't trigger monitor focus change #1

Closed mihirlad55 closed 4 years ago

mihirlad55 commented 4 years ago

In a vertical monitor setup, when the mouse is near the edge of the two monitors, sometimes the bar doesn't notice which monitor the cursor is really on.

Possible solution: Don't use dwm for detecting selected monitor changes. Use polybar.

mihirlad55 commented 4 years ago

This happens when the bar has override-redirect = true since this causes any mouse events that occurs on the bar to not be sent to dwm which means dwm does not realize that the cursor has entered a different monitor. A possible fix is to disable override-redirect and write a patch to have dwm manage polybar as its main status bar.

mihirlad55 commented 4 years ago

See https://github.com/mihirlad55/dwm-anybar. This patch allows polybar to be managed by dwm with override-redirect = false. As a result, dwm receives EnterNotify X events that allow it to select the correct monitor when the cursor hovers over the bar which in turn sends a monitor_focus_change_event fixing this issue.

mihirlad55 commented 4 years ago

There doesn't seem to be a standard way to retrieve the cursor position from a module, so that probably isn't a solution.

This issue is related to another problem where clicking the tags don't work on the monitor that the bar is on if its not considered in focus.

Besides the patch, another semi-solution is adding an IPC command that allows you to specify the monitor to focus to in dwm, and then running this command before the tag view or toggleview command. However, this wouldn't exactly fix the tag states when hovering over polybar while another monitor is in focus

mihirlad55 commented 4 years ago

As mentioned above, there is not much that can be done to fix this issue. The anybar patch can allow dwm to detect monitor changes when the bar is at the edge of two monitors. Otherwise, this is only an issue when the cursor crosses between monitor boundaries over polybar in override-redirect mode which is a bit of an edge case.