[xmonad] [SOLVED] Re: Complex hotkeys definition
mito
info at mito-space.com
Mon Jan 17 20:44:54 UTC 2022
-- Awesome!
, ("M-2", spawn "something" *> windows (W.view "2"))
did it!
>> race condition:
Thanks for the hint; maybe I can use that later.
Anyway, in fact I don't want to spawn "konsole" but "xdotool" with a key
combo (for some KDE5 action) – and so far it's working great! ^^
Am 17.01.22 um 21:10 schrieb Brandon Allbery:
> You have two problems. The first is that `$` extends as far as
> possible, so `spawn` ends up being grouped with `W.view` instead of
> with `windows`; fix this by using explicit parentheses instead of `$`,
> that is `windows (W.view "2")`. The second is that the correct
> operator to use is either `*>` or `>>`.
>
> Although you will then discover a third problem, which is a race
> condition because `spawn` is asynchronous (Linux is not Windows),
> meaning sometimes the new window will open on the previously active
> workspace. You may want to use
> https://hackage.haskell.org/package/xmonad-contrib-0.17.0/docs/XMonad-Actions-SpawnOn.html#v:spawnOn
> instead (don't forget to add
> https://hackage.haskell.org/package/xmonad-contrib-0.17.0/docs/XMonad-Actions-SpawnOn.html#v:manageSpawn
> to the `manageHook` or it won't work).
>
> On Mon, Jan 17, 2022 at 2:44 PM mito <info at mito-space.com> wrote:
>> Dear all,
>>
>> yet I failed properly occasionally extending "myHotkeys" commands with
>> additional arguments, e.g. like also spawning something when switching
>> workspaces.
>>
>> Say, the default is something like:
>>
>> myHotkeys = [
>> ...
>> , ("M-2", windows $ W.view "2")
>> ...
>> ]
>>
>> for hitting <Super_L+2> for changing to workspace "2".
>>
>> But what if I wanted to additionally execute some extra command or app –
>> such as launching "konsole" (just for testing; I am going to do
>> something else)?
>>
>> Simply editing and adding stuff link
>>
>> , ("M-2", windows $ W.view "2" $ spawn "konsole")
>> or
>> , ("M-2", windows $ W.view "2" . spawn "konsole")
>> or
>> , ("M-2", windows $ W.view "2" || spawn "konsole")
>> or
>> , ("M-2", windows $ W.view "2" <+> spawn "konsole")
>>
>> doesn't work, due to compilation errors.
>>
>> I am no programmer and haven't yet found the right operators or order;
>> or am I missing brackets?
>> And I don't get the error logs in detail really.
>>
>> Thanks in advance!
>> _______________________________________________
>> xmonad mailing list
>> xmonad at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
>
>
More information about the xmonad
mailing list