Как связать несколько действий в manageHook в Xmonad?

Я пытаюсь получить эффект при открытии skype / discord из значка в трее, перемещает окно программы в определенное рабочее пространство "11:w-" и переключает текущий экран на это рабочее пространство. Моя проблема в том, что я не могу правильно понять типы.

myManageHook = composeAll . concat $
   [ [ className   =? t --> sequence [doShift "11:w-", screenWorkspace "11:w-"] | t <- rarelyUsedApps] ]

rarelyUsedApps = ["Skype", "discord"]

этот код вызывает ошибку

Error detected while loading xmonad configuration file: /home/i/.xmonad/xmonad.hs

xmonad.hs:268:33:
    Couldn't match type `[Data.Monoid.Endo WindowSet]'
                  with `Data.Monoid.Endo
                          (W.StackSet
                             WorkspaceId (Layout Window) Window ScreenId ScreenDetail)'
    Expected type: Query
                     (Data.Monoid.Endo
                        (W.StackSet
                           WorkspaceId (Layout Window) Window ScreenId ScreenDetail))
      Actual type: Query [Data.Monoid.Endo WindowSet]
    In the return type of a call of `sequence'
    In the second argument of `(-->)', namely
      `sequence [doShift "11:w-", screenWorkspace "11:w-"]'
    In the expression:
      className =? t
      --> sequence [doShift "11:w-", screenWorkspace "11:w-"]

xmonad.hs:268:60:
    Couldn't match type `X' with `Query'
    Expected type: Query (Data.Monoid.Endo WindowSet)
      Actual type: X (Maybe WorkspaceId)
    In the return type of a call of `screenWorkspace'
    In the expression: screenWorkspace "11:w-"
    In the first argument of `sequence', namely
      `[doShift "11:w-", screenWorkspace "11:w-"]'

xmonad.hs:268:76:
    Couldn't match expected type `ScreenId' with actual type `[Char]'
    In the first argument of `screenWorkspace', namely `"11:w-"'
    In the expression: screenWorkspace "11:w-"
    In the first argument of `sequence', namely
      `[doShift "11:w-", screenWorkspace "11:w-"]'

Please check the file for errors.

person Dmitriusan    schedule 15.08.2017    source источник


Ответы (1)


Я только что понял, что первая ошибка в приведенном выше коде заключается в том, что я передаю имя рабочего пространства вместо идентификатора рабочего пространства в screenWorkspace "11:w-". Кроме того, screenWorkspace - совершенно неподходящая функция для моей цели.

В любом случае обнаружил, что то, что я хочу, уже описано в вики https://wiki.haskell.org/Xmonad/General_xmonad.hs_config_tips#Shift_an_app_to_a_workspace_and_view_it

person Dmitriusan    schedule 16.08.2017