Home liberachat/#xmonad: Logs Calendar

Logs: liberachat/#xmonad

←Prev  Next→
Page 1 .. 357 358 359 360 361 362 363 364 365 366 367 .. 1847
184,666 events total
2021-11-25 18:29:12 geekosaur joins (~geekosaur@xmonad/geekosaur)
2021-11-25 19:17:21 dschrempf joins (~dominik@070-207.dynamic.dsl.fonira.net)
2021-11-25 19:44:31 × dschrempf quits (~dominik@070-207.dynamic.dsl.fonira.net) (Ping timeout: 245 seconds)
2021-11-25 20:03:35 dschrempf joins (~dominik@070-207.dynamic.dsl.fonira.net)
2021-11-25 20:14:51 × dschrempf quits (~dominik@070-207.dynamic.dsl.fonira.net) (Ping timeout: 260 seconds)
2021-11-25 20:22:36 qbt joins (~qbt@user/edun)
2021-11-25 20:39:03 dschrempf joins (~dominik@070-207.dynamic.dsl.fonira.net)
2021-11-25 21:10:42 × dschrempf quits (~dominik@070-207.dynamic.dsl.fonira.net) (Ping timeout: 260 seconds)
2021-11-25 21:18:17 × qbt quits (~qbt@user/edun) (Quit: Leaving.)
2021-11-25 21:27:22 benin joins (~benin@183.82.179.164)
2021-11-25 22:11:28 × mc47 quits (~mc47@xmonad/TheMC47) (Remote host closed the connection)
2021-11-25 23:07:02 × seschwar quits (~seschwar@user/seschwar) (Quit: :wq)
2021-11-25 23:23:43 <Vermoot> Could someone help me use `parseKeyCombo` from EZUtil?
2021-11-25 23:24:35 <Vermoot> I was under the impression that I could use that wherever a keybind looking like `(modMask, xK_a)` was expected
2021-11-25 23:25:00 <Vermoot> Allowing me to replace it with `parseKeyCombo "M-a"`
2021-11-25 23:25:16 <Vermoot> So this is the line I have here:
2021-11-25 23:25:20 <Vermoot> ` , ("C-S-M1-e", bindFirst [(className =? "Discord", sendKey parseKeyCombo "M1-<Up>") , (pure True, sendKey parseKeyCombo "M1-Down")])`
2021-11-25 23:26:20 <geekosaur> first off, that'd be sendKey (parseKeyCombo "M1-<Up>")
2021-11-25 23:26:22 <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-25 23:26:27 <Vermoot> AH
2021-11-25 23:26:34 <geekosaur> otherweise you are sending the parseKeyCombo function
2021-11-25 23:26:46 <Vermoot> Oh, and not its result?
2021-11-25 23:26:58 <geekosaur> but you still have a problem because it returns a result in ReadP, not directly a (KeyMask,KeySym)
2021-11-25 23:27:12 <geekosaur> think map foo list
2021-11-25 23:27:40 <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-25 23:28:03 <Vermoot> Man this is something I still have trouble wrapping my head around
2021-11-25 23:28:11 <geekosaur> because that'd be even more confusing than missing/extra parameters already are, if you mess up
2021-11-25 23:28:25 <Vermoot> Which is problematic because as I understand it it's kinda the whole thing of functionnal programming
2021-11-25 23:29:53 <Vermoot> Alright so I can't use parseKeyCombo in that way?
2021-11-25 23:30:52 <geekosaur> now: ReadP is a parser. you use readP_to_S to run it on a String
2021-11-25 23:31:07 <geekosaur> (see Text.ParserCombinators.ReadP)
2021-11-25 23:31:42 <geekosaur> you are also missing the XConfig parameter that parseKeyCombo needs, so it knows how to translate "M-"
2021-11-25 23:31:56 <Vermoot> Sooo.... `readP_to_S parseKeyCombo "M1-<Up>"?
2021-11-25 23:33:08 <geekosaur> sendKey (readP_to_S (parseKeyCombo def) "M1-<Up>")
2021-11-25 23:33:22 <Vermoot> phew
2021-11-25 23:33:48 <Vermoot> Might wanna define a function for an easier call to that :D
2021-11-25 23:33:56 <geekosaur> if you need "M-" to work then you replace `def` with something like `def {modMask = mod4Mask}`
2021-11-25 23:37:38 <Vermoot> readP_to_S is not in scope
2021-11-25 23:37:41 <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-25 23:37:55 <geekosaur> [25 23:31:07] <geekosaur> (see Text.ParserCombinators.ReadP)
2021-11-25 23:38:21 <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-25 23:40:32 <Vermoot> * Couldn't match expected type `X ()`
2021-11-25 23:40:32 <Vermoot> with actual type `KeySym -> X ()`
2021-11-25 23:40:32 <Vermoot> * Probable cause: `sendKey` is applied to too few arguments
2021-11-25 23:40:32 <Vermoot> In the expression:
2021-11-25 23:40:33 <Vermoot> sendKey (readP_to_S (parseKeyCombo def) "M1-<Up>")
2021-11-25 23:40:42 <Vermoot> oops, sorry for the spam paste
2021-11-25 23:41:24 <geekosaur> hm, let me look up sendKey
2021-11-25 23:42:20 <geekosaur> sendKey does not want a tuple such as parseKeyCombo returns, it wants them as separate parameters
2021-11-25 23:42:37 <Vermoot> Ah, yeah ok I see that
2021-11-25 23:42:49 <Vermoot> So uh, map?
2021-11-25 23:42:53 <Vermoot> no
2021-11-25 23:43:21 <geekosaur> uncurry sendKey (readP_to_S (parseKeyCombo def) "M1-<Up>")
2021-11-25 23:43:56 <Vermoot> * Couldn't match expected type `(KeyMask, KeySym)`
2021-11-25 23:43:56 <Vermoot> with actual type `[((KeyMask, KeySym), String)]`
2021-11-25 23:44:02 <Vermoot> Damn this is hard haha
2021-11-25 23:44:14 <geekosaur> yeh, lemme think this through a bit more
2021-11-25 23:44:43 <Vermoot> Then I'll really have to define a function to make all of this easier to reuse multiple times :D
2021-11-25 23:45:31 <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-25 23:46:28 <geekosaur> oh, right, I'm forgetting ReadP parsers provide a list of results
2021-11-25 23:46:40 <geekosaur> where you almost always care only about the first one, and only its fst
2021-11-25 23:46:51 <geekosaur> this is really the wrong way to go about things…
2021-11-25 23:47:14 <geekosaur> uncurry sendKey (fst (head (readP_to_S (parseKeyCombo def) "M1-<Up>")))
2021-11-25 23:47:40 <geekosaur> and don't get your string wrong because this will throw a runtime error if you do
2021-11-25 23:48:11 <Vermoot> which means the end of my xmonad session without an ability to do anything then?
2021-11-25 23:48:36 <geekosaur> right
2021-11-25 23:49:07 <geekosaur> you'd have to replace `head` with something smarter, and "smarter" may be difficult or at least annoying here
2021-11-25 23:50:16 <Vermoot> Ok so uh
2021-11-25 23:50:26 <Vermoot> Compiles, and no runtime error
2021-11-25 23:50:47 <Vermoot> But I just get an `m` instead of `M1-<Up>`
2021-11-25 23:51:08 <Vermoot> Now I feel *really* lost haha
2021-11-25 23:52:46 <geekosaur> oh damn, ReadP can't make this easy, can it?
2021-11-25 23:52:59 <Vermoot> I thought finding bindFirst, sendKey and parseKeyCombo would make this all pretty straightforward
2021-11-25 23:53:13 <geekosaur> it returns three possible parses. the *third* is correct (has an empty suffix)
2021-11-25 23:53:59 <geekosaur> and this won't be fixed because it'll depend on how complex the string is that's being parsed :(
2021-11-25 23:54:47 <Vermoot> I guess uh... (KeyMask, KeySym) doesn't look too bad at this point
2021-11-25 23:55:17 <geekosaur> *Main Text.ParserCombinators.ReadP XMonad.Util.EZConfig XMonad.Util.Paste> fst (last (readP_to_S (parseKeyCombo def) "M1-<Up>"))
2021-11-25 23:55:18 <geekosaur> (8,65362)
2021-11-25 23:55:47 <Vermoot> whut
2021-11-25 23:56:52 <geekosaur> *Main Text.ParserCombinators.ReadP XMonad.Util.EZConfig XMonad.Util.Paste> fst (last (readP_to_S (parseKeyCombo def) "M1-<Down>"))
2021-11-25 23:56:53 <geekosaur> (8,65364)
2021-11-25 23:57:07 <geekosaur> so `last` in place of `head`
2021-11-25 23:58:01 <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-25 23:59:37 <Vermoot> Well
2021-11-25 23:59:49 <Vermoot> Thank you very much for fighting for me to make this possible :D
2021-11-26 00:00:24 <Vermoot> but tbh I went back to (KeyMask, KeySym), and defined a custom keymask for meh
2021-11-26 00:00:31 <Vermoot> , ("C-S-M1-e", bindFirst [(className =? "discord", sendKey mod1Mask xK_Up)
2021-11-26 00:00:31 <Vermoot> , (pure True , sendKey mehMask xK_e)])
2021-11-26 00:00:45 <Vermoot> This is much more readable, and I actually understand it haha
2021-11-26 00:02:15 <geekosaur> yeh
2021-11-26 00:02:42 <geekosaur> that was why I suggested just using the KeyMask and KeySym to start with
2021-11-26 00:02:56 <geekosaur> sometimes being clever just isn't worth it
2021-11-26 00:10:06 <Vermoot> Well that definitely is a good tick in my todo list. Per-app shortcuts is done.
2021-11-26 00:10:19 <Vermoot> Thank you very much for your help, now it's time for me to go to bed
2021-11-26 00:10:22 <Vermoot> o/
2021-11-26 00:40:56 × noex quits (~noex@2600:8804:1280:aa0:5857:94a:25de:c513) (Quit: my dad's not a phone!)
2021-11-26 00:41:21 noex joins (~null@2600:8804:1280:aa0:5857:94a:25de:c513)
2021-11-26 00:58:57 mvk joins (~mvk@2607:fea8:5cc1:fa00::4702)
2021-11-26 01:24:31 × catman quits (~catman@user/catman) (Ping timeout: 250 seconds)
2021-11-26 02:34:42 catman joins (~catman@user/catman)

All times are in UTC.