- added shortcuts to cycle through the clients, and to hide/show the pager

This commit is contained in:
frese 2005-01-16 19:16:38 +00:00
parent d06743740e
commit fae255085c
2 changed files with 37 additions and 4 deletions

View File

@ -1,5 +1,6 @@
(define-record-type move-wm-pager :move-wm-pager
(make-move-wm-pager dpy window wm in-channel options buttons-alist width)
(make-move-wm-pager dpy window wm in-channel options buttons-alist width
visible?)
move-wm-pager?
(dpy pager:dpy)
(window pager:window)
@ -8,7 +9,8 @@
(options pager:options)
;; client -> button
(buttons-alist pager:buttons-alist set-pager:buttons-alist!)
(width pager:width set-pager:width!))
(width pager:width set-pager:width!)
(visible? pager:visible? set-pager:visible!))
;; TODO: hide buttons/keys
;; TODO: client-name <-> WM_ICON_NAME?
@ -35,7 +37,7 @@
(gc (create-gc dpy window '()))
(colormap (screen:default-colormap (display:default-screen dpy)))
(pager (make-move-wm-pager dpy window wm in-channel options '()
(rectangle:width rect))))
(rectangle:width rect) #t)))
(spawn*
(list 'move-wm-pager wm window)
(lambda (release)
@ -212,3 +214,9 @@
(button (cdr c.b)))
(pager-update-button pager button client)))
(pager:buttons-alist pager)))
(define (pager-change-visibility pager)
(set-pager:visible! pager (not (pager:visible? pager)))
(if (not (pager:visible? pager))
(unmap-window (pager:dpy pager) (pager:window pager))
(map-window (pager:dpy pager) (pager:window pager))))

View File

@ -12,6 +12,9 @@
'("#808080" "#aaaaaa" "#eeeeee" "#777777" "black"))
(pager-maximum-button-width int 140)
(pager-height int 24)
(select-next keys "M-Tab")
(select-previous keys "M-S-Tab") ;; or ISO_Left_Tab ?
(hide-show-pager keys "M-p")
)
(define (create-move-wm out-channel dpy parent options default-options
@ -30,7 +33,13 @@
(window (wm:window wm))
(gc (create-gc dpy window '()))
(pager-channel (make-channel))
(pager (create-move-wm-pager wm pager-channel (wm:options wm))))
(options (wm:options wm))
(pager (create-move-wm-pager wm pager-channel options)))
(for-each (lambda (id)
(grab-shortcut dpy window
(get-option-value options id)
id channel #f))
'(select-next select-previous hide-show-pager))
(spawn* (list 'move-wm wm)
(lambda (release)
(release)
@ -217,6 +226,22 @@
(raise-window dpy (client:client-window c)))
clients)))
((select-next select-previous)
(let* ((time (second msg))
(cc (wm-current-client wm))
(clients (if (eq? (first msg) 'select-next)
(wm-clients wm)
(reverse (wm-clients wm)))))
(let loop ((l (append clients clients)))
(and (not (null? l))
(if (eq? (car l) cc)
(and (not (null? (cdr l)))
(wm-select-client wm (cadr l) time))
(loop (cdr l)))))))
((hide-show-pager)
(pager-change-visibility pager))
(else (warn "unhandled move-wm message" wm msg)))))
(define (make-client-data titlebar resizer)