Spatial groups concept discussion

4 views
Skip to first unread message

Russell Adams

unread,
Mar 8, 2022, 12:52:24 PM3/8/22
to stumpwm-devel
It occurred to me that the reason why the spatial concept was so
different is that it's a method of inter-group or inter-screen
management.

Tiling is intra-screen, how we divide up a single screen to show
multiple application windows without overlapping.

Spatially organizing entire screens together is inter-screen
management, which provides a grid of screens and a desktop analogy to
navigate.

Today the default for this is a variable list of single screens. I
have the impression this is generally a short list, with new groups
made for a specific purpose. However I don't think there is a method
for organizing groups outside of that list.

All the default keybinds work with a short list of groups. For example
next group, prev group, select group from list, jump to group by
function key. In particular C-t F# looks limited to function keys F1
through F12.

Is that truly the case, that most StumpWM users are just navigating
between a few groups with hotkeys?

Are there other methods of inter-group management or organization?

------------------------------------------------------------------
Russell Adams RLA...@AdamsInfoServ.com

PGP Key ID: 0x1160DCB3 http://www.adamsinfoserv.com/

Fingerprint: 1723 D8CA 4280 1EC9 557F 66E8 1154 E018 1160 DCB3

Tim Macdonald

unread,
Mar 8, 2022, 4:23:17 PM3/8/22
to stumpwm-devel
Thank you very much for starting this discussion, posting the code, making the video, etc. For the record, I think using Libreoffice Calc as a presentation tool was inspired.

As a relatively new Stump user I've also been curious about groups. The 1D list of groups has felt limiting compared to previous WMs I've used that supported a 2D grid of workspaces (and so far have been too lazy to write functions to do the appropriate modular arithmetic to simulate a 2D. Now with your code we can go 3D—even better!). I think you have an unusually window-heavy workflow, and other ways of skinning the cat include having a lot of buffers in one Emacs, browser tabs, terminal tabs, perhaps tmux, using multiple monitors/heads, using splits (back when I had a 4k monitor it was almost necessary to use splits to make windows a usable size), etc. I personally have a group called "messaging" with five or six apps in it (Signal, Slack, Element, etc.) and am happy to use C-t <n> (0 through 5) to get the right one up.

FWIW, I have hotkeys to cycle between groups and move windows between groups. I completely forgot about the C-t F# bindings and don't plan to use them.

Anyway, that's my answer to how I deal with group management and I'm very interested to hear how other people approach it.

—Tim

-----
Tim Macdonald



Russell Adams

unread,
Mar 8, 2022, 5:06:22 PM3/8/22
to stumpw...@nongnu.org
On Tue, Mar 08, 2022 at 06:09:58PM +0000, Tim Macdonald wrote:
> Thank you very much for starting this discussion, posting the code, making
> the video, etc. For the record, I think using Libreoffice Calc as a
> presentation tool was inspired.

That was cheating. I needed to illustrate a grid, and a spreadsheet
was natural. For a real presentation I should make some graphics.

> As a relatively new Stump user I've also been curious about groups. The 1D
> list of groups has felt limiting compared to previous WMs I've used that
> supported a 2D grid of workspaces (and so far have been too lazy to write
> functions to do the appropriate modular arithmetic to simulate a 2D. Now
> with your code we can go 3D—even better!).

I have to say, it's on par with other tiling WMs. I recall xmonad, i3,
and others doing the same small list of groups.

> I think you have an unusually window-heavy workflow, and other ways
> of skinning the cat include having a lot of buffers in one Emacs,
> browser tabs, terminal tabs, perhaps tmux, using multiple
> monitors/heads, using splits (back when I had a 4k monitor it was
> almost necessary to use splits to make windows a usable size), etc.
> I personally have a group called "messaging" with five or six apps
> in it (Signal, Slack, Element, etc.) and am happy to use C-t <n> (0
> through 5) to get the right one up.

My primary screen is a tiny laptop screen. I used to travel
heavily. When you have zero cost task switching and little screen
space, you spam windows.

