workspaces conditional on host name

Dear All, I use XMonad on different machines. The configuration is identical, except for the default workspaces, so I'd like to have the config file set the default workspaces automagically. Haskell ignorant here, but googling around I think I am almost there. These are, I think, the relevant pieces myWorkspaces = map show[1..7] myWorkspacesPhelsuma = map show[1..3] ++ ["top", "sync", "zot", "whats"] myWorkspacesTriturus = map show[1..2] ++ ["top", "sync"] main :: IO () main = do hostname <- io (getEnv "HOSTNAME") let myWorkspaces = case hostname of "Phelsuma" -> myWorkspacesPhelsuma "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces xmonad $ ewmh $ dynamicProjects myProjects $ withNavigation2DConfig def $ docks $ withEasySB (statusBarProp "xmobar ~/.xmonad/.xmobarrc" (pure myXmobarPP)) defToggleStrutsKey $ myConfig myConfig = def { --- blablabla workspaces = myWorkspaces } However, I keep getting an error: • Couldn't match expected type ‘Maybe String’ with actual type ‘[Char]’ • In the pattern: "Phelsuma" In a case alternative: "Phelsuma" -> myWorkspacesPhelsuma In the expression: case hostname of "Phelsuma" -> myWorkspacesPhelsuma "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces | 882 | "Phelsuma" -> myWorkspacesPhelsuma | ^^^^^^^^^^ (and the same error for the second entry, "Triturus") This I think should be fairly easy to fix, but I can't find how. I tried writing the case section as let myWorkspaces = case hostname of Just "Phelsuma" -> myWorkspacesPhelsuma Just "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces and that does not give me an error, but it seems to ignore the actual hostname and uses the "default" one (the one with workspaces 1 to 7). So I think I am using "Just" incorrectly and possibly also misunderstanding how "let" works in main. Any suggestions? Thanks, -- Ramon Diaz-Uriarte Department of Biochemistry, Lab B-31 Facultad de Medicina Universidad Autónoma de Madrid Arzobispo Morcillo, 4 28029 Madrid Spain Phone: +34-91-497-2412 Email: rdiaz02@gmail.com r.diaz@uam.es https://ligarto.org/rdiaz

That should actually be fine. Check the case of your hostname? You
might want to drop a `print hostname` before the `let` and then check
the session log.
On Mon, Sep 19, 2022 at 12:02 PM Ramon Diaz-Uriarte
Dear All,
I use XMonad on different machines. The configuration is identical, except for the default workspaces, so I'd like to have the config file set the default workspaces automagically. Haskell ignorant here, but googling around I think I am almost there. These are, I think, the relevant pieces
myWorkspaces = map show[1..7] myWorkspacesPhelsuma = map show[1..3] ++ ["top", "sync", "zot", "whats"] myWorkspacesTriturus = map show[1..2] ++ ["top", "sync"]
main :: IO () main = do hostname <- io (getEnv "HOSTNAME") let myWorkspaces = case hostname of "Phelsuma" -> myWorkspacesPhelsuma "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces xmonad $ ewmh $ dynamicProjects myProjects $ withNavigation2DConfig def $ docks $ withEasySB (statusBarProp "xmobar ~/.xmonad/.xmobarrc" (pure myXmobarPP)) defToggleStrutsKey $ myConfig
myConfig = def { --- blablabla workspaces = myWorkspaces }
However, I keep getting an error:
• Couldn't match expected type ‘Maybe String’ with actual type ‘[Char]’ • In the pattern: "Phelsuma" In a case alternative: "Phelsuma" -> myWorkspacesPhelsuma In the expression: case hostname of "Phelsuma" -> myWorkspacesPhelsuma "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces | 882 | "Phelsuma" -> myWorkspacesPhelsuma | ^^^^^^^^^^
(and the same error for the second entry, "Triturus")
This I think should be fairly easy to fix, but I can't find how. I tried writing the case section as
let myWorkspaces = case hostname of Just "Phelsuma" -> myWorkspacesPhelsuma Just "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces
and that does not give me an error, but it seems to ignore the actual hostname and uses the "default" one (the one with workspaces 1 to 7). So I think I am using "Just" incorrectly and possibly also misunderstanding how "let" works in main.
Any suggestions?
Thanks,
-- Ramon Diaz-Uriarte Department of Biochemistry, Lab B-31 Facultad de Medicina Universidad Autónoma de Madrid Arzobispo Morcillo, 4 28029 Madrid Spain
Phone: +34-91-497-2412
Email: rdiaz02@gmail.com r.diaz@uam.es
https://ligarto.org/rdiaz _______________________________________________ xmonad mailing list xmonad@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
-- brandon s allbery kf8nh allbery.b@gmail.com

Hi! It looks like `myWorkspaces` in `myConfig` definition is referencing this defintion: myWorkspaces = map show[1..7] instead of the one you actually want. Maybe try adding workspaces as an argument to `myConfig`? Something like this: myConfig workspaces = def { --- blablabla workspaces = workspaces } main :: IO () main = do hostname <- io (getEnv "HOSTNAME") let workspaces = case hostname of Just "Phelsuma" -> myWorkspacesPhelsuma Just "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces xmonad $ ewmh $ dynamicProjects myProjects $ withNavigation2DConfig def $ docks $ withEasySB (statusBarProp "xmobar ~/.xmonad/.xmobarrc" (pure myXmobarPP)) defToggleStrutsKey $ myConfig workspaces -- Best regards, Platon Pronko PGP 2A62D77A7A2CB94E On 2022-09-19 19:01, Ramon Diaz-Uriarte wrote:
Dear All,
I use XMonad on different machines. The configuration is identical, except for the default workspaces, so I'd like to have the config file set the default workspaces automagically. Haskell ignorant here, but googling around I think I am almost there. These are, I think, the relevant pieces
myWorkspaces = map show[1..7] myWorkspacesPhelsuma = map show[1..3] ++ ["top", "sync", "zot", "whats"] myWorkspacesTriturus = map show[1..2] ++ ["top", "sync"]
main :: IO () main = do hostname <- io (getEnv "HOSTNAME") let myWorkspaces = case hostname of "Phelsuma" -> myWorkspacesPhelsuma "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces xmonad $ ewmh $ dynamicProjects myProjects $ withNavigation2DConfig def $ docks $ withEasySB (statusBarProp "xmobar ~/.xmonad/.xmobarrc" (pure myXmobarPP)) defToggleStrutsKey $ myConfig
myConfig = def { --- blablabla workspaces = myWorkspaces }
However, I keep getting an error:
• Couldn't match expected type ‘Maybe String’ with actual type ‘[Char]’ • In the pattern: "Phelsuma" In a case alternative: "Phelsuma" -> myWorkspacesPhelsuma In the expression: case hostname of "Phelsuma" -> myWorkspacesPhelsuma "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces | 882 | "Phelsuma" -> myWorkspacesPhelsuma | ^^^^^^^^^^
(and the same error for the second entry, "Triturus")
This I think should be fairly easy to fix, but I can't find how. I tried writing the case section as
let myWorkspaces = case hostname of Just "Phelsuma" -> myWorkspacesPhelsuma Just "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces
and that does not give me an error, but it seems to ignore the actual hostname and uses the "default" one (the one with workspaces 1 to 7). So I think I am using "Just" incorrectly and possibly also misunderstanding how "let" works in main.
Any suggestions?
Thanks,

