Home liberachat/#xmonad: Logs Calendar

Logs on 2022-04-10 (liberachat/#xmonad)

00:47:08 × kidany quits (~kidany@68.205.87.94) (Quit: Leaving)
01:02:17 × benin quits (~benin@183.82.204.110) (Quit: The Lounge - https://thelounge.chat)
02:03:42 × banc quits (banc@gateway/vpn/airvpn/banc) (Ping timeout: 272 seconds)
02:22:57 banc joins (banc@gateway/vpn/airvpn/banc)
02:54:42 × steve_ quits (~steve@ool-182c2b80.dyn.optonline.net) (Ping timeout: 246 seconds)
03:33:53 × jao quits (~jao@cpc103048-sgyl39-2-0-cust502.18-2.cable.virginm.net) (Ping timeout: 256 seconds)
03:38:53 benin joins (~benin@183.82.204.110)
04:15:05 × Czernobog quits (~Czernobog@user/czernobog) (Quit: ZNC 1.8.2 - https://znc.in)
04:16:50 Czernobog joins (~Czernobog@user/czernobog)
04:28:40 × Czernobog quits (~Czernobog@user/czernobog) (Read error: Connection reset by peer)
04:35:41 Czernobog joins (~Czernobog@user/czernobog)
04:39:24 × Czernobog quits (~Czernobog@user/czernobog) (Client Quit)
04:41:00 Czernobog joins (~Czernobog@user/czernobog)
04:47:54 × Czernobog quits (~Czernobog@user/czernobog) (Read error: Connection reset by peer)
04:48:24 Czernobog joins (~Czernobog@user/czernobog)
04:48:40 × Czernobog quits (~Czernobog@user/czernobog) (Remote host closed the connection)
04:50:28 Czernobog joins (~Czernobog@user/czernobog)
04:59:31 dschrempf joins (~dominik@2a01-036d-0118-ae84-6c6f-79fb-839d-0cde.pool6.digikabel.hu)
05:14:57 × geekosaur quits (~geekosaur@xmonad/geekosaur) (Killed (NickServ (GHOST command used by allbery_b)))
05:14:59 allbery_b joins (~geekosaur@xmonad/geekosaur)
05:15:02 allbery_b is now known as geekosaur
05:24:29 × dschrempf quits (~dominik@2a01-036d-0118-ae84-6c6f-79fb-839d-0cde.pool6.digikabel.hu) (Quit: WeeChat 3.4.1)
06:50:40 × Czernobog quits (~Czernobog@user/czernobog) (Quit: ZNC 1.8.2 - https://znc.in)
06:51:07 <amenonsen> hmm, maybe I can use XMonad.Actions.PerWorkspaceKeys to use XMonad.Util.ExtensibleState to mark/unmark a workspace for skipping.
06:52:23 Czernobog joins (~Czernobog@user/czernobog)
06:58:48 × Czernobog quits (~Czernobog@user/czernobog) (Quit: ZNC 1.8.2 - https://znc.in)
07:00:30 Czernobog joins (~Czernobog@user/czernobog)
09:05:44 × noex quits (~null@user/noex) (Remote host closed the connection)
09:06:13 noex joins (~null@user/noex)
10:12:25 <Ether[m]> Is it possible to do tell xmonad to do a something when theree are 3 windows in particular layout?
10:12:33 Nahra joins (~user@static.161.95.99.88.clients.your-server.de)
10:16:48 <abastro[m]> I think layouthook is capable of that
10:17:08 <abastro[m]> Forgot how to do tho
10:27:24 <Ether[m]> When something is unbound xmonad uses default bindings..
10:27:34 <Ether[m]> How do i change this behavior 🤔?
10:28:43 <Solid> you can directly override the `keys` field of the XConfig record
10:38:45 <amenonsen> i think i've thoroughly broken my xmonad by trying to use Util.ExtensibleState to hide my work-space
10:43:48 <fizzie> Ether[m]: If you're using EZConfig for your key bindings, it's got an `removeKeys` and `removeKeysP` for removing bindings from the defaults.
10:45:38 <fizzie> (Assuming you want to keep most of the defaults and just drop some. If you don't want any defaults at all, then yeah, just set `keys` in the config directly.)
11:07:05 × benin quits (~benin@183.82.204.110) (Ping timeout: 248 seconds)
11:12:31 <amenonsen> hmm, the examples of ExtensibleState usage in xmonad-contrib are distinctly non-trivial
11:18:24 <abastro[m]> What is ExtensibleState?
11:19:23 <amenonsen> https://xmonad.github.io/xmonad-docs/xmonad-contrib/XMonad-Util-ExtensibleState.html
11:19:26 <amenonsen> "Module for storing custom mutable state in xmonad."
11:20:24 <amenonsen> i'm trying to store a list of WorkspaceIds to ignore with moveTo Next/Prev workspaces (with .Action.CycleWS)
11:56:47 <geekosaur> Ether[m], re 3 windows, take a look at XMonad.Layout.IfMax
11:57:07 <geekosaur> re bindings, you're seeing what is wrong with the kind of config you used instead of the one we recommend
12:06:48 <fizzie> amenonsen: The ExtensibleState module-level docs have kind of the minimal possible example, for storing an [Integer], which isn't really any different from storing a [WorkspaceId] (aka [String]). But it is inherently quite... Haskell-y, since it involves a type class.
12:10:00 <fizzie> You'd basically need that latter, five-line block, where you'd substitute `ListStorage` by some name descriptive of your thing (say, `IgnoredWorkspaces`) and `[Integer]` by `[WorkspaceId]`, and that would allow you, in a keybinding or elsewhere you have a X action, to say `XS.put (IgnoredWorkspaces ["foo", "bar"])` to update the list, and `(XS.get :: X IgnoredWorkspaces)` to retrieve it back.
12:23:53 <amenonsen> fizzie: that's roughly what i've done, following the integer example that you pointed me to yesterday.
12:24:24 <amenonsen> https://irc.toroid.org/file/2/Dd36AugJga0LqFjU
12:24:56 <amenonsen> sorry, and this is what the definition looks like:
12:24:59 <amenonsen> https://irc.toroid.org/file/2/8G5CWUUzLBKgjBTc
12:25:26 <amenonsen> (you're right, though, IgnoredWorkspaces would have been a better name for it)
12:29:43 <fizzie> That looks mostly right, you'll just need to unwrap it from the WorkspaceList type, and also sequence it to get it out of the X.
12:31:03 <fizzie> Completely untested, but something like ("M-<Left>", (XS.get :: X WorkspaceList) >>= \(WorkspaceList ignored) -> (moveTo Prev $ ignoringWSs ignoring)) has a _chance_ of working.
12:31:13 <fizzie> There's probably a more elegant way of doing that too.
12:33:05 <fizzie> Maybe with do notation, something like ("M-<Left>", do WorkspaceList ignored <- XS.get; moveTo Prev $ ignoringWSs ignored). Or something vaguely like that. I can't really write Haskell without some machine assistance.
12:34:44 <amenonsen> it works!
12:34:55 <amenonsen> (i tried the first form, not the do)
12:35:47 <amenonsen> so now i just need to make another keybinding to add another workspaceid to the list
12:44:43 <abastro[m]> I wonder what would be the usecase of the advanced feature
12:47:32 <geekosaur> which advanced feature?
12:51:57 jao joins (~jao@cpc103048-sgyl39-2-0-cust502.18-2.cable.virginm.net)
13:05:15 × de-vri-es quits (~de-vri-es@voyager.de-vri.es) (Quit: Bathrobe!)
13:05:46 de-vri-es joins (~de-vri-es@voyager.de-vri.es)
13:06:55 <abastro[m]> Mutable states
13:07:06 <abastro[m]> * Mutable extended states
13:10:43 <geekosaur> in this case, they have a "work" workspace and want to hide it when they're not working
13:11:24 <geekosaur> I have a module that uses it to add "icons" to NamedScratchpads (which needs to be extended for dynamic scratchpads at some point)
13:11:56 <geekosaur> various other modules use it to add state to the core without having to patch the core
13:13:36 <geekosaur> since that lets you pass state between hooks
13:37:56 × geekosaur quits (~geekosaur@xmonad/geekosaur) (Remote host closed the connection)
13:38:16 geekosaur joins (~geekosaur@xmonad/geekosaur)
13:47:38 <abastro[m]> Oh, I see
14:00:48 <amenonsen> i have main = do … spawn … xmonad $ … $ stuff
14:01:14 <amenonsen> can i stuff an XS.put(IgnoredWorkspace [scratchpadWorkspaceTag]) in there somehow?
14:01:40 <amenonsen> (as opposed to setting initialValue = [scratchpadWorkspaceTag] when defining the type)
14:01:54 <fizzie> No, because it's in IO, and you need that to be in X. You could stuff one in startupHook, though.
14:06:37 <fizzie> (How exactly you'd do that depends a little on what `… $ stuff` looks like, but it's just a field on the XConfig like manageHook and others. And the type is already a X (), which is exactly what a `XS.put (...)` is too.)
14:14:03 <amenonsen> cool.
14:14:48 <amenonsen> if i `import qualified XMonad.StackSet as W`, will W.workspace be my current WorkspaceId?
14:21:13 <geekosaur> W.currentTag
14:21:47 <geekosaur> W.workspace points to the actual workspace record, which contains a tag, the current layout, and a Maybe Stack
14:23:33 <geekosaur> also it won't be the current one necessarily; you need to go through W.current (which gets you a Screen) and *then* W.workspace
14:23:55 <geekosaur> W.currentTag is shorthand for W.tag . W.workspace . W.current
14:24:11 <amenonsen> currentWs = liftX (withWindowSet $ return . W.currentTag)
14:24:20 <amenonsen> (found in Hooks/ManageHelpers)
14:24:26 <geekosaur> yep
14:26:07 <geekosaur> (the liftX indicates that it's a manageHook)
14:26:21 <fizzie> If you just need an `X WorkspaceId`, I imagine it should be just `withWindowSet W.currentTag`.
14:31:56 <amenonsen> https://irc.toroid.org/file/2/avA9g9ntHRsUB2Cr
14:31:59 <geekosaur> still need the return because it's in X
14:35:35 <amenonsen> , ("M-C-A-h", (XS.get :: X IgnoredWorkspaces) >>= \(IgnoredWorkspaces ignored) -> (XS.put (IgnoredWorkspaces $ ignored ++ [(withWindowSet $ return . W.currentTag)])))
14:35:52 × geekosaur quits (~geekosaur@xmonad/geekosaur) (Killed (NickServ (GHOST command used by allbery_b)))
14:35:52 allbery_b joins (~geekosaur@xmonad/geekosaur)
14:35:55 allbery_b is now known as geekosaur
14:35:59 <amenonsen> this says Expected type: WorkspaceId, Actual type: X WorkspaceId. that seems like progress.
14:36:16 <amenonsen> but just adding liftX gives me a Query WorkspaceId
14:38:32 <geekosaur> withWindowSet $ return W.currentTag
14:38:43 <geekosaur> or: fmap W.currentTag $ gets windowset
14:39:32 <abastro[m]> Wow complex onr
14:39:38 <abastro[m]> * Wow complex one
14:56:47 <fizzie> See also XS.modify.
14:58:09 <geekosaur> sorry, needed that dot. withWindowSet $ return . W.currentTag
14:58:46 <geekosaur> without the dot it's withWindowSet $ \w -> return (W.currentTag w)
15:02:50 <fizzie> Or, putting it together slightly differently: withWindowSet $ \w -> XS.modify (\(IgnoredWorkspaces ignored) -> IgnoredWorkspaces (ignored ++ [W.currentTag w]))
15:03:40 <geekosaur> I'd actually use : instead of ++ unless order matters, but it doesn't seem to here
15:06:08 <geekosaur> well, actually, if it weren't likely to never be more than 2 I'd use a Set instead of a list :)
15:06:29 <fizzie> I also kind of hope there's a more elegant way of dealing with the wrapping type (IgnoredWorkspaces) than the "pattern-match in lambda, rewrap by calling a constructor", something that'd let you just use (W.currentTag ws :) as the "core" of the modification. But I don't know what it is.
15:08:19 <amenonsen> so i have
15:08:23 <amenonsen> , ("M-C-A-h", withWindowSet $ \w -> XS.modify (\(IgnoredWorkspaces ignored) -> IgnoredWorkspaces (ignored ++ [W.currentTag w])))
15:08:23 <amenonsen> , ("M-C-A-s", withWindowSet $ \w -> XS.modify (\(IgnoredWorkspaces ignored) -> IgnoredWorkspaces (filter (\x -> x /= W.currentTag w) ignored)))
15:08:56 <geekosaur> the pattern would be fmap except that the type can't change so fmap won't work. MonoFunctor (https://hackage.haskell.org/package/mono-traversable-1.0.15.3/docs/Data-MonoTraversable.html#t:MonoFunctor) would, but that's a fairly heavy dependency for such a light use case
15:09:10 <amenonsen> the way it's written now, it _should_ be possible for me to go around hiding multiple workspaces with no problem
15:09:38 <amenonsen> is there a convenient way for me to dump the contents of the list for debugging?
15:09:47 <geekosaur> so mostly I'd just define it with a shorter data constructor (IW instead of IgnoredWorkspaces)
15:11:09 <abastro[m]> Well this kind of modification is also possible with optics but
15:11:32 <abastro[m]> In this case, it seems like `IgnoredWorkspaces` is a newtype. Is it?
15:11:36 <amenonsen> well, i changed it to IWs
15:12:08 <amenonsen> it compiles, but it doesn't seem to work (the thing doesn't get ignored after my key binding)
15:12:50 <amenonsen> abastro[m]: yes, data IWs = IWs [WorkspaceId] \n instance ExtensionClass IWs where initialValue = IWs []
15:13:08 <geekosaur> you could modify https://github.com/geekosaur/xmonad.hs/blob/skkukuk/xmonad.hs#L170 / https://github.com/geekosaur/xmonad.hs/blob/skkukuk/xmonad.hs#L309-L313
15:13:20 <abastro[m]> If you define it as a newtype, you can use `coerce` function
15:13:52 <abastro[m]> :t coerce
15:13:53 <lambdabot> error:
15:13:54 <lambdabot> • Variable not in scope: coerce
15:13:54 <lambdabot> • Perhaps you meant ‘coerced’ (imported from Control.Lens)
15:14:00 <geekosaur> then (XS.get :: IWs) >>= hPutStrLn . show
15:14:14 <geekosaur> bah, yahb isn't in here
15:14:29 <abastro[m]> @hoogle coerce
15:14:30 <lambdabot> Data.Coerce coerce :: forall (k :: RuntimeRep) (a :: TYPE k) (b :: TYPE k) . Coercible a b => a -> b
15:14:30 <lambdabot> GHC.Exts coerce :: forall (k :: RuntimeRep) (a :: TYPE k) (b :: TYPE k) . Coercible a b => a -> b
15:14:30 <lambdabot> Control.Lens.Internal.Coerce coerce :: Coercible a b => a -> b
15:14:57 <amenonsen> abastro[m]: (but i have no idea what any of that means)
15:15:20 <geekosaur> I am not sure a newtype will work there, tbh
15:15:33 <geekosaur> there's some type games going on in ExtensibleState
15:16:33 <abastro[m]> In this case, if you define IWs with newtype, Coercible ([] WorkspaceId -> [] WorkspaceId) (IWs -> IWs)
15:16:51 <abastro[m]> That is, you can convert a function on WorkspaceId to a function on IWs
15:17:26 <abastro[m]> I think newtype should work
15:25:45 × noex quits (~null@user/noex) (Ping timeout: 248 seconds)
15:27:02 noex joins (~null@user/noex)
15:39:23 <amenonsen> , ("M-S-h", withWindowSet $ \w -> XS.modify (\(IWs ignored) -> IWs (ignored ++ [W.currentTag w])))
15:39:23 <amenonsen> , ("M-S-x", withWindowSet $ \w -> XS.modify (\(IWs ignored) -> IWs (filter (\x -> x /= W.currentTag w) ignored)))
15:39:27 <amenonsen> ok, this works fine.
15:40:19 <amenonsen> i can in fact hide and unhide (after e.g., mod+2 to go directly to the hidden workspace) multiple workspaces and moveTo Next/Prev behave exactly as desired.
16:06:45 <amenonsen> hm. should i really switch from (working) XMonad.Hooks.DynamicLog to XMonad.Hooks.StatusBar{,.PP}?
16:07:56 <geekosaur> I haven't bothered yet. although I need to use dbus so I think it's just the import that would change
16:14:26 × geekosaur quits (~geekosaur@xmonad/geekosaur) (Remote host closed the connection)
16:16:06 geekosaur joins (~geekosaur@xmonad/geekosaur)
16:23:04 <amenonsen> i'd like to filter out the new NSP workspace in the workspace list. seems straightforward enough. might explore StatusBar alongside.
16:29:13 <amenonsen> this was certainly a very productive weekend, xmonad-configuration wise. i'm off to bed now, but thank you all for your help.
16:32:37 <geekosaur> you might at some point abstract out the common part of that to a withIWs function
16:34:14 <geekosaur> it's not quite trivial because you need to factor the current workspace as well, but it's not terrible either
18:17:03 benin joins (~benin@183.82.204.110)
19:08:34 × geekosaur quits (~geekosaur@xmonad/geekosaur) (Killed (NickServ (GHOST command used by allbery_b)))
19:08:34 allbery_b joins (~geekosaur@xmonad/geekosaur)
19:08:37 allbery_b is now known as geekosaur
19:26:56 × benin quits (~benin@183.82.204.110) (Quit: The Lounge - https://thelounge.chat)
20:15:24 × Nahra quits (~user@static.161.95.99.88.clients.your-server.de) (Remote host closed the connection)
20:18:48 steve_ joins (~steve@ool-182c2b80.dyn.optonline.net)
21:20:13 <geekosaur> amenonsen, https://paste.tomsmeding.com/1dWFx7d1
21:22:05 <geekosaur> sorry, two typoes
21:24:15 <geekosaur> https://paste.tomsmeding.com/jJFXrr8n also has slightly better comments
21:42:48 <geekosaur> if you really wanted to be annoying, the first is withIWs (:) and the second is withIWs (filter . (/=))
21:43:13 <geekosaur> there comes a point where clever becomes unreadable, though
23:47:01 mvk joins (~mvk@2607:fea8:5ce3:8500::9d5a)

All times are in UTC on 2022-04-10.