Discussion:
[xmonad] Xmonad: Get NSP Workspace
Dave Macias
2016-06-08 16:18:30 UTC
Permalink
Hello xmonad!

Recently i change myWorkspaces from strings to numbers to be able to use
the dice font in ppCurrent/Visible. (it's pretty cool)

Formerly myWorkspace was defined as so:
*--myWorkspaces = ["1","2","3","4","5","6","7","8","9"] ++ ["NSP"]*
Now:
*myWorkspaces = map show $ [1..9] ++ [0] -- 0 is the NSP ws*

Everything has been working fine. The only issue is in my keybindings.
specifically in CycleWS.

So i have some keybindings as so:
...
...
* , ((mod, xK_Up), windows . W.greedyView =<< findWorkspace
getSortByIndexNoNSP Next HiddenNonEmptyWS 1) -- move to next WS non NSP*
*...*
*...*
*where*
* getSortByIndexNoNSP = fmap (.namedScratchpadFilterOutWorkspace)
getSortByIndex*



So, if i understand this correctly, "namedScratchpadFilterOutWorkspace"
doesnt work because the "name" of the workspace is now the number "0" when
it formerly was the string "NSP".

How can i get the keybinding to work when i've changed the NSP workpace
name to an actual number?

Please let me know if more info is needed.

Thank you in advance.

-Dave
Brandon Allbery
2016-06-08 17:07:30 UTC
Permalink
Post by Dave Macias
How can i get the keybinding to work when i've changed the NSP workpace
name to an actual number?
NamedScratchpad is still using the name "NSP" internally; you can only
change this by editing the module source and rebuilding.

What happened is that you added the workspace "0", and that is where "NSP"
was in the StackSet, so that is where they got put after mod-q. So both
xmonad and the NamedScratchpad module now think all those windows are on
workspace "0" instead of in "NSP". If you go to that workspace and press
the toggle key for each window, the window will be moved to the new "NSP";
likewise if you don't go there and press the toggle key twice (once will
bring it to the current workspace, second will move it to the new "NSP").
--
brandon s allbery kf8nh sine nomine associates
***@gmail.com ***@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
Dave Macias
2016-06-08 18:20:12 UTC
Permalink
Thank you for replying Brandon.
If you go to that workspace and press the toggle key for each window, the
window will be moved to the new "NSP"; likewise if you don't go there and
press the toggle key twice (once will bring it to the current workspace,
second will move it to the new "NSP").
But reading your comment made realize something, (note: my haskelling is
close to zero)
1. NSP still exist. how do i know? i have several scratchpads and when i
hide them they actually go to the ws NSP but I myself cannot go to that
workspace. (mod-0) but this is probably a separate/related issue.
2. ws 0 (mod-0) is not the same as NSP, but that is what i want WS 0 to be
used for

So perhaps i didnt phrase my question correctly, or i just didnt understand
what was really happening.

The keybinding should skip the NSP workspace when i cycle through them. It
worked before because i actually defined the NSP workspace as "NSP".
Now that i have a workspace 0, how can i make it behave as the NSP
workspace so that the keybinding works?

Or would it be easier to define "myWorkspaces" as?:
*myWorkspaces = map show $ [1..9] ++ ["NSP"]*

But i had tried that before but it didnt work. My assumption was because i
was using an init and not a char data type.

Thanks
Post by Dave Macias
How can i get the keybinding to work when i've changed the NSP workpace
name to an actual number?
NamedScratchpad is still using the name "NSP" internally; you can only
change this by editing the module source and rebuilding.
What happened is that you added the workspace "0", and that is where "NSP"
was in the StackSet, so that is where they got put after mod-q. So both
xmonad and the NamedScratchpad module now think all those windows are on
workspace "0" instead of in "NSP". If you go to that workspace and press
the toggle key for each window, the window will be moved to the new "NSP";
likewise if you don't go there and press the toggle key twice (once will
bring it to the current workspace, second will move it to the new "NSP").
--
brandon s allbery kf8nh sine nomine associates
unix, openafs, kerberos, infrastructure, xmonad
http://sinenomine.net
Brandon Allbery
2016-06-08 18:24:04 UTC
Permalink
Post by Dave Macias
But reading your comment made realize something, (note: my haskelling is
close to zero)
1. NSP still exist. how do i know? i have several scratchpads and when i
hide them they actually go to the ws NSP but I myself cannot go to that
workspace. (mod-0) but this is probably a separate/related issue.
2. ws 0 (mod-0) is not the same as NSP, but that is what i want WS 0 to be
used for
If you have EwmhDesktops configured then you can use xdotool or wmctrl to
switch to the new NSP workspace. (Note that it won't exist until something
is moved there, unless you list it explicitly in your workspaces.)