Oh, I missed that. Yes, the `myWorkspaces` you set in `main` has
nothing to do with the global one which `myConfig` sees; you need to
pass the new one in. And possibly rename it so it's more obvious that
they're not related.
On Mon, Sep 19, 2022 at 1:30 PM Platon Pronko
Hi!
It looks like `myWorkspaces` in `myConfig` definition is referencing this defintion:
myWorkspaces = map show[1..7]
instead of the one you actually want. Maybe try adding workspaces as an argument to `myConfig`? Something like this:
myConfig workspaces = def { --- blablabla workspaces = workspaces }
main :: IO () main = do hostname <- io (getEnv "HOSTNAME") let workspaces = case hostname of Just "Phelsuma" -> myWorkspacesPhelsuma Just "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces xmonad $ ewmh $ dynamicProjects myProjects $ withNavigation2DConfig def $ docks $ withEasySB (statusBarProp "xmobar ~/.xmonad/.xmobarrc" (pure myXmobarPP)) defToggleStrutsKey $ myConfig workspaces
-- Best regards, Platon Pronko PGP 2A62D77A7A2CB94E
On 2022-09-19 19:01, Ramon Diaz-Uriarte wrote:
Dear All,
I use XMonad on different machines. The configuration is identical, except for the default workspaces, so I'd like to have the config file set the default workspaces automagically. Haskell ignorant here, but googling around I think I am almost there. These are, I think, the relevant pieces
myWorkspaces = map show[1..7] myWorkspacesPhelsuma = map show[1..3] ++ ["top", "sync", "zot", "whats"] myWorkspacesTriturus = map show[1..2] ++ ["top", "sync"]
main :: IO () main = do hostname <- io (getEnv "HOSTNAME") let myWorkspaces = case hostname of "Phelsuma" -> myWorkspacesPhelsuma "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces xmonad $ ewmh $ dynamicProjects myProjects $ withNavigation2DConfig def $ docks $ withEasySB (statusBarProp "xmobar ~/.xmonad/.xmobarrc" (pure myXmobarPP)) defToggleStrutsKey $ myConfig
myConfig = def { --- blablabla workspaces = myWorkspaces }
However, I keep getting an error:
• Couldn't match expected type ‘Maybe String’ with actual type ‘[Char]’ • In the pattern: "Phelsuma" In a case alternative: "Phelsuma" -> myWorkspacesPhelsuma In the expression: case hostname of "Phelsuma" -> myWorkspacesPhelsuma "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces | 882 | "Phelsuma" -> myWorkspacesPhelsuma | ^^^^^^^^^^
(and the same error for the second entry, "Triturus")
This I think should be fairly easy to fix, but I can't find how. I tried writing the case section as
let myWorkspaces = case hostname of Just "Phelsuma" -> myWorkspacesPhelsuma Just "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces
and that does not give me an error, but it seems to ignore the actual hostname and uses the "default" one (the one with workspaces 1 to 7). So I think I am using "Just" incorrectly and possibly also misunderstanding how "let" works in main.
Any suggestions?
Thanks,
_______________________________________________ xmonad mailing list xmonad@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
-- brandon s allbery kf8nh allbery.b@gmail.com

