emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/exwm 34d5885 4/4: Add demo configurations


From: Chris Feng
Subject: [elpa] externals/exwm 34d5885 4/4: Add demo configurations
Date: Wed, 28 Oct 2015 11:00:41 +0000

branch: externals/exwm
commit 34d588599d2d7ef46db6a810c1549199f78cf8ba
Author: Chris Feng <address@hidden>
Commit: Chris Feng <address@hidden>

    Add demo configurations
    
    * exwm-config.el: Demo EXWM configurations.
    * xinitrc: Demo xinitrc file.
    * exwm.el (exwm-enable-ido-workaround, exwm-disable-ido-workaround): Partly
      moved to exwm-config.el.
---
 exwm-config.el |  101 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 exwm.el        |   45 ++++---------------------
 xinitrc        |   14 ++++++++
 3 files changed, 122 insertions(+), 38 deletions(-)

diff --git a/exwm-config.el b/exwm-config.el
new file mode 100644
index 0000000..7f02303
--- /dev/null
+++ b/exwm-config.el
@@ -0,0 +1,101 @@
+;;; exwm-config.el --- Predefined configurations  -*- lexical-binding: t -*-
+
+;; Copyright (C) 2015 Free Software Foundation, Inc.
+
+;; Author: Chris Feng <address@hidden>
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This module contains typical (yet minimal) configurations of EXWM.
+
+;;; Code:
+
+(require 'exwm)
+
+(defun exwm-config-default ()
+  "Default configuration of EXWM."
+  ;; Make class name the buffer name
+  (add-hook 'exwm-update-class-hook
+            (lambda ()
+              (exwm-workspace-rename-buffer exwm-class-name)))
+  ;; 's-r': Reset
+  (exwm-input-set-key (kbd "s-r") #'exwm-reset)
+  ;; 's-w': Switch workspace
+  (exwm-input-set-key (kbd "s-w") #'exwm-workspace-switch)
+  ;; 's-N': Switch to certain workspace
+  (dotimes (i exwm-workspace-number)
+    (exwm-input-set-key (kbd (format "s-%d" i))
+                        `(lambda () (interactive) (exwm-workspace-switch ,i))))
+  ;; 's-&': Launch application
+  (exwm-input-set-key (kbd "s-&")
+                      (lambda (command)
+                        (interactive (list (read-shell-command "$ ")))
+                        (start-process-shell-command command nil command)))
+  ;; Line-editing shortcuts
+  (exwm-input-set-simulation-keys
+   '(([?\C-b] . left)
+     ([?\C-f] . right)
+     ([?\C-p] . up)
+     ([?\C-n] . down)
+     ([?\C-a] . home)
+     ([?\C-e] . end)
+     ([?\M-v] . prior)
+     ([?\C-v] . next)))
+  ;; Enable EXWM
+  (exwm-enable)
+  ;; Configure Ido
+  (exwm-config-ido)
+  ;; Other configurations
+  (exwm-config-misc))
+
+(defun exwm-config--ido-buffer-window-other-frame (orig-fun buffer)
+  "Wrapper for `ido-buffer-window-other-frame' to exclude invisible windows."
+  (with-current-buffer buffer
+    (if (and (eq major-mode 'exwm-mode)
+             (or exwm--floating-frame
+                 (not exwm-layout-show-all-buffers)))
+        ;; `ido-mode' works well with `exwm-mode' buffers
+        (funcall orig-fun buffer)
+      ;; Other buffers should be selected within the same workspace
+      (get-buffer-window buffer exwm-workspace--current))))
+
+(defun exwm-config--fix/ido-buffer-window-other-frame ()
+  "Fix `ido-buffer-window-other-frame'."
+  (advice-add 'ido-buffer-window-other-frame :around
+              #'exwm-config--ido-buffer-window-other-frame))
+
+(defun exwm-config-ido ()
+  "Configure Ido to work with EXWM."
+  (ido-mode 1)
+  (add-hook 'exwm-init-hook #'exwm-config--fix/ido-buffer-window-other-frame))
+
+(defun exwm-config-misc ()
+  "Other configurations."
+  ;; Make more room
+  (menu-bar-mode -1)
+  (tool-bar-mode -1)
+  (scroll-bar-mode -1)
+  (fringe-mode 1)
+  ;; Disable dialog boxes
+  (setq use-dialog-box nil))
+
+
+
+(provide 'exwm-config)
+
+;; exwm-config.el ends here
diff --git a/exwm.el b/exwm.el
index b5d246e..ba71e32 100644
--- a/exwm.el
+++ b/exwm.el
@@ -43,22 +43,10 @@
 ;; 2. In '~/.emacs', add following lines (please modify accordingly):
 ;;
 ;;    (require 'exwm)
-;;    ;; We always need a way to go back from char-mode to line-mode
-;;    (exwm-input-set-key (kbd "s-r") 'exwm-reset)
-;;    ;; Bind a key to switch workspace interactively
-;;    (exwm-input-set-key (kbd "s-w") 'exwm-workspace-switch)
-;;    ;; Use class name to name an EXWM buffer
-;;    (add-hook 'exwm-update-class-hook
-;;              (lambda () (exwm-workspace-rename-buffer exwm-class-name t)))
-;;    ;; Enable EXWM
-;;    (exwm-enable)
-;;
-;; 3. Make a file '~/.xinitrc' with the following lines:
-;;
-;;    # You may need to comment out the next line to disable access control
-;;    #xhost +
-;;    exec emacs
+;;    (require 'exwm-config)
+;;    (exwm-config-default)
 ;;
+;; 3. Link or copy the file 'xinitrc' to '~/.xinitrc'.
 ;; 4. Launch EXWM in a console (e.g. tty1) with
 ;;
 ;;    xinit -- vt01
@@ -600,31 +588,12 @@
                ;; For other types, return the value as-is.
                (t result))))))
 
-(defun exwm--ido-buffer-window-other-frame (orig-fun buffer)
-  "Wrapper for `ido-buffer-window-other-frame' to exclude invisible windows."
-  (with-current-buffer buffer
-    (if (and (eq major-mode 'exwm-mode)
-             (or exwm--floating-frame
-                 (not exwm-layout-show-all-buffers)))
-        ;; `ido-mode' works well with `exwm-mode' buffers
-        (funcall orig-fun buffer)
-      ;; Other buffers should be selected within the same workspace
-      (get-buffer-window buffer exwm-workspace--current))))
-
-(defun exwm--fix-ido-buffer-window-other-frame ()
-  "Fix `ido-buffer-window-other-frame'."
-  (advice-add 'ido-buffer-window-other-frame :around
-              #'exwm--ido-buffer-window-other-frame))
-
-(defun exwm-enable-ido-workaround ()
-  "Enable workarounds for 'ido-mode'."
-  (add-hook 'exwm-init-hook #'exwm--fix-ido-buffer-window-other-frame))
+(define-obsolete-function-alias 'exwm-enable-ido-workaround 'exwm-config-ido
+  "25.1" "Enable workarounds for Ido.")
 
 (defun exwm-disable-ido-workaround ()
-  "Disable workarounds for 'ido-mode'."
-  (remove-hook 'exwm-init-hook #'exwm--fix-ido-buffer-window-other-frame)
-  (advice-remove 'ido-buffer-window-other-frame
-                 #'exwm--ido-buffer-window-other-frame))
+  "This function does nothing actually."
+  (declare (obsolete nil "25.1")))
 
 
 
diff --git a/xinitrc b/xinitrc
new file mode 100644
index 0000000..3de5b0b
--- /dev/null
+++ b/xinitrc
@@ -0,0 +1,14 @@
+# Disable access control
+xhost +
+
+# Themes, etc
+gnome-settings-daemon &
+
+# Fallback cursor
+xsetroot -cursor_name left_ptr
+
+# Keyboard repeat rate
+xset r rate 200 60
+
+# Start Emacs
+exec dbus-launch --exit-with-session emacs



reply via email to

[Prev in Thread] Current Thread [Next in Thread]