2020-08-31 15:36:55 +02:00
|
|
|
;;; window-manager.el --- Functions augmenting my usage of EXWM -*- lexical-binding: t -*-
|
|
|
|
|
2019-10-09 13:13:56 +02:00
|
|
|
;; Author: William Carroll <wpcarro@gmail.com>
|
2020-08-31 15:36:55 +02:00
|
|
|
;; Version: 0.0.1
|
|
|
|
;; URL: https://git.wpcarro.dev/wpcarro/briefcase
|
|
|
|
;; Package-Requires: ((emacs "25.1"))
|
2019-10-09 13:13:56 +02:00
|
|
|
|
|
|
|
;;; Commentary:
|
2019-12-23 12:19:42 +01:00
|
|
|
;; I switched to EXWM from i3, and I haven't looked back. One day I may write a
|
|
|
|
;; poem declaring my love for Emacs and EXWM. For now, I haven't the time.
|
|
|
|
|
2019-10-09 13:13:56 +02:00
|
|
|
;; Wish list:
|
|
|
|
;; - TODO: Support different startup commands and layouts depending on laptop or
|
|
|
|
;; desktop.
|
|
|
|
;; - TODO: Support a Music named-workspace.
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
2020-01-08 16:16:26 +01:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Dependencies
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
2020-01-15 23:11:53 +01:00
|
|
|
(require 'alert)
|
2020-09-02 15:00:43 +02:00
|
|
|
(require 'al)
|
2019-10-09 13:13:56 +02:00
|
|
|
(require 'prelude)
|
|
|
|
(require 'string)
|
|
|
|
(require 'cycle)
|
|
|
|
(require 'set)
|
|
|
|
(require 'kbd)
|
|
|
|
(require 'ivy-helpers)
|
|
|
|
(require 'display)
|
2020-02-08 17:00:31 +01:00
|
|
|
(require 'vterm-mgt)
|
2020-02-02 14:20:55 +01:00
|
|
|
(require 'dash)
|
2019-10-09 13:13:56 +02:00
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Library
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
;; TODO: Associate `window-purpose' window-layouts with each of these named
|
|
|
|
;; workspaces.
|
|
|
|
|
|
|
|
;; TODO: Associate KBDs for each of these named-layouts.
|
|
|
|
|
|
|
|
;; TODO: Decide between window-manager, exwm, or some other namespace.
|
|
|
|
|
2020-09-01 11:17:43 +02:00
|
|
|
;; TODO: Support (cycle-from-list '(current previous)) to toggle back and forth
|
2019-10-09 13:13:56 +02:00
|
|
|
;; between most recent workspace.
|
|
|
|
|
|
|
|
;; TODO: Support ad hoc cycle for loading a few workspaces that can be cycled
|
2020-09-01 11:17:43 +02:00
|
|
|
;; between. (cycle-from-list '("Project" "Workspace"))
|
2019-10-09 13:13:56 +02:00
|
|
|
|
|
|
|
;; TODO: Consider supporting a workspace for Racket, Clojure, Common Lisp,
|
|
|
|
;; Haskell, Elixir, and a few other languages. These could behave very similarly
|
|
|
|
;; to repl.it, which I've wanted to have locally for awhile now.
|
|
|
|
|
|
|
|
;; TODO: Support MRU cache of workspaces for easily switching back-and-forth
|
|
|
|
;; between workspaces.
|
|
|
|
|
2020-09-29 12:21:09 +02:00
|
|
|
(cl-defstruct window-manager--named-workspace label kbd display)
|
2019-10-09 13:13:56 +02:00
|
|
|
|
2020-08-31 15:36:55 +02:00
|
|
|
(defconst window-manager--install-kbds? t
|
2019-10-09 13:13:56 +02:00
|
|
|
"When t, install the keybindings to switch between named-workspaces.")
|
|
|
|
|
|
|
|
;; TODO: Consume `cache/touch' after changing workspaces. Use this to enable
|
|
|
|
;; cycling through workspaces.
|
|
|
|
|
2020-08-31 15:36:55 +02:00
|
|
|
(defconst window-manager--named-workspaces
|
|
|
|
(list (make-window-manager--named-workspace
|
2020-10-03 15:48:46 +02:00
|
|
|
:label "Web Browsing"
|
2020-09-29 12:21:09 +02:00
|
|
|
:kbd "c"
|
|
|
|
:display display-4k-horizontal)
|
2020-08-31 15:36:55 +02:00
|
|
|
(make-window-manager--named-workspace
|
2020-10-03 15:48:46 +02:00
|
|
|
:label "Coding"
|
2020-09-29 12:21:09 +02:00
|
|
|
:kbd "d"
|
|
|
|
:display display-4k-horizontal)
|
2020-08-31 15:36:55 +02:00
|
|
|
(make-window-manager--named-workspace
|
2019-10-09 13:13:56 +02:00
|
|
|
:label "Todos"
|
2020-09-29 12:21:09 +02:00
|
|
|
:kbd "o"
|
|
|
|
:display display-4k-horizontal)
|
2020-08-31 15:36:55 +02:00
|
|
|
(make-window-manager--named-workspace
|
2019-10-09 13:13:56 +02:00
|
|
|
:label "Chatter"
|
2020-09-29 12:21:09 +02:00
|
|
|
:kbd "h"
|
2020-09-29 14:54:41 +02:00
|
|
|
:display display-4k-vertical)
|
|
|
|
(make-window-manager--named-workspace
|
|
|
|
:label "Logs"
|
|
|
|
:kbd "t"
|
2020-09-29 12:21:09 +02:00
|
|
|
:display display-4k-vertical))
|
2020-08-31 15:36:55 +02:00
|
|
|
"List of `window-manager--named-workspace' structs.")
|
2019-10-09 13:13:56 +02:00
|
|
|
|
|
|
|
;; Assert that no two workspaces share KBDs.
|
2020-09-01 11:17:43 +02:00
|
|
|
(prelude-assert (= (list-length window-manager--named-workspaces)
|
2020-08-31 15:36:55 +02:00
|
|
|
(->> window-manager--named-workspaces
|
2020-09-01 11:17:43 +02:00
|
|
|
(list-map #'window-manager--named-workspace-kbd)
|
|
|
|
set-from-list
|
|
|
|
set-count)))
|
2019-10-09 13:13:56 +02:00
|
|
|
|
2020-08-31 15:36:55 +02:00
|
|
|
(defun window-manager--alert (x)
|
2019-10-09 13:13:56 +02:00
|
|
|
"Message X with a structured format."
|
2020-09-01 00:28:47 +02:00
|
|
|
(alert (string-concat "[exwm] " x)))
|
2019-10-09 13:13:56 +02:00
|
|
|
|
|
|
|
;; Use Emacs as my primary window manager.
|
|
|
|
(use-package exwm
|
|
|
|
:config
|
|
|
|
(require 'exwm-config)
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Multiple Displays
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
(require 'exwm-randr)
|
|
|
|
(exwm-randr-enable)
|
2020-01-11 21:01:57 +01:00
|
|
|
(setq exwm-randr-workspace-monitor-plist
|
2020-09-29 12:21:09 +02:00
|
|
|
(->> window-manager--named-workspaces
|
|
|
|
(-map-indexed (lambda (i x)
|
|
|
|
(list i (window-manager--named-workspace-display x))))
|
|
|
|
-flatten))
|
2020-10-04 14:56:01 +02:00
|
|
|
(setq exwm-workspace-number (list-length window-manager--named-workspaces))
|
2019-10-09 13:13:56 +02:00
|
|
|
(setq exwm-input-simulation-keys
|
|
|
|
;; TODO: Consider supporting M-d and other readline style KBDs.
|
|
|
|
'(([?\C-b] . [left])
|
|
|
|
([?\M-b] . [C-left])
|
|
|
|
([?\C-f] . [right])
|
|
|
|
([?\M-f] . [C-right])
|
|
|
|
([?\C-p] . [up])
|
|
|
|
([?\C-n] . [down])
|
|
|
|
([?\C-a] . [home])
|
|
|
|
([?\C-e] . [end])
|
|
|
|
([?\C-d] . [delete])
|
|
|
|
;; TODO: Assess whether or not this is a good idea.
|
|
|
|
;; TODO: Ensure C-c copies.
|
|
|
|
([?\C-c] . [C-c])))
|
|
|
|
(exwm-enable))
|
|
|
|
|
|
|
|
;; Here is the code required to allow EXWM to cycle workspaces.
|
2020-08-31 15:36:55 +02:00
|
|
|
(defconst window-manager--workspaces
|
|
|
|
(->> window-manager--named-workspaces
|
2020-09-01 11:17:43 +02:00
|
|
|
cycle-from-list)
|
2019-10-09 13:13:56 +02:00
|
|
|
"Cycle of the my EXWM workspaces.")
|
|
|
|
|
2020-08-31 18:05:31 +02:00
|
|
|
(prelude-assert
|
2019-10-09 13:13:56 +02:00
|
|
|
(= exwm-workspace-number
|
2020-09-01 11:17:43 +02:00
|
|
|
(list-length window-manager--named-workspaces)))
|
2019-10-09 13:13:56 +02:00
|
|
|
|
2020-08-31 15:36:55 +02:00
|
|
|
(defun window-manager-next-workspace ()
|
2019-10-09 13:13:56 +02:00
|
|
|
"Cycle forwards to the next workspace."
|
|
|
|
(interactive)
|
2020-09-01 11:17:43 +02:00
|
|
|
(window-manager--change-workspace (cycle-next window-manager--workspaces)))
|
2019-10-09 13:13:56 +02:00
|
|
|
|
2020-08-31 15:36:55 +02:00
|
|
|
(defun window-manager-prev-workspace ()
|
2019-10-09 13:13:56 +02:00
|
|
|
"Cycle backwards to the previous workspace."
|
|
|
|
(interactive)
|
2020-09-01 11:17:43 +02:00
|
|
|
(window-manager--change-workspace (cycle-prev window-manager--workspaces)))
|
2019-10-09 13:13:56 +02:00
|
|
|
|
|
|
|
;; TODO: Create friendlier API for working with EXWM.
|
|
|
|
|
|
|
|
;; Here is the code required to toggle EXWM's modes.
|
2020-08-31 15:36:55 +02:00
|
|
|
(defun window-manager--line-mode ()
|
2019-10-09 13:13:56 +02:00
|
|
|
"Switch exwm to line-mode."
|
|
|
|
(call-interactively #'exwm-input-grab-keyboard)
|
2020-08-31 15:36:55 +02:00
|
|
|
(window-manager--alert "Switched to line-mode"))
|
2019-10-09 13:13:56 +02:00
|
|
|
|
2020-08-31 15:36:55 +02:00
|
|
|
(defun window-manager--char-mode ()
|
2019-10-09 13:13:56 +02:00
|
|
|
"Switch exwm to char-mode."
|
|
|
|
(call-interactively #'exwm-input-release-keyboard)
|
2020-08-31 15:36:55 +02:00
|
|
|
(window-manager--alert "Switched to char-mode"))
|
2019-10-09 13:13:56 +02:00
|
|
|
|
2020-08-31 15:36:55 +02:00
|
|
|
(defconst window-manager--modes
|
2020-09-01 11:17:43 +02:00
|
|
|
(cycle-from-list (list #'window-manager--char-mode
|
2020-08-31 15:36:55 +02:00
|
|
|
#'window-manager--line-mode))
|
2019-10-09 13:13:56 +02:00
|
|
|
"Functions to switch exwm modes.")
|
|
|
|
|
2020-08-31 15:36:55 +02:00
|
|
|
(defun window-manager-toggle-mode ()
|
2019-10-09 13:13:56 +02:00
|
|
|
"Switch between line- and char- mode."
|
|
|
|
(interactive)
|
|
|
|
(with-current-buffer (window-buffer)
|
|
|
|
(when (eq major-mode 'exwm-mode)
|
2020-09-01 11:17:43 +02:00
|
|
|
(funcall (cycle-next window-manager--modes)))))
|
2019-10-09 13:13:56 +02:00
|
|
|
|
|
|
|
;; Ensure exwm apps open in char-mode.
|
2020-08-31 15:36:55 +02:00
|
|
|
(add-hook 'exwm-manage-finish-hook #'window-manager--char-mode)
|
2019-10-09 13:13:56 +02:00
|
|
|
|
|
|
|
;; Interface to the Linux password manager
|
2020-01-06 11:11:08 +01:00
|
|
|
;; TODO: Consider writing a better client for this.
|
2019-10-09 13:13:56 +02:00
|
|
|
(use-package ivy-pass)
|
|
|
|
|
2020-01-06 11:11:08 +01:00
|
|
|
;; TODO: How do I handle this dependency?
|
2020-08-31 15:36:55 +02:00
|
|
|
(defconst window-manager--preferred-browser "google-chrome"
|
2019-10-09 13:13:56 +02:00
|
|
|
"My preferred web browser.")
|
|
|
|
|
|
|
|
;; TODO: Consider replacing the `ivy-read' call with something like `hydra' that
|
|
|
|
;; can provide a small mode for accepting user-input.
|
|
|
|
;; TODO: Put this somewhere more diliberate.
|
|
|
|
|
|
|
|
;; TODO: Configure the environment variables for xsecurelock so that the font is
|
|
|
|
;; smaller, different, and the glinux wallpaper doesn't show.
|
|
|
|
;; - XSECURELOCK_FONT="InputMono-Black 10"
|
|
|
|
;; - XSECURE_SAVER=""
|
|
|
|
;; - XSECURE_LOGO_IMAGE=""
|
|
|
|
;; Maybe just create a ~/.xsecurelockrc
|
|
|
|
;; TODO: Is there a shell-command API that accepts an alist and serializes it
|
|
|
|
;; into variables to pass to the shell command?
|
2020-08-31 15:36:55 +02:00
|
|
|
(defconst window-manager--xsecurelock
|
2019-10-09 13:13:56 +02:00
|
|
|
"/usr/share/goobuntu-desktop-files/xsecurelock.sh"
|
|
|
|
"Path to the proper xsecurelock executable.
|
|
|
|
The other path to xsecurelock is /usr/bin/xsecurelock, which works fine, but it
|
|
|
|
is not optimized for Goobuntu devices. Goobuntu attempts to check a user's
|
|
|
|
password using the network. When there is no network connection available, the
|
|
|
|
login attempts fail with an \"unknown error\", which isn't very helpful. To
|
|
|
|
avoid this, prefer the goobuntu wrapper around xsecurelock when on a goobuntu
|
|
|
|
device. This all relates to PAM (i.e. pluggable authentication modules).")
|
|
|
|
|
2020-08-31 15:36:55 +02:00
|
|
|
(defun window-manager-logout ()
|
2019-10-09 13:13:56 +02:00
|
|
|
"Prompt the user for options for logging out, shutting down, etc.
|
|
|
|
|
|
|
|
The following options are supported:
|
|
|
|
- Lock
|
|
|
|
- Logout
|
|
|
|
- Suspend
|
|
|
|
- Hibernate
|
|
|
|
- Reboot
|
|
|
|
- Shutdown
|
|
|
|
|
|
|
|
Ivy is used to capture the user's input."
|
|
|
|
(interactive)
|
2020-08-31 15:36:55 +02:00
|
|
|
(let* ((name->cmd `(("Lock" . ,window-manager--xsecurelock)
|
2019-10-09 13:13:56 +02:00
|
|
|
("Logout" . "sudo systemctl stop lightdm")
|
2020-09-01 00:28:47 +02:00
|
|
|
("Suspend" . ,(string-concat
|
2020-08-31 15:36:55 +02:00
|
|
|
window-manager--xsecurelock
|
2019-10-09 13:13:56 +02:00
|
|
|
" && systemctl suspend"))
|
2020-09-01 00:28:47 +02:00
|
|
|
("Hibernate" . ,(string-concat
|
2020-08-31 15:36:55 +02:00
|
|
|
window-manager--xsecurelock
|
2019-10-09 13:13:56 +02:00
|
|
|
" && systemctl hibernate"))
|
|
|
|
("Reboot" . "systemctl reboot")
|
|
|
|
("Shutdown" . "systemctl poweroff"))))
|
|
|
|
(funcall
|
|
|
|
(lambda ()
|
|
|
|
(shell-command
|
2020-09-02 15:00:43 +02:00
|
|
|
(al-get (ivy-read "System: " (al-keys name->cmd))
|
|
|
|
name->cmd))))))
|
2019-10-09 13:13:56 +02:00
|
|
|
|
2020-08-31 15:36:55 +02:00
|
|
|
(defun window-manager--label->index (label workspaces)
|
2019-10-09 13:13:56 +02:00
|
|
|
"Return the index of the workspace in WORKSPACES named LABEL."
|
2020-08-31 17:07:11 +02:00
|
|
|
(let ((index (-elem-index label (-map #'window-manager--named-workspace-label
|
|
|
|
workspaces))))
|
2020-04-02 19:36:51 +02:00
|
|
|
(if index index (error (format "No workspace found for label: %s" label)))))
|
2019-10-09 13:13:56 +02:00
|
|
|
|
2020-08-31 15:36:55 +02:00
|
|
|
(defun window-manager--register-kbd (workspace)
|
2019-10-09 13:13:56 +02:00
|
|
|
"Registers a keybinding for WORKSPACE struct.
|
|
|
|
Currently using super- as the prefix for switching workspaces."
|
|
|
|
(let ((handler (lambda ()
|
|
|
|
(interactive)
|
2020-08-31 17:07:11 +02:00
|
|
|
(window-manager--switch
|
|
|
|
(window-manager--named-workspace-label workspace))))
|
2020-08-31 15:36:55 +02:00
|
|
|
(key (window-manager--named-workspace-kbd workspace)))
|
2019-10-09 13:13:56 +02:00
|
|
|
(exwm-input-set-key
|
2020-09-01 11:17:43 +02:00
|
|
|
(kbd-for 'workspace key)
|
2019-10-09 13:13:56 +02:00
|
|
|
handler)))
|
|
|
|
|
2020-08-31 15:36:55 +02:00
|
|
|
(defun window-manager--change-workspace (workspace)
|
2020-01-09 15:01:49 +01:00
|
|
|
"Switch EXWM workspaces to the WORKSPACE struct."
|
2020-04-02 19:36:51 +02:00
|
|
|
(exwm-workspace-switch
|
2020-08-31 17:07:11 +02:00
|
|
|
(window-manager--label->index
|
|
|
|
(window-manager--named-workspace-label workspace)
|
|
|
|
window-manager--named-workspaces))
|
2020-08-31 15:36:55 +02:00
|
|
|
(window-manager--alert
|
2020-09-01 00:28:47 +02:00
|
|
|
(string-format "Switched to: %s"
|
2020-08-31 17:07:11 +02:00
|
|
|
(window-manager--named-workspace-label workspace))))
|
2020-01-09 15:01:49 +01:00
|
|
|
|
2020-08-31 15:36:55 +02:00
|
|
|
(defun window-manager--switch (label)
|
2019-10-09 13:13:56 +02:00
|
|
|
"Switch to a named workspaces using LABEL."
|
2020-09-01 11:17:43 +02:00
|
|
|
(cycle-focus (lambda (x)
|
2020-01-09 15:01:49 +01:00
|
|
|
(equal label
|
2020-08-31 15:36:55 +02:00
|
|
|
(window-manager--named-workspace-label x)))
|
|
|
|
window-manager--workspaces)
|
2020-09-01 11:17:43 +02:00
|
|
|
(window-manager--change-workspace (cycle-current window-manager--workspaces)))
|
2020-01-09 15:01:49 +01:00
|
|
|
|
2020-08-31 15:36:55 +02:00
|
|
|
(exwm-input-set-key (kbd "C-S-f") #'window-manager-toggle-previous)
|
2020-04-02 19:36:21 +02:00
|
|
|
|
2020-08-31 15:36:55 +02:00
|
|
|
(defun window-manager-toggle-previous ()
|
2020-01-09 15:01:49 +01:00
|
|
|
"Focus the previously active EXWM workspace."
|
|
|
|
(interactive)
|
2020-08-31 17:07:11 +02:00
|
|
|
(window-manager--change-workspace
|
2020-09-01 11:17:43 +02:00
|
|
|
(cycle-focus-previous! window-manager--workspaces)))
|
2019-10-09 13:13:56 +02:00
|
|
|
|
2020-08-31 15:36:55 +02:00
|
|
|
(defun window-manager--exwm-buffer? (x)
|
2020-02-02 14:20:55 +01:00
|
|
|
"Return t if buffer X is an EXWM buffer."
|
|
|
|
(equal 'exwm-mode (buffer-local-value 'major-mode x)))
|
|
|
|
|
2020-08-31 15:36:55 +02:00
|
|
|
(defun window-manager--application-name (buffer)
|
2020-02-02 14:20:55 +01:00
|
|
|
"Return the name of the application running in the EXWM BUFFER.
|
2020-08-31 17:07:11 +02:00
|
|
|
This function asssumes that BUFFER passes the `window-manager--exwm-buffer?'
|
|
|
|
predicate."
|
2020-02-02 14:20:55 +01:00
|
|
|
(with-current-buffer buffer exwm-class-name))
|
|
|
|
|
|
|
|
;; TODO: Support disambiguating between two or more instances of the same
|
|
|
|
;; application. For instance if two `exwm-class-name' values are
|
|
|
|
;; "Google-chrome", find a encode this information in the `buffer-alist'.
|
2020-08-31 15:36:55 +02:00
|
|
|
(defun window-manager-switch-to-exwm-buffer ()
|
2020-02-02 14:20:55 +01:00
|
|
|
"Use `completing-read' to focus an EXWM buffer."
|
|
|
|
(interactive)
|
|
|
|
(let* ((buffer-alist (->> (buffer-list)
|
2020-08-31 15:36:55 +02:00
|
|
|
(-filter #'window-manager--exwm-buffer?)
|
2020-08-31 17:07:11 +02:00
|
|
|
(-map
|
|
|
|
(lambda (buffer)
|
|
|
|
(cons (window-manager--application-name buffer)
|
|
|
|
buffer)))))
|
2020-02-02 14:20:55 +01:00
|
|
|
(label (completing-read "Switch to EXWM buffer: " buffer-alist)))
|
|
|
|
(exwm-workspace-switch-to-buffer
|
2020-09-02 15:00:43 +02:00
|
|
|
(al-get label buffer-alist))))
|
2020-02-02 14:20:55 +01:00
|
|
|
|
2020-08-31 15:36:55 +02:00
|
|
|
(when window-manager--install-kbds?
|
2019-10-09 13:13:56 +02:00
|
|
|
(progn
|
2020-08-31 15:36:55 +02:00
|
|
|
(->> window-manager--named-workspaces
|
2020-09-01 11:17:43 +02:00
|
|
|
(list-map #'window-manager--register-kbd))
|
2020-08-31 15:36:55 +02:00
|
|
|
(window-manager--alert "Registered workspace KBDs!")))
|
2019-10-09 13:13:56 +02:00
|
|
|
|
2020-10-03 15:49:02 +02:00
|
|
|
(defun window-manager-current-workspace ()
|
|
|
|
"Output the label of the currently active workspace."
|
|
|
|
(->> window-manager--workspaces
|
|
|
|
cycle-current
|
|
|
|
window-manager--named-workspace-label))
|
|
|
|
|
2020-10-03 15:49:33 +02:00
|
|
|
(defun window-manager-swap-workspaces ()
|
|
|
|
"Prompt the user to switch the current workspace with another."
|
|
|
|
(interactive)
|
|
|
|
(let* ((selection (->> window-manager--named-workspaces
|
|
|
|
(-map #'window-manager--named-workspace-label)
|
|
|
|
(-reject
|
|
|
|
(lambda (x)
|
|
|
|
(s-equals? x (window-manager-current-workspace))))
|
|
|
|
(completing-read
|
|
|
|
(format "Swap current workspace (i.e. \"%s\") with: "
|
|
|
|
(window-manager-current-workspace)))))
|
|
|
|
(i (-find-index (lambda (x)
|
|
|
|
(s-equals? selection (window-manager--named-workspace-label x)))
|
|
|
|
window-manager--named-workspaces)))
|
|
|
|
(exwm-workspace-swap exwm-workspace--current (elt exwm-workspace--list i))))
|
|
|
|
|
2019-10-09 13:13:56 +02:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2020-08-31 15:36:55 +02:00
|
|
|
;; Startup Applications in `window-manager--named-workspaces'
|
2019-10-09 13:13:56 +02:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
2020-10-04 14:54:57 +02:00
|
|
|
(add-hook 'exwm-init-hook (lambda () (window-manager--switch "Coding")))
|
2020-01-08 16:16:26 +01:00
|
|
|
|
2019-10-09 13:13:56 +02:00
|
|
|
(provide 'window-manager)
|
|
|
|
;;; window-manager.el ends here
|