Dear Brandon and Platon,
Thanks a lot! I fixed it as suggested (use a new, different, variable name to hold the value from the let, and pass that to myConfig), and it now works. :-)
Actually, there was something else that was not working: when I print
io (getEnv "HOSTNAME")
and
io (getEnv "HOST")
I get Nothing in both cases. I do not understand why that happens, since
ramon@Phelsuma:~$ hostname
Phelsuma
ramon@Phelsuma:~$ echo $HOSTNAME
Phelsuma
Anyway, I solved it by setting in ~/.profile
export HOSTNAME_PROFILE_XMONAD=$HOSTNAME
And doing, in xmonad.hs
hostname <- io (getEnv "HOSTNAME_PROFILE_XMONAD")
Maybe it is related to how I call XMonad (it is called from /usr/bin/xmonad-session, which if I remember correctly I started doing because I use lxdm as display manager).
Thanks again.
Best,
R.
On Mon, 19-September-2022, at 19:33:08, Brandon Allbery
Oh, I missed that. Yes, the `myWorkspaces` you set in `main` has nothing to do with the global one which `myConfig` sees; you need to pass the new one in. And possibly rename it so it's more obvious that they're not related.
On Mon, Sep 19, 2022 at 1:30 PM Platon Pronko
wrote: Hi!
It looks like `myWorkspaces` in `myConfig` definition is referencing this defintion:
myWorkspaces = map show[1..7]
instead of the one you actually want. Maybe try adding workspaces as an argument to `myConfig`? Something like this:
myConfig workspaces = def { --- blablabla workspaces = workspaces }
main :: IO () main = do hostname <- io (getEnv "HOSTNAME") let workspaces = case hostname of Just "Phelsuma" -> myWorkspacesPhelsuma Just "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces xmonad $ ewmh $ dynamicProjects myProjects $ withNavigation2DConfig def $ docks $ withEasySB (statusBarProp "xmobar ~/.xmonad/.xmobarrc" (pure myXmobarPP)) defToggleStrutsKey $ myConfig workspaces
-- Best regards, Platon Pronko PGP 2A62D77A7A2CB94E
On 2022-09-19 19:01, Ramon Diaz-Uriarte wrote:
Dear All,
I use XMonad on different machines. The configuration is identical, except for the default workspaces, so I'd like to have the config file set the default workspaces automagically. Haskell ignorant here, but googling around I think I am almost there. These are, I think, the relevant pieces
myWorkspaces = map show[1..7] myWorkspacesPhelsuma = map show[1..3] ++ ["top", "sync", "zot", "whats"] myWorkspacesTriturus = map show[1..2] ++ ["top", "sync"]
main :: IO () main = do hostname <- io (getEnv "HOSTNAME") let myWorkspaces = case hostname of "Phelsuma" -> myWorkspacesPhelsuma "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces xmonad $ ewmh $ dynamicProjects myProjects $ withNavigation2DConfig def $ docks $ withEasySB (statusBarProp "xmobar ~/.xmonad/.xmobarrc" (pure myXmobarPP)) defToggleStrutsKey $ myConfig
myConfig = def { --- blablabla workspaces = myWorkspaces }
However, I keep getting an error:
• Couldn't match expected type ‘Maybe String’ with actual type ‘[Char]’ • In the pattern: "Phelsuma" In a case alternative: "Phelsuma" -> myWorkspacesPhelsuma In the expression: case hostname of "Phelsuma" -> myWorkspacesPhelsuma "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces | 882 | "Phelsuma" -> myWorkspacesPhelsuma | ^^^^^^^^^^
(and the same error for the second entry, "Triturus")
This I think should be fairly easy to fix, but I can't find how. I tried writing the case section as
let myWorkspaces = case hostname of Just "Phelsuma" -> myWorkspacesPhelsuma Just "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces
and that does not give me an error, but it seems to ignore the actual hostname and uses the "default" one (the one with workspaces 1 to 7). So I think I am using "Just" incorrectly and possibly also misunderstanding how "let" works in main.
Any suggestions?
Thanks,
_______________________________________________ xmonad mailing list xmonad@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
-- Ramon Diaz-Uriarte Department of Biochemistry, Lab B-31 Facultad de Medicina Universidad Autónoma de Madrid Arzobispo Morcillo, 4 28029 Madrid Spain Phone: +34-91-497-2412 Email: rdiaz02@gmail.com r.diaz@uam.es https://ligarto.org/rdiaz

You might check if `$HOSTNAME` is actually exported. There's a
difference between "exported" and merely "set" in most shells; use the
"export" command (or "env") to see which names are actually exported.
(On my Ubuntu system, `$HOSTNAME` isn't set at all.)
On Mon, Sep 19, 2022 at 3:41 PM Ramon Diaz-Uriarte
Dear Brandon and Platon,
Thanks a lot! I fixed it as suggested (use a new, different, variable name to hold the value from the let, and pass that to myConfig), and it now works. :-)
Actually, there was something else that was not working: when I print
io (getEnv "HOSTNAME")
and
io (getEnv "HOST")
I get Nothing in both cases. I do not understand why that happens, since
ramon@Phelsuma:~$ hostname Phelsuma ramon@Phelsuma:~$ echo $HOSTNAME Phelsuma
Anyway, I solved it by setting in ~/.profile
export HOSTNAME_PROFILE_XMONAD=$HOSTNAME
And doing, in xmonad.hs
hostname <- io (getEnv "HOSTNAME_PROFILE_XMONAD")
Maybe it is related to how I call XMonad (it is called from /usr/bin/xmonad-session, which if I remember correctly I started doing because I use lxdm as display manager).
Thanks again.
Best,
R.
On Mon, 19-September-2022, at 19:33:08, Brandon Allbery
wrote: Oh, I missed that. Yes, the `myWorkspaces` you set in `main` has nothing to do with the global one which `myConfig` sees; you need to pass the new one in. And possibly rename it so it's more obvious that they're not related.
On Mon, Sep 19, 2022 at 1:30 PM Platon Pronko
wrote: Hi!
It looks like `myWorkspaces` in `myConfig` definition is referencing this defintion:
myWorkspaces = map show[1..7]
instead of the one you actually want. Maybe try adding workspaces as an argument to `myConfig`? Something like this:
myConfig workspaces = def { --- blablabla workspaces = workspaces }
main :: IO () main = do hostname <- io (getEnv "HOSTNAME") let workspaces = case hostname of Just "Phelsuma" -> myWorkspacesPhelsuma Just "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces xmonad $ ewmh $ dynamicProjects myProjects $ withNavigation2DConfig def $ docks $ withEasySB (statusBarProp "xmobar ~/.xmonad/.xmobarrc" (pure myXmobarPP)) defToggleStrutsKey $ myConfig workspaces
-- Best regards, Platon Pronko PGP 2A62D77A7A2CB94E
On 2022-09-19 19:01, Ramon Diaz-Uriarte wrote:
Dear All,
I use XMonad on different machines. The configuration is identical, except for the default workspaces, so I'd like to have the config file set the default workspaces automagically. Haskell ignorant here, but googling around I think I am almost there. These are, I think, the relevant pieces
myWorkspaces = map show[1..7] myWorkspacesPhelsuma = map show[1..3] ++ ["top", "sync", "zot", "whats"] myWorkspacesTriturus = map show[1..2] ++ ["top", "sync"]
main :: IO () main = do hostname <- io (getEnv "HOSTNAME") let myWorkspaces = case hostname of "Phelsuma" -> myWorkspacesPhelsuma "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces xmonad $ ewmh $ dynamicProjects myProjects $ withNavigation2DConfig def $ docks $ withEasySB (statusBarProp "xmobar ~/.xmonad/.xmobarrc" (pure myXmobarPP)) defToggleStrutsKey $ myConfig
myConfig = def { --- blablabla workspaces = myWorkspaces }
However, I keep getting an error:
• Couldn't match expected type ‘Maybe String’ with actual type ‘[Char]’ • In the pattern: "Phelsuma" In a case alternative: "Phelsuma" -> myWorkspacesPhelsuma In the expression: case hostname of "Phelsuma" -> myWorkspacesPhelsuma "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces | 882 | "Phelsuma" -> myWorkspacesPhelsuma | ^^^^^^^^^^
(and the same error for the second entry, "Triturus")
This I think should be fairly easy to fix, but I can't find how. I tried writing the case section as
let myWorkspaces = case hostname of Just "Phelsuma" -> myWorkspacesPhelsuma Just "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces
and that does not give me an error, but it seems to ignore the actual hostname and uses the "default" one (the one with workspaces 1 to 7). So I think I am using "Just" incorrectly and possibly also misunderstanding how "let" works in main.
Any suggestions?
Thanks,
_______________________________________________ xmonad mailing list xmonad@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
-- Ramon Diaz-Uriarte Department of Biochemistry, Lab B-31 Facultad de Medicina Universidad Autónoma de Madrid Arzobispo Morcillo, 4 28029 Madrid Spain
Phone: +34-91-497-2412
Email: rdiaz02@gmail.com r.diaz@uam.es
-- brandon s allbery kf8nh allbery.b@gmail.com