As I said previously, you must modify the NamedScratchpad module in order
to use a different workspace name. It does not work by slots (like the
reloading of workspaces across mod-q does), it looks for NSP by name.
https://github.com/xmonad/xmonad-contrib/blob/master/XMonad/Util/NamedScratchpad.hs#L153
--
brandon s allbery kf8nh sine nomine associates
***@gmail.com ***@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
Dave Macias
2016-06-08 19:39:50 UTC
Permalink
Ok, that makes sense. So in essence i could have up to 11 ws if NSP has a
window.

So that being the case is either of these possible?
*myWorkspaces = map show $ [1..9] ++ [0] ++ ["NSP"]*
myWorkspaces = map show $ [1..9] ++ ["NSP"]

This, i believe, will solve the keybinding issue and still allow me to use
the dice.ttf font.
Post by Brandon Allbery
Post by Dave Macias
But reading your comment made realize something, (note: my haskelling is
close to zero)
1. NSP still exist. how do i know? i have several scratchpads and when i
hide them they actually go to the ws NSP but I myself cannot go to that
workspace. (mod-0) but this is probably a separate/related issue.
2. ws 0 (mod-0) is not the same as NSP, but that is what i want WS 0 to
be used for
If you have EwmhDesktops configured then you can use xdotool or wmctrl to
switch to the new NSP workspace. (Note that it won't exist until something
is moved there, unless you list it explicitly in your workspaces.)
As I said previously, you must modify the NamedScratchpad module in order
to use a different workspace name. It does not work by slots (like the
reloading of workspaces across mod-q does), it looks for NSP by name.
https://github.com/xmonad/xmonad-contrib/blob/master/XMonad/Util/NamedScratchpad.hs#L153
--
brandon s allbery kf8nh sine nomine associates
unix, openafs, kerberos, infrastructure, xmonad
http://sinenomine.net
Brandon Allbery
2016-06-08 19:52:01 UTC
Permalink
Post by Dave Macias
Ok, that makes sense. So in essence i could have up to 11 ws if NSP has a
window.
So that being the case is either of these possible?
*myWorkspaces = map show $ [1..9] ++ [0] ++ ["NSP"]*
You're using ($) wrong and will get a type error from trying to append a
list of strings to a list of numbers.

myWorkspaces = map show [1..9] ++ ["0","NSP"]

is what I'd write, if I were using numeric workspaces (I use words).

It's still possible you'd need to move stuff off of "0" back to "NSP".

This, i believe, will solve the keybinding issue and still allow me to use
Post by Dave Macias
the dice.ttf font.
--
brandon s allbery kf8nh sine nomine associates
***@gmail.com ***@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
Dave Macias
2016-06-08 20:22:09 UTC
Permalink
Post by Brandon Allbery
You're using ($) wrong and will get a type error from trying to append a
list of strings to a list of numbers.
I figure appending a string to numbers was the issue.

The code worked.

Thank you for the continue support.

-Dave
Post by Brandon Allbery
Post by Dave Macias
Ok, that makes sense. So in essence i could have up to 11 ws if NSP has a
window.
So that being the case is either of these possible?
*myWorkspaces = map show $ [1..9] ++ [0] ++ ["NSP"]*
You're using ($) wrong and will get a type error from trying to append a
list of strings to a list of numbers.
myWorkspaces = map show [1..9] ++ ["0","NSP"]
is what I'd write, if I were using numeric workspaces (I use words).
It's still possible you'd need to move stuff off of "0" back to "NSP".
This, i believe, will solve the keybinding issue and still allow me to use
Post by Dave Macias
the dice.ttf font.
--
brandon s allbery kf8nh sine nomine associates
unix, openafs, kerberos, infrastructure, xmonad
http://sinenomine.net
Loading...