ch11ng / exwm

Emacs X Window Manager
2.85k stars 136 forks source link

x-applications is shown in all workspaces on a screen when using several screens. #379

Closed vetegrodd closed 6 years ago

vetegrodd commented 6 years ago

Since exwm-17 I cannot longer use multiple workspaces in combination with multiple screens.

Setup: Two screens with 4 workspaces. WS 0 and 1 on screen 0 and WS 2 and 3 on screen 1. If I open a web browser in workspace 0 it is still visible when I switch to workspace 1, although the focus in the buffer that was associated with ws 1. The same happens on screen 1 if I open or move a window to worskpace 2 and 3.

This is my config:

(require 'exwm)
(require 'exwm-config)
(exwm-config-default)
(require 'exwm-randr)
(exwm-randr-enable)
(exwm-enable)

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(exwm-randr-screen-change-hook
   (quote
    ((lambda nil
       (start-process-shell-command "xrandr" nil "xrandr --output HDMI-1 --left-of LVDS-1 --primary --auto --output LVDS-1 --auto")))))
 '(exwm-randr-workspace-output-plist (quote (0 "HDMI-1" 1 "HDMI-1" 2 "LVDS-1" 3 "LVDS-1")))
 '(package-selected-packages
   (quote
    (exwm ## pipenv yaml-mode company company-mode paradox use-package))))
rayslava commented 6 years ago

I guess it's same as #375 And yes, I've got the same issue, but with 3 screens

kinleyd commented 6 years ago

I have the same issue since upgrading to 0.17.

ch11ng commented 6 years ago

Please wait for the merge of #378 for the actual fix. As with #375 you can remove the primary output from exwm-randr-workspace-output-plist to workaround this problem.

vetegrodd commented 6 years ago

Thanks for the hard work and a really awesome project!

kinleyd commented 6 years ago

Agreed! Thanks @ch11ng!

On Thu, Mar 1, 2018, 23:47 vetegrodd notifications@github.com wrote:

Thanks for the hard work and a really awesome project!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ch11ng/exwm/issues/379#issuecomment-369672831, or mute the thread https://github.com/notifications/unsubscribe-auth/ABWrv7vM_qzPpDs40-mgHrUkOAnVvfn0ks5taDRGgaJpZM4SXJmM .

ch11ng commented 6 years ago

This problem should have been fixed. Please give a try.

kinleyd commented 6 years ago

@ch11ng: I copied exwm-workspace.el (I understand this to be the file with the relevant changes) into my /elpa/exwm-0.17 folder and byte compiled it. However, the issue remains. Please let me know if I have the right file for the fix, or if there are multiple files to insert. Thanks.

vetegrodd commented 6 years ago

I tested with dd0f1077 and it solved this issue.

kinleyd commented 6 years ago

Strange. It's working now with just exwm-workspace.el updated, and I haven't done anything different. :)

I'll update exwm-core.el and exwm-input.el for good measure!

kinleyd commented 6 years ago

The problem is mitigated but not fully gone for me. Even with updating exwm-workspace, exwm-core and exwm-input.el, I get the screen problem on the first run of an app. After closing the app and running it the second time, the problem doesn't recur.

ch11ng commented 6 years ago

@kinleyd You'd better update all files or it can be problematic. Features/Fixes often involve with modifying multiple files.

kinleyd commented 6 years ago

Thanks @ch11ng. I replaced all .el files with their latest versions and byte-compiled, but the issue remains.

ch11ng commented 6 years ago

@kinleyd Perhaps yours is another problem. Please describe it in more details.

kinleyd commented 6 years ago

Yes, I was wondering the same. Here's the issue:

I've got a triple screen setup, and on my second screen I have opened two workspaces. One workspace contains 6 windows as numbered in the picture below (excuse the quick and dirty annotations!). Windows 1, 2 and 3 are emacs windows (scripts, etc.) while 4, 5 and 6 run urxvt with tmux, ncmpcpp and conky respectively.

When I open xfe for the first time in its own workspace on the second screen, I can only see it on windows 1, 2 and 3 (the emacs windows). The other three windows continue to display windows from the first workspace.

This mashup doesn't occur when I close and reopen xfe or if I click around my screens and windows first and then open xfe. Switching the xfe buffer across workspaces and/or screens also sometimes clears the mashup.

exwm-bug

ch11ng commented 6 years ago

What's the value of exwm-workspace-number and which screen is the primary output (you can check that with xrandr)? I've pushed cb8706f91c1c343a9bf392c9deaadc0c42d4dba6 to fix a potential problem. No sure if that resolves yours.

kinleyd commented 6 years ago

I tried installing the latest version of exwm but it would trigger an error at login and fail so had to revert to my previous git clone.

With that earlier version:

describe-variable exwm-workspace-number:

exwm-workspace-number is a variable defined in ‘exwm-workspace.el’. Its value is 8 Original value was 1

Documentation: Initial number of workspaces.

xrandr output:

Corsair :: ~ » xrandr Screen 0: minimum 8 x 8, current 5760 x 1080, maximum 16384 x 16384 DVI-I-0 disconnected (normal left inverted right x axis y axis) DVI-I-1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 510mm x 290mm 1920x1080 60.00*+ 1680x1050 59.95 1600x900 60.00 1440x900 59.89 1400x1050 59.98 1280x1024 75.02 60.02 1280x800 59.81 1280x720 60.00 1152x864 75.00 1024x768 75.03 60.00 800x600 75.00 60.32 56.25 640x480 75.00 59.94 HDMI-0 connected 1920x1080+3840+0 (normal left inverted right x axis y axis) 510mm x 290mm 1920x1080 60.00*+ 59.94 50.00 60.05 60.00 50.04 1680x1050 59.95 1600x900 60.00 1440x900 59.89 1400x1050 59.98 1280x1024 60.02 1280x800 59.81 1280x720 60.00 59.94 50.00 1152x864 60.00 1024x768 60.00 800x600 60.32 720x576 50.00 720x480 59.94 640x480 59.94 59.93 DP-0 disconnected (normal left inverted right x axis y axis) DVI-D-0 connected primary 1920x1080+1920+0 (normal left inverted right x axis y axis) 510mm x 290mm 1920x1080 60.00*+ 1680x1050 59.95 1600x900 60.00 1440x900 59.89 1400x1050 59.98 1280x1024 75.02 60.02 1280x800 59.81 1280x720 60.00 1152x864 75.00 1024x768 75.03 60.00 800x600 75.00 60.32 56.25 640x480 75.00 59.94 DP-1 disconnected (normal left inverted right x axis y axis)

ch11ng commented 6 years ago

I tried installing the latest version of exwm but it would trigger an error at login and fail so had to revert to my previous git clone.

What's the error? It may have something to do with how you start EXWM.

kinleyd commented 6 years ago

Thanks @ch11ng. I use slim to log in, and get this error 'failed to execute login command'. This usually results from incorrect settings in .xinitrc or init.el as you mentioned, but in this case, with the same settings for both, the error is triggered only when I use the latest version of exwm I have in my git clone.

ch11ng commented 6 years ago

'Failed to execute login command' can mean a lot of things. Could you try with xinit/startx and see what error Emacs reports?

tumashu commented 6 years ago
 .xinitrc

r+x ?

kinleyd commented 6 years ago

@tumashu: permissions seem to be fine, afaik. @ch11ng: OK, starting with xinit I get these errors using the latest rebase from the exwm repo:

Debugger entered--Lisp error: (file-error "Cannot open load file" "No such file or directory" "exwm") require(exwm) eval-buffer(#<buffer load> nil "/home/kdd/.emacs.d/init.el" nil t) ; Reading at buffer position 1345 load-with-code-conversion("/home/kdd/.emacs.d/init.el" "/home/kdd/.emacs.d/init.el" t t) load("/home/kdd/.emacs.d/init" t t)

[0 "\205\266

ch11ng commented 6 years ago

Please remove the .elc files and try again. They are probably not correctly byte-compiled.

kinleyd commented 6 years ago

Yes, I was aware of the possibility of .elc file mismatches, so they were removed prior to testing.

Question: My exwm files are installed in ~/../exwm-0.17. For the present tests I simply removed files in this folder and inserted copies from my git clone. Would that be a problem? I had no problems doing it this way a couple of git rebases before.

ch11ng commented 6 years ago

~/../exwm-0.17

/home/exwm-0.17 ? Please check if you have read permission to these files.

kinleyd commented 6 years ago

Yes, I do have read permissions on the files in my git clone (the ones that aren't currently working). What's crazy is the files that are currently working have root as the user, and not me - I'd expect this bunch not to work. Hmm.

Edit: /home/user/.emacs.d/elpa/exwm-0.17

ch11ng commented 6 years ago

@kinleyd What's the status?

kinleyd commented 6 years ago

Hey @ch11ng, I copied over the latest git versions into my ~/.emacs.d/elpa/exwm-0.17/ folder and confirmed all permissions were exactly as it was for the melpa installed version. I continue getting the same error: file-error "Cannot open load file" "No such file or directory" "exwm"

I'm not sure what the problem is with this.

Meanwhile, reverting to my earlier version works. I still get the mashup between workspaces, but switching back and forth once between the affected workspaces removes the mashup and my work can continue.

ch11ng commented 6 years ago
ls -l ~/.emacs.d/elpa/ | grep exwm
ls -lR ~/.emacs.d/elpa/exwm-0.17/
sha256sum ~/.emacs.d/elpa/exwm-0.17/*

PS. You may also need to update XELB.

kinleyd commented 6 years ago

» ls -l ~/.emacs.d/elpa/ | grep exwm drwxr-xr-x 2 kdd users 4096 Mar 11 22:34 exwm-0.17 -rw-r--r-- 1 kdd users 147 Mar 6 21:30 exwm-0.17.signed

» ls -lR ~/.emacs.d/elpa/exwm-0.17/ /home/kdd/.emacs.d/elpa/exwm-0.17/: total 436 -rw-r--r-- 1 kdd users 115580 Mar 11 22:34 ChangeLog -rw-r--r-- 1 kdd users 6602 Mar 11 22:34 exwm-autoloads.el -rw-r--r-- 1 kdd users 1429 Mar 11 22:34 exwm-cm.el -rw-r--r-- 1 kdd users 4401 Mar 11 22:34 exwm-config.el -rw-r--r-- 1 kdd users 12074 Mar 11 22:34 exwm-core.el -rw-r--r-- 1 kdd users 36519 Mar 11 22:34 exwm.el -rw-r--r-- 1 kdd users 31457 Mar 11 22:34 exwm-floating.el -rw-r--r-- 1 kdd users 42852 Mar 11 22:34 exwm-input.el -rw-r--r-- 1 kdd users 22866 Mar 11 22:34 exwm-layout.el -rw-r--r-- 1 kdd users 29329 Mar 11 22:34 exwm-manage.el -rw-r--r-- 1 kdd users 177 Mar 11 22:34 exwm-pkg.el -rw-r--r-- 1 kdd users 10176 Mar 11 22:34 exwm-randr.el -rw-r--r-- 1 kdd users 23377 Mar 11 22:34 exwm-systemtray.el -rw-r--r-- 1 kdd users 72376 Mar 11 22:34 exwm-workspace.el -rw-r--r-- 1 kdd users 749 Mar 11 22:34 README.md -rw-r--r-- 1 kdd users 352 Mar 11 22:34 xinitrc

» sha256sum ~/.emacs.d/elpa/exwm-0.17/* 1874522931dc53352e040f2fc55ebc04283be40cdcbdd79ef7519c7c92fcd3fe /home/kdd/.emacs.d/elpa/exwm-0.17/ChangeLog 30ad2a774529b47c6d4b947c062a6341330633cb311745d806cfcd79e0df891f /home/kdd/.emacs.d/elpa/exwm-0.17/exwm-autoloads.el f90b78a4d433c7d666622a4eb85846f7e831760ce0dcc8076a72eec1d515a466 /home/kdd/.emacs.d/elpa/exwm-0.17/exwm-cm.el 35be214dd5c981dee8b5d8247f37ce169db5d852d490c2a7a5bcab499098ac0b /home/kdd/.emacs.d/elpa/exwm-0.17/exwm-config.el 3b72e07060f89a0c765ab0ea919ae10da21d86200e914faae916ada8aee26d39 /home/kdd/.emacs.d/elpa/exwm-0.17/exwm-core.el 1052dfdc7e6dd949975832015503ef24c60be57c2d661d41e96bf55fece84157 /home/kdd/.emacs.d/elpa/exwm-0.17/exwm.el dabc4fbb77add55ddf9bce941d29b10f5170e728e7ba39d25264bb481f13668c /home/kdd/.emacs.d/elpa/exwm-0.17/exwm-floating.el cda47859c175270e32954b33cc1fb24d0fc1a337bf8c41c04a2aa5790ff3fed7 /home/kdd/.emacs.d/elpa/exwm-0.17/exwm-input.el 57ecaab35a18fe900de6c3de50d867f6b834370c0d6ba1728ca588b8cdfe36b1 /home/kdd/.emacs.d/elpa/exwm-0.17/exwm-layout.el b7ff4ccda0de3cdb96234ecbe39752026733eab39a8cacab238ce25de79a2568 /home/kdd/.emacs.d/elpa/exwm-0.17/exwm-manage.el 9ac5b0bbdddf69e1d9e290d2434a55ce9c30352ba364883d468fbc560dd0271c /home/kdd/.emacs.d/elpa/exwm-0.17/exwm-pkg.el d24953cef5e495d94ca18790328c15ffd00a9a1c6b687a70000c2f6a8acfd81f /home/kdd/.emacs.d/elpa/exwm-0.17/exwm-randr.el bae5784fc0586af764e6874e64888a1d400871f25166cb234ed0d4f083e0d65a /home/kdd/.emacs.d/elpa/exwm-0.17/exwm-systemtray.el e7776423feab577c1fa38fdbbd95fbb8ec0f8eba12abde1a50b26f5b1aee08cd /home/kdd/.emacs.d/elpa/exwm-0.17/exwm-workspace.el 12b0bc3fe53040cd2750a96883a369f58763e3db404f55ef67af210aea988b22 /home/kdd/.emacs.d/elpa/exwm-0.17/README.md
8bf8eaa79366fb581ebd1f7fab195e8ece4c3ca4b12424f4b3cbe16a915e634d /home/kdd/.emacs.d/elpa/exwm-0.17/xinitrc

ch11ng commented 6 years ago

Please remove exwm-autoloads.el . The preferable way to load the latest code is to uninstall the elpa package and add the local repo to load-path.

kinleyd commented 6 years ago

OK re removing exwm-autoloads.el. Regarding uninstalling the elpa package, I did that at the start but had all kinds of problems thereafter. Will try again if that is the preferred way.

I'm also updating xelb to git version. Let's see.

kinleyd commented 6 years ago

OK, uninstalled elpa versions of exwm and xelb, and added local git clones to the load path. And no errors loading exwm now with the latest git versions. Thanks! :)

However, problem with screen mashup remains as before.

ch11ng commented 6 years ago

Could you show your RandR configurations? I tested with a triple monitor setup with spice and nothing seemed to be broken.

kinleyd commented 6 years ago

» xrandr Screen 0: minimum 8 x 8, current 5760 x 1080, maximum 16384 x 16384 DVI-I-0 disconnected (normal left inverted right x axis y axis) DVI-I-1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 510mm x 290mm 1920x1080 60.00+ 1680x1050 59.95
1600x900 60.00
1440x900 59.89
1400x1050 59.98
1280x1024 75.02 60.02
1280x800 59.81
1280x720 60.00
1152x864 75.00
1024x768 75.03 60.00
800x600 75.00 60.32 56.25
640x480 75.00 59.94
HDMI-0 connected 1920x1080+3840+0 (normal left inverted right x axis y axis) 510mm x 290mm 1920x1080 60.00
+ 59.94 50.00 60.05 60.00 50.04
1680x1050 59.95
1600x900 60.00
1440x900 59.89
1400x1050 59.98
1280x1024 60.02
1280x800 59.81
1280x720 60.00 59.94 50.00
1152x864 60.00
1024x768 60.00
800x600 60.32
720x576 50.00
720x480 59.94
640x480 59.94 59.93
DP-0 disconnected (normal left inverted right x axis y axis) DVI-D-0 connected primary 1920x1080+1920+0 (normal left inverted right x axis y axis) 510mm x 290mm 1920x1080 60.00*+ 1680x1050 59.95
1600x900 60.00
1440x900 59.89
1400x1050 59.98
1280x1024 75.02 60.02
1280x800 59.81
1280x720 60.00
1152x864 75.00
1024x768 75.03 60.00
800x600 75.00 60.32 56.25
640x480 75.00 59.94
DP-1 disconnected (normal left inverted right x axis y axis)

ch11ng commented 6 years ago

I mean the configurations related to exwm-randr-workspace-output-plist and exwm-randr-screen-change-hook for example. You've already dumped that output before.

kinleyd commented 6 years ago

Oops. Here it is:

(require 'exwm-randr) (setq exwm-randr-workspace-output-plist '(0 "DVI-I-1" 1 "DVI-D-0" 2 "HDMI-0" 3 "DVI-I-1" 4 "DVI-D-0" 5 "HDMI-0" 6 "DVI-D-0" 7 "HDMI-0")) (add-hook 'exwm-randr-screen-change-hook (lambda () (start-process-shell-command "xrandr" nil "xrandr --output DVI-I-1 --output DVI-D-0 --output HDMI-0 --auto"))) (exwm-randr-enable)

ch11ng commented 6 years ago

So you have workspace 1, 4 and 6 on your second output (which is also the primary one), and the initially selected workspace is on the left. Is that right? What's the result of the following form before you do any workspace operation?

(mapcar (lambda (i)
          (vector (frame-parameter i 'exwm-randr-output)
                  (frame-parameter i 'exwm-active)))
        exwm-workspace--list)
kinleyd commented 6 years ago

"So you have workspace 1, 4 and 6 on your second output (which is also the primary one), and the initially selected workspace is on the left. Is that right?"

Yes.

Regarding the form above: I evaluated it before doing any workspace operation. However, I don't seem to be getting any return message.

kinleyd commented 6 years ago

OK, eval-print-last-sexp: (["DVI-I-1" t] ["DVI-D-0" t] ["HDMI-0" t] ["DVI-I-1" t] ["DVI-D-0" t] ["HDMI-0" t] ["DVI-D-0" t] ["HDMI-0" t])

ch11ng commented 6 years ago

@kinleyd It should be fixed in 8db0a7838233946b3b9ea1ef4b33ab0cb113c5e1.

kinleyd commented 6 years ago

@ch11ng, happy to confirm that. Thank you!

kinleyd commented 6 years ago

Oh no. While xfe doesn't cause this anymore, as it did before, the problem recurs. The look of the problem is the same as before, but this time it gets triggered by spicy. exwm-bug

@ch11ng

ch11ng commented 6 years ago

@kinleyd Sorry to hear that. As usual could you provide the steps for reproducing this? And the following test may still be helpful:

(mapcar (lambda (i)
          (vector (frame-parameter i 'exwm-randr-output)
                  (frame-parameter i 'exwm-active)))
        exwm-workspace--list)
kinleyd commented 6 years ago

@ch11ng, yeah I know, I was hoping it was solved. Thanks for your quick response, as always.

The output for the above test is: (["DVI-I-1" t] ["DVI-D-0" t] ["HDMI-0" t] ["DVI-I-1" nil] ["DVI-D-0" nil] ["HDMI-0" nil] ["DVI-I-1" nil] ["DVI-D-0" nil] ["HDMI-0" nil])

I've added another two workspaces since the last error that you fixed, but I was getting the spicy error before I added the workspaces, so essentially everything is the same as it was with the xfe error. Like in the xfe case, all I have to do is load up exwm and my settings (workspaces, windows and apps) via init.el, and without interacting manually with the settings if I load up my qemu/spicy script via an exwm shortkey, the mangled screen appears. However, if I interact manually with workspaces and then run my qemu/spicy script, the mangled screen doesn't (usually) appear. Basically, the same problem as xfe used to have.

Edit: Also, after getting the above screen, I can resolve it simply by switching to workspace 1 (the one with the urxvt windows) and then switching back to the spicy workspace. So it's not a show stopper, thankfully. :)

ch11ng commented 6 years ago

@kinleyd Is the output captured just after EXWM has started and no workspace switch is ever done?

kinleyd commented 6 years ago

@ch11ng: Yes, it is. I tested it carefully without switching workspaces, and the output is captured just as I have posted previously.

ch11ng commented 6 years ago

@kinleyd Then it's not the same problem. Please provide some details on the qemu/spicy script.

kinleyd commented 6 years ago

OK. Here's how I start qemu and spicy in exwm:

;; separate exwm layout from qemu and spice action ;; qemu and spice action (exwm-input-set-key (kbd "s-w") (lambda () (interactive) (start-process-shell-command "vm-start" nil "vm-start") (sleep-for 3) (start-process-shell-command "spicy" nil "spicy -h 127.0.0.1 -p 3001"))) ;; exwm layout ;; wait till s-w has spawned Spicy<2> and Spicy<3> buffers before running this (exwm-input-set-key (kbd "s-W") (lambda () (interactive) (exwm-workspace-switch 7) ;; center screen ;; handle main window -- using switch-to-buffer causes problems when combining start of spicy with workspace rearrangement (exwm-workspace-switch-to-buffer "Spicy<2>") (exwm-layout-toggle-fullscreen) ;; presently has no effect; use S-F11 to toggle fullscreen (exwm-workspace-switch 8) ;; right screen (exwm-workspace-switch-to-buffer "Spicy<3>") ;; handle second window (exwm-layout-toggle-fullscreen) ;; presently has no effect; use S-F11 to toggle fullscreen ))

ch11ng commented 6 years ago

Is the output taken before running this script?

PS. That's a lot of workspace switches. It's simply too clumsy. I'll add a per-application configuration for this.

kinleyd commented 6 years ago

Sorry, had a power outage last night in the middle of our exchange.

Yes, the output previously posted was before running the spicy script. After running the script I get this: (["DVI-I-1" t] ["DVI-D-0" t] ["HDMI-0" nil] ["DVI-I-1" nil] ["DVI-D-0" nil] ["HDMI-0" nil] ["DVI-I-1" nil] ["DVI-D-0" nil] ["HDMI-0" t])

Re the workspace and buffer switching, yes, a bit clumsy, although the bigger bummer is waiting for the Windows VM to load. I'll take a look at per-app configuration as you suggest.