Using environment variables to get hostname feels a bit unstable. I personally read /etc/hostname to determine the hostname, like this: hostname <- fmap trimString (readFile "/etc/hostname") where `trimString` is: trimString :: String -> String trimString = f . f where f = reverse . dropWhile isSpace There's also `hostname` package, which uses proper library functions to determine hostname: https://hackage.haskell.org/package/hostname -- Best regards, Platon Pronko PGP 2A62D77A7A2CB94E On 2022-09-19 23:05, Brandon Allbery wrote:
You might check if `$HOSTNAME` is actually exported. There's a difference between "exported" and merely "set" in most shells; use the "export" command (or "env") to see which names are actually exported. (On my Ubuntu system, `$HOSTNAME` isn't set at all.)
On Mon, Sep 19, 2022 at 3:41 PM Ramon Diaz-Uriarte
wrote: Dear Brandon and Platon,
Thanks a lot! I fixed it as suggested (use a new, different, variable name to hold the value from the let, and pass that to myConfig), and it now works. :-)
Actually, there was something else that was not working: when I print
io (getEnv "HOSTNAME")
and
io (getEnv "HOST")
I get Nothing in both cases. I do not understand why that happens, since
ramon@Phelsuma:~$ hostname Phelsuma ramon@Phelsuma:~$ echo $HOSTNAME Phelsuma
Anyway, I solved it by setting in ~/.profile
export HOSTNAME_PROFILE_XMONAD=$HOSTNAME
And doing, in xmonad.hs
hostname <- io (getEnv "HOSTNAME_PROFILE_XMONAD")
Maybe it is related to how I call XMonad (it is called from /usr/bin/xmonad-session, which if I remember correctly I started doing because I use lxdm as display manager).
Thanks again.
Best,
R.
On Mon, 19-September-2022, at 19:33:08, Brandon Allbery
wrote: Oh, I missed that. Yes, the `myWorkspaces` you set in `main` has nothing to do with the global one which `myConfig` sees; you need to pass the new one in. And possibly rename it so it's more obvious that they're not related.
On Mon, Sep 19, 2022 at 1:30 PM Platon Pronko
wrote: Hi!
It looks like `myWorkspaces` in `myConfig` definition is referencing this defintion:
myWorkspaces = map show[1..7]
instead of the one you actually want. Maybe try adding workspaces as an argument to `myConfig`? Something like this:
myConfig workspaces = def { --- blablabla workspaces = workspaces }
main :: IO () main = do hostname <- io (getEnv "HOSTNAME") let workspaces = case hostname of Just "Phelsuma" -> myWorkspacesPhelsuma Just "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces xmonad $ ewmh $ dynamicProjects myProjects $ withNavigation2DConfig def $ docks $ withEasySB (statusBarProp "xmobar ~/.xmonad/.xmobarrc" (pure myXmobarPP)) defToggleStrutsKey $ myConfig workspaces
-- Best regards, Platon Pronko PGP 2A62D77A7A2CB94E
On 2022-09-19 19:01, Ramon Diaz-Uriarte wrote:
Dear All,
I use XMonad on different machines. The configuration is identical, except for the default workspaces, so I'd like to have the config file set the default workspaces automagically. Haskell ignorant here, but googling around I think I am almost there. These are, I think, the relevant pieces
myWorkspaces = map show[1..7] myWorkspacesPhelsuma = map show[1..3] ++ ["top", "sync", "zot", "whats"] myWorkspacesTriturus = map show[1..2] ++ ["top", "sync"]
main :: IO () main = do hostname <- io (getEnv "HOSTNAME") let myWorkspaces = case hostname of "Phelsuma" -> myWorkspacesPhelsuma "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces xmonad $ ewmh $ dynamicProjects myProjects $ withNavigation2DConfig def $ docks $ withEasySB (statusBarProp "xmobar ~/.xmonad/.xmobarrc" (pure myXmobarPP)) defToggleStrutsKey $ myConfig
myConfig = def { --- blablabla workspaces = myWorkspaces }
However, I keep getting an error:
• Couldn't match expected type ‘Maybe String’ with actual type ‘[Char]’ • In the pattern: "Phelsuma" In a case alternative: "Phelsuma" -> myWorkspacesPhelsuma In the expression: case hostname of "Phelsuma" -> myWorkspacesPhelsuma "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces | 882 | "Phelsuma" -> myWorkspacesPhelsuma | ^^^^^^^^^^
(and the same error for the second entry, "Triturus")
This I think should be fairly easy to fix, but I can't find how. I tried writing the case section as
let myWorkspaces = case hostname of Just "Phelsuma" -> myWorkspacesPhelsuma Just "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces
and that does not give me an error, but it seems to ignore the actual hostname and uses the "default" one (the one with workspaces 1 to 7). So I think I am using "Just" incorrectly and possibly also misunderstanding how "let" works in main.
Any suggestions?
Thanks,
_______________________________________________ xmonad mailing list xmonad@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
-- Ramon Diaz-Uriarte Department of Biochemistry, Lab B-31 Facultad de Medicina Universidad Autónoma de Madrid Arzobispo Morcillo, 4 28029 Madrid Spain
Phone: +34-91-497-2412
Email: rdiaz02@gmail.com r.diaz@uam.es