To be fair, my central communication screen is heavily tmuxed. Email,
Signal, terminal Emacs on one side, and a ssh login to tmux on the
other with irc, xmpp, and more.

I've found that unless I have a reason to stack things on one window
(ie: durable processes on a remote server), it's easier to spread out.

> Anyway, that's my answer to how I deal with group management and I'm very
> interested to hear how other people approach it.

Thanks for sharing!

Roland Everaert

unread,
Mar 9, 2022, 5:39:50 AM3/9/22
to Russell Adams, stumpw...@nongnu.org
A few questions:

- How does this system works with multiple heads?
I also use StumpWM on a laptop and at home, I use a second bigger screen, so I wonder how the various cells will be organized, and does behave the navigation.

- How does behave a spacial desktop, when splitting a head to display 2 or more frames, did you prevent a window from another cell to fill out the new area automatically?

Roland Everaert
---
Use the F.O.S.S., Luke

Envoyé avec la messagerie sécurisée ProtonMail.

------- Original Message -------

Russell Adams

unread,
Mar 9, 2022, 5:55:06 AM3/9/22
to stumpw...@nongnu.org
On Wed, Mar 09, 2022 at 10:38:32AM +0000, Roland Everaert wrote:
> A few questions:
>
> - How does this system works with multiple heads?

I haven't done any testing with multiple heads. My rig is single
monitor.

I think that multiple screens should be treated like a wider cursor
instead of independent cursors, but I haven't tried it.

> - How does behave a spacial desktop, when splitting a head to
> - display 2 or more frames, did you prevent a window from another
> - cell to fill out the new area automatically?

Spatial has no effect on Stump's tiling behavior within the
screen. That works normally. Spatial is only the relationship between
groups and their navigation.

Lucien Cartier-Tilet

unread,
Mar 9, 2022, 12:21:07 PM3/9/22
to stumpw...@nongnu.org
I really like this concept, it kind of reminds me of how newm (a
window manager and compositor for wayland) works with the addition of
what you called in your video desktops but minus the ability of
zooming in and out of a screen.

I will definitively try your module out!

> Is that truly the case, that most StumpWM users are just navigating
> between a few groups with hotkeys?

That’s the case for me, I navigate between my four groups with s-1 to
s-4 (well, not exactly due to the bépo layout, but something similar).
--
Lucien “Phundrak” Cartier-Tilet
<https://phundrak.com> (Français)
<https://phundrak.com/en> (English)
Sent from GNU/Emacs
signature.asc

Roland Everaert

unread,
Mar 13, 2022, 4:59:20 AM3/13/22
to Russell Adams, stumpw...@nongnu.org
Hello M. Adams,

I just install the module which works quite well.

Nonetheless, could you, please, consider updating your documentation to explain how to override your keybindings?

They are interfering with keybindings used in terminals and text editors.

C-Left and C-Right are used to jump between words. C-Up and C-Down are used to jump between paragraphs. The keys coords C-S-<arrow-key> are also used in text editors.

So, I have the feeling it can be, at the very least, surprising to new users of your module.

With regards to using your module with multiple heads, I find the behaviours quite natural, so far.

How did you save and restore each workspace?

There are commands, in stumpwm, to dump and restore frames and windows, but I am not quite sure they are adapted to a spacial grouping.

I will try to provide some feedback about my usage of the spatial groups in the coming weeks.

Regards,

Roland Everaert
---
Use the F.O.S.S., Luke

Envoyé avec la messagerie sécurisée ProtonMail.

------- Original Message -------

Russell Adams

unread,
Mar 13, 2022, 10:44:10 AM3/13/22
to stumpw...@nongnu.org
On Sun, Mar 13, 2022 at 08:58:47AM +0000, Roland Everaert wrote:
> Hello M. Adams,
>
> I just install the module which works quite well.
>
> Nonetheless, could you, please, consider updating your documentation
> to explain how to override your keybindings?

That's an oversight on my part. I'll add a config variable and wrap
those in a function shortly.

To be fair, this is my first module and it was adapted from my
personal config. ;]

