-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement focused-monitor css class #536
base: master
Are you sure you want to change the base?
Conversation
Why is this code in context though? |
I thought about putting it in Workspaces, but it occurred to me that someone might want to make use of the css class on a bar that doesn't have a workspace widget. |
Or I could just put it in Workspaces, if the "no workspace widget" use case isn't a concern |
Yeah, that makes sense.
Yeah, this is a huge redflag. The right way to do this is to decouple the representation of stuff related ewmh from the workspace widget, and then provide updates to our internal view of ewmh state over a channel. This would allow all workspaces to share the same event handling, and also enable your use case of having widgets other than workspaces have access to ewmh state. |
This might all be a bit too much for you to do, but there are some simple improvements you would need to make to this before I would consider merging.
I believe that this is because ScreenId is either internal to XMonad or an X11 property, while monitorNumber should be something that is obtained from gdk. I still think there should a way to establish a mapping between them that makes sense. Did you look in to this at all? In general pagerHints is a hack that we should avoid extending or overusing. |
Thanks for taking a look at this :) |
Didn't mean to close this, my finger slipped -_- |
👍
As far as I can tell, gdk is using X11's numbering system (https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gdk/x11/gdkscreen-x11.c#L1067). XMonad applies its own numbering (https://hackage.haskell.org/package/xmonad-0.15/docs/src/XMonad.StackSet.html#new), but I think it matches Xinerama's numbering (https://gitlab.freedesktop.org/xorg/lib/libxinerama/-/blob/master/src/Xinerama.c#L313). To follow it farther than this I'll need to figure out X11's internal messaging, |
Avoiding use of PagerHints would require either XMonad support for additional EWMH hints (as discussed in xmonad/xmonad-contrib#150) or getting the active monitor via |
or making the monitor/screen number stuff work properly, which would be the solution I would prefer. |
I actually think that #399 is describing a behavior that is slightly different than what we have here btw. The desired behavior there is to show as active on each monitor the workspace that is displayed on THAT monitor. |
Unfortunately this still requires pagerHints since taffybar can't see ScreenId otherwise. I don't think EWMH hints can do this — |
Sure thing: https://gist.github.com/echarliewhite/19c80ec49592161cc74bccc62a3d53ae This reminds me that this css contains a workaround for another issue (#506 (comment)) |
I can see two main ways to handle communication with XMonad:
Both approaches could also address #399 |
I'm going to see if I can do this. It might take a while. |
@echarliewhite any thoughts about finishing this? |
This pull request adds css classes which indicate whether or not a taffybar
window is on the currently focused monitor (see #399).
This is working on my setup (XMonad, two monitors, one taffybar on each), but
has not been tested otherwise. There are a few issues that should probably be
addressed before merging (see below).
Implementation notes (short version)
_NET_CURRENT_DESKTOP
changesmonitor's geometry, which is acquired from XMonad via pagerHints
"unfocused-monitor"
Implementation notes (long version)
_NET_CURRENT_DESKTOP
changesupon creation (in
buildBarWindow
), and will unsubscribe if the window isdestroyed.
in
buildContext
, but I was unsure about how to unsubscribe if a contextis destroyed (while the taffybar process continues to run). I'm guessing
this never happens, but wasn't sure.
_XMONAD_FOCUSED_MONITOR_GEOMETRY
is added to PagerHints"x y w h"
ScreenID
and taffybar'smonitorNumber
didn't always match up (not sure why)_NET_DESKTOP_LAYOUT_Sn
or_NET_WORK_AREA
rateLimitFn
andupdateWidgetClasses
are copied from Workspaces.hs,could move these to Util.hs, since they are shared
copy-pasting.
updateTaffyWindowStatus
in particular should be closelyreviewed 😬