Thanks! I'll give that a try (what I found interesting of using getEnv, though, is that it seems simple to use arbitrary variables I set for ad-hoc needs in .profile, even if it is kind of a kludge).
Best,
R.
On Tue, 20-September-2022, at 06:58:14, Platon Pronko
Using environment variables to get hostname feels a bit unstable. I personally read /etc/hostname to determine the hostname, like this:
hostname <- fmap trimString (readFile "/etc/hostname")
where `trimString` is:
trimString :: String -> String trimString = f . f where f = reverse . dropWhile isSpace
There's also `hostname` package, which uses proper library functions to determine hostname: https://hackage.haskell.org/package/hostname
-- Ramon Diaz-Uriarte Department of Biochemistry, Lab B-31 Facultad de Medicina Universidad Autónoma de Madrid Arzobispo Morcillo, 4 28029 Madrid Spain Phone: +34-91-497-2412 Email: rdiaz02@gmail.com r.diaz@uam.es https://ligarto.org/rdiaz

Thanks. I tried exporting it, by adding an explicit export to .bashrc, but it did not work; looking around, it seems that with some display managers and at least in Debian, .bashrc might not be read early enough; (at least in Debian), .profile seems a safer bet (which is what I've finally settled on).
Best,
R.
On Mon, 19-September-2022, at 22:05:20, Brandon Allbery
You might check if `$HOSTNAME` is actually exported. There's a difference between "exported" and merely "set" in most shells; use the "export" command (or "env") to see which names are actually exported. (On my Ubuntu system, `$HOSTNAME` isn't set at all.)
On Mon, Sep 19, 2022 at 3:41 PM Ramon Diaz-Uriarte
wrote: Dear Brandon and Platon,
Thanks a lot! I fixed it as suggested (use a new, different, variable name to hold the value from the let, and pass that to myConfig), and it now works. :-)
Actually, there was something else that was not working: when I print
io (getEnv "HOSTNAME")
and
io (getEnv "HOST")
I get Nothing in both cases. I do not understand why that happens, since
ramon@Phelsuma:~$ hostname Phelsuma ramon@Phelsuma:~$ echo $HOSTNAME Phelsuma
Anyway, I solved it by setting in ~/.profile
export HOSTNAME_PROFILE_XMONAD=$HOSTNAME
And doing, in xmonad.hs
hostname <- io (getEnv "HOSTNAME_PROFILE_XMONAD")
Maybe it is related to how I call XMonad (it is called from /usr/bin/xmonad-session, which if I remember correctly I started doing because I use lxdm as display manager).
Thanks again.
Best,
R.
On Mon, 19-September-2022, at 19:33:08, Brandon Allbery
wrote: Oh, I missed that. Yes, the `myWorkspaces` you set in `main` has nothing to do with the global one which `myConfig` sees; you need to pass the new one in. And possibly rename it so it's more obvious that they're not related.
On Mon, Sep 19, 2022 at 1:30 PM Platon Pronko
wrote: Hi!
It looks like `myWorkspaces` in `myConfig` definition is referencing this defintion:
myWorkspaces = map show[1..7]
instead of the one you actually want. Maybe try adding workspaces as an argument to `myConfig`? Something like this:
myConfig workspaces = def { --- blablabla workspaces = workspaces }
main :: IO () main = do hostname <- io (getEnv "HOSTNAME") let workspaces = case hostname of Just "Phelsuma" -> myWorkspacesPhelsuma Just "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces xmonad $ ewmh $ dynamicProjects myProjects $ withNavigation2DConfig def $ docks $ withEasySB (statusBarProp "xmobar ~/.xmonad/.xmobarrc" (pure myXmobarPP)) defToggleStrutsKey $ myConfig workspaces
-- Best regards, Platon Pronko PGP 2A62D77A7A2CB94E
On 2022-09-19 19:01, Ramon Diaz-Uriarte wrote:
Dear All,
I use XMonad on different machines. The configuration is identical, except for the default workspaces, so I'd like to have the config file set the default workspaces automagically. Haskell ignorant here, but googling around I think I am almost there. These are, I think, the relevant pieces
myWorkspaces = map show[1..7] myWorkspacesPhelsuma = map show[1..3] ++ ["top", "sync", "zot", "whats"] myWorkspacesTriturus = map show[1..2] ++ ["top", "sync"]
main :: IO () main = do hostname <- io (getEnv "HOSTNAME") let myWorkspaces = case hostname of "Phelsuma" -> myWorkspacesPhelsuma "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces xmonad $ ewmh $ dynamicProjects myProjects $ withNavigation2DConfig def $ docks $ withEasySB (statusBarProp "xmobar ~/.xmonad/.xmobarrc" (pure myXmobarPP)) defToggleStrutsKey $ myConfig
myConfig = def { --- blablabla workspaces = myWorkspaces }
However, I keep getting an error:
• Couldn't match expected type ‘Maybe String’ with actual type ‘[Char]’ • In the pattern: "Phelsuma" In a case alternative: "Phelsuma" -> myWorkspacesPhelsuma In the expression: case hostname of "Phelsuma" -> myWorkspacesPhelsuma "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces | 882 | "Phelsuma" -> myWorkspacesPhelsuma | ^^^^^^^^^^
(and the same error for the second entry, "Triturus")
This I think should be fairly easy to fix, but I can't find how. I tried writing the case section as
let myWorkspaces = case hostname of Just "Phelsuma" -> myWorkspacesPhelsuma Just "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces
and that does not give me an error, but it seems to ignore the actual hostname and uses the "default" one (the one with workspaces 1 to 7). So I think I am using "Just" incorrectly and possibly also misunderstanding how "let" works in main.
Any suggestions?
Thanks,
_______________________________________________ xmonad mailing list xmonad@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
-- Ramon Diaz-Uriarte Department of Biochemistry, Lab B-31 Facultad de Medicina Universidad Autónoma de Madrid Arzobispo Morcillo, 4 28029 Madrid Spain
Phone: +34-91-497-2412
Email: rdiaz02@gmail.com r.diaz@uam.es
-- Ramon Diaz-Uriarte Department of Biochemistry, Lab B-31 Facultad de Medicina Universidad Autónoma de Madrid Arzobispo Morcillo, 4 28029 Madrid Spain Phone: +34-91-497-2412 Email: rdiaz02@gmail.com r.diaz@uam.es https://ligarto.org/rdiaz