> They are interfering with keybindings used in terminals and text editors.
>
> C-Left and C-Right are used to jump between words. C-Up and C-Down
> are used to jump between paragraphs. The keys coords C-S-<arrow-key>
> are also used in text editors.

I disagree completely. These are my day to day bindings carefully
chosen not to interfere with the applications I use. The only one I
run into is Shift-arrows breaks updating Org-mode timestamps. They
haven't changed in about a decade.

However, I'm aware that Windoze style GUI applications may abuse
C-Arrows instead of sane defaults like C-n and C-p. In Emacs,
Meta-arrows jumps across words. C-c is interrupt, and C-v is page
down, they have nothing to do with the clipboard.

You absolutely should be able to customize your keys though, I'll post
a fix.

> So, I have the feeling it can be, at the very least, surprising to
> new users of your module.

Yep, I'll wrap it. Would you recommend enabling the keybinds by
default with an option to disable, or require additional configuration
to set the base keybinds?

I'm leaning toward the second option, of updating the install
instructions to call the keybind function.

> With regards to using your module with multiple heads, I find the
> behaviours quite natural, so far.

You're using it multihead? I'm surprised it even works. There are
rules like "same group can never be on two screens", and there's no
relationship logic (ie: to the left, to the right of, screens = ( x ,
x - 1) ) in the code.

I always thought I'd have to add a layer to specify orientation to the
coordinate change login per screen, and then swap all screens to a
screen specific "null" group before moving to the final.

> How did you save and restore each workspace?

I don't normally. In my startup I had some code to make some splits,
but I've not found a good way to launch applications into those
specific places.

Do you know how to do "run program in group 1, frame 3"? It always
just launches in current frame for me.

> There are commands, in stumpwm, to dump and restore frames and
> windows, but I am not quite sure they are adapted to a spacial
> grouping.

I think that they should work. Spatial uses group names as a text
string of coordinates, and doesn't touch the splits/frames. I think
save and load will work normally.

> I will try to provide some feedback about my usage of the spatial
> groups in the coming weeks.

Looking forward to it!

Roland Everaert

unread,
Mar 14, 2022, 4:19:25 AM3/14/22
to Russell Adams, stumpw...@nongnu.org
No worries, I have never written a module, so I couldn't blame you for anything.

Regarding keybings, (un)fortunately, I live in a hybrid-world, the machine I use for my job is a windows machine provided by the customer, so I have to account for the Windows world, hence C-n et al. doesn't feels natural to me for a very long time.

Maybe you could propose predefined keybindings in addition to the possibility for the user to define its own. The Nyxt web-browser, a common lisp based browser, do that quite well.

Below is my keybindings definition:

;; 1. Undefine all the default keybindings
(undefine-key *top-map* (kbd "C-Left"))
(undefine-key *top-map* (kbd "C-Right"))
(undefine-key *top-map* (kbd "C-Up"))
(undefine-key *top-map* (kbd "C-Down"))
(undefine-key *top-map* (kbd "C-S-Left"))
(undefine-key *top-map* (kbd "C-S-Right"))
(undefine-key *top-map* (kbd "C-S-Up"))
(undefine-key *top-map* (kbd "C-S-Down"))
;; 2. Set my own keybindings
(define-key *top-map* (kbd "s-Left") "coord-left")
(define-key *top-map* (kbd "s-Right") "coord-right")
(define-key *top-map* (kbd "s-Up") "coord-up")
(define-key *top-map* (kbd "s-Down") "coord-down")
;; Control-Shift left/right to switch desktop Z
(define-key *top-map* (kbd "C-s-Left") "coord-taskleft")
(define-key *top-map* (kbd "C-s-Right") "coord-taskright")
;; Control-Shift-Up to return to origin 0,0 on current desktop Z
(define-key *top-map* (kbd "C-s-Up") "coord-taskorigin")
;; "Pop" back to last desktop position
(define-key *top-map* (kbd "C-s-Down") "coord-taskpop")
;; ----------------------------------------------

