stumpwm-devel
[Top][All Lists]
Advanced

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

[STUMP] [PATCH] [RESEND] Corrected patches for StumpWM and StumpiSH


From: 38a938c2
Subject: [STUMP] [PATCH] [RESEND] Corrected patches for StumpWM and StumpiSH
Date: Sat, 30 Aug 2008 21:52:34 +0400
User-agent: Thunderbird 2.0.0.14 (X11/20080825)

                Hello.
        I tried to fix (and merge) patches I have sent previously.
        In the first patch there is a "refresh" command in addition to
"redisplay". The second one is just like in ratpoison (I hope), the
first one leaves the window on its place.
        In the second patch there is only one command,
"make-window-numbers-contiguous" and when called as a function it has an
optional argument - list of numbers no to touch.
        The third patch has the same effect as before, just suggested iteration
format is used.
        The fourth patch is a simple merge of the patch and its correction.

PS. "git rebase --onto" does something more complicated than manual made
me think upon non-concentrated reading..
>From 171505aa67475e637205a203f8e07c7856b61bfa Mon Sep 17 00:00:00 2001
From: 38a938c2 <address@hidden>
Date: Sat, 30 Aug 2008 20:05:18 +0400
Subject: [PATCH] Adding redisplay functionality from ratpoison (refresh+occupy 
entire frame) and refresh command (just resize a step down and a step up to 
make application repaint its window). Binding from ratpoison: l is redisplay.

---
 bindings.lisp |    1 +
 window.lisp   |   39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/bindings.lisp b/bindings.lisp
index 65b02c1..46212cd 100644
--- a/bindings.lisp
+++ b/bindings.lisp
@@ -146,6 +146,7 @@
           (define-key m (kbd "A") "title")
           (define-key m (kbd "h") '*help-map*)
           (define-key m (kbd "i") "info")
+          (define-key m (kbd "l") "redisplay")
           m)))
 
 (when (null *groups-map*)
diff --git a/window.lisp b/window.lisp
index df2ff93..ec3e831 100644
--- a/window.lisp
+++ b/window.lisp
@@ -639,6 +639,45 @@ than the root window's width and height."
                   (xlib:drawable-height (window-parent win)) (- 
(frame-display-height (window-group win) frame)
                                                                 (* 2 
(xlib:drawable-border-width (window-parent win))))))))))
 
