exwm icon indicating copy to clipboard operation
exwm copied to clipboard

Extending same workspace to multiple monitor

Open HumHongeKamyaab opened this issue 3 years ago • 11 comments

Recently shifted from Gnome.

Couldn't figure out, how to extend same workspace to multiple monitors like in Gnome, StumpWm.

Right now, each monitor run different workspace.

My randr config:

''' ;; randr config (require 'exwm-randr) (setq exwm-randr-workspace-output-plist '(1 "HDMI-1")) (add-hook 'exwm-randr-screen-change-hook (lambda () (start-process-shell-command "xrandr" nil "xrandr --output HDMI-1 --above eDP-1 --auto"))) (exwm-randr-enable)

''' Any suggestions ...

HumHongeKamyaab avatar Sep 17 '20 06:09 HumHongeKamyaab

Very interested -- I sort of depend on different workspaces per monitor, with (setq exwm-layout-show-all-buffers t) . What's the usecase for this?

WorldsEndless avatar Sep 25 '20 14:09 WorldsEndless

I use different workspaces basically to completely separate different tasks. For eg. songs, browsing social media etc on 1 workspace and emacs, terminal, work browser on another workspace. I dont want to use (setq exwm-layout-show-all-buffers t) to keep these tasks completely on different workspaces, basically to ensure distraction free environment.

Now while using multiple monitors, I want emacs on one monitor, and terminal, browser on another monitor. These all processes belong to same workspace, but are on multiple monitor(that what I mean by extending workspace)

As I said this was perfectly possible in Gnome and Stumpwm.

HumHongeKamyaab avatar Sep 25 '20 20:09 HumHongeKamyaab

You might consider other emacs packages to help with this. Persp mode and perspective.el are the big-hitters in this domain, and recently there's Torus, but also bufler (https://github.com/alphapapa/bufler.el) has a mode of showing only switch-buffers in a certain group. I don't know whether it's workable to just one monitor, since I don't use it for those capabilities, but you might look at some of them.

HTH

WorldsEndless avatar Sep 25 '20 21:09 WorldsEndless

@WorldsEndless Thanks for pointing to them. I will try them out in future. Meanwhile it would be great if exwm can put it as a feature request, as it is default behavior in stumpwm and gnome.

HumHongeKamyaab avatar Sep 25 '20 22:09 HumHongeKamyaab

@HumHongeKamyaab You can have workspaces span across multiple monitors, as per screenshot section in the wiki which shows an image being displayed in such a manner. It's not mentioned in the User Guide though. I just tested the procedure mentioned and it worked for me but to sum it up:

  • disable exwm-randr (by commenting out (exwm-randr-enable))
  • make sure you run xrandr before EXWM is initiated, by putting (shell-command "xrandr --output HDMI-1 --above eDP-1 --auto") right before (exwm-enable)

Next time you start EXWM, you should have workspaces spanning across monitors. It's seems a little finicky though, as it is literally just a single frame spanning both windows, but it's a start.

Let me know if it worked for you :)

lucasgruss avatar Sep 28 '20 21:09 lucasgruss

@lucasgruss I have tried it. Its not working, as it literally extending single frame in the multiple monitors that too in a weird way. By extending, I mean that each monitor should have there own emacs frame, but all these frames of each monitor should belong to same workspace.

In present exwm implementation, no of workspaces is equal to number of emacs frames.

HumHongeKamyaab avatar Sep 28 '20 21:09 HumHongeKamyaab

@HumHongeKamyaab in this case the following snippet implements a rudimentary workspace spanning multiple monitors by leveraging EXWM's own workspaces:

(defun exwm-workspace-switch-group-hack (list-index)
  "Switch to a group of workspaces"
  (dolist (workspace list-index)
    (exwm-workspace-switch-create workspace)))

(defun exwm-workspace-switch-group (index size)
  "Activate workspaces in [index; index+size["
  (interactive)
  (exwm-workspace-switch-group-hack
   (number-sequence
    (* index size)
    (- (* size (+ index 1)) 1))))

;; odd numbered workspaces are mapped to HDMI-1, even-numbered ones to eDP-1 (ugly)
(setq exwm-randr-workspace-output-plist '(0 "eDP-1" 1 "HDMI-1" 2 "eDP-1" 3 "HDMI-1" 4 "eDP-1" 5 "HDMI-1"
6 "eDP-1" 7 "HDMI-1" 8 "eDP-1" 9 "HDMI-1" ))

The idea is to switch to multiple EXWM workspaces in sequence by supplying a list of workspaces that can constitute a "virtual workspace". So here, if you call (exwm-workspace-switch-group 0 2), you'll be taken to virtual workspace 0, exploiting the 2 workspaces at index 0 and 1.

There is definitely room for improvement but I hope it can provide a temporary solution for you.

lucasgruss avatar Sep 28 '20 22:09 lucasgruss

@lucasgruss this hack looks promising. https://github.com/ch11ng/exwm/issues/784#issuecomment-699664146 Can you suggest modification in the function exwm-workspace-switch-cycle mentioned in above issue to switch between virtual workspaces. Also have you shared your exwm config file on git?

HumHongeKamyaab avatar Sep 28 '20 23:09 HumHongeKamyaab

@HumHongeKamyaab Did you figure out any way to span a workspace across monitors? I am also looking for a package for this task as I feel this workflow of spanning workspaces makes much more sense.

ebeem avatar Mar 04 '22 22:03 ebeem

@ebeem Here is my rough solution for managing workspace groups, where each workspace in the current group corresponds to each monitor: https://github.com/daehwannam/exwm-workspace-group

daehwannam avatar May 20 '22 05:05 daehwannam

Thanks @daehwannam, I tried your solution and it seems like a very good starting point Many thanks for sharing.

ebeem avatar May 20 '22 18:05 ebeem