.bashrc is only read by interactive shells.
On Tue, Sep 20, 2022 at 4:42 AM Ramon Diaz-Uriarte
Thanks. I tried exporting it, by adding an explicit export to .bashrc, but it did not work; looking around, it seems that with some display managers and at least in Debian, .bashrc might not be read early enough; (at least in Debian), .profile seems a safer bet (which is what I've finally settled on).
Best,
R.
On Mon, 19-September-2022, at 22:05:20, Brandon Allbery
wrote: You might check if `$HOSTNAME` is actually exported. There's a difference between "exported" and merely "set" in most shells; use the "export" command (or "env") to see which names are actually exported. (On my Ubuntu system, `$HOSTNAME` isn't set at all.)
On Mon, Sep 19, 2022 at 3:41 PM Ramon Diaz-Uriarte
wrote: Dear Brandon and Platon,
Thanks a lot! I fixed it as suggested (use a new, different, variable name to hold the value from the let, and pass that to myConfig), and it now works. :-)
Actually, there was something else that was not working: when I print
io (getEnv "HOSTNAME")
and
io (getEnv "HOST")
I get Nothing in both cases. I do not understand why that happens, since
ramon@Phelsuma:~$ hostname Phelsuma ramon@Phelsuma:~$ echo $HOSTNAME Phelsuma
Anyway, I solved it by setting in ~/.profile
export HOSTNAME_PROFILE_XMONAD=$HOSTNAME
And doing, in xmonad.hs
hostname <- io (getEnv "HOSTNAME_PROFILE_XMONAD")
Maybe it is related to how I call XMonad (it is called from /usr/bin/xmonad-session, which if I remember correctly I started doing because I use lxdm as display manager).
Thanks again.
Best,
R.
On Mon, 19-September-2022, at 19:33:08, Brandon Allbery
wrote: Oh, I missed that. Yes, the `myWorkspaces` you set in `main` has nothing to do with the global one which `myConfig` sees; you need to pass the new one in. And possibly rename it so it's more obvious that they're not related.
On Mon, Sep 19, 2022 at 1:30 PM Platon Pronko
wrote: Hi!
It looks like `myWorkspaces` in `myConfig` definition is referencing this defintion:
myWorkspaces = map show[1..7]
instead of the one you actually want. Maybe try adding workspaces as an argument to `myConfig`? Something like this:
myConfig workspaces = def { --- blablabla workspaces = workspaces }
main :: IO () main = do hostname <- io (getEnv "HOSTNAME") let workspaces = case hostname of Just "Phelsuma" -> myWorkspacesPhelsuma Just "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces xmonad $ ewmh $ dynamicProjects myProjects $ withNavigation2DConfig def $ docks $ withEasySB (statusBarProp "xmobar ~/.xmonad/.xmobarrc" (pure myXmobarPP)) defToggleStrutsKey $ myConfig workspaces
-- Best regards, Platon Pronko PGP 2A62D77A7A2CB94E
On 2022-09-19 19:01, Ramon Diaz-Uriarte wrote:
Dear All,
I use XMonad on different machines. The configuration is identical, except for the default workspaces, so I'd like to have the config file set the default workspaces automagically. Haskell ignorant here, but googling around I think I am almost there. These are, I think, the relevant pieces
myWorkspaces = map show[1..7] myWorkspacesPhelsuma = map show[1..3] ++ ["top", "sync", "zot", "whats"] myWorkspacesTriturus = map show[1..2] ++ ["top", "sync"]
main :: IO () main = do hostname <- io (getEnv "HOSTNAME") let myWorkspaces = case hostname of "Phelsuma" -> myWorkspacesPhelsuma "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces xmonad $ ewmh $ dynamicProjects myProjects $ withNavigation2DConfig def $ docks $ withEasySB (statusBarProp "xmobar ~/.xmonad/.xmobarrc" (pure myXmobarPP)) defToggleStrutsKey $ myConfig
myConfig = def { --- blablabla workspaces = myWorkspaces }
However, I keep getting an error:
• Couldn't match expected type ‘Maybe String’ with actual type ‘[Char]’ • In the pattern: "Phelsuma" In a case alternative: "Phelsuma" -> myWorkspacesPhelsuma In the expression: case hostname of "Phelsuma" -> myWorkspacesPhelsuma "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces | 882 | "Phelsuma" -> myWorkspacesPhelsuma | ^^^^^^^^^^
(and the same error for the second entry, "Triturus")
This I think should be fairly easy to fix, but I can't find how. I tried writing the case section as
let myWorkspaces = case hostname of Just "Phelsuma" -> myWorkspacesPhelsuma Just "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces
and that does not give me an error, but it seems to ignore the actual hostname and uses the "default" one (the one with workspaces 1 to 7). So I think I am using "Just" incorrectly and possibly also misunderstanding how "let" works in main.
Any suggestions?
Thanks,
_______________________________________________ xmonad mailing list xmonad@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
-- Ramon Diaz-Uriarte Department of Biochemistry, Lab B-31 Facultad de Medicina Universidad Autónoma de Madrid Arzobispo Morcillo, 4 28029 Madrid Spain
Phone: +34-91-497-2412
Email: rdiaz02@gmail.com r.diaz@uam.es
-- Ramon Diaz-Uriarte Department of Biochemistry, Lab B-31 Facultad de Medicina Universidad Autónoma de Madrid Arzobispo Morcillo, 4 28029 Madrid Spain
Phone: +34-91-497-2412
Email: rdiaz02@gmail.com r.diaz@uam.es
-- brandon s allbery kf8nh allbery.b@gmail.com