As for the multi-head usage, S-Arrows allows to switch between frames in the same group, so it allows to switch between heads.

As for frame/windows placement in groups, according to the documentation, it is possible to define rules, unfortunately, I never manage to make them works, with the exception of firefox. :(

It is important to note that the target group must exists for the rule to not raise an error.

Below is the rule I had defined for firefox, before using spatial groups.

(define-frame-preference "F3-Media"
(0 nil t :create t :class "Navigator.Firefox"))



Roland Everaert
---
Use the F.O.S.S., Luke

Envoyé avec la messagerie sécurisée ProtonMail.

------- Original Message -------

Russell Adams

unread,
Mar 14, 2022, 5:17:55 AM3/14/22
to stumpw...@nongnu.org
Roland,

On Mon, Mar 14, 2022 at 08:19:09AM +0000, Roland Everaert wrote:
> Regarding keybings, (un)fortunately, I live in a hybrid-world, the
> machine I use for my job is a windows machine provided by the
> customer, so I have to account for the Windows world, hence C-n et
> al. doesn't feels natural to me for a very long time.

Xkeymacs. http://xkeymacs.osdn.jp/

Reskin your OS to use reasonable keybindings.

> Maybe you could propose predefined keybindings in addition to the
> possibility for the user to define its own. The Nyxt web-browser, a
> common lisp based browser, do that quite well.

Kind of out of scope for me. ;]

> Below is my keybindings definition:
>
> ;; 1. Undefine all the default keybindings
> (undefine-key *top-map* (kbd "C-Left"))
> (undefine-key *top-map* (kbd "C-Right"))
> (undefine-key *top-map* (kbd "C-Up"))
> (undefine-key *top-map* (kbd "C-Down"))
> (undefine-key *top-map* (kbd "C-S-Left"))
> (undefine-key *top-map* (kbd "C-S-Right"))
> (undefine-key *top-map* (kbd "C-S-Up"))
> (undefine-key *top-map* (kbd "C-S-Down"))
> ;; 2. Set my own keybindings
> (define-key *top-map* (kbd "s-Left") "coord-left")
> (define-key *top-map* (kbd "s-Right") "coord-right")
> (define-key *top-map* (kbd "s-Up") "coord-up")
> (define-key *top-map* (kbd "s-Down") "coord-down")
> ;; Control-Shift left/right to switch desktop Z
> (define-key *top-map* (kbd "C-s-Left") "coord-taskleft")
> (define-key *top-map* (kbd "C-s-Right") "coord-taskright")
> ;; Control-Shift-Up to return to origin 0,0 on current desktop Z
> (define-key *top-map* (kbd "C-s-Up") "coord-taskorigin")
> ;; "Pop" back to last desktop position
> (define-key *top-map* (kbd "C-s-Down") "coord-taskpop")
> ;; ----------------------------------------------

The updated module 0.0.2 now has a function you have to call to
install my default keybinds. If you omit it, you can just define
them. No need for undefines.

So you moved the coordinate navigation from Control-arrows to Windows-key arrows?

I have my music player bound there. ;]

> As for the multi-head usage, S-Arrows allows to switch between
> frames in the same group, so it allows to switch between heads.

You mean move-focus? That built in likely works.

Do you configure the multiple heads somewhere, regarding which screen
is adjacent to the other? (ie: DP2 left of DP1)

