Recently Written · git

stumpwm-init

I use dwm now. Archived.

git clone https://github.com/equwal/stumpwm-init

Log | Files | Refs


commit f7d7b7d13d72ca88b6184237bf9caea76fdaf5c7
Spenser Truex <web@spensertruex.com>
2019-12-07 17:27:06 -0800

Improve portability through lesser dependency.

 README.org    | 29 +++++++++++++++++++----------
 commands.lisp |  2 --
 config.lisp   | 19 ++++++++++---------
 package.lisp  |  2 +-
 4 files changed, 30 insertions(+), 22 deletions(-)
diff --git a/README.org b/README.org
index a2cae0c..f2bd784 100644
--- a/README.org
+++ b/README.org
@@ -21,18 +21,27 @@ to your ~.stumpwmrc~ (although there is some [[*Optional Configuration][optional
 ** xterm
 Install the =Hack= font, or add your own to =stumpwm-init:*xterm-font*=.
 ** poison
-Find your mouse's name with ~xinput --list~, and set it to ~*my-mouse*~.
+Find your mouse's name with ~xinput --list~, and set it to ~*my-mouse*~. Turns the mouse all the way off using ~xinput~.
 ** app-menu
-Any programs in ~stumpwm-init:*app-menu*~ need to be installed to work:
-- xterm
-- nmtui
-- openoffice
-- gimp
-- pass
-- okular
-- pavucontrol
+Add programs to the app menu (bound to =M-`= by default) using ~pushnew-apps~.
+This keeps them sorted alphabetically. Any programs in ~stumpwm-init:*app-menu*~
+need to be installed to work:
 - emacs
-You may also edit ~stumpwm-init:*app-menu*~ yourself.
+- web browser
+Example:
+#+begin_src common-lisp
+(defvar *xterm-font* "Hack"
+  "The name of the font to use for xterm.")
+(stumpwm-init:pushnew-apps '("eclipse" "eclipse")
+                           '("spotify" "spotify")
+                           '("gimp" "gimp")
+                           '("office" "openoffice")
+                           '("pass"
+                             ("copy" pass:pass-copy-menu)
+                             ("generate" pass:pass-generate))
+                           '("PDF" "okular")
+                           '("sound" "pavucontrol"))
+#+end_src
 * Keybindings
   Most can be found under the prefix (bound to =C-i=), but =M-`= (no prefix) is the app-menu.
 * Contributing
diff --git a/commands.lisp b/commands.lisp
index dcdf9aa..0fad978 100644
--- a/commands.lisp
+++ b/commands.lisp
@@ -1,6 +1,4 @@
 (in-package #:stumpwm-init)
-(defvar *xterm-font* "Hack"
-  "The name of the font to use for xterm.")
 (defvar *xterm-font-pt* 12
   "The font size to call xterm with.")
 (defcommand xterm (&optional additional-argstr) ()
diff --git a/config.lisp b/config.lisp
index a059ddf..359aec2 100644
--- a/config.lisp
+++ b/config.lisp
@@ -1,16 +1,17 @@
 (in-package #:stumpwm-init)
 
+(defun pushnew-apps (&rest apps)
+  (dolist (app apps)
+    (pushnew app
+             app-menu::*app-menu*
+             :test #'string=
+             :key #'car))
+  (setf app-menu::*app-menu*
+        (sort app-menu::*app-menu* #'string< :key #'car)))
+
 (setq app-menu::*app-menu*
       '(("emacs" "emacs")
-        ("gimp" "gimp")
-        ("office" "openoffice")
-        ("pass"
-         ("copy" pass:pass-copy-menu)
-         ("generate" pass:pass-generate))
-        ("PDF" "okular")
-        ("sound" "pavucontrol")
-        ("web" browse:browse)
-        ("wifi" nmtui)))
+        ("web" browse:browse)))
 
 (setf *mode-line-timeout* 1)
 (setf *mode-line-foreground-color* "#98BDFB")
diff --git a/package.lisp b/package.lisp
index ce0cfff..f3322b1 100644
--- a/package.lisp
+++ b/package.lisp
@@ -28,4 +28,4 @@
    :*my-mouse* ;Set for the `poison' command to toggle it.
    :*xterm-font* ;;settings for xterm to look nice.
    :*xterm-font-pt*
-   :*app-menu*))
+   :pushnew-apps))