Then that explains why my setting it on .bashrc did not work. I still do not understand why it did not work given that hostname returns the right name (and that, in fact, I initially did not set it in .bashrc). But never mind, since setting it in .profile works.
On Tue, 20-September-2022, at 14:02:40, Brandon Allbery
.bashrc is only read by interactive shells.
On Tue, Sep 20, 2022 at 4:42 AM Ramon Diaz-Uriarte
wrote: Thanks. I tried exporting it, by adding an explicit export to .bashrc, but it did not work; looking around, it seems that with some display managers and at least in Debian, .bashrc might not be read early enough; (at least in Debian), .profile seems a safer bet (which is what I've finally settled on).
Best,
R.
On Mon, 19-September-2022, at 22:05:20, Brandon Allbery
wrote: You might check if `$HOSTNAME` is actually exported. There's a difference between "exported" and merely "set" in most shells; use the "export" command (or "env") to see which names are actually exported. (On my Ubuntu system, `$HOSTNAME` isn't set at all.)
On Mon, Sep 19, 2022 at 3:41 PM Ramon Diaz-Uriarte
wrote: Dear Brandon and Platon,
Thanks a lot! I fixed it as suggested (use a new, different, variable name to hold the value from the let, and pass that to myConfig), and it now works. :-)
Actually, there was something else that was not working: when I print
io (getEnv "HOSTNAME")
and
io (getEnv "HOST")
I get Nothing in both cases. I do not understand why that happens, since
ramon@Phelsuma:~$ hostname Phelsuma ramon@Phelsuma:~$ echo $HOSTNAME Phelsuma
Anyway, I solved it by setting in ~/.profile
export HOSTNAME_PROFILE_XMONAD=$HOSTNAME
And doing, in xmonad.hs
hostname <- io (getEnv "HOSTNAME_PROFILE_XMONAD")
Maybe it is related to how I call XMonad (it is called from /usr/bin/xmonad-session, which if I remember correctly I started doing because I use lxdm as display manager).
Thanks again.
Best,
R.
On Mon, 19-September-2022, at 19:33:08, Brandon Allbery
wrote: Oh, I missed that. Yes, the `myWorkspaces` you set in `main` has nothing to do with the global one which `myConfig` sees; you need to pass the new one in. And possibly rename it so it's more obvious that they're not related.
On Mon, Sep 19, 2022 at 1:30 PM Platon Pronko
wrote: Hi!
It looks like `myWorkspaces` in `myConfig` definition is referencing this defintion:
myWorkspaces = map show[1..7]
instead of the one you actually want. Maybe try adding workspaces as an argument to `myConfig`? Something like this:
myConfig workspaces = def { --- blablabla workspaces = workspaces }
main :: IO () main = do hostname <- io (getEnv "HOSTNAME") let workspaces = case hostname of Just "Phelsuma" -> myWorkspacesPhelsuma Just "Triturus" -> myWorkspacesTriturus _ -> myWorkspaces xmonad $ ewmh $ dynamicProjects myProjects $ withNavigation2DConfig def $ docks $ withEasySB (statusBarProp "xmobar ~/.xmonad/.xmobarrc" (pure myXmobarPP)) defToggleStrutsKey $ myConfig workspaces
-- Best regards, Platon Pronko PGP 2A62D77A7A2CB94E
On 2022-09-19 19:01, Ramon Diaz-Uriarte wrote: > Dear All, > > I use XMonad on different machines. The configuration is identical, except for the default workspaces, so I'd like to have the config file set the default workspaces automagically. Haskell ignorant here, but googling around I think I am almost there. These are, I think, the relevant pieces > > > myWorkspaces = map show[1..7] > myWorkspacesPhelsuma = map show[1..3] ++ ["top", "sync", "zot", "whats"] > myWorkspacesTriturus = map show[1..2] ++ ["top", "sync"] > > > main :: IO () > main = do > hostname <- io (getEnv "HOSTNAME") > let myWorkspaces = case hostname of > "Phelsuma" -> myWorkspacesPhelsuma > "Triturus" -> myWorkspacesTriturus > _ -> myWorkspaces > xmonad > $ ewmh > $ dynamicProjects myProjects > $ withNavigation2DConfig def > $ docks > $ withEasySB (statusBarProp "xmobar ~/.xmonad/.xmobarrc" (pure myXmobarPP)) defToggleStrutsKey > $ myConfig > > > myConfig = def { > --- blablabla > workspaces = myWorkspaces > } > > > However, I keep getting an error: > > • Couldn't match expected type ‘Maybe String’ > with actual type ‘[Char]’ > • In the pattern: "Phelsuma" > In a case alternative: "Phelsuma" -> myWorkspacesPhelsuma > In the expression: > case hostname of > "Phelsuma" -> myWorkspacesPhelsuma > "Triturus" -> myWorkspacesTriturus > _ -> myWorkspaces > | > 882 | "Phelsuma" -> myWorkspacesPhelsuma > | ^^^^^^^^^^ > > (and the same error for the second entry, "Triturus") > > > This I think should be fairly easy to fix, but I can't find how. I > tried > writing the case section as > > let myWorkspaces = case hostname of > Just "Phelsuma" -> myWorkspacesPhelsuma > Just "Triturus" -> myWorkspacesTriturus > _ -> myWorkspaces > > and that does not give me an error, but it seems to ignore the actual > hostname and uses the "default" one (the one with workspaces 1 to > 7). So I > think I am using "Just" incorrectly and possibly also misunderstanding > how > "let" works in main. > > Any suggestions? > > Thanks, > _______________________________________________ xmonad mailing list xmonad@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
-- Ramon Diaz-Uriarte Department of Biochemistry, Lab B-31 Facultad de Medicina Universidad Autónoma de Madrid Arzobispo Morcillo, 4 28029 Madrid Spain
Phone: +34-91-497-2412
Email: rdiaz02@gmail.com r.diaz@uam.es
-- Ramon Diaz-Uriarte Department of Biochemistry, Lab B-31 Facultad de Medicina Universidad Autónoma de Madrid Arzobispo Morcillo, 4 28029 Madrid Spain
Phone: +34-91-497-2412
Email: rdiaz02@gmail.com r.diaz@uam.es
-- Ramon Diaz-Uriarte Department of Biochemistry, Lab B-31 Facultad de Medicina Universidad Autónoma de Madrid Arzobispo Morcillo, 4 28029 Madrid Spain Phone: +34-91-497-2412 Email: rdiaz02@gmail.com r.diaz@uam.es https://ligarto.org/rdiaz

