stumpwm-devel
[Top][All Lists]
Advanced

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

Re: [STUMP] fselect to support >10 frames


From: John Li
Subject: Re: [STUMP] fselect to support >10 frames
Date: Thu, 26 Jun 2008 08:06:29 -0400
User-agent: Mutt/1.5.18 (2008-05-17)

On Thu, Jun 26, 2008 at 05:00:20AM -0400, John Li wrote:
> On Tue, Jun 24, 2008 at 01:28:37AM -0400, John Li wrote:
> > stumplings,
> >
> > [...]
> > 1. How do I add the ability to "C-g" out of the selection?
>
> I have a half-way solution. If "(and (char= character #g) (is-modifier
> (car key)))", then return.

This is actually completely wrong - it only worked because I was
testing with frames numbered with at most 2 digits.


Here's my current iteration of "read-n-chars" (now read-frame-chars):

(defun read-frame-chars (n screen)
  "Read n number of characters from the user and return them as a
string for the purpose of identifying a frame."
  (with-focus (screen-key-window screen)
    (let ((string nil))
      (dotimes (count n)
        (let* ((k (read-key))
               (c (keycode->character (car k) (xlib:make-state-keys (cdr k)))))
          (cond ((or (char= c #\Space)
                     (char= c #\FULLWIDTH_HYPHEN-MINUS)) ; this means "Return". 
I don't understand.
                 (return))
                ((not (or (digit-char-p c)
                          (find c *frame-number-map*)))
                 (return-from read-frame-chars))
                (t (setf string (concatenate 'string string (string c)))))))
      string)))

This returns the current string when you hit space or enter, and quits
the process if you hit any other key that isn't either in your
*frame-number-map* or a number.

The only remaining issue AFAICT is that you cannot have keys in your
*frame-number-map* that require shift (or any other modifier) to
input. This seems okay because Shift+key isn't much more accessible
than a two-digit frame number.

Yes, you can reach up to 36 frames by using an alphanumeric
*frame-number-map*, but this way, you can have 1,000 frames all
accessible with at most 3 keystrokes - which would likely be a
distinguishing stumpwm feature (try using Exposé there!), and it's
clearly the direction we're going in as people get larger screens and
multi-head desktops =).


-John




reply via email to

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