Browse Source

Remove exwm and eyebrowse

master
Peter J. Jones 6 months ago
parent
commit
4edfb6e9de
Signed by: Peter Jones <pjones@devalot.com> GPG Key ID: 9DAFAA8D01941E49
16 changed files with 13 additions and 396 deletions
  1. 0
    28
      bin/exwm
  2. 0
    12
      lisp/functions.el
  3. 0
    8
      lisp/keys.el
  4. 0
    1
      lisp/modes.el
  5. 0
    1
      lisp/options.el
  6. 3
    1
      lisp/themes.el
  7. 8
    76
      modes/browse-url-conf.el
  8. 0
    3
      modes/evil-conf.el
  9. 0
    139
      modes/exwm-conf.el
  10. 0
    15
      modes/eyebrowse-conf.el
  11. 2
    2
      modes/ivy-conf.el
  12. 0
    24
      nix/exwm-nw.nix
  13. 0
    25
      nix/exwm.nix
  14. 0
    26
      nix/ivy-exwm.nix
  15. 0
    10
      nix/packages.nix
  16. 0
    25
      nix/xelb.nix

+ 0
- 28
bin/exwm View File

@@ -1,28 +0,0 @@
#!/bin/sh

################################################################################
# A script to start the Emacs X Window Manager (EXWM).
set -e

################################################################################
# Disable access control:
xhost "+SI:localuser:$USER"

# Make Java applications aware this is a non-reparenting window manager:
export _JAVA_AWT_WM_NONREPARENTING=1

# Some variables that can be overridden:
EMACS_BIN=${EMACS_BIN:=@emacspath@/emacs}
EMACS_SERVER_NAME=${EMACS_SERVER_NAME:=server}

# Create a FIFO for a KDE Plasmoid I use:
plasmoid=$HOME/.cache/emacs/plasmoid
rm -f "$plasmoid" && mkfifo -m 0600 "$plasmoid"

# Start Emacs:
exec "$EMACS_BIN" \
--eval "(setq server-name \"$EMACS_SERVER_NAME\")" \
--eval "(require 'exwm)" \
-f server-start \
-f exwm-enable \
"$@"

+ 0
- 12
lisp/functions.el View File

@@ -10,18 +10,6 @@
frame 0 frame "_NET_WM_STATE" 32
'(1 "_NET_WM_STATE_DEMANDS_ATTENTION" 0)))

