Home liberachat/#xmonad: Logs Calendar

Logs on 2023-04-17 (liberachat/#xmonad)

00:41:39 × ft quits (~ft@87.122.10.136) (Ping timeout: 260 seconds)
00:43:04 ft joins (~ft@i59F54987.versanet.de)
02:09:04 × td_ quits (~td@i53870922.versanet.de) (Ping timeout: 248 seconds)
02:10:47 td_ joins (~td@i53870920.versanet.de)
02:46:29 catman joins (~catman@user/catman)
05:00:25 × catman quits (~catman@user/catman) (Ping timeout: 240 seconds)
05:52:19 × werneta quits (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) (Ping timeout: 250 seconds)
05:54:20 werneta joins (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net)
05:58:37 catman joins (~catman@user/catman)
06:31:07 × catman quits (~catman@user/catman) (Quit: WeeChat 3.8)
06:45:37 mncheckm joins (~mncheck@193.224.205.254)
07:14:52 × werneta quits (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) (Ping timeout: 252 seconds)
07:16:53 werneta joins (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net)
07:35:27 cfricke joins (~cfricke@user/cfricke)
07:47:40 thyriaen joins (~thyriaen@2a01:aea0:dd4:555f:6245:cbff:fe9f:48b1)
09:00:06 × murchadha[m] quits (~murdchadh@2001:470:69fc:105::3:3103) (Quit: You have been kicked for being idle)
09:00:07 × liskin[m] quits (~liskinmat@2001:470:69fc:105::768) (Quit: You have been kicked for being idle)
09:00:07 × unclechu quits (~unclechu@2001:470:69fc:105::354) (Quit: You have been kicked for being idle)
09:30:36 × noze quits (~user@2001:41d0:a:21f1::1) (Quit: ERC 5.4 (IRC client for GNU Emacs 28.2))
09:31:08 noze joins (~user@2001:41d0:a:21f1::1)
10:00:50 hightower3 joins (~hightower@213.149.61.95)
10:03:01 × hightower2 quits (~hightower@213.149.61.117) (Ping timeout: 240 seconds)
10:17:23 × noze quits (~user@2001:41d0:a:21f1::1) (Ping timeout: 256 seconds)
10:22:23 noze joins (~user@2001:41d0:a:21f1::1)
10:28:53 × thyriaen quits (~thyriaen@2a01:aea0:dd4:555f:6245:cbff:fe9f:48b1) (Quit: Leaving)
12:04:48 × werneta quits (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) (Ping timeout: 248 seconds)
14:52:59 × amenonsen quits (~amenonsen@pitta.toroid.org) (Ping timeout: 264 seconds)
15:01:45 sadmax joins (~user@64.130.91.66)
15:11:22 × cfricke quits (~cfricke@user/cfricke) (Quit: WeeChat 3.8)
15:15:30 × abhixec quits (~abhixec@c-67-169-139-16.hsd1.ca.comcast.net) (Ping timeout: 260 seconds)
15:49:03 <JonathanWatson[m> does anyone know how i can benchmark xmonad? i would like to give xmonad many keypresses via xdotool and see how long it takes xmonad to execute them all, but i don't know how to find out when this is
15:50:18 <JonathanWatson[m> i changed the NextLayout event to take five seconds and xdotool finishes immediately rather than wait for the five seconds
15:50:51 <geekosaur> xdotool doesn't know how to wait for results of key actions; it just sends the event and exits
15:51:04 liskin[m] joins (~liskinmat@2001:470:69fc:105::768)
15:51:19 unclechu joins (~unclechu@2001:470:69fc:105::354)
15:51:23 <geekosaur> (it doesn't even know what the result would be and therefore what to wait for)
15:53:25 <JonathanWatson[m> is there anything that could work without modifying xmonad itself?
15:53:41 <geekosaur> nope
15:53:42 <JonathanWatson[m> since any change i make probably needs to also be made to 96 other versions of xmonad
15:55:05 <geekosaur> and you would also need to modify xdotool, since as I said it has no idea of what to wait for. worse, xmonad can't even tell that xdotool sent the event and that it should send some response back; the event will have the `send_event` flag set, but no indication of what sent it
15:55:14 <mc47[m]> You can probably create a function that takes a label and `X a` and prints the label with how much it took to execute the action to a file or to stderr
15:55:52 <mc47[m]> Oh and Haskell laziness should be considered as well
15:56:10 <geekosaur> very little in xmonad is lazy since everything does IO actions…
15:56:49 <mc47[m]> But you'd need to wrape every action
15:57:57 <JonathanWatson[m> i think the easiest method for my purposes it to send like 1000 keypresses and then wait for the screen to stop changing for five seconds
15:58:01 <JonathanWatson[m> and then subtract five
15:59:14 <JonathanWatson[m> but then i need to make sure that i am sending the keypresses faster than xmonad is handling them and i need to check that that many keypresses can be queued
15:59:33 <JonathanWatson[m> and i also need to figure out how to actually check that the screen hasn't changed for five seconds
16:00:03 <geekosaur> that's actually the easiest part: select expose events on the root window and all children
16:01:26 <JonathanWatson[m> can i do that from outside of xmonad?
16:01:42 <geekosaur> yes
16:01:51 <geekosaur> (and must, in fact)
16:03:42 <JonathanWatson[m> is xmonad an X client?
16:05:50 <geekosaur> yes
16:06:04 <JonathanWatson[m> i'm haven't been sure exactly where it comes into the x window manager pipeline since it doesn't seem to be the server but isn't a normal program
16:06:47 <geekosaur> the only thing that makes a window manager special is that it selects SubstructureRedirectMask on the root window and all children. it's a bit hacky
16:07:17 <JonathanWatson[m> ok
16:07:53 <JonathanWatson[m> now i assume when i use xdotool to send keys they get sent to the x server and then the x server sends them to the x clients like xmonad to be consumed
16:08:57 <geekosaur> correct, with one small modification: xmonad uses passive key grabs, so when the server receives one of the grabbed keys it gives xmonad a full keyboard drab and sends all key events including the triggering event to it
16:09:25 <geekosaur> which is why you don't have to worry about focused windows
16:09:28 <JonathanWatson[m> oh ok
16:10:15 <JonathanWatson[m> my worry is that if i just run xdotool many times then the time taken for the benchmark to finish is the amount of time it takes xdotool to send that
16:10:25 <JonathanWatson[m> because it has a bit of a delay
16:10:37 <geekosaur> if all you're doing is timing xdotool, then yes that is exactly what will happen
16:11:12 <JonathanWatson[m> but if i could just send all of the keypresses to the x server at once and have them queued, then the limiting factor would just be the amount of time it takes for the x server to send the commands to xmonad and xmonad to execute them
16:11:43 <JonathanWatson[m> although the x server sending the commands might still be a limiting factor but i feel like less so?
16:11:46 <geekosaur> right, but detecting that is a problem
16:12:28 <geekosaur> they'll just sit in the AF_UNIX socket connecting xmonad to the X server until consumed by XNextEvent
16:12:33 <JonathanWatson[m> as in detecting that the commands have been executed?
16:12:37 <geekosaur> yes
16:13:37 × sadmax quits (~user@64.130.91.66) (Remote host closed the connection)
16:13:43 <geekosaur> we don't have a hook that is executed just before the core does XNextEvent
16:13:56 <JonathanWatson[m> well i hope that once i stop queuing them, the display will keep flashing until all of the commands have been handled (at least no delays for more than five seconds)
16:14:11 <geekosaur> but if the key you send switches workspaces you could use an xmonad.hs which logs the time in its logHook or something
16:14:59 <geekosaur> note that it won't work well to time something that does a spawn because xmonad does a fork() to spawn the command and you won't get any timing after that
16:15:14 <geekosaur> (double fork(), in fact)
16:15:53 werneta joins (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net)
16:16:33 <JonathanWatson[m> well i was hoping not to time individual commands
16:16:46 <JonathanWatson[m> but just time how long it takes to do all of them
16:16:57 <JonathanWatson[m> and then compare that with the time for a potentially slower version of xmonad
16:38:45 × berberman_ quits (~berberman@user/berberman) (Ping timeout: 256 seconds)
16:47:22 <JonathanWatson[m> also i have found an easy way to queue the commands now
16:47:50 <JonathanWatson[m> just send SIGSTOP, send all the commands to the x server with xdotool, then send SIGCONT
17:52:32 amenonsen joins (~amenonsen@pitta.toroid.org)
18:04:11 berberman joins (~berberman@user/berberman)
18:45:45 × kaskal quits (~kaskal@213-147-166-209.nat.highway.webapn.at) (Ping timeout: 240 seconds)
18:51:58 catman joins (~catman@user/catman)
19:16:32 kaskal joins (~kaskal@2001:4bb8:2cc:efb3:2d42:311d:d744:4a5)
20:41:07 × catman quits (~catman@user/catman) (Ping timeout: 276 seconds)
21:46:49 stellacy joins (~stellacy@gateway/tor-sasl/stellacy)
22:07:32 × stellacy quits (~stellacy@gateway/tor-sasl/stellacy) (Remote host closed the connection)
22:08:04 stellacy joins (~stellacy@gateway/tor-sasl/stellacy)
22:13:07 <JonathanWatson[m> i'm back again
22:13:40 <JonathanWatson[m> does anyone know how i can listen to expose events? i wrote this script to run separately but its not printing anything
22:13:43 <JonathanWatson[m> allocaXEvent $ \xEventPointer ->... (full message at <https://libera.ems.host/_matrix/media/v3/download/libera.chat/ed27ba729d93dc9fe65f6fdea40e9c6388fa4b41>)
22:13:59 JonathanWatson[m sent a haskell code block: https://libera.ems.host/_matrix/media/v3/download/libera.chat/ed27ba729d93dc9fe65f6fdea40e9c6388fa4b41
22:14:55 <JonathanWatson[m> perhaps i need to use the checkTypedWindowEvent function
22:17:59 <geekosaur> https://hackage.haskell.org/package/X11-1.10.3/docs/Graphics-X11-Xlib-Event.html#v:selectInput
22:18:10 <geekosaur> you won't get events unless you select for them
22:18:35 <geekosaur> https://tronche.com/gui/x/xlib/event-handling/XSelectInput.html
22:19:27 <geekosaur> also that program is going to loop forever on the first event it receives because peekEvent leaves it queued
22:21:36 <geekosaur> also also, `threadDelay 10000` delays for 10ms
22:31:21 <JonathanWatson[m> <geekosaur> "also also, `threadDelay 10000..." <- Fine by me
22:32:47 <JonathanWatson[m> <geekosaur> "also that program is going to..." <- I thought that the normal method would consume the events and stop them happening but fortunately not
22:33:03 <geekosaur> you want nextEvent, not peekEvent
22:33:43 <JonathanWatson[m> Yes
22:34:21 <JonathanWatson[m> unfortunate time for element to start randomly crashing in xmonad
22:34:45 <geekosaur> huh. I ran it for a while without problems
22:35:15 <JonathanWatson[m> seems to be working now
22:35:18 <geekosaur> although I guess I was running the webapp instead of the standalone one (I have more than enough JS engines running as it is)
22:35:41 <JonathanWatson[m> is there an easy way to get all the windows with the X11 library?
22:36:11 <geekosaur> queryTree aka XQueryTree()
22:37:05 × mncheckm quits (~mncheck@193.224.205.254) (Ping timeout: 240 seconds)
22:37:16 <JonathanWatson[m> interesting
22:37:25 <geekosaur> but if this is for XSelectInput you want to omit the do_not_propagate flag and select on the root window
22:37:57 <geekosaur> hm, actually I think that might not work here and you would have to queryTree
22:37:59 <JonathanWatson[m> ah nice
22:38:05 <JonathanWatson[m> oh ok
22:38:39 <JonathanWatson[m> i'll need to use rootWindow to get the window argument for selectInput anyway
22:38:46 <JonathanWatson[m> or even defaultRootWindow
22:40:20 <JonathanWatson[m> do i need to use queryTree recursively?
22:40:44 <JonathanWatson[m> i suppose i only really need to check the xmonad window for expose events
22:41:09 <geekosaur> you shouldn't need to because it's no longer common for programs to create inner server-side windows; that is slow and inflexible
22:41:21 <geekosaur> and xmonad doesn't have a window
22:42:10 <JonathanWatson[m> oh ok
22:42:52 <JonathanWatson[m> is exposureMask the mask to use?
22:44:13 <JonathanWatson[m> looks like it works
22:44:24 <geekosaur> exposureMask and structureNotifyMask (so you can select an input mask on new windows as they appear)
22:45:24 <JonathanWatson[m> should i just bitwise OR them together?
22:45:30 <geekosaur> yes
22:46:33 <JonathanWatson[m> ok this is my code now... (full message at <https://libera.ems.host/_matrix/media/v3/download/libera.chat/4e68c95a37b2a875e79b1288f05d911ea49a33a6>)
22:48:12 <geekosaur> don't forget to also set the input mask on the root window
22:48:39 <geekosaur> so you get notifications for new windows
22:49:55 <JonathanWatson[m> ok
22:51:09 <geekosaur> correction: substructureNotifyMask on the root
22:51:20 <geekosaur> (Notify, not Redirect!)
22:55:17 <JonathanWatson[m> plus state monad for actually telling when an expose event is new... (full message at <https://libera.ems.host/_matrix/media/v3/download/libera.chat/c5473cdb559f501974d4e9ad3745a0a47497bf8b>)
22:59:36 <geekosaur> that's slightly wrong. you want substructureNotifyMask on the root, but structureNotifyMask on the child windows. you also want to watch for MapWindow events that you receive and select exposureMask .|. structureNotifyMask on them
23:00:03 <geekosaur> (you don't need to know about window deletion, the corresponding event mask will go away by itself)
23:00:47 <geekosaur> come to think of it I don't think you need structureNotifyMask on the children at all, since you don't care about resizes and such
23:01:15 <geekosaur> just the substructureNotifyMask on the root so you can select expose events on new windows as they appear
23:02:42 <geekosaur> mm, and … I am suddenly thinking Expose isn't sent on random draws, and is likely to be useless in a tiled wm unless a floating window is closed
23:03:35 <geekosaur> you may only care about MapRequest and UnmapRequest because no event is sent at all when something draws in a window, unless that part of the window is hidden and then it gets a NoExpose event
23:03:59 <geekosaur> and wm events are not going to be draws anyway
23:04:47 <geekosaur> so, hm. https://tronche.com/gui/x/xlib/events/processing-overview.html#StructureNotifyMask is probably what you care about as the only things xmonad will affect about windows
23:06:10 <JonathanWatson[m> so do i only need to select substructureNotifyMask on the root?
23:06:15 <geekosaur> yes
23:06:24 <geekosaur> structureNotifyMask on everything else
23:07:09 <geekosaur> expose events will be received for those layouts that cover up windows instead of unmapping them (example of the former is simpleTabbed, example of the latter is Full)
23:07:25 <JonathanWatson[m> oh ok so i keep expose for checkTypedEvent
23:07:44 <geekosaur> right but you also want to checktypedEvent for mapNotify
23:08:01 <geekosaur> and selectInput on the window in question
23:10:52 <geekosaur> if you want something that's sanely measurable, you probably want to load a couple of workspaces with windows (say, xterms) and switch between them
23:11:40 <geekosaur> this will be the slowest because it causes a full run of X.O.windows on the newly revealed workspace, and that will do a full run of the layout
23:11:55 <JonathanWatson[m> i can't see how to get the window for mapNotify
23:13:15 <JonathanWatson[m> oh get_window probably
23:13:21 <geekosaur> every event has an `ev_window`
23:15:11 <JonathanWatson[m> when we get a mapNotify event, what mask do we give the window?
23:15:36 <geekosaur> structureNotifyMask .|. exposureMask
23:15:48 <geekosaur> same as for the existing windows when you start up
23:16:55 <geekosaur> anyway an event is a Haskell record which has multiple fields that you can access in the usual way
23:17:29 <JonathanWatson[m> ok so this is my new code... (full message at <https://libera.ems.host/_matrix/media/v3/download/libera.chat/8de1961fc197cb923ba05f03d0cae1c24793a2e5>)
23:17:40 <geekosaur> https://hackage.haskell.org/package/X11-1.10.3/docs/Graphics-X11-Xlib-Extras.html look for MapNotifyEvent
23:18:40 <JonathanWatson[m> oh i see
23:20:38 <JonathanWatson[m> > <@jjw:matrix.org> ok so this is my new code... (full message at <https://libera.ems.host/_matrix/media/v3/download/libera.chat/1fa31d40d7ff8269f48c039938c897c9961c3406>)
23:20:38 <JonathanWatson[m> but its not giving anything anymore
23:20:40 <lambdabot> <hint>:1:1: error: parse error on input ‘<@’
23:20:59 <geekosaur> did you do something like switching workspaces?
23:21:55 <JonathanWatson[m> i run it in workspace 1 every time and stay in there
23:23:15 <JonathanWatson[m> very strange
23:23:36 <JonathanWatson[m> > <@jjw:matrix.org> ok this is my code now... (full message at <https://libera.ems.host/_matrix/media/v3/download/libera.chat/0769027e9da25bf11d789efaf2e9714ae49a67e4>)
23:23:37 <lambdabot> <hint>:1:1: error: parse error on input ‘<@’
23:23:51 <JonathanWatson[m> well it printed some of the expose events
23:25:00 <geekosaur> you won't see anything
23:25:11 <geekosaur> as I said, you don't get events at all just for draws
23:25:28 <geekosaur> Expose means a new (region of a) window has become visible
23:25:56 <geekosaur> in a tiling wm, you don't get many Expose events unless you close a floating window
23:26:17 <geekosaur> you will pretty much only get events for opening a new window, closing an existing window, or switching workspaces
23:26:25 <geekosaur> this is pretty much the nature of tiling wms
23:26:43 <JonathanWatson[m> well it ran sometimes when i did next layout (alt+space)
23:26:58 <geekosaur> and when it comes down to it, if your intent is to benchmark a window manager, that's all you really care about
23:27:15 <geekosaur> right, that'll alter what windows are visible and how
23:27:36 <geekosaur> but no expose events because we pretty much show either all or none of a window
23:27:48 <geekosaur> and an expose event is about part of a window
23:28:55 <geekosaur> well, not entirely true, Tabbed layouts will produce whole-window expose events. but Full won't because it unmaps instead of hiding
23:31:32 <JonathanWatson[m> oh ok
23:31:44 malook joins (~Thunderbi@46.52.55.36)
23:32:08 <JonathanWatson[m> so i think i should also detect unmaps
23:33:11 <JonathanWatson[m> i have checkTypedEvent display mapRequest xEventPointer but its never true
23:33:46 <JonathanWatson[m> i suppose i want to check for unmapNotify
23:36:51 <JonathanWatson[m> i think there is a flaw in my code
23:36:56 <JonathanWatson[m> "The XCheckTypedEvent() function searches the event queue and then any events available on the server connection for the first event that matches the specified type. If it finds a match, XCheckTypedEvent() removes that event, copies it into the specified XEvent structure, and returns True . The other events in the queue are not discarded. If the event is not available, XCheckTypedEvent() returns False , and the output buffer will have
23:36:56 <JonathanWatson[m> been flushed."
23:37:15 <JonathanWatson[m> so it doesn't actually check the event from nextevent but actually checks the whole queue
23:37:44 <JonathanWatson[m> and the second checkTypedEvent never happens if there's an expose event at any point in the queue
23:39:12 <geekosaur> hm, right
23:40:44 <geekosaur> well, except the second part is wrong, it will first look for expose events and give you the first it finds, then it will look for MapNotify, then you want to look for UnmapNotify, then you want to nextEvent to clear the topmost event which is apparently none of the above
23:40:46 <geekosaur> then loop
23:41:00 catman joins (~catman@user/catman)
23:42:51 <JonathanWatson[m> this is my latest iteration... (full message at <https://libera.ems.host/_matrix/media/v3/download/libera.chat/d5fe7d114c25baed420f096ac9133a7a25259a64>)
23:43:09 <JonathanWatson[m> i don't think nextEvent is needed at all
23:43:16 <JonathanWatson[m> ?
23:43:45 <JonathanWatson[m> not sure what "output buffer will have been flushed" means
23:45:16 <geekosaur> if none of the `checkTypedEvent`s gave you an event then you need to possibly discard an event
23:45:34 <geekosaur> because there are other events you might receive that aren't the ones you're looking for
23:46:32 <JonathanWatson[m> yeah i'm thinking i can just run flush if all of them return false
23:49:27 <geekosaur> o.O I wonder if they actually mean the input queue; there's no "output buffer"
23:52:07 <geekosaur> actually, hm, in that case you would in fact not be able to do the second check (and the whole thing becomes difficult at best)
23:52:21 <JonathanWatson[m> yes
23:53:03 <geekosaur> https://tronche.com/gui/x/xlib/event-handling/manipulating-event-queue/XMaskEvent.html
23:54:07 <JonathanWatson[m> probably better
23:54:13 <geekosaur> and, well, I don't think you so much care about the actual event tyepe except insofar as you need to XSelectInput on a MapNotify
23:54:54 <geekosaur> any of the StructureNotifyMask/SubstructureNotifyMask/ExposureMask events indicate window manager activity
23:55:34 <JonathanWatson[m> i am wondering what is the difference between XMaskEvent and XCheckMaskEvent
23:55:54 <geekosaur> https://tronche.com/gui/x/xlib/event-handling/manipulating-event-queue/selecting-using-window-or-event-mask.html
23:58:07 <geekosaur> the remaining issue is finding out when activity from xmonad has ended. the classic but not really Haskell solution is you select() on the server socket with a timeout, and track the time when each select() returns so you know when all the activity finished
23:59:07 <geekosaur> the more Haskelly equivalent is to do the X stuff in a thread with results posted to a Chan, and the main program kills the thread after the timeout (see the async library)

All times are in UTC on 2023-04-17.