stumpwm-devel
[Top][All Lists]
Advanced

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

[STUMP] [PATCH] functions and commands for altering mode line visibility


From: Nils Anspach
Subject: [STUMP] [PATCH] functions and commands for altering mode line visibility
Date: Sun, 24 Oct 2010 14:46:52 +0200

Hi list,

attached is a small patch for altering the visibility of mode lines. 

With this patch the visibility of mode lines can collectively be 
enabled, disabled or toggled on

        * all heads of a specified screen
        * all heads of all screens

Interactive user commands for accessing these functionalities have
also been added.

Nils
---
 mode-line.lisp |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/mode-line.lisp b/mode-line.lisp
index f82d165..9a672b8 100644
--- a/mode-line.lisp
+++ b/mode-line.lisp
@@ -33,6 +33,8 @@
           add-screen-mode-line-formatter
          enable-mode-line
          toggle-mode-line
+         enable-all-mode-lines
+         toggle-all-mode-lines
          bar-zone-color))
 
 (defstruct mode-line
@@ -532,6 +534,50 @@ critical."
       (when (head-mode-line head)
         (toggle-mode-line screen head))))
 
+(defun enable-all-mode-lines (&key screen (state t) format)
+  "Enables (if STATE is T) or disables (otherwise) the mode lines
+  on all heads of SCREEN (if given) or on all screens (otherwise).
+  If STATE is T and FORMAT is specified, then only the format of
+  the mode lines is updated."
+  (check-type screen (or screen null))
+  (let ((screen-list (if screen (list screen) *screen-list*)))
+    (dolist (screen screen-list)
+      (dolist (head (screen-heads screen))
+       (enable-mode-line screen head state format)))))
+
+(defun toggle-all-mode-lines (&key screen (format '*screen-mode-line-format*))
+  "Toggles the states of the mode lines on all heads of SCREEN
+  (if given) or on all screens (otherwise)."
+  (check-type screen (or screen null))
+  (let ((screen-list (if screen (list screen) *screen-list*)))
+    (dolist (screen screen-list)
+      (dolist (head (screen-heads screen))
+       (toggle-mode-line screen head format)))))
+
 (defcommand mode-line () ()
   "A command to toggle the mode line visibility."
   (toggle-mode-line (current-screen) (current-head)))
+
+(defcommand mode-lines-screen-enable () ()
+  "Makes the mode lines on all heads of the current screen visible."
+  (enable-all-mode-lines :screen (current-screen)))
+
+(defcommand mode-lines-screen-disable () ()
+  "Hides the mode lines on all heads of the current screen."
+  (enable-all-mode-lines :screen (current-screen) :state nil))
+
+(defcommand mode-lines-screen () ()
+  "Toggles the visibility of the mode lines on the heads of the current 
screen."
+  (toggle-all-mode-lines :screen (current-screen)))
+
+(defcommand mode-lines-desktop-enable () ()
+  "Makes the mode lines on all heads of all screens visible."
+  (enable-all-mode-lines))
+
+(defcommand mode-lines-desktop-disable () ()
+  "Hides the mode lines on all heads of all screens."
+  (enable-all-mode-lines :state nil))
+
+(defcommand mode-lines-desktop () ()
+  "Toggles the visibility of the mode lines on all heads of all screens."
+  (toggle-all-mode-lines))
\ No newline at end of file
-- 
1.6.5.7




reply via email to

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