2021/11/26

2021-11-26 00:07:02 +0100seschwar(~seschwar@user/seschwar) (Quit: :wq)
2021-11-26 00:23:43 +0100 <Vermoot> Could someone help me use `parseKeyCombo` from EZUtil?
2021-11-26 00:24:35 +0100 <Vermoot> I was under the impression that I could use that wherever a keybind looking like `(modMask, xK_a)` was expected
2021-11-26 00:25:00 +0100 <Vermoot> Allowing me to replace it with `parseKeyCombo "M-a"`
2021-11-26 00:25:16 +0100 <Vermoot> So this is the line I have here:
2021-11-26 00:25:20 +0100 <Vermoot> ` , ("C-S-M1-e", bindFirst [(className =? "Discord", sendKey parseKeyCombo "M1-<Up>") , (pure True, sendKey parseKeyCombo "M1-Down")])`
2021-11-26 00:26:20 +0100 <geekosaur> first off, that'd be sendKey (parseKeyCombo "M1-<Up>")
2021-11-26 00:26:22 +0100 <Vermoot> (this being in my keybinds) The goal is to have C-S-M1-e be transformed to "M1-<Up>" when the focused window is Discord, and "M1-Down" otherwise
2021-11-26 00:26:27 +0100 <Vermoot> AH
2021-11-26 00:26:34 +0100 <geekosaur> otherweise you are sending the parseKeyCombo function
2021-11-26 00:26:46 +0100 <Vermoot> Oh, and not its result?
2021-11-26 00:26:58 +0100 <geekosaur> but you still have a problem because it returns a result in ReadP, not directly a (KeyMask,KeySym)
2021-11-26 00:27:12 +0100 <geekosaur> think map foo list
2021-11-26 00:27:40 +0100 <geekosaur> functions are perfectly valid parameters, and Haskell does not try to guess at types to see if it should treat something as a function or as a function call
2021-11-26 00:28:03 +0100 <Vermoot> Man this is something I still have trouble wrapping my head around
2021-11-26 00:28:11 +0100 <geekosaur> because that'd be even more confusing than missing/extra parameters already are, if you mess up
2021-11-26 00:28:25 +0100 <Vermoot> Which is problematic because as I understand it it's kinda the whole thing of functionnal programming
2021-11-26 00:29:53 +0100 <Vermoot> Alright so I can't use parseKeyCombo in that way?
2021-11-26 00:30:52 +0100 <geekosaur> now: ReadP is a parser. you use readP_to_S to run it on a String
2021-11-26 00:31:07 +0100 <geekosaur> (see Text.ParserCombinators.ReadP)
2021-11-26 00:31:42 +0100 <geekosaur> you are also missing the XConfig parameter that parseKeyCombo needs, so it knows how to translate "M-"
2021-11-26 00:31:56 +0100 <Vermoot> Sooo.... `readP_to_S parseKeyCombo "M1-<Up>"?
2021-11-26 00:33:08 +0100 <geekosaur> sendKey (readP_to_S (parseKeyCombo def) "M1-<Up>")
2021-11-26 00:33:22 +0100 <Vermoot> phew
2021-11-26 00:33:48 +0100 <Vermoot> Might wanna define a function for an easier call to that :D
2021-11-26 00:33:56 +0100 <geekosaur> if you need "M-" to work then you replace `def` with something like `def {modMask = mod4Mask}`
2021-11-26 00:37:38 +0100 <Vermoot> readP_to_S is not in scope
2021-11-26 00:37:41 +0100 <geekosaur> and if you're doing this a lot then you may want to consider refactoring so everything happens inside the ReadP. or just giving up and using (KeyMask,KeySym) to begin with
2021-11-26 00:37:55 +0100 <geekosaur> [25 23:31:07] <geekosaur> (see Text.ParserCombinators.ReadP)
2021-11-26 00:38:21 +0100 <Vermoot> (KeyMask,KeySym) is fine when just using one modifier, but this is intended for use with Meh (C-A-S) a lot
2021-11-26 00:40:32 +0100 <Vermoot> * Couldn't match expected type `X ()`
2021-11-26 00:40:32 +0100 <Vermoot> with actual type `KeySym -> X ()`
2021-11-26 00:40:32 +0100 <Vermoot> * Probable cause: `sendKey` is applied to too few arguments
2021-11-26 00:40:32 +0100 <Vermoot> In the expression:
2021-11-26 00:40:33 +0100 <Vermoot> sendKey (readP_to_S (parseKeyCombo def) "M1-<Up>")
2021-11-26 00:40:42 +0100 <Vermoot> oops, sorry for the spam paste
2021-11-26 00:41:24 +0100 <geekosaur> hm, let me look up sendKey
2021-11-26 00:42:20 +0100 <geekosaur> sendKey does not want a tuple such as parseKeyCombo returns, it wants them as separate parameters
2021-11-26 00:42:37 +0100 <Vermoot> Ah, yeah ok I see that
2021-11-26 00:42:49 +0100 <Vermoot> So uh, map?
2021-11-26 00:42:53 +0100 <Vermoot> no
2021-11-26 00:43:21 +0100 <geekosaur> uncurry sendKey (readP_to_S (parseKeyCombo def) "M1-<Up>")
2021-11-26 00:43:56 +0100 <Vermoot> * Couldn't match expected type `(KeyMask, KeySym)`
2021-11-26 00:43:56 +0100 <Vermoot> with actual type `[((KeyMask, KeySym), String)]`
2021-11-26 00:44:02 +0100 <Vermoot> Damn this is hard haha
2021-11-26 00:44:14 +0100 <geekosaur> yeh, lemme think this through a bit more
2021-11-26 00:44:43 +0100 <Vermoot> Then I'll really have to define a function to make all of this easier to reuse multiple times :D
2021-11-26 00:45:31 +0100 <geekosaur> sigh, tried to use cabal repl, it's rebuilding everything,m this will a be a while since it'll hit xmonad-contrib shortly :þ
2021-11-26 00:46:28 +0100 <geekosaur> oh, right, I'm forgetting ReadP parsers provide a list of results
2021-11-26 00:46:40 +0100 <geekosaur> where you almost always care only about the first one, and only its fst
2021-11-26 00:46:51 +0100 <geekosaur> this is really the wrong way to go about things…
2021-11-26 00:47:14 +0100 <geekosaur> uncurry sendKey (fst (head (readP_to_S (parseKeyCombo def) "M1-<Up>")))
2021-11-26 00:47:40 +0100 <geekosaur> and don't get your string wrong because this will throw a runtime error if you do
2021-11-26 00:48:11 +0100 <Vermoot> which means the end of my xmonad session without an ability to do anything then?
2021-11-26 00:48:36 +0100 <geekosaur> right
2021-11-26 00:49:07 +0100 <geekosaur> you'd have to replace `head` with something smarter, and "smarter" may be difficult or at least annoying here
2021-11-26 00:50:16 +0100 <Vermoot> Ok so uh
2021-11-26 00:50:26 +0100 <Vermoot> Compiles, and no runtime error
2021-11-26 00:50:47 +0100 <Vermoot> But I just get an `m` instead of `M1-<Up>`
2021-11-26 00:51:08 +0100 <Vermoot> Now I feel *really* lost haha
2021-11-26 00:52:46 +0100 <geekosaur> oh damn, ReadP can't make this easy, can it?
2021-11-26 00:52:59 +0100 <Vermoot> I thought finding bindFirst, sendKey and parseKeyCombo would make this all pretty straightforward
2021-11-26 00:53:13 +0100 <geekosaur> it returns three possible parses. the *third* is correct (has an empty suffix)
2021-11-26 00:53:59 +0100 <geekosaur> and this won't be fixed because it'll depend on how complex the string is that's being parsed :(
2021-11-26 00:54:47 +0100 <Vermoot> I guess uh... (KeyMask, KeySym) doesn't look too bad at this point
2021-11-26 00:55:17 +0100 <geekosaur> *Main Text.ParserCombinators.ReadP XMonad.Util.EZConfig XMonad.Util.Paste> fst (last (readP_to_S (parseKeyCombo def) "M1-<Up>"))
2021-11-26 00:55:18 +0100 <geekosaur> (8,65362)
2021-11-26 00:55:47 +0100 <Vermoot> whut
2021-11-26 00:56:52 +0100 <geekosaur> *Main Text.ParserCombinators.ReadP XMonad.Util.EZConfig XMonad.Util.Paste> fst (last (readP_to_S (parseKeyCombo def) "M1-<Down>"))
2021-11-26 00:56:53 +0100 <geekosaur> (8,65364)
2021-11-26 00:57:07 +0100 <geekosaur> so `last` in place of `head`
2021-11-26 00:58:01 +0100 <geekosaur> this is still likely to throw an exception if it fails, but preventing that exception will be harder because last is even more evil than head is
2021-11-26 00:59:37 +0100 <Vermoot> Well
2021-11-26 00:59:49 +0100 <Vermoot> Thank you very much for fighting for me to make this possible :D
2021-11-26 01:00:24 +0100 <Vermoot> but tbh I went back to (KeyMask, KeySym), and defined a custom keymask for meh
2021-11-26 01:00:31 +0100 <Vermoot> , ("C-S-M1-e", bindFirst [(className =? "discord", sendKey mod1Mask xK_Up)
2021-11-26 01:00:31 +0100 <Vermoot> , (pure True , sendKey mehMask xK_e)])
2021-11-26 01:00:45 +0100 <Vermoot> This is much more readable, and I actually understand it haha
2021-11-26 01:02:15 +0100 <geekosaur> yeh
2021-11-26 01:02:42 +0100 <geekosaur> that was why I suggested just using the KeyMask and KeySym to start with
2021-11-26 01:02:56 +0100 <geekosaur> sometimes being clever just isn't worth it
2021-11-26 01:10:06 +0100 <Vermoot> Well that definitely is a good tick in my todo list. Per-app shortcuts is done.
2021-11-26 01:10:19 +0100 <Vermoot> Thank you very much for your help, now it's time for me to go to bed
2021-11-26 01:10:22 +0100 <Vermoot> o/
2021-11-26 01:40:56 +0100noex(~noex@2600:8804:1280:aa0:5857:94a:25de:c513) (Quit: my dad's not a phone!)
2021-11-26 01:41:21 +0100noex(~null@2600:8804:1280:aa0:5857:94a:25de:c513)
2021-11-26 01:58:57 +0100mvk(~mvk@2607:fea8:5cc1:fa00::4702)
2021-11-26 02:24:31 +0100catman(~catman@user/catman) (Ping timeout: 250 seconds)
2021-11-26 03:34:42 +0100catman(~catman@user/catman)
2021-11-26 03:44:33 +0100catman(~catman@user/catman) (Quit: WeeChat 3.4-dev)
2021-11-26 03:46:59 +0100catman(~catman@user/catman)
2021-11-26 04:01:36 +0100benin(~benin@183.82.179.164) (Ping timeout: 245 seconds)
2021-11-26 04:02:02 +0100benin(~benin@183.82.179.164)
2021-11-26 04:03:41 +0100banc(banc@gateway/vpn/airvpn/banc) (Ping timeout: 245 seconds)
2021-11-26 04:10:58 +0100catman(~catman@user/catman) (Quit: WeeChat 3.4-dev)
2021-11-26 04:14:16 +0100catman(~catman@user/catman)
2021-11-26 04:22:12 +0100banc(banc@gateway/vpn/airvpn/banc)
2021-11-26 04:24:12 +0100td_(~td@94.134.91.22) (Ping timeout: 256 seconds)
2021-11-26 04:26:09 +0100td_(~td@94.134.91.33)
2021-11-26 04:43:07 +0100gruntsplatter(~sogens@gateway/vpn/pia/sogens)
2021-11-26 04:49:13 +0100catman(~catman@user/catman) (Quit: WeeChat 3.4-dev)
2021-11-26 05:01:17 +0100catman(~catman@user/catman)
2021-11-26 05:11:37 +0100gruntsplatter(~sogens@gateway/vpn/pia/sogens) (Quit: WeeChat 3.3)
2021-11-26 05:22:31 +0100catman_(~catman@user/catman)
2021-11-26 05:23:03 +0100catman(~catman@user/catman) (Killed (platinum.libera.chat (Nickname regained by services)))
2021-11-26 05:23:03 +0100catman_catman
2021-11-26 07:30:13 +0100qbt(~qbt@user/edun)
2021-11-26 07:39:56 +0100srk(~sorki@user/srk) (Ping timeout: 245 seconds)
2021-11-26 07:57:01 +0100benin(~benin@183.82.179.164) (Ping timeout: 245 seconds)
2021-11-26 07:59:57 +0100benin(~benin@183.82.179.164)
2021-11-26 08:23:19 +0100Solidnow remembers that he wanted to redo EZConfigs parsing to use a wrapped ReadP with sane behaviour
2021-11-26 08:23:41 +0100 <Solid> it's nice that we can get a genuinely commutative parser, but it's just a pain to use in practice
2021-11-26 08:24:02 +0100 <Solid> but since EZConfigs parsers are exported, that'd be a breaking change :/
2021-11-26 09:52:33 +0100cfricke(~cfricke@user/cfricke)
2021-11-26 10:17:38 +0100allbery_b(~geekosaur@xmonad/geekosaur)
2021-11-26 10:17:38 +0100geekosaur(~geekosaur@xmonad/geekosaur) (Killed (NickServ (GHOST command used by allbery_b)))
2021-11-26 10:17:41 +0100allbery_bgeekosaur
2021-11-26 10:19:01 +0100mc47(~mc47@xmonad/TheMC47)
2021-11-26 10:38:55 +0100srk(~sorki@user/srk)
2021-11-26 12:14:54 +0100 <Vermoot> Is there a smart/easy way to have a keybind do something, but also pass the keybind through?
2021-11-26 12:15:49 +0100 <Vermoot> Kind of like `clickJustFocuses = false` for a keybind. You *do* do an action, but also pass the keybind to the focused window
2021-11-26 12:20:37 +0100 <Vermoot> For now I just sendKey the binding, but I'd prefer a solution that doesn't require me to modify it for different bindings
2021-11-26 12:41:04 +0100 <geekosaur> there is not; once the X server upgrades the passive grab to an active one, all keys go to xmonad and the best you can do is sendKey
2021-11-26 12:43:29 +0100 <Vermoot> ok
2021-11-26 12:43:35 +0100 <Vermoot> That'll do then
2021-11-26 12:47:46 +0100vanvik4(~vanvik@82.194.204.210)
2021-11-26 12:48:53 +0100smashgra_(~smashgrab@bare.metal.computer)
2021-11-26 12:49:04 +0100jsoo_(~znc@irc.refl.club)
2021-11-26 12:51:25 +0100Eoco_(~ian@x-160-94-179-157.acm.umn.edu)
2021-11-26 12:54:57 +0100dschrempf(~dominik@070-207.dynamic.dsl.fonira.net)
2021-11-26 12:55:34 +0100eblip(~eb0t@90.199.243.141)
2021-11-26 12:55:59 +0100qbt(~qbt@user/edun) (Ping timeout: 260 seconds)
2021-11-26 12:55:59 +0100jsoo(~znc@irc.refl.club) (Ping timeout: 260 seconds)
2021-11-26 12:55:59 +0100rundown(~eb0t@90.199.243.141) (Ping timeout: 260 seconds)
2021-11-26 12:55:59 +0100Eoco(~ian@x-160-94-179-157.acm.umn.edu) (Ping timeout: 260 seconds)
2021-11-26 12:56:00 +0100vanvik(~vanvik@82.194.204.210) (Ping timeout: 260 seconds)
2021-11-26 12:56:00 +0100smashgrab(~smashgrab@bare.metal.computer) (Ping timeout: 260 seconds)
2021-11-26 12:56:01 +0100vanvik4vanvik
2021-11-26 13:04:00 +0100qbt(~qbt@user/edun)
2021-11-26 13:04:22 +0100qbt(~qbt@user/edun) (Remote host closed the connection)
2021-11-26 13:04:39 +0100qbt(~qbt@user/edun)
2021-11-26 13:16:11 +0100benin(~benin@183.82.179.164) (Ping timeout: 245 seconds)
2021-11-26 13:28:13 +0100benin(~benin@183.82.179.164)
2021-11-26 13:46:21 +0100cfricke(~cfricke@user/cfricke) (Ping timeout: 250 seconds)
2021-11-26 13:47:39 +0100cfricke(~cfricke@user/cfricke)
2021-11-26 14:53:53 +0100mc47(~mc47@xmonad/TheMC47) (Remote host closed the connection)
2021-11-26 15:28:20 +0100eblip(~eb0t@90.199.243.141) (Quit: WeeChat 3.0)
2021-11-26 16:25:24 +0100dschrempf(~dominik@070-207.dynamic.dsl.fonira.net) (Quit: WeeChat 3.3)
2021-11-26 16:53:30 +0100seschwar(~seschwar@user/seschwar)
2021-11-26 17:44:46 +0100qbt(~qbt@user/edun) (Quit: Leaving.)
2021-11-26 17:47:45 +0100cfricke(~cfricke@user/cfricke) (Quit: WeeChat 3.3)
2021-11-26 18:11:19 +0100qbt(~qbt@user/edun)
2021-11-26 18:16:16 +0100qbt(~qbt@user/edun) (Quit: Leaving.)
2021-11-26 18:22:37 +0100geekosaur(~geekosaur@xmonad/geekosaur) (Remote host closed the connection)
2021-11-26 18:24:18 +0100geekosaur(~geekosaur@xmonad/geekosaur)
2021-11-26 18:54:03 +0100benin(~benin@183.82.179.164) (Quit: The Lounge - https://thelounge.chat)
2021-11-26 18:54:54 +0100benin(~benin@183.82.179.164)
2021-11-26 19:02:07 +0100geekosaur(~geekosaur@xmonad/geekosaur) (Remote host closed the connection)
2021-11-26 19:06:14 +0100geekosaur(~geekosaur@xmonad/geekosaur)
2021-11-26 19:10:49 +0100benin(~benin@183.82.179.164) (Quit: The Lounge - https://thelounge.chat)
2021-11-26 19:13:58 +0100benin(~benin@183.82.179.164)
2021-11-26 19:17:42 +0100benin(~benin@183.82.179.164) (Client Quit)
2021-11-26 19:18:13 +0100kiyit63504[m](~kiyit6350@2001:470:69fc:105::1:3e8a)
2021-11-26 19:27:31 +0100vanvik(~vanvik@82.194.204.210) (Quit: Later)
2021-11-26 19:27:53 +0100vanvik(~vanvik@82.194.204.210)
2021-11-26 19:32:31 +0100catman(~catman@user/catman) (Quit: WeeChat 3.4-dev)
2021-11-26 19:40:01 +0100catman(~catman@user/catman)
2021-11-26 20:32:08 +0100MrNobody_0000000(~MrNobody@user/mrnobody-0000000/x-9129771)
2021-11-26 20:46:16 +0100 <FOSSHuman[m]> How would I create a keybind with additionalKeysP that can shift all windows in the focused workspace to another one? I've looked at some other configs that do this, but they used myKeys to do this + a Zipper function and a list from 0-9... Is there a way to do some kind of list comprehension in additionalKeysP??
2021-11-26 20:47:47 +0100 <FOSSHuman[m]> FOSSHuman[m]: (IIRC)
2021-11-26 20:49:41 +0100 <geekosaur> I wouldn't use a list comprehension, I'd just get the focused workspace and shift each window in {focus, up, down}
2021-11-26 21:37:11 +0100VarikValefor[m](~varikvale@2001:470:69fc:105::a5d) (Ping timeout: 250 seconds)
2021-11-26 21:37:24 +0100VarikValefor[m](~varikvale@2001:470:69fc:105::a5d)
2021-11-26 21:51:59 +0100mc47(~mc47@xmonad/TheMC47)
2021-11-26 21:56:09 +0100cyr4x3(~cyr4x3@139.47.118.87)
2021-11-26 22:10:37 +0100 <Vermoot> Can't you just cobble something together with `map` and `Stack`, allowing you to move every window in the stack with one function call?
2021-11-26 22:12:10 +0100 <geekosaur> hm, a Stack is Traversable… that might be crazy enough to work
2021-11-26 22:12:24 +0100 <Vermoot> I have no idea what that means, but alright :D
2021-11-26 22:12:49 +0100 <geekosaur> you can traverse the Window-s in a Stack
2021-11-26 22:14:03 +0100 <geekosaur> although maybe fold would be good enough, z is the original StackSet and f is either shiftWin or flip shiftWin, I forget which
2021-11-26 22:15:20 +0100 <geekosaur> :t foldr
2021-11-26 22:15:21 +0100 <lambdabot> Foldable t => (a -> b -> b) -> b -> t a -> b
2021-11-26 22:16:21 +0100dschrempf(~dominik@070-207.dynamic.dsl.fonira.net)
2021-11-26 22:18:31 +0100 <geekosaur> windows (\ss -> foldr shiftWin ss ((stack . workspace . current) ss)) -- maybe?
2021-11-26 22:19:02 +0100 <geekosaur> no, that's missing the destination
2021-11-26 22:19:23 +0100 <geekosaur> \tag -> windows (\ss -> foldr (shiftWin tag) ss ((stack . workspace . current) ss)) -- maybe?
2021-11-26 22:19:33 +0100 <geekosaur> where tag is the destination workspace
2021-11-26 22:21:36 +0100 <geekosaur> ofc if you always want the same tag you can remove the \tag -> and hardcode the tag in the shiftWin
2021-11-26 22:25:50 +0100 <geekosaur> missing a lot of W. and I get a type error after fixing it :(
2021-11-26 22:29:33 +0100 <geekosaur> *Main W> :t windows (\ss -> foldr (W.shiftWin "2") ss ((W.integrate' . W.stack . W.workspace . W.current) ss))
2021-11-26 22:29:33 +0100 <geekosaur> windows (\ss -> foldr (W.shiftWin "2") ss ((W.integrate' . W.stack . W.workspace . W.current) ss))
2021-11-26 22:29:33 +0100 <geekosaur> :: X ()
2021-11-26 22:30:01 +0100 <geekosaur> replace "2" with your chosen tag
2021-11-26 22:43:10 +0100 <geekosaur> FOSSHuman[m], ^^
2021-11-26 22:54:29 +0100alternateved(~user@staticline-31-183-149-3.toya.net.pl)
2021-11-26 23:18:49 +0100cyr4x3(~cyr4x3@139.47.118.87) (Quit: WeeChat 2.3)
2021-11-26 23:47:26 +0100dschrempf(~dominik@070-207.dynamic.dsl.fonira.net) (Quit: WeeChat 3.3)