From 835b5087dc6c897fcd58fdaf5a0d7e6d85f03003 Mon Sep 17 00:00:00 2001 From: Matt Spear Date: Tue, 15 Mar 2011 20:35:54 -0700 Subject: [PATCH 1/3] add a window-map --- primitives.lisp | 4 ++++ window.lisp | 7 +++++++ 2 files changed, 11 insertions(+), 0 deletions(-) diff --git a/primitives.lisp b/primitives.lisp index b855021..15b85c8 100644 --- a/primitives.lisp +++ b/primitives.lisp @@ -471,6 +471,9 @@ exist, in which case they go into the current group.") (format stream "#S(frame ~d ~a ~d ~d ~d ~d)" (frame-number object) (frame-window object) (frame-x object) (frame-y object) (frame-width object) (frame-height object))) +(defvar *window-number-map* "0123456789" + "Set this to a string to remap the window numbers to something more convinient.") + (defvar *frame-number-map* "0123456789abcdefghijklmnopqrstuvxwyz" "Set this to a string to remap the frame numbers to more convenient keys. For instance, @@ -758,6 +761,7 @@ do: cur (cdr cur))))))) (defvar *window-formatters* '((#\n window-number) + (#\f window-map-number) (#\s fmt-window-status) (#\t window-name) (#\c window-class) diff --git a/window.lisp b/window.lisp index 0774e9b..13fc480 100644 --- a/window.lisp +++ b/window.lisp @@ -253,6 +253,13 @@ _NET_WM_STATE_DEMANDS_ATTENTION set" :format 32 :data data)) +(defun window-map-number (window) + (let ((num (window-number window))) + (or (and (< num (length *window-number-map*)) + (char *window-number-map* num)) + ;; translate the frame number to a char. FIXME: it loops after 9 + (prin1-to-string num)))) + (defun fmt-window-status (window) (let ((group (window-group window))) (cond ((eq window (group-current-window group)) -- 1.7.3.5 From 90c790d3819bef73ec4632392bdaa4628767b0a4 Mon Sep 17 00:00:00 2001 From: Matt Spear Date: Tue, 15 Mar 2011 20:37:53 -0700 Subject: [PATCH 2/3] rm comment --- window.lisp | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/window.lisp b/window.lisp index 13fc480..461b77d 100644 --- a/window.lisp +++ b/window.lisp @@ -257,7 +257,6 @@ _NET_WM_STATE_DEMANDS_ATTENTION set" (let ((num (window-number window))) (or (and (< num (length *window-number-map*)) (char *window-number-map* num)) - ;; translate the frame number to a char. FIXME: it loops after 9 (prin1-to-string num)))) (defun fmt-window-status (window) -- 1.7.3.5 From 27af1b78d02b942c8fa13bda28e660ab1dd9ce56 Mon Sep 17 00:00:00 2001 From: Matt Spear Date: Tue, 15 Mar 2011 21:30:14 -0700 Subject: [PATCH 3/3] add group format cleanup --- group.lisp | 8 ++++++++ primitives.lisp | 11 +++++++++++ 2 files changed, 19 insertions(+), 0 deletions(-) diff --git a/group.lisp b/group.lisp index 27ea95f..0aa13c5 100644 --- a/group.lisp +++ b/group.lisp @@ -106,6 +106,14 @@ otherwise specified." "Return a copy of the screen's group list sorted by number." (sort1 (screen-groups screen) '< :key 'group-number)) +(defun group-map-number (group) + (let* ((len (length *group-number-map*)) + (num (group-number group)) + (n (if (eq num 0) 10 num))) + (if (<= n len) + (char *group-number-map* (- n 1)) + (prin1-to-string n)))) + (defun fmt-group-status (group) (let ((screen (group-screen group))) (cond ((eq group (screen-current-group screen)) diff --git a/primitives.lisp b/primitives.lisp index 15b85c8..4ad90bd 100644 --- a/primitives.lisp +++ b/primitives.lisp @@ -474,6 +474,9 @@ exist, in which case they go into the current group.") (defvar *window-number-map* "0123456789" "Set this to a string to remap the window numbers to something more convinient.") +(defvar *group-number-map* "0123456789" + "Set this to a string to remap the group numbers to something more convinient.") + (defvar *frame-number-map* "0123456789abcdefghijklmnopqrstuvxwyz" "Set this to a string to remap the frame numbers to more convenient keys. For instance, @@ -780,6 +783,9 @@ with the following formatting options: @table @asis @item %n Substitute the window number. address@hidden %f +Substitutes the windows number translated via *window-number-map*, if there +are more windows than *window-number-map* then will use the window-number. @item %s Substitute the window's status. * means current window, + means last window, and - means any other window. @@ -801,6 +807,7 @@ characters.") "The format used in the info command. @xref{*window-format*} for formatting details.") (defvar *group-formatters* '((#\n group-number) + (#\f group-map-number) (#\s fmt-group-status) (#\t group-name)) "An alist of characters and formatter functions. The character can be @@ -818,6 +825,10 @@ group listing. The following format options are available: @item %n The group's number. address@hidden %f +Substitutes the group number translated via *group-number-map*, if there +are more windows than *group-number-map* then will use the group-number. + @item %s The group's status. Similar to a window's status. -- 1.7.3.5