Hi all, I've been thinking of new buttons provided by sawfish, so we don't need to reinvent the wheel everytime (like mxflat does). Together with the new options for changing frame-font-colors independently of the theme and on-the-fly it may improve the experience of making new themes for sawfish (or improving old ones).
First of all the complete patch (frame-classes, their keymap,
sawfish.texi, news.texi, ChangeLog and KEYBINDINGS update)
*************************************************
diff --git a/ChangeLog b/ChangeLog
index 10136ab..71cf661 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -42,6 +42,18 @@
* man/sawfish.texi: added update-frame-font-color
+ * man/sawfish.texi
+ * KEYBINDINGS
+ * lisp/sawfish/wm/frames.jl
+ * lisp/sawfish/wm/keymaps.jl: added new buttons + keymaps + docs:
+ - sticky button
+ - lock button
+ - rename button
+ - move/resize button
+ - raise/lower button
+
+ * man/news.texi: updated
+
2009-09-23 Christopher Bratusek <[email protected]>
* man/news.texi: news items for 1.6.0 are partially rewritten [Teika
Kazura]
diff --git a/KEYBINDINGS b/KEYBINDINGS
index 7d3156c..d500489 100644
--- a/KEYBINDINGS
+++ b/KEYBINDINGS
@@ -113,7 +113,7 @@ for example:
( unbind-keys global-keymap "W-Tab" 'cycle-windows )
another thing would be nested keybindings (I prefer `macros' instead of
`nested keyinbindgs'),
-like in emacs. nested means you first press keys which together act as
a new modifier
+like in emacs. nested means you first press keys which together act as
a new modifier
(this new modifier works like the compose key does -> you don't have to
keep it pressed, like other modifiers),
then you press another key (or keybinding) to actually perform the
desired action, example:
@@ -189,3 +189,31 @@ Button1-Click1 -> Popup Window Menu
shade-button-keymap (Those bindings are active when the pointer is on
the shade button)
Button1-Off -> Toggle Window Shaded
+
+sticky-button-keymap (Those bindings are active when the pointer is on
the sticky button)
+
+Button1-Off -> Toggle Window Sticky
+Button2-Off -> Toggle Window Viewport-Sticky
+
+lock-button-keymap (Those bindings are active when the pointer is on
the lock button)
+
+Button1-Off -> Toggle Window Fixed-Position
+
+rename-button-keymap (Those bindings are active when the pointer is on
the rename button)
+
+Button1-Off -> Rename Window
+
+move-resize-button-keymap (Those bindings are active when the pointer
in on the move/resize button)
+
+Button1-Off -> Move Window Interactively
+Button2-Off -> Resize Window Interactively
+Button3-Off -> Move Window Center
+Button4-Off -> Double Window Size
+Button5-Off -> Halve Window Size
+
+raise-lower-button-keymap (Those bindings are active when the pointer
in on the raise/lower button)
+
+Button1-Off -> Raise Window
+Button2-Off -> Lower Window
+Button4-Off -> Raise Window Depth
+Button5-Off -> Lower Window Depth
diff --git a/lisp/sawfish/wm/frames.jl b/lisp/sawfish/wm/frames.jl
index 9c65c2e..c6b8397 100644
--- a/lisp/sawfish/wm/frames.jl
+++ b/lisp/sawfish/wm/frames.jl
@@ -633,6 +633,11 @@ deciding which frame type to ask a theme to
generate.")
(define-frame-class 'iconify-button '((keymap .
iconify-button-keymap)))
(define-frame-class 'maximize-button '((keymap .
maximize-button-keymap)))
(define-frame-class 'shade-button '((keymap . shade-button-keymap)))
+ (define-frame-class 'sticky-button '((keymap .
sticky-button-keymap)))
+ (define-frame-class 'lock-button '((keymap . lock-button-keymap)))
+ (define-frame-class 'rename-button '((keymap .
rename-button-keymap)))
+ (define-frame-class 'move-resize-button '((keymap .
move-resize-button-keymap)))
+ (define-frame-class 'raise-lower-button '((keymap .
raise-lower-button-keymap)))
(define-frame-class 'title `((keymap . title-keymap)
(cursor . ,(cursor-for-frame-part 'title))))
diff --git a/lisp/sawfish/wm/keymaps.jl b/lisp/sawfish/wm/keymaps.jl
index 25e761b..f27cec2 100644
--- a/lisp/sawfish/wm/keymaps.jl
+++ b/lisp/sawfish/wm/keymaps.jl
@@ -101,7 +101,7 @@
"W-Button2-Click1" 'popup-window-menu
"W-Button1-Move" 'move-window-interactively
"Button1-Click1" 'raise-and-pass-through-click
- "W-ISO_Left_Tab" 'tab-raise-left-window
+ "W-ISO_Left_Tab" 'tab-raise-left-window
"H-ISO_Left_Tab" 'tab-raise-right-window)
"Keymap containing bindings active when a client window is
focused."
:group bindings
@@ -177,6 +177,57 @@ of a window. (Only mouse-bindings are evaluated in
this map.)"
:group bindings
:type keymap)
+ (defcustom sticky-button-keymap (bind-keys (make-keymap)
+ "Button1-Off" 'toggle-window-sticky
+ "Button2-Off" '(call-command
+ (lambda ()
+ (if (window-get
(current-event-window) 'sticky-viewport)
+ (window-put
(current-event-window) 'sticky-viewport
nil)
+ (window-put
(current-event-window) 'sticky-viewport t)))))
+ "Keymap containing bindings active when the pointer is in the
sticky button
+of a window. (Only mouse-bindings are evaluated in this map.)"
+ :group bindings
+ :type keymap)
+
+ (defcustom lock-button-keymap (bind-keys (make-keymap)
+ "Button1-Off" '(call-command
+ (lambda ()
+ (if (window-get (current-event-window)
'fixed-position)
+ (window-put (current-event-window)
'fixed-position nil)
+ (window-put (current-event-window)
'fixed-position t)))))
+ "Keymap containing bindings active when the pointer is in the lock
button
+of a window. (Only mouse-bindings are evaluated in this map.)"
+ :group bindings
+ :type keymap)
+
+ (defcustom rename-button-keymap (bind-keys (make-keymap)
+ "Button1-Off" 'rename-window)
+ "Keymap containing bindings active when the pointer is in the
rename button
+of a window. (Only mouse-bindings are evaluated in this map.)"
+ :group bindings
+ :type keymap)
+
+ (defcustom move-resize-button-keymap (bind-keys (make-keymap)
+ "Button1-Off"
'move-window-interactively
+ "Button2-Off"
'resize-window-interactively
+ "Button3-Off" 'move-window-center
+ "Button4-Off" 'double-window-size
+ "Button5-Off" 'halve-window-size)
+ "Keymap containing bindings active when the pointer is in the
move/resize button
+of a window. (Only mouse-bindings are evaluated in this map.)"
+ :group bindings
+ :type keymap)
+
+ (defcustom raise-lower-button-keymap (bind-keys (make-keymap)
+ "Button1-Off" 'raise-window
+ "Button2-Off" 'lower-window
+ "Button4-Off" 'raise-window-depth
+ "Button5-Off" 'lower-window-depth)
+ "Keymap containing bindings active when the pointer is in the
raise/lower button
+of a window. (Only mouse-bindings are evaluated in this map.)"
+ :group bindings
+ :type keymap)
+
(defvar pointer-motion-threshold 2
"Distance in pixels pointer must move before generating motion
events.")
@@ -196,7 +247,7 @@ of a window. (Only mouse-bindings are evaluated in
this map.)"
(define (keymap-add-window w)
(unless (window-get w 'keymap)
(window-put w 'keymap window-keymap)))
-
+
(add-hook 'add-window-hook keymap-add-window)
;; custom support for modifiers
diff --git a/man/news.texi b/man/news.texi
index 077c4bb..1387fe2 100644
--- a/man/news.texi
+++ b/man/news.texi
@@ -83,7 +83,7 @@ Shrink-yank functions and @code{send-to-workspace}.
@item Sawfish does now support theme-tarballs compressed with XZ (aka
LZMA2) or LZMA [Christopher Bratusek]
-...@item 3 new sawfish-mmc based commands (@code{maximize-unframe},
@code{maximize-reframe} and @code{rename-window}) [Christopher Bratusek]
+...@item 3 new sawfish-mmc based commands (@code{maximize-unframe},
@code{maximize-reframe} and @code{rename-window} (not ICCCM compliant))
[Christopher Bratusek]
@item 5 new move-cursor commands (@code{move-cursor-} @code{northwest},
@code{northeast}, @code{southwest}, @code{southeast}), and
@code{move-cursor-center} [Christopher Bratusek]
@@ -126,6 +126,19 @@ In KDE4 WM Selector, Sawfish is added.
@item Added @code{get-window-by-class} and
@code{get-window-by-class-re} [Christopher Bratusek]
@end itemize
+...@item New Frame Classes:
+...@itemize @minus
+
+...@item @code{sticky-button}, a button to toggle window @code{sticky} or
@code{viewport-sticky} [Christopher Bratusek]
+
+...@item @code{lock-button}, a button to toggle window position
@code{fixed} [Christopher Bratusek]
+
+...@item @code{rename-button}, a button to rename the window-title and
window-icon properties (not ICCCM compliant) [Christopher Bratusek]
+
+...@item @code{move-resize-button}, a button to perform various move and
resize actions on a window [Christopher Bratusek]
+
+...@item @code{raise-lower-button}, a button to perform various raising
and lowering actions on a window [Christopher Bratusek]
+...@end itemize
@item Widget Transistion:
@itemize @minus
diff --git a/man/sawfish.texi b/man/sawfish.texi
index 4d14006..4fd46a9 100644
--- a/man/sawfish.texi
+++ b/man/sawfish.texi
@@ -3231,10 +3231,11 @@ The names of the pre-defined classes are as
follows, their meanings
should be self-explanatory:
@code{title}, @code{menu-button}, @code{close-button},
-...@code{iconify-button}, @code{maximize-button}, @code{top-border},
-...@code{left-border}, @code{right-border}, @code{bottom-border},
-...@code{top-left-corner}, @code{top-right-corner},
-...@code{bottom-left-corner}, @code{bottom-right-corner}.
+...@code{iconify-button}, @code{maximize-button}, @code{sticky-button},
+...@code{lock-button}, @code{rename-button}, @code{move-resize-button},
+...@code{raise-lower-button}, @code{top-border}, @code{left-border},
+...@code{right-border}, @code{bottom-border}, @code{top-left-corner},
+...@code{top-right-corner}, @code{bottom-left-corner},
@code{bottom-right-corner}.
@noindent
Extra classes can be created by adding to @code{frame-part-classes}.
@@ -5347,6 +5348,11 @@ Keymaps active in the title and borders of window
frames.
@itemx maximize-button-keymap
@itemx menu-button-keymap
@itemx shade-button-keymap
+...@itemx sticky-button-keymap
+...@itemx lock-button-keymap
+...@itemx rename-button-keymap
+...@itemx move-resize-button-keymap
+...@itemx raise-lower-button-keymap
Keymaps active in the standard window frame buttons.
@item override-keymap
*************************************************
Alternatively I may add `toggle-window-sticky-viewport' and
`toggle-window-fixed-position' commands
instead of manually calling window-put, if that is desired.
Possible future plans:
* Beeing able to change more options on the fly than the font-color (I
dunno which ones yet, but
perhaps the button-order (maybe using some fancy custom GtkWidget?),
or the frame-color (though
the later my cause ugly results on some themes perhaps))
* add something like window-is-tabbed-p to recognize tabbed windows and
add a new frame-class 'tabbed
(so that themes can be set-up for supporting both tabbed and
non-tabbed windows *at once*)
* more?
Now I would like to hear your oppionions.
Happy Hacking,
Chris
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
