stumpwm-devel
[Top][All Lists]
Advanced

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

[STUMP] [RESEND] [PATCHES]


From: Michael Raskin
Subject: [STUMP] [RESEND] [PATCHES]
Date: Fri, 17 Oct 2008 01:43:54 +0400
User-agent: Thunderbird 2.0.0.16 (X11/20080904)

        I never got any reaction beyond "Oh, they got forgotten" when I
reminded about these patches, so I send them once more...
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(-)
---
 bindings.lisp |    1 +
 window.lisp   |   39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/bindings.lisp b/bindings.lisp
index c7a9c28..93b022c 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 f44b3d4..cb0b836 100644
--- a/window.lisp
+++ b/window.lisp
@@ -645,6 +645,45 @@ than the root window's width and height."
                                   (- (xlib:drawable-height (window-parent 
win)) height wy))
                             :cardinal 32))))
 
+(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.1

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(-)
---
 window.lisp |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/window.lisp b/window.lisp
index cb0b836..729fd21 100644
--- a/window.lisp
+++ b/window.lisp
@@ -1329,6 +1329,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.1

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(-)
---
 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.1

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(-)
---
 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.1

From: 38a938c2 <address@hidden>
Date: Sun, 31 Aug 2008 21:50:53 +0400
Subject: [PATCH] Added possiility not to use ncurses for colouring.

---
 contrib/stumpish |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
 contrib/stumpish |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/contrib/stumpish b/contrib/stumpish
index 55afd17..7b6bfd2 100755
--- a/contrib/stumpish
+++ b/contrib/stumpish
@@ -105,6 +105,10 @@ if [ "x$1" = "x-prefix" ]; then
     shift 2;
 fi;
 
+if [ -n "$NO_NCURSES" ]; then
+    tput () { : ; };
+fi;
+
 if [ $# -gt 0 ]
 then
     [ "$1" = "--help" ] && usage
-- 
1.6.0.1

>From 1dc5eaa8d01eb53447902485e1671883936a0efc Mon Sep 17 00:00:00 2001
From: 38a938c2 <address@hidden>
Date: Mon, 1 Sep 2008 08:16:09 +0400
Subject: [PATCH] Added commands to save/load placement information using window 
properties. Good when restarting stumpwm..

---
 group.lisp  |    5 +++++
 window.lisp |   36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/group.lisp b/group.lisp
index a6a1d38..db8a9a1 100644
--- a/group.lisp
+++ b/group.lisp
@@ -399,3 +399,8 @@ The windows will be moved to group \"^B^2*~a^n\"
   (if (eq from (current-group))
       (message "^B^3*Cannot merge group with itself!")
       (merge-groups from (current-group))))
+
+(defun all-groups ()
+  "List all the known groups on all screens"
+  (apply #'append
+    (mapcar #'screen-groups *screen-list*)))
diff --git a/window.lisp b/window.lisp
index 729fd21..52f09c4 100644
--- a/window.lisp
+++ b/window.lisp
@@ -383,6 +383,15 @@ _NET_WM_STATE_DEMANDS_ATTENTION set"
 (defun window-property (window prop)
   (xlib:get-property (window-xwin window) prop))
 
+(defun window-string-property (window prop)
+  "Get window property and convert it to string"
+  (map 'string 'character (window-property window prop))
+  )
+
+(defun (setf window-string-property) (value window prop)
+  "Set window property to value specified by a string"
+  (xlib:change-property (window-xwin window) prop value :string 8 :transform 
'char-code))
+
 (defun find-wm-state (xwin state)
   (find (xlib:find-atom *display* state) (xlib:get-property xwin 
:_NET_WM_STATE) :test #'=))
 
@@ -1539,3 +1548,30 @@ be used to override the default window formatting."
   (if (current-window)
       (message "~a" (format-expand *window-formatters* fmt (current-window)))
       (message "No Current Window")))
+
+(defcommand placement-to-properties (&optional (window nil)) ()
+  "Create X window properties to hold current window position"
+  (let* ((win (if window window (current-window)))
+        (gr (window-group win))
+        (fr (window-frame win))
+        )
+    (setf (window-string-property win :stumpwm-group-name) (group-name gr))
+    (setf (window-string-property win :stumpwm-frame-number) (format nil "~s " 
(frame-number fr)))))
+
+(defcommand placement-by-properties (&optional (window nil)) ()
+  "Read X window properties we have set and place window according to them"
+  (let* ((win (if window window (current-window)))
+        (grname (window-string-property win :stumpwm-group-name))
+        (group (find-if (lambda (g) (equal (group-name g) grname)) 
(all-groups)))
+        (frnum (ignore-errors (parse-integer (window-string-property win 
:stumpwm-frame-number))))
+        (frame (if group (find-if (lambda (f) (equal (frame-number f) frnum)) 
(group-frames group)) nil)))
+    (when group (move-window-to-group win group))
+    (when frame (pull-window win frame))))
+
+(defcommand all-placement-to-properties () ()
+  "Save all window placement data to properties"
+  (mapc #'placement-to-properties (all-windows)))
+
+(defcommand all-placement-by-properties () ()
+  "Load all window placement data from properties"
+  (mapc #'placement-by-properties (all-windows)))
-- 
1.6.0.1


reply via email to

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