> As for frame/windows placement in groups, according to the
> documentation, it is possible to define rules, unfortunately, I
> never manage to make them works, with the exception of firefox. :(

Yeah. I mentioned this at one point, where you can define a group
where all terminals go, or all Firefox windows go. That feels very
confining to me, cramming all those on one group / screen.

I meant that on startup I'd love to launch a series of applications in
fixed locations (group 0,0,0, frame 0, launch urxvt. group 0,0,0,
frame 1, launch urxvt. and so on). Instead I have a short snippet to
create my frames and splits, but then I have to manually launch things.

(defun my-startup ()
(spatial-groups:spatial-gselect "0,0,0")
(hsplit)
(resize-frame (current-group) (tile-group-current-frame (current-group)) (- 110 (frame-width (tile-group-current-frame (current-group)))) :width)
(move-focus :right)
(hsplit)
; (run-shell-command "/usr/bin/urxvt")
; (sleep 1)
(move-focus :right)
; (run-shell-command "/usr/bin/urxvt")
; (sleep 1)
(spatial-groups:spatial-gselect "0,1,0")
(hsplit)
; (run-shell-command "/usr/bin/urxvt")
; (sleep 1)
(move-focus :right)
; (run-shell-command "/usr/bin/urxvt")
; (sleep 1)
(spatial-groups:spatial-gselect "1,-1,0")
(hsplit)
; (run-shell-command "/usr/bin/urxvt")
; (sleep 1)
(move-focus :right)
; (run-shell-command "/usr/bin/urxvt")
; (sleep 1)
(spatial-groups:spatial-gselect "1,0,0")
; (run-shell-command "/usr/bin/emacsclient -c")
; (sleep 1)
(spatial-groups:spatial-gselect "0,0,0") )

(when *initializing* (my-startup))

If I uncomment the run-shell-command, they stack in the last or
current frame.

Roland Everaert

unread,
Mar 14, 2022, 5:50:44 AM3/14/22
to Russell Adams, stumpw...@nongnu.org
Russel,

> Roland,
>
> On Mon, Mar 14, 2022 at 08:19:09AM +0000, Roland Everaert wrote:
>
> > Regarding keybings, (un)fortunately, I live in a hybrid-world, the
> >
> > machine I use for my job is a windows machine provided by the
> >
> > customer, so I have to account for the Windows world, hence C-n et
> >
> > al. doesn't feels natural to me for a very long time.
>
> Xkeymacs. http://xkeymacs.osdn.jp/
>
> Reskin your OS to use reasonable keybindings.

I will have to look at it, thanks

>
> > Maybe you could propose predefined keybindings in addition to the
> >
> > possibility for the user to define its own. The Nyxt web-browser, a
> >
> > common lisp based browser, do that quite well.
>
> Kind of out of scope for me. ;]
>
> > Below is my keybindings definition:
> >
> > ;; 1. Undefine all the default keybindings
> >
> > (undefine-key top-map (kbd "C-Left"))
> >
> > (undefine-key top-map (kbd "C-Right"))
> >
> > (undefine-key top-map (kbd "C-Up"))
> >
> > (undefine-key top-map (kbd "C-Down"))
> >
> > (undefine-key top-map (kbd "C-S-Left"))
> >
> > (undefine-key top-map (kbd "C-S-Right"))
> >
> > (undefine-key top-map (kbd "C-S-Up"))
> >
> > (undefine-key top-map (kbd "C-S-Down"))
> >
> > ;; 2. Set my own keybindings
> >
> > (define-key top-map (kbd "s-Left") "coord-left")
> >
> > (define-key top-map (kbd "s-Right") "coord-right")
> >
> > (define-key top-map (kbd "s-Up") "coord-up")
> >
> > (define-key top-map (kbd "s-Down") "coord-down")
> >
> > ;; Control-Shift left/right to switch desktop Z
> >
> > (define-key top-map (kbd "C-s-Left") "coord-taskleft")
> >
> > (define-key top-map (kbd "C-s-Right") "coord-taskright")
> >
> > ;; Control-Shift-Up to return to origin 0,0 on current desktop Z
> >
> > (define-key top-map (kbd "C-s-Up") "coord-taskorigin")
> >
> > ;; "Pop" back to last desktop position
> >
> > (define-key top-map (kbd "C-s-Down") "coord-taskpop")
> >
> > ;; ----------------------------------------------
>
> The updated module 0.0.2 now has a function you have to call to
>
> install my default keybinds. If you omit it, you can just define
>
> them. No need for undefines.
>
> So you moved the coordinate navigation from Control-arrows to Windows-key arrows?

Indeed.