(defun pjones:plasmoid-update ()
"Update a KDE plasmoid that is blocked reading from a FIFO."
(let ((inhibit-message t)
(file (concat user-emacs-directory "plasmoid"))
(desktop (exwm-nw--format exwm-workspace-current-index))
(eyebrowse (let* ((slot (eyebrowse--get 'current-slot))
(cfgs (eyebrowse--get 'window-configs)))
(eyebrowse-format-slot (assoc slot cfgs)))))
(with-temp-buffer
(insert (concat desktop " | " eyebrowse "\n"))
(write-region nil nil file t))))

(defun pjones:define-keys-from-hydra (keymap heads)
"Define keys in KEYMAP from HEADS."
(dolist (head heads)

+ 0
- 8
lisp/keys.el View File

@@ -79,13 +79,6 @@
(define-key map (kbd "p") #'passmm-completing-read)
(define-key map (kbd "l") #'passmm-list-passwords))

(let ((map pjones:w-map))
(define-key map (kbd "'") #'eyebrowse-last-window-config)
(define-key map (kbd "SPC") #'eyebrowse-switch-to-window-config)
(define-key map (kbd "c") #'eyebrowse-create-window-config)
(define-key map (kbd "n") #'eyebrowse-rename-window-config)
(define-key map (kbd "x") #'eyebrowse-close-window-config))

;; User bindings under C-c:
(global-set-key (kbd "C-c b") pjones:b-map)
(global-set-key (kbd "C-c c") #'pjones:projectile-compile-project)
@@ -99,7 +92,6 @@
(global-set-key (kbd "C-c m") #'magit-status)
(global-set-key (kbd "C-c p") pjones:p-map)
(global-set-key (kbd "C-c t") #'org-mru-clock-in)
(global-set-key (kbd "C-c w") pjones:w-map)

;; Evil and evil-leader:
;; These need to be set before loading Evil.

+ 0
- 1
lisp/modes.el View File

@@ -18,7 +18,6 @@
(unless noninteractive
;; Global minor modes:
(winner-mode) ; Track win conifg changes
(eyebrowse-mode) ; Named window configurations
(projectile-mode) ; Project tool
(global-auto-revert-mode) ; External changes cause a revert
(shackle-mode) ; Control pop-up windows.

+ 0
- 1
lisp/options.el View File

@@ -49,7 +49,6 @@
;; Settings not worth their own file in the modes directory:
(custom-set-variables
'(epa-file-encrypt-to "204284CB") ; Default GPG key to use
'(epa-pinentry-mode 'loopback) ; Needed for EXWM.
'(compilation-scroll-output 'first-error)
`(custom-file ,(concat user-emacs-directory "custom.el"))) ; To keep Emacs happy


+ 3
- 1
lisp/themes.el View File

@@ -5,7 +5,9 @@
;; Code to activate my preferred themes.
;;
;;; Code:
(load-theme 'doom-city-lights t)
(if (display-graphic-p)
(load-theme 'doom-city-lights t)
(load-theme 'doom-one t))

;; Stolen from: https://github.com/alezost/emacs-config
(defun pjones:load-theme (theme)

+ 8
- 76
modes/browse-url-conf.el View File

@@ -1,87 +1,19 @@
;;; browse-url-conf.el -- Settings for browse-url.
(eval-when-compile
(require 'browse-url))

;;
;;; Commentary:
;;
;;; Code:
;; Dependencies.
(require 'exwm)
(require 'async)
(require 'browse-url) ;; If `C-z o' loads this file.

;; FIXME: Turn this into a minor-mode.

(defvar pjones:url-shortcuts
'("http://duckduckgo.com/?q=%s"
"http://www.google.com/search?q=%s"
"http://en.wikipedia.org/w/index.php?title=Special:Search&search=%s&go=Go")
;; FIXME: add hoogle, hackage, imdb, amazon, etc.
"Custom URLs that will have %s replaced with a search string.")

;; Taken from exwm-surf: Copyright (C) 2017 craven@gmx.net
(defun exwm-surf-set-prop (prop winid value)
"Set property PROP on X window WINID to VALUE."
(start-process-shell-command "xprop" nil (format "xprop -id %s -f %s 8s -set %s \"%s\"" winid prop prop value)))

;; Taken from exwm-surf: Copyright (C) 2017 craven@gmx.net
(defun exwm-surf-get-prop (prop winid)
"Read property PROP from X window WINID."
(let ((text (shell-command-to-string (format "xprop -notype -id %s %s" winid prop))))
(string-match "\"\\(.*\\)\"" text)
(match-string 1 text)))
(require 'browse-url)

(defun pjones:browse-url-browser-function (url &optional new-window &rest args)
"Open URL in a external browser.

If NEW-WINDOW is non-nil then always open a new browsers window.
Other arguments in ARGS are ignored."
(interactive)
(if (and (derived-mode-p 'exwm-mode) (not new-window))
(cond
((string= exwm-class-name "Surf")
(exwm-surf-set-prop "_SURF_GO" (exwm--buffer->id (current-buffer)) url))
(t (async-start-process "surf" "surf" nil url)))
(async-start-process "firefox" "firefox" nil "--new-window" url)))

(defun pjones:extract-url-from-surf ()
"Extract the URL from the Surf window.

Assumes the current window is a Surf window."
(let ((winid (if (derived-mode-p 'exwm-mode)
(exwm--buffer->id (current-buffer))
(error "Not an exwm window"))))
(exwm-surf-get-prop "_SURF_URI" winid)))

(defun pjones:browse-url-prompt ()
"Prompt for a URL.

If the current window is a browser, extract a URL from it."
(let ((prompt "URL: ")
(default (when (derived-mode-p 'exwm-mode)
(cond
((string= exwm-class-name "Surf")
(pjones:extract-url-from-surf))))))
(if default (list (read-string prompt default)
(not (eq (null browse-url-new-window-flag)
(null current-prefix-arg))))
(browse-url-interactive-arg prompt))))

(defun pjones:browse-url (url &rest args)
"Ask a browser to display URL.

If URL is nil, prompt for it. ARGS are passed to the real
`browse-url' unchanged."
(interactive (pjones:browse-url-prompt))
(browse-url url (car args)))

(defun pjones:browse-url-shortcut (new-window)
"Browse a URL after picking a shortcut.

Prompts for a shortcut and search string. If NEW-WINDOW is
non-nil then display the URL in a new window."
(interactive "P")
(let* ((shortcut (completing-read "Shortcut: " pjones:url-shortcuts))
(url (if (string-match-p "%s" shortcut)
(format shortcut (read-string "Search: "))
shortcut)))
(browse-url url new-window)))
(async-start-process "firefox" "firefox" nil "--new-window" url))

(setq browse-url-browser-function #'pjones:browse-url-browser-function)

;;; browse-url-conf.el ends here

+ 0
- 3
modes/evil-conf.el View File

@@ -16,9 +16,6 @@
'(evil-lookup-func #'man)
'(evil-symbol-word-search t))

;; EXWM settings:
(evil-set-initial-state 'exwm-mode 'emacs)

(defun pjones:evil-update-cursor ()
"Change the cursor to match the evil state."
(let* ((cursor

+ 0
- 139
modes/exwm-conf.el View File

@@ -1,139 +0,0 @@
;;; exwm-conf.el -- Setting for EXWM.
;;
;;; Commentary:
;;
;; Functions and settings for EXWM:
;; https://github.com/ch11ng/exwm
;;
;;; Code:
(require 'exwm)
(require 'cl-lib)
(require 'exwm-nw)
(require 'exwm-randr)

;###############################################################################
;;
;;; Custom EXWM functions:
;;
;###############################################################################
(defun pjones:exwm-manage-finish-hook ()
"Hook run when a new X window is managed by EXWM.")

(defun pjones:exwm-update-class-hook ()
"Hook run when a window's class name changed."
(exwm-workspace-rename-buffer exwm-class-name))

(defun pjones:exwm-workspace-switch-hook ()
"Hook run when changing workspaces."
(pjones:plasmoid-update))

(defmacro pjones:exwm-switch-to (n)
"Create a function that will switch to workspace N."
`(lambda () (interactive) (exwm-workspace-switch-create ,n)))

;###############################################################################
;;
;;; Settings:
;;
;###############################################################################
(custom-set-variables ;; Common settings:
;; Workspace settings:
'(exwm-workspace-number 10)
'(exwm-randr-workspace-output-plist nil)
'(exwm-workspace-show-all-buffers nil)
'(exwm-layout-show-all-buffers nil)
'(exwm-workspace-minibuffer-position nil)
'(exwm-workspace-display-echo-area-timeout 1)
'(exwm-workspace-warp-cursor t)

;; Floating windows:
'(exwm-manage-force-tiling t)
'(exwm-floating-border-width 3)
'(exwm-floating-border-color "#ff52bb")

;; Global key bindings:
'(exwm-input-prefix-keys
(list ?\C-w ?\C-x ?\C-u ?\C-h ?\C-c ?\M-x ?\M-& ?\M-:))

`(exwm-input-global-keys
(quote ((,(kbd "s-r") . exwm-reset)
(,(kbd "s-o") . other-frame)
(,(kbd "s-z") . exwm-workspace-switch)
(,(kbd "s-n") . exwm-nw-set-name)
(,(kbd "s-SPC") . exwm-nw-find-workspace)
(,(kbd "s-'") . exwm-nw-goto-previous)

;; Switch workspaces with the super key:
(,(kbd "s-;") . ,(pjones:exwm-switch-to 0))
(,(kbd "s-a") . ,(pjones:exwm-switch-to 1))
(,(kbd "s-s") . ,(pjones:exwm-switch-to 2))
(,(kbd "s-d") . ,(pjones:exwm-switch-to 3))
(,(kbd "s-f") . ,(pjones:exwm-switch-to 4))
(,(kbd "s-g") . ,(pjones:exwm-switch-to 5))
(,(kbd "s-h") . ,(pjones:exwm-switch-to 6))
(,(kbd "s-j") . ,(pjones:exwm-switch-to 7))
(,(kbd "s-k") . ,(pjones:exwm-switch-to 8))
(,(kbd "s-l") . ,(pjones:exwm-switch-to 9)))))

;; Simulated key presses to X Windows:
'(exwm-input-simulation-keys
'(([?\C-c ?\C-c] . [?\C-c])
([?\C-p] . [up])
([?\C-n] . [down]))))


(define-key exwm-workspace--switch-map (kbd "s-z") #'exwm-nw-goto-previous)
(define-key exwm-workspace--switch-map (kbd "C-z C-z") #'exwm-nw-goto-previous)
(define-key exwm-workspace--switch-map (kbd "C-c C-b") #'exwm-nw-move-left)
(define-key exwm-workspace--switch-map (kbd "C-c C-f") #'exwm-nw-move-right)
(define-key exwm-workspace--switch-map (kbd "C-c C-n") #'exwm-nw-set-name)
(define-key exwm-workspace--switch-map (kbd "C-s") #'exwm-nw-find-workspace)
(define-key exwm-workspace--switch-map (kbd "C-u") #'universal-argument)

;###############################################################################
;;
;;; Activate optional features:
;;
;###############################################################################
(exwm-randr-enable)
(exwm-nw-mode)

;###############################################################################
;;
;;; Evil integration
;;
;###############################################################################
;; See also: evil-conf.el
;; FIXME: do some proper evil config here.

;###############################################################################
;;
;;; Logging Out
;;
;###############################################################################
(defun pjones:exwm-logout ()
"Exit Emacs and logout."
(interactive)
(when (yes-or-no-p "Really exit EXWM and KDE? ")
(save-some-buffers)
(run-hooks 'kill-emacs-hook)
(start-process-shell-command
"logout" nil
"qdbus org.kde.ksmserver /KSMServer logout 0 3 3")))

(defun pjones:exwm-set-logout-binding ()
"Set up the logout key binding."
(global-set-key (kbd "C-x C-c") #'pjones:exwm-logout))

;###############################################################################
;;
;;; Insert some hooks:
;;
;###############################################################################
(add-hook 'exwm-update-class-hook #'pjones:exwm-update-class-hook)
(add-hook 'exwm-manage-finish-hook #'pjones:exwm-manage-finish-hook)
(add-hook 'exwm-workspace-switch-hook #'pjones:exwm-workspace-switch-hook)
(add-hook 'exwm-init-hook #'pjones:exwm-set-logout-binding)
;; (add-hook 'exwm-init-hook #'desktop-save-mode)

;;; exwm-conf.el ends here

+ 0
- 15
modes/eyebrowse-conf.el View File

@@ -1,15 +0,0 @@
;;; eyebrowse-conf.el -- Settings for eyebrowse.
;;
;;; Commentary:
;;
;;; Code:
(require 'eyebrowse)

(custom-set-variables
'(eyebrowse-wrap-around t)
'(eyebrowse-new-workspace t))

(declare-function pjones:plasmoid-update "../lisp/functions.el")
(add-hook 'eyebrowse-post-window-switch-hook #'pjones:plasmoid-update)

;;; eyebrowse-conf.el ends here

+ 2
- 2
modes/ivy-conf.el View File

@@ -38,8 +38,8 @@
'(ivy-current-match ((t (:inherit 'isearch)))))

;; Enable complementary modes:
(require 'ivy-exwm)
(ivy-exwm-mode 1)
(require 'ivy-rich)
(ivy-rich-mode 1)

(defun pjones:ivy-ignore-buffers (buffer)
"Ignore BUFFER if it meets certain criteria."

+ 0
- 24
nix/exwm-nw.nix View File

@@ -1,24 +0,0 @@
{ super
, self
, pkgs
, melpaBuild
}:

melpaBuild {
pname = "exwm-nw";
version = "0.1";

src = pkgs.fetchgit {
url = "git://git.devalot.com/exwm-nw.git";
rev = "ada2cf7874a925d2b83b9735de25594e75520219";
sha256 = "0kbbry6fdx4wagn1nhah9cshp7p1yl7fnp35rnvy24k06nibds1a";
};

recipe = pkgs.writeText "recipe" ''
(exwm-nw :repo "pjones/exwm-nw" :fetcher github)
'';

packageRequires = [
self.exwm
];
}

+ 0
- 25
nix/exwm.nix View File

@@ -1,25 +0,0 @@
{ self
, pkgs
, melpaBuild
, ...
}:

melpaBuild {
pname = "exwm";
version = "0.21.20190102";

src = pkgs.fetchFromGitHub {
owner = "ch11ng";
repo = "exwm";
rev = "404c94568d581fb66fca5e2524c908d63188388";
sha256 = "1081aqlp7g6h7r1lrlkab97npn5w9kmnafh2lmcb9hskp0ydfiym";
};

recipe = pkgs.writeText "recipe" ''
(exwm :repo "ch11ng/exwm" :fetcher github)
'';

packageRequires = [
self.xelb
];
}

+ 0
- 26
nix/ivy-exwm.nix View File

@@ -1,26 +0,0 @@
{ super
, self
, pkgs
, melpaBuild
}:

melpaBuild {
pname = "ivy-exwm";
version = "0.1";

src = pkgs.fetchgit {
url = "git://git.devalot.com/ivy-exwm.git";
rev = "32f107374aef01b9ae00f1647233d50b4ea659e0";
sha256 = "1shs1zh8nr2lwxlvrhnhxxjn5g0p21vkjxnjgha1sn07pg7v3iqq";
};

recipe = pkgs.writeText "recipe" ''
(ivy-exwm :repo "pjones/ivy-exwm" :fetcher github)
'';

packageRequires = [
self.exwm
super.ivy
super.ivy-rich
];
}

+ 0
- 10
nix/packages.nix View File

@@ -20,13 +20,7 @@ let
projectile = self.melpaPackages.projectile;

# Newer versions of existing packages:
exwm = import ./exwm.nix { inherit super self pkgs melpaBuild; };
xelb = import ./xelb.nix { inherit super self pkgs melpaBuild; };
mu4e-query-fragments = import ./mu4e-query-fragments.nix { inherit super self pkgs melpaBuild; };

# My custom packages:
exwm-nw = import ./exwm-nw.nix { inherit super self pkgs melpaBuild; };
ivy-exwm = import ./ivy-exwm.nix { inherit super self pkgs melpaBuild; };
passmm = import ./passmm.nix { inherit super self pkgs melpaBuild; };
});

@@ -61,9 +55,6 @@ overrides.emacsWithPackages (epkgs: with epkgs; [
evil-magit
evil-org
evil-surround
exwm
exwm-nw
eyebrowse
flycheck
git-annex
graphviz-dot-mode
@@ -76,7 +67,6 @@ overrides.emacsWithPackages (epkgs: with epkgs; [
indium
inf-ruby
ivy
ivy-exwm
ivy-hydra
ivy-rich
js2-mode

+ 0
- 25
nix/xelb.nix View File

@@ -1,25 +0,0 @@
{ pkgs
, melpaBuild
, self
, ...
}:

melpaBuild {
pname = "xelb";
version = "0.16.20190102";

src = pkgs.fetchFromGitHub {
owner = "ch11ng";
repo = "xelb";
rev = "407cce8dd8b0e621449c6c3015c303539f53819";
sha256 = "0pf20jbhszv5p0ncd0y3smx0c2im3xslid4r62whr55x1mq27mr9";
};

recipe = pkgs.writeText "recipe" ''
(xelb :repo "ch11ng/xelb" :fetcher github)
'';

packageRequires = [
self.cl-generic
];
}

Loading…
Cancel
Save