[xmonad] DynamicWorkspaceGroups persistent after reboot?

Alexis de BRUYN alexis.mailinglist at de-bruyn.fr
Thu Apr 10 17:35:41 UTC 2014


On 09.04.2014 21:09, Brent Yorgey wrote:
> On Tue, Apr 08, 2014 at 04:48:12PM +0200, Alexis de BRUYN wrote:
>> On 07.04.2014 19:00, Brent Yorgey wrote:
>>> On Sat, Mar 29, 2014 at 02:36:31PM +0100, Alexis de BRUYN wrote:
>>>> Hi Everybody,
>>>>
>>>> Is there a way make the WSGroup persistent after reboot with
>>>> XMonad.Actions.DynamicWorkspaceGroups?
>>>>
>>>> Can we define statically the WSGroup? With addWSGroup?
>>>
>>> Hi Alexis,
>> Hi Brent,
>>
>>> Apologies for the delay in responding.  Yes, to statically define some
>> No problem.
>>
>>> WSGroups it should suffice to put some calls to addWSGroup in your
>>> startupHook.  Let me know if you have any trouble.
>> Actually I can set my Groups with addWSGroup in my startupHook, but only
>> a group is created if the workspaces are displayed on screens.
>>
>> eg :
>> myWorkspaces = ["1", "2", "3", "4", "5", "6"]
>>
>> myStartupHook = do
>>                 addWSGroup "g1" ["1", "2", "3"]
>>                 addWSGroup "g2" ["4", "5", "6"]
>>
>> After restarting xmonad, only g1 is created (and "1", "2" & "3" are
>> displayed as usual).
> 
> Oh, sorry, I see what is wrong.  DynamicWorkspaceGroups remembers not
> just the names of the workspaces but which screens they were on (so
> that the same workspaces will always be displayed on the same screens
> when you switch to a workspace group).  So addWSGroup only looks among
> the currently displayed workspaces, because otherwise it does not know
> which screen id to use for each workspace.
> 
> The following function should achieve what you want:
> 
>   import qualified Data.Map                    as M
>   import qualified XMonad.Util.ExtensibleState as XS
> 
>   addWSGroup' :: WSGroupId -> [(ScreenId, WorkspaceId)] -> X ()
>   addWSGroup' name = XS.modify . withWSG . M.insert name
I have got the following error:
xmonad.hs:27:32: Not in scope: `withWSG'

Thanks for your help.
> 
> Now you have to explicitly give it screen ID's, of course, like
> 
>   myStartupHook = do
>     addWSGroup' "g1" [(S 0, "1"), (S 1, "2"), (S 2, "3")]
>     ... etc.
> 
> Unfortunately I do not remember whether there is any guarantee about
> the numbering of screens being consecutive or even being the same
> between different runs of xmonad.  You will have to experiment a bit.
> 
> -Brent

-- 
Alexis de BRUYN


More information about the xmonad mailing list