`hostname` gets it from a kernel call, and the kernel gets it from
`/etc/hostname` during system boot. (
https://hackage.haskell.org/package/network-bsd-2.8.1.0/docs/Network-BSD.htm...
)
On Wed, Sep 21, 2022, 13:01 Ramon Diaz-Uriarte
Then that explains why my setting it on .bashrc did not work. I still do not understand why it did not work given that hostname returns the right name (and that, in fact, I initially did not set it in .bashrc). But never mind, since setting it in .profile works.
.bashrc is only read by interactive shells.
On Tue, Sep 20, 2022 at 4:42 AM Ramon Diaz-Uriarte
wrote: Thanks. I tried exporting it, by adding an explicit export to .bashrc,
but it
did not work; looking around, it seems that with some display managers and at least in Debian, .bashrc might not be read early enough; (at least in Debian), .profile seems a safer bet (which is what I've finally settled on).
Best,
R.
On Mon, 19-September-2022, at 22:05:20, Brandon Allbery < allbery.b@gmail.com> wrote:
You might check if `$HOSTNAME` is actually exported. There's a difference between "exported" and merely "set" in most shells; use the "export" command (or "env") to see which names are actually exported. (On my Ubuntu system, `$HOSTNAME` isn't set at all.)
On Mon, Sep 19, 2022 at 3:41 PM Ramon Diaz-Uriarte
wrote: Dear Brandon and Platon,
Thanks a lot! I fixed it as suggested (use a new, different,
variable name
to hold the value from the let, and pass that to myConfig), and it now works. :-)
Actually, there was something else that was not working: when I print
io (getEnv "HOSTNAME")
and
io (getEnv "HOST")
I get Nothing in both cases. I do not understand why that happens, since
ramon@Phelsuma:~$ hostname Phelsuma ramon@Phelsuma:~$ echo $HOSTNAME Phelsuma
Anyway, I solved it by setting in ~/.profile
export HOSTNAME_PROFILE_XMONAD=$HOSTNAME
And doing, in xmonad.hs
hostname <- io (getEnv "HOSTNAME_PROFILE_XMONAD")
Maybe it is related to how I call XMonad (it is called from /usr/bin/xmonad-session, which if I remember correctly I started doing because I use lxdm as display manager).
Thanks again.
Best,
R.
On Mon, 19-September-2022, at 19:33:08, Brandon Allbery
wrote: Oh, I missed that. Yes, the `myWorkspaces` you set in `main` has nothing to do with the global one which `myConfig` sees; you need to pass the new one in. And possibly rename it so it's more obvious
they're not related.
On Mon, Sep 19, 2022 at 1:30 PM Platon Pronko <
wrote: > > Hi! > > It looks like `myWorkspaces` in `myConfig` definition is referencing this defintion: > > myWorkspaces = map show[1..7] > > instead of the one you actually want. Maybe try adding workspaces as an argument to `myConfig`? Something like this: > > myConfig workspaces = def { > --- blablabla > workspaces = workspaces > } > > main :: IO () > main = do > hostname <- io (getEnv "HOSTNAME") > let workspaces = case hostname of > Just "Phelsuma" -> myWorkspacesPhelsuma > Just "Triturus" -> myWorkspacesTriturus > _ -> myWorkspaces > xmonad > $ ewmh > $ dynamicProjects myProjects > $ withNavigation2DConfig def > $ docks > $ withEasySB (statusBarProp "xmobar ~/.xmonad/.xmobarrc" (pure myXmobarPP)) defToggleStrutsKey > $ myConfig workspaces > > -- > Best regards, > Platon Pronko > PGP 2A62D77A7A2CB94E > > On 2022-09-19 19:01, Ramon Diaz-Uriarte wrote: > > Dear All, > > > > I use XMonad on different machines. The configuration is identical, except for the default workspaces, so I'd like to have the config file set the default workspaces automagically. Haskell ignorant here, but googling around I think I am almost there. These are, I think,
On Tue, 20-September-2022, at 14:02:40, Brandon Allbery < allbery.b@gmail.com> wrote: that platon7pronko@gmail.com> the relevant pieces
> > > > > > myWorkspaces = map show[1..7] > > myWorkspacesPhelsuma = map show[1..3] ++ ["top", "sync", "zot", "whats"] > > myWorkspacesTriturus = map show[1..2] ++ ["top", "sync"] > > > > > > main :: IO () > > main = do > > hostname <- io (getEnv "HOSTNAME") > > let myWorkspaces = case hostname of > > "Phelsuma" -> myWorkspacesPhelsuma > > "Triturus" -> myWorkspacesTriturus > > _ -> myWorkspaces > > xmonad > > $ ewmh > > $ dynamicProjects myProjects > > $ withNavigation2DConfig def > > $ docks > > $ withEasySB (statusBarProp "xmobar ~/.xmonad/.xmobarrc" (pure myXmobarPP)) defToggleStrutsKey > > $ myConfig > > > > > > myConfig = def { > > --- blablabla > > workspaces = myWorkspaces > > } > > > > > > However, I keep getting an error: > > > > • Couldn't match expected type ‘Maybe String’ > > with actual type ‘[Char]’ > > • In the pattern: "Phelsuma" > > In a case alternative: "Phelsuma" -> myWorkspacesPhelsuma > > In the expression: > > case hostname of > > "Phelsuma" -> myWorkspacesPhelsuma > > "Triturus" -> myWorkspacesTriturus > > _ -> myWorkspaces > > | > > 882 | "Phelsuma" -> myWorkspacesPhelsuma > > | ^^^^^^^^^^ > > > > (and the same error for the second entry, "Triturus") > > > > > > This I think should be fairly easy to fix, but I can't find how. I > > tried > > writing the case section as > > > > let myWorkspaces = case hostname of > > Just "Phelsuma" -> myWorkspacesPhelsuma > > Just "Triturus" -> myWorkspacesTriturus > > _ -> myWorkspaces > > > > and that does not give me an error, but it seems to ignore the actual > > hostname and uses the "default" one (the one with workspaces 1 to > > 7). So I > > think I am using "Just" incorrectly and possibly also misunderstanding > > how > > "let" works in main. > > > > Any suggestions? > > > > Thanks, > > > _______________________________________________ > xmonad mailing list > xmonad@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
-- Ramon Diaz-Uriarte Department of Biochemistry, Lab B-31 Facultad de Medicina Universidad Autónoma de Madrid Arzobispo Morcillo, 4 28029 Madrid Spain
Phone: +34-91-497-2412
Email: rdiaz02@gmail.com r.diaz@uam.es
-- Ramon Diaz-Uriarte Department of Biochemistry, Lab B-31 Facultad de Medicina Universidad Autónoma de Madrid Arzobispo Morcillo, 4 28029 Madrid Spain
Phone: +34-91-497-2412
Email: rdiaz02@gmail.com r.diaz@uam.es
-- Ramon Diaz-Uriarte Department of Biochemistry, Lab B-31 Facultad de Medicina Universidad Autónoma de Madrid Arzobispo Morcillo, 4 28029 Madrid Spain
Phone: +34-91-497-2412
Email: rdiaz02@gmail.com r.diaz@uam.es
participants (3)
-
Brandon Allbery
-
Platon Pronko
-
Ramon Diaz-Uriarte