Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using M-<number> to switch workspace in eyebrowse #1520

Closed
tuhdo opened this issue May 7, 2015 · 21 comments
Closed

Using M-<number> to switch workspace in eyebrowse #1520

tuhdo opened this issue May 7, 2015 · 21 comments
Labels
Enhancement ☺ Key Bindings stale marked as a stale issue/pr (usually by a bot)

Comments

@tuhdo
Copy link
Contributor

tuhdo commented May 7, 2015

Currently I have something like this in my private layer to quickly switch workspace with M-<number> for testing:

(defmacro tuhdo/define-eyebrowse-binding (key)
  `(define-key window-numbering-keymap (kbd ,(concat "M-" key))
     (lambda ()
       (interactive)
       (funcall ',(intern (concat "eyebrowse-switch-to-window-config-" key)))
       (spacemacs//workspaces-ms-documentation)
       (spacemacs/workspaces-micro-state)
       (funcall ',(intern (concat "eyebrowse-switch-to-window-config-" key))))))

(defun tuhdo/post-init-eyebrowse ()
  (with-eval-after-load 'window-numbering
    (tuhdo/define-eyebrowse-binding "0")
    (tuhdo/define-eyebrowse-binding "1")
    (tuhdo/define-eyebrowse-binding "2")
    (tuhdo/define-eyebrowse-binding "3")
    (tuhdo/define-eyebrowse-binding "4")
    (tuhdo/define-eyebrowse-binding "5")
    (tuhdo/define-eyebrowse-binding "6")
    (tuhdo/define-eyebrowse-binding "7")
    (tuhdo/define-eyebrowse-binding "8")
    (tuhdo/define-eyebrowse-binding "9")))

Why assign to window-numbering-keymap? Because window-numbering-mode is active and all the M-<number> keys are attached to switch window commands. And about the logic in the lambda, I have to call eyebrowse-switch-to-window-config-<key> twice to refresh the microstate doc. I made this hack because spacemacs|define-micro-state macro apparently doesn't accept variable for its :evil-leader key.

Using M-<number> is much more convenient thanSPC W(3 key presses) orC-c W(4 key presses).M-` is currently redundant anyway.

@syl20bnr
Copy link
Owner

syl20bnr commented May 7, 2015

Calling the micro-state and then use execute-kbd-macro does not work ?

@tuhdo
Copy link
Contributor Author

tuhdo commented May 7, 2015

@syl20bnr I didn't know that. It could work but then, it would shadow the SPC <number> currently used for switching windows. But, how do you think about this idea? Personally, I find it better than the current leader key.

@syl20bnr
Copy link
Owner

syl20bnr commented May 7, 2015

I will keep SPC # for switching windows. SPC W is also important we cannot ditch it. SPC s-# can be used to switch workspaces.
Since switching window is so important I won't change M-# at the spacemacs level, the potential to disturb people workflow is too high on this one.
I find SPC/M-n # for windows and SPC/M-m s-# for workspaces pretty good default. There is also M-# and M-s-# available that while being a key combination is available in all states.
They may seems to be duplicates but they are not, SPC # is a sequence and M-# is a combination. Depending on where you type both are relevant. And originally Spacemacs is all about sequences instead of combinations.

@syl20bnr
Copy link
Owner

syl20bnr commented May 7, 2015

SPC W is important because I intend to implement my i3 modal config into it which can be pretty cool for some users.

@tuhdo
Copy link
Contributor Author

tuhdo commented May 7, 2015

But if we have many workspaces, we should be able to quickly switch. Righ now it takes too many key presses to switch to one (5 for holy-mode and 4 for evil-mode). So, how about just SPC S <number>? i.e. SPC ! to switch workspace 1, SPC @ to workspace 2... it is more consistent with switching window: if you want to switch to a workspace, use Shift, otherwise windows. And we could also add M-S-<number> version too.

@syl20bnr
Copy link
Owner

syl20bnr commented May 7, 2015

@tuhdo .... this is what I proposed :-D
oh ok, by lower s I meant shift.

@trishume
Copy link
Contributor

trishume commented May 7, 2015

good idea! Only thing it conflicts with right now is SPC ! for shell command but that isn't very important.

@CestDiego
Copy link
Contributor

guys I have one request on this thoug... Is it possible to have different number workspaces? or to have them all at the same time anyway....like with i3 or bspwm window managers, so that whenever you want to switch to workspace 4 and it hasn't been created yet, it gets created, (despite worspace # 2, 3, 4 are not created) I think this would be more of a thing for "labeled" workspaces, where you know workspace #1 is about elisp, #2 is gonna be your django project, #3 is IRC, #4 is emms, etc. Although I think this is a question more related to @wasamasa.

@syl20bnr
Copy link
Owner

syl20bnr commented May 8, 2015

This is something to ask upstream.

@syl20bnr
Copy link
Owner

syl20bnr commented May 8, 2015

Oh that's already the case :-)

@syl20bnr
Copy link
Owner

syl20bnr commented May 8, 2015

Press SPC W 5 and the workspace [5] will be created.

@CestDiego
Copy link
Contributor

Oh that's so cool! :O :O :O I didn't know this..I remember I tried this before. weird. Anyway thx... just one thing @syl20bnr, what is upstream? D: I mean when I'm working on my fork, this repo is upstream...but this repo isn't a fork of anything so is there an upstream?

@syl20bnr
Copy link
Owner

syl20bnr commented May 8, 2015

You are right this is the original meaning. Since more and more people uses this term it is now abused and upstream in this case means the official repository of something.

@syl20bnr
Copy link
Owner

syl20bnr commented May 8, 2015

Sorry for the typos :-) Fixed.

@wasamasa
Copy link

wasamasa commented May 8, 2015

Switching to a non-existent workspace will create a new one, yes. I don't get why you're creating your own commands with a macro again and worse, funcalling concatenated strings that happen to form an existing command considering that you can pass numbers to the respective function just fine (and I intend to extend it later to take a numerical prefix argument). If you have issues that can be solved easier by me providing a solution, feel free to tell me instead of amassing inofficial hacks, especially the ones using internals that are prone to breakage.

@CestDiego To answer your other question, yes, I'm currently working on tagged workspaces.

@tuhdo
Copy link
Contributor Author

tuhdo commented May 8, 2015

@wasamasa a macro is needed to show the evil microstate like in this screenshot: http://s22.postimg.org/aqd1em8xd/spacemacs_eyebrowse_demo.gif. Using stock eyebrowse function does not activate the microstate information in the minibuffer but simply change the value in the modeline.

@syl20bnr
Copy link
Owner

syl20bnr commented May 8, 2015

@tuhdo Are you sure a macro is needed ? Just a function to call the micro-state then send the keyboard key should be ok.

@wasamasa
Copy link

wasamasa commented Jun 8, 2015

@CestDiego Tagging is implemented BTW.

@StreakyCobra
Copy link
Contributor

@syl20bnr @CestDiego What's you opinion on this? Should this be integrated in spacemacs-layout ? Should it be closed?

@angerman
Copy link

What happened to this? I don't see M-S-# working, but then again, I might be doing something wrong :)

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Feb 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ☺ Key Bindings stale marked as a stale issue/pr (usually by a bot)
Projects
None yet
Development

No branches or pull requests

7 participants