Skip to content

Javyre/winds.el

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Winds.el

https://melpa.org/packages/winds-badge.svg

Window configuration switcher grouped by workspaces

winds.el is very similar to eyebrowse, tab-bar-mode, and other window config switchers, but allows for having multiple “workspaces” grouping sets of window config slots. It also saves winner-like history for each window config slot independently.

This small package was started because I tend to have multiple unrelated projects open at once, and need to keep them open. I do not want to cycle through unrelated window configs to get to what I want and I want to keep only one fullscreen emacs frame open.

(This package has basic support for multiple frames)

Screenshot

scrot.png

Install

This package is available on Melpa. Simply install it with your favorite package manager:

(use-package winds :ensure t)

Getting Started

To get started, bind some keys to winds-goto:

(global-set-key (kbd "M-1") (lambda () (interactive) (winds-goto :ws 1)))
(global-set-key (kbd "M-2") (lambda () (interactive) (winds-goto :ws 2)))
(global-set-key (kbd "M-3") (lambda () (interactive) (winds-goto :ws 3)))
(global-set-key (kbd "C-c 1") (lambda () (interactive) (winds-goto :cfg 1)))
(global-set-key (kbd "C-c 2") (lambda () (interactive) (winds-goto :cfg 2)))
(global-set-key (kbd "C-c 3") (lambda () (interactive) (winds-goto :cfg 3)))

You might also want to bind next~/~prev and close

(global-set-key (kbd "C-c <")  'winds-next)
(global-set-key (kbd "C-c >")  'winds-prev)
(global-set-key (kbd "C-c \\") 'winds-close)
(global-set-key (kbd "C-<")    'winds-cfg-next)
(global-set-key (kbd "C->")    'winds-cfg-prev)
(global-set-key (kbd "C-\\")   'winds-cfg-close)

Options

To disable the status message when changing window configs:

(setq winds-display-status-msg nil)

For a simple mode-line indicator, add this to your mode-line-format:

(:eval (format "%s|%s " (winds-get-cur-ws) (winds-get-cur-cfg)))

For example (dumb example):

(setq mode-line-format
      `(,mode-line-format
        (:eval (format "%s|%s "
                       (winds-get-cur-ws)
                       (winds-get-cur-cfg)))))

winds.el works with desktop.el! If you want to enable saving of winds workspaces add this to your configuration:

(with-eval-after-load 'desktop (winds-enable-desktop-save))

winds.el saves winner-like history for each window config slot! To enable history tracking, add this:

(winds-history-mode)
(global-set-key (kbd "C-c <left>")  'winds-history-undo)
(global-set-key (kbd "C-c <right>")  'winds-history-redo)

My config

As an example, here is how I use this package:

(use-package winds
  :straight t
  :custom
  (winds-default-ws 1)
  (winds-default-cfg 1)
  :init
  ;; Avoid lazy loading so that history is saved
  ;; from the very start of session
  (winds-mode)
  (winds-history-mode)
  (with-eval-after-load 'desktop (winds-enable-desktop-save))
  :general
  (:prefix "SPC w"
    "[" 'winds-history-undo
    "]" 'winds-history-redo
    "w n" 'winds-next
    "w p" 'winds-prev
    "w c" 'winds-close
    "w w TAB" 'winds-last
    "n" 'winds-cfg-next
    "p" 'winds-cfg-prev
    "c" 'winds-cfg-close
    "w TAB" 'winds-cfg-last
    "w o" 'winds-pos-last
    "w 0" (lambda () (interactive) (winds-goto :ws 10))
    "w 1" (lambda () (interactive) (winds-goto :ws 1))
    "w 2" (lambda () (interactive) (winds-goto :ws 2))
    "w 3" (lambda () (interactive) (winds-goto :ws 3))
    "w 4" (lambda () (interactive) (winds-goto :ws 4))
    "w 5" (lambda () (interactive) (winds-goto :ws 5))
    "w 6" (lambda () (interactive) (winds-goto :ws 6))
    "w 7" (lambda () (interactive) (winds-goto :ws 7))
    "w 8" (lambda () (interactive) (winds-goto :ws 8))
    "w 9" (lambda () (interactive) (winds-goto :ws 9))
    "0" (lambda () (interactive) (winds-goto :cfg 10))
    "1" (lambda () (interactive) (winds-goto :cfg 1))
    "2" (lambda () (interactive) (winds-goto :cfg 2))
    "3" (lambda () (interactive) (winds-goto :cfg 3))
    "4" (lambda () (interactive) (winds-goto :cfg 4))
    "5" (lambda () (interactive) (winds-goto :cfg 5))
    "6" (lambda () (interactive) (winds-goto :cfg 6))
    "7" (lambda () (interactive) (winds-goto :cfg 7))
    "8" (lambda () (interactive) (winds-goto :cfg 8))
    "9" (lambda () (interactive) (winds-goto :cfg 9)))
  ("M-0" (lambda () (interactive) (winds-goto :cfg 10))
   "M-1" (lambda () (interactive) (winds-goto :cfg 1))
   "M-2" (lambda () (interactive) (winds-goto :cfg 2))
   "M-3" (lambda () (interactive) (winds-goto :cfg 3))
   "M-4" (lambda () (interactive) (winds-goto :cfg 4))
   "M-5" (lambda () (interactive) (winds-goto :cfg 5))
   "M-6" (lambda () (interactive) (winds-goto :cfg 6))
   "M-7" (lambda () (interactive) (winds-goto :cfg 7))
   "M-8" (lambda () (interactive) (winds-goto :cfg 8))
   "M-9" (lambda () (interactive) (winds-goto :cfg 9))))

About

2-Dimensional Emacs window configuration switcher

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published