>
> I have my music player bound there. ;]
>
> > As for the multi-head usage, S-Arrows allows to switch between
> >
> > frames in the same group, so it allows to switch between heads.
>
> You mean move-focus? That built in likely works.

Yes, move-focus.

>
> Do you configure the multiple heads somewhere, regarding which screen
>
> is adjacent to the other? (ie: DP2 left of DP1)

I used lxrandr to create a configuration file for screen placement, then in my configuration I launch this command:

(run-shell-command "gtk-launch lxrandr-autostart")
> (when initializing (my-startup))
>
> If I uncomment the run-shell-command, they stack in the last or
>
> current frame.

I have the same problem :(

Tim Macdonald

unread,
Apr 22, 2022, 12:09:54 PM4/22/22
to Roland Everaert, stumpwm-devel
I finally had some spare time to get this up and running on my own system and so far like it very much. Just need to retrain some of my muscle memory! I'm currently using it on two heads and it's fine; it's the same as using it on one head with every single desktop having a vertical split.

A stupid hack that I did and thought I'd share is changing the focus color for each z-layer to have a subtle reminder of which layer you're in. Here's how I did it (directly editing COORD-GROUP-CHANGE in the library file >.< ):

diff --git a/.stumpwm.d/modules/StumpWMSpatial/spatial-groups.lisp b/.stumpwm.d/modules/StumpWMSpatial/spatial-groups.lisp
index f3cba3c..c73e628 100644
--- a/.stumpwm.d/modules/StumpWMSpatial/spatial-groups.lisp
+++ b/.stumpwm.d/modules/StumpWMSpatial/spatial-groups.lisp
@@ -119,7 +119,8 @@
                   (split-string (group-name (current-group)) ",")))
          (new-coords (mapcar #'+ current-coords (list xo yo zo)))
          (new-group-name (format nil "~{~a~^,~}" new-coords)) )
-
+    (set-focus-color (elt *colors* (mod (third new-coords)
+                                        (length *colors*))))
     (if (= 0 zo)
 
         ;; Not changing desktop, so just move by coordinates


—Tim

Russell Adams

unread,
Apr 22, 2022, 6:04:43 PM4/22/22
to stumpwm-devel
On Fri, Apr 22, 2022 at 05:08:48PM +0100, Tim Macdonald wrote:
> I finally had some spare time to get this up and running on my own system
> and so far like it very much. Just need to retrain some of my muscle
> memory! I'm currently using it on two heads and it's fine; it's the same as
> using it on one head with every single desktop having a vertical split.

Great! I ought to test that at some point, but I tend to only use one
monitor.

> A stupid hack that I did and thought I'd share is changing the focus color
> for each z-layer to have a subtle reminder of which layer you're in. Here's
> how I did it (directly editing COORD-GROUP-CHANGE in the library file >.< ):

This is for the colored border around the currently active window?

> diff --git a/.stumpwm.d/modules/StumpWMSpatial/spatial-groups.lisp
> b/.stumpwm.d/modules/StumpWMSpatial/spatial-groups.lisp
> index f3cba3c..c73e628 100644
> --- a/.stumpwm.d/modules/StumpWMSpatial/spatial-groups.lisp
> +++ b/.stumpwm.d/modules/StumpWMSpatial/spatial-groups.lisp
> @@ -119,7 +119,8 @@
> (split-string (group-name (current-group)) ",")))
> (new-coords (mapcar #'+ current-coords (list xo yo zo)))
> (new-group-name (format nil "~{~a~^,~}" new-coords)) )
> -
> + (set-focus-color (elt *colors* (mod (third new-coords)
> + (length *colors*))))
> (if (= 0 zo)
>
> ;; Not changing desktop, so just move by coordinates
>
>
> —Tim

I don't run into a problem forgetting which z-layer (desktop?). I do
like that I have a coord-taskorigin call which re-centers on the
current z-layer.

I'm glad you're enjoying it!


------------------------------------------------------------------
Russell Adams RLA...@AdamsInfoServ.com
https://www.adamsinfoserv.com/

Reply all
Reply to author
Forward
0 new messages