2

Say I'm in workspace 1 and I switch to workspace 3. Currently I have to remember that I was in workspace 1 but I want some sort of functionality to to do this for me. In i3wm I can enable workspace_auto_back_and_forth to achieve this. I there anyway to have the same thing in exwm?

3

I do not think there's a built-in way to do this, but you could add the code below to your init-file.

(defvar exwm-workspace-previous-index nil "The previous active workspace index.")

(defun exwm-workspace--current-to-previous-index (_x)
  (setq exwm-workspace-previous-index exwm-workspace-current-index))

(advice-add 'exwm-workspace-switch :before #'exwm-workspace--current-to-previous-index)

(defun exwm-workspace-switch-to-previous ()
  (interactive)
  "Switch to the previous active workspace." 
  (let ((index exwm-workspace-previous-index))
    (exwm-workspace-switch index)))

And now bind exwm-workspace-switch-to-previous to a key. Then you can use that key to toggle to your previous visited workspace.

  • I had to hook it to exwm-init-hook or else it gives me an error with a fresh start of emacs. And thanks it works nicely. :) – fhdhsni May 28 '17 at 13:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.