Discussion:
[xmonad] XMonad Per Host Keybinding
Dave Macias
2016-05-12 21:04:20 UTC
Permalink
Hello i've googled around to try to figure this out.
I feel im very close.

Im trying to add different actions to identical keybindings depending on
the HOST im on. (i use my xmonad.hs file for my desktop and laptop)

Here is a snippet of what i did: (start on line 101)
https://gist.github.com/davama/8ec019c5ea19f1f857f37ad140abbf41

I get the error "hostname not in scope".

I also have a hook which uses "hostname" and it works but cant add to
keybindings.

What am i missing?

Thank you,
Dave
Sylvain Henry
2016-05-12 21:27:36 UTC
Permalink
Hi,

Indeed "hostname" is not in scope in "myKeys". You can add a "hostname"
parameter to "myKeys" and to "defaults" (lines 21, 33, 48 and 71) to
pass the "hostname" you retrieve in "main" down to "myKeys"

--
Sylvain
Post by Dave Macias
Hello i've googled around to try to figure this out.
I feel im very close.
Im trying to add different actions to identical keybindings depending
on the HOST im on. (i use my xmonad.hs file for my desktop and laptop)
Here is a snippet of what i did: (start on line 101)
https://gist.github.com/davama/8ec019c5ea19f1f857f37ad140abbf41
I get the error "hostname not in scope".
I also have a hook which uses "hostname" and it works but cant add to
keybindings.
What am i missing?
Thank you,
Dave
_______________________________________________
xmonad mailing list
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Dave Macias
2016-05-13 12:24:19 UTC
Permalink
Thank you for replying

I did what you suggested and through trial and error, 3/4 lines look good.
Now line 71 gives me the same error "not in scope"

I cant seem to figure out how to add it as a parameter. (Unless i did the
other 3 lines wrong)

Thanks again
Dave
Post by Sylvain Henry
Hi,
Indeed "hostname" is not in scope in "myKeys". You can add a "hostname"
parameter to "myKeys" and to "defaults" (lines 21, 33, 48 and 71) to pass
the "hostname" you retrieve in "main" down to "myKeys"
--
Sylvain
Hello i've googled around to try to figure this out.
I feel im very close.
Im trying to add different actions to identical keybindings depending on
the HOST im on. (i use my xmonad.hs file for my desktop and laptop)
Here is a snippet of what i did: (start on line 101)
https://gist.github.com/davama/8ec019c5ea19f1f857f37ad140abbf41
I get the error "hostname not in scope".
I also have a hook which uses "hostname" and it works but cant add to
keybindings.
What am i missing?
Thank you,
Dave
_______________________________________________
_______________________________________________
xmonad mailing list
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Sylvain Henry
2016-05-13 13:22:30 UTC
Permalink
On line 71, put "hostname" just after "myKeys" to make it the first
parameter of the "myKeys" function and it should work (hopefully ;)).
The other lines look good!

Cheers
Sylvain
Post by Dave Macias
Thank you for replying
I did what you suggested and through trial and error, 3/4 lines look good.
Now line 71 gives me the same error "not in scope"
I cant seem to figure out how to add it as a parameter. (Unless i did
the other 3 lines wrong)
Thanks again
Dave
Hi,
Indeed "hostname" is not in scope in "myKeys". You can add a
"hostname" parameter to "myKeys" and to "defaults" (lines 21, 33,
48 and 71) to pass the "hostname" you retrieve in "main" down to
"myKeys"
--
Sylvain
Post by Dave Macias
Hello i've googled around to try to figure this out.
I feel im very close.
Im trying to add different actions to identical keybindings
depending on the HOST im on. (i use my xmonad.hs file for my
desktop and laptop)
Here is a snippet of what i did: (start on line 101)
https://gist.github.com/davama/8ec019c5ea19f1f857f37ad140abbf41
I get the error "hostname not in scope".
I also have a hook which uses "hostname" and it works but cant
add to keybindings.
What am i missing?
Thank you,
Dave
_______________________________________________
xmonad mailing list
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
_______________________________________________
xmonad mailing list
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Sylvain Henry
2016-05-13 13:29:28 UTC
Permalink
On line 48, you may have to enclose "defaults hostname" with brackets:
"(defaults hostname)"
Post by Sylvain Henry
On line 71, put "hostname" just after "myKeys" to make it the first
parameter of the "myKeys" function and it should work (hopefully ;)).
The other lines look good!
Cheers
Sylvain
Post by Dave Macias
Thank you for replying
I did what you suggested and through trial and error, 3/4 lines look good.
Now line 71 gives me the same error "not in scope"
I cant seem to figure out how to add it as a parameter. (Unless i did
the other 3 lines wrong)
Thanks again
Dave
Hi,
Indeed "hostname" is not in scope in "myKeys". You can add a
"hostname" parameter to "myKeys" and to "defaults" (lines 21, 33,
48 and 71) to pass the "hostname" you retrieve in "main" down to
"myKeys"
--
Sylvain
Post by Dave Macias
Hello i've googled around to try to figure this out.
I feel im very close.
Im trying to add different actions to identical keybindings
depending on the HOST im on. (i use my xmonad.hs file for my
desktop and laptop)
Here is a snippet of what i did: (start on line 101)
https://gist.github.com/davama/8ec019c5ea19f1f857f37ad140abbf41
I get the error "hostname not in scope".
I also have a hook which uses "hostname" and it works but cant
add to keybindings.
What am i missing?
Thank you,
Dave
_______________________________________________
xmonad mailing list
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
_______________________________________________
xmonad mailing list
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
_______________________________________________
xmonad mailing list
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Dave Macias
2016-05-13 13:34:57 UTC
Permalink
I did try that but i remember it spit out a few errors.
This is the error:

""
*xmonad.hs:455:20:*
* Couldn't match type ‘[Char]’ with ‘XConfig l0’*
* Expected type: XConfig l0*
* Actual type: String*
* In the expression: hostname*
* In the first argument of ‘defaults’, namely*
* ‘hostname*
* {manageHook = composeAll*
* [manageDocks, manageSpawn, myManageHook, ....],*
* startupHook = composeAll*
* [myStartupHook, setWMName "Xmonad", myCaseHook
hostname, ....],*
* logHook = composeAll*
* [myFadeHook, ewmhDesktopsLogHook, myDzenLogHook
xmproc]*
* >> updatePointer (0.5, 0.5) (0, 0)}’*
""

Granted line *455* is actually line 71. (in the provided gist config)
The *"In the first argument of ‘defaults’, namely"* output, that is line 48
if i understand it correctly.

Let me know if i need to provide more of the xmonad.hs config code. (didnt
want to flood you with its many lines)

Dave
Post by Sylvain Henry
On line 71, put "hostname" just after "myKeys" to make it the first
parameter of the "myKeys" function and it should work (hopefully ;)). The
other lines look good!
Cheers
Sylvain
Thank you for replying
I did what you suggested and through trial and error, 3/4 lines look good.
Now line 71 gives me the same error "not in scope"
I cant seem to figure out how to add it as a parameter. (Unless i did the
other 3 lines wrong)
Thanks again
Dave
Post by Sylvain Henry
Hi,
Indeed "hostname" is not in scope in "myKeys". You can add a "hostname"
parameter to "myKeys" and to "defaults" (lines 21, 33, 48 and 71) to pass
the "hostname" you retrieve in "main" down to "myKeys"
--
Sylvain
Hello i've googled around to try to figure this out.
I feel im very close.
Im trying to add different actions to identical keybindings depending on
the HOST im on. (i use my xmonad.hs file for my desktop and laptop)
Here is a snippet of what i did: (start on line 101)
https://gist.github.com/davama/8ec019c5ea19f1f857f37ad140abbf41
I get the error "hostname not in scope".
I also have a hook which uses "hostname" and it works but cant add to
keybindings.
What am i missing?
Thank you,
Dave
_______________________________________________
_______________________________________________
xmonad mailing list
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Dave Macias
2016-05-13 13:41:55 UTC
Permalink
That did the trick! Thank you very much Sylvain!

-Dave
just saw email.
trying "()"
need to confirm...
will reply again in a sec
Post by Dave Macias
I did try that but i remember it spit out a few errors.
""
*xmonad.hs:455:20:*
* Couldn't match type ‘[Char]’ with ‘XConfig l0’*
* Expected type: XConfig l0*
* Actual type: String*
* In the expression: hostname*
* In the first argument of ‘defaults’, namely*
* ‘hostname*
* {manageHook = composeAll*
* [manageDocks, manageSpawn, myManageHook, ....],*
* startupHook = composeAll*
* [myStartupHook, setWMName "Xmonad", myCaseHook
hostname, ....],*
* logHook = composeAll*
* [myFadeHook, ewmhDesktopsLogHook, myDzenLogHook
xmproc]*
* >> updatePointer (0.5, 0.5) (0, 0)}’*
""
Granted line *455* is actually line 71. (in the provided gist config)
The *"In the first argument of ‘defaults’, namely"* output, that is line
48 if i understand it correctly.
Let me know if i need to provide more of the xmonad.hs config code.
(didnt want to flood you with its many lines)
Dave
Post by Sylvain Henry
On line 71, put "hostname" just after "myKeys" to make it the first
parameter of the "myKeys" function and it should work (hopefully ;)). The
other lines look good!
Cheers
Sylvain
Thank you for replying
I did what you suggested and through trial and error, 3/4 lines look good.
Now line 71 gives me the same error "not in scope"
I cant seem to figure out how to add it as a parameter. (Unless i did
the other 3 lines wrong)
Thanks again
Dave
Post by Sylvain Henry
Hi,
Indeed "hostname" is not in scope in "myKeys". You can add a "hostname"
parameter to "myKeys" and to "defaults" (lines 21, 33, 48 and 71) to pass
the "hostname" you retrieve in "main" down to "myKeys"
--
Sylvain
Hello i've googled around to try to figure this out.
I feel im very close.
Im trying to add different actions to identical keybindings depending
on the HOST im on. (i use my xmonad.hs file for my desktop and laptop)
Here is a snippet of what i did: (start on line 101)
https://gist.github.com/davama/8ec019c5ea19f1f857f37ad140abbf41
I get the error "hostname not in scope".
I also have a hook which uses "hostname" and it works but cant add to
keybindings.
What am i missing?
Thank you,
Dave
_______________________________________________
_______________________________________________
xmonad mailing list
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Loading...