+(defun to-top-left-corner (window)
+  "Move the window to the top left corner of corresponding frame."
+  (let ((frame (window-frame window)))
+    (set-window-geometry window
+      :x (frame-x frame)
+      :y (frame-y frame))))
+ 
+(defun fill-frame (window)
+  "Resize the window to occupy entire frame."
+  (to-top-left-corner window)
+  (let ((frame (window-frame window)))
+    (set-window-geometry window
+      :width (frame-width frame)
+      :height (frame-height frame))))
+
+(defcommand refresh () ()
+  "Refresh current window without changing its size"
+  (let* ((window (current-window))
+         (w (window-width window))
+         (h (window-height window)))
+    (set-window-geometry window
+      :width (- w 1)
+      :height (- h 1))
+    (maximize-window window)
+    (set-window-geometry window
+      :width w
+      :height h)
+    (maximize-window window)))
+
+(defcommand redisplay () ()
+  "Refresh current window by a pair of resizes, also make it occupy entire 
frame."
+  (let ((window (current-window)))
+    (set-window-geometry window
+      :width (- (window-width window) 1)
+      :height (- (window-width window) 1))
+    (maximize-window window)
+    (fill-frame window)
+    (maximize-window window)))
+
 (defun find-free-window-number (group)
   "Return a free window number for GROUP."
   (find-free-number (mapcar 'window-number (group-windows group))))
-- 
1.6.0

>From 53fc799e8c2825f9f7348702abead03ccd9102cc Mon Sep 17 00:00:00 2001
From: 38a938c2 <address@hidden>
Date: Sat, 30 Aug 2008 21:01:10 +0400
Subject: [PATCH] Added a command to compact window numbers

---
 window.lisp |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/window.lisp b/window.lisp
index ec3e831..0882053 100644
--- a/window.lisp
+++ b/window.lisp
@@ -1323,6 +1323,20 @@ is using the number, then the windows swap numbers. 
Defaults to current group."
 
 (defcommand-alias number renumber)
 
+(defcommand make-window-numbers-contiguous (&optional (preserved nil)) ()
+  "Ensure that used window numbers do not have gaps; possibly ignore preserved 
window numbers"
+  (let* ((group (current-group))
+        (windows (sort-windows group)))
+    (loop for w in windows
+         do (unless (find (window-number w) preserved)
+              (setf
+                (window-number w)
+                (find-free-number
+                  (remove
+                    (window-number w)
+                    (mapcar 'window-number windows))
+                  0))))))
+
 (defcommand gravity (gravity) ((:gravity "Gravity: "))
   (when (current-window)
     (setf (window-gravity (current-window)) gravity)
-- 
1.6.0

>From d592d620d95807aa95b1d2ac8a232b637d8a7dc9 Mon Sep 17 00:00:00 2001
From: 38a938c2 <address@hidden>
Date: Sat, 30 Aug 2008 21:12:55 +0400
Subject: [PATCH] Added logging of OSD messages

---
 message-window.lisp |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/message-window.lisp b/message-window.lisp
index 38497aa..b8ccb3f 100644
--- a/message-window.lisp
+++ b/message-window.lisp
@@ -227,6 +227,7 @@ function expects to be wrapped in a with-state for win."
           (cancel-timer *message-window-timer*)
           (setf *message-window-timer* nil))
         (reset-message-window-timer))
+    (dformat 5 "Outputting a message:~%~{ ~a~%~}~%End of message" strings)
     (apply 'run-hook-with-args *message-hook* strings)))
 
 (defun echo-string (screen msg)
-- 
1.6.0

>From fb928039fc7efd8ffcdbbd32ae7b632f68c52204 Mon Sep 17 00:00:00 2001
From: 38a938c2 <address@hidden>
Date: Sat, 30 Aug 2008 21:19:15 +0400
Subject: [PATCH] Added possibility to add arbitrary prefix to commands in 
stumpish (the suggested use is adding eval to get a StumpWM Common Lisp REPL)

---
 contrib/stumpish |   24 +++++++++++++++++-------
 1 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/contrib/stumpish b/contrib/stumpish
index 1d48bb4..55afd17 100755
--- a/contrib/stumpish
+++ b/contrib/stumpish
@@ -100,6 +100,11 @@ then
     shift 1
 fi
 
+if [ "x$1" = "x-prefix" ]; then
+    export STUMPISH_COMMAND_PREFIX="$2 ";
+    shift 2;
+fi;
+
 if [ $# -gt 0 ]
 then
     [ "$1" = "--help" ] && usage
@@ -134,12 +139,17 @@ else
 
        tput setaf 5
         echo Welcome to the STUMPwm Interactive SHell.
-        tput sgr0
-        echo -n 'Type '
-        tput setaf 2
-        echo -n commands
-        tput sgr0
-        echo \ for a list of commands.
+       if [ -z "$STUMPISH_COMMAND_PREFIX" ]; then
+            tput sgr0
+            echo -n 'Type '
+            tput setaf 2
+            echo -n commands
+            tput sgr0
+            echo \ for a list of commands.
+       else
+           echo "Every command will be prepended with 
\`$STUMPISH_COMMAND_PREFIX'";
+            tput sgr0
+       fi;
 
         IFS='
 '
@@ -148,7 +158,7 @@ else
        do
            tput bold
            tput setaf 2
-           send_cmd "$REPLY"
+           send_cmd "$STUMPISH_COMMAND_PREFIX$REPLY"
            tput sgr0
 
            echo -n "> "
-- 
1.6.0


reply via email to

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