[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[STUMP] bindings change, rudimentary window groups, odd bug
From: |
Julian Fondren |
Subject: |
[STUMP] bindings change, rudimentary window groups, odd bug |
Date: |
Thu, 1 Jan 2004 09:22:07 +0000 (GMT) |
Happy New Years =) I just got stumpwm working today,
and did some small
amount of hacking. I'll share that first; the bug
(which I suppose I
would understand if I knew X a bit better) I put at
the end.
;; keybindings
I had some immediate trouble with stumpwm, because I
didn't know what
keybindings it had. After I got a development system
up, I changed the
*key-bindings* values to have (cons fn name), with a
string for NAME.
The one accessor of FN now looks at (car (cons fn
name)). I should've
probably used a struct for this. I then changed
SET-DEFAULT-BINDINGS
as follows:
(defun set-default-bindings ()
"..."
(macrolet ((bind-keys (&rest list)
`(progn ,@(mapcar (lambda (k)
`(set-key-binding ,@k))
list))))
(bind-keys (#\n "next window"
'focus-next-window)
(#\p "prev window" 'focus-prev-winow)
...
(#\? "help" 'echo-bindings)
(#\r "reload" 'reload-user)
...)))
with
(defun set-key-binding (key name fn)
"Bind KEY to the function FN with NAME."
(setf (gethash key *key-bindings*) (cons fn
name)))
(defun echo-bindings (screen)
(let ((bindings nil))
(maphash (lambda (k v)
(pushnew (concatenate 'string (string
k) ": " (cdr v))
bindings))
*key-bindings*)
(echo-string-list screen bindings)))
(I'll go to bed soon =) but I *hope* I had a good
reason for building
BINDINGS that way. This probably also won't work with
how I imagine
keybindings to modifiers will work, but I haven't
gotten that far.)
(defun reload-user (screen)
(echo-string screen "The mindflayer casts a spell
--MORE-- You resist!")
(load "/home/julian/lisp/stumpwm/user.lisp")
(setf *key-bindings* (make-hash-table))
(set-default-bindings))
(should probably have
(load (translate-logical-pathname
"stumpwm:user.lisp"))
but nevermind)
;; rudimentary window groups
I started very ambitiously, threw stumpwm into the
debugger about 30
times, and then finally came up with the following =)
I'll add
something a bit nicer tomorrow, but I think this a
nifty enough feature
already that someone else may find it interesting.
(defstruct window-group name windows)
(defvar other-group (make-window-group :name
"other"))
(defun other-group (screen)
(let ((wins (copy-list (screen-mapped-windows
screen))))
(mapcar (lambda (w) (remove-window screen w))
wins)
(mapcar (lambda (w) (absorb-mapped-window screen
w))
(window-group-windows other-group))
(setf (window-group-windows other-group) wins))
(focus-next-window screen)
(echo-string screen "The Oracle ignores you."))
(originally I planned that only (to-window-group
irc-group) would
display the above message. Alas.)
and then I crashed stumpwm a twice more, leading to
these redefinitions:
(defun focus-next-window (screen)
(unless (null (screen-mapped-windows screen))
(focus-forward (sort-windows screen))))
(defun focus-prev-window (screen)
(unless (null (screen-mapped-windows screen))
(focus-forward (reverse (sort-windows
screen)))))
This seems to work well, except that (C-t t) doesn't
quite
work anymore. I haven't paid much attention to that,
yet, because
I prefer lots of window groups and 1-to-3 windows per
group.
;; bug
When I throw stumpwm into the debugger, I often have
to restart it
anew from the toplevel as (stumpwm:stumpwm "" :display
0); sometimes
some state doesn't get cleared and I have to restart
SBCL. I know
when to do this by the following error:
Attempt to use closed display #<XLIB:DISPLAY :0
(Gentoo Linux (XFree86
4.3.0, revision r3) R40300000)>
;; something else
Looking through the archives, I've only heard of
Debian and CMUCL used
for stumpwm, and something of a call for accounts of
how much
difficultly people had getting stumpwm up. Briefly:
I use SBCL, with a CLX that asdf-install fetched.
I have CLOCC just for stumpwm; I had to alter
stumpwm.asd to not
depend on :port (and to load :clx instead of
:cmucl-clx)
I don't start X so frequently that I've bothered to
get a nice way
to start stumpwm. I have just 'exec emacs' in my
~/.xsession and
I start stumpwm in screen through eshell, before
moving it over to
an Eterm. The 'X-dies-on-my-death' process will
probably change
to xscreensaver, eventually.
Sometimes I get stuck with stumpwm in the debugger
and in another
window. It helps to kill Eterms until the screen(1)
detaches =)
;; and two questions
In case I somehow can't figure this out tomorrow,
1) How can I create a 'modeful' keymap? I'd like to
(C-tC-f)
and have some of my letters bound to
number-emitters, for
those programs that assume a number pad -- with
'q', say,
to unbind those keys. In Sawfish I'd do
something like
(bind-keys "o" (lambda ()
(synthesize-event "3"
(input-focus)))
2) How can I bind to modified keys, such as C-f in
the previous
question?
(a 'modeful' keymap would also make it easy to arrange
windows:
C-tC-w to display the windows with temporary arrow-key
bindings)
;; Thanks =)
________________________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping"
your friends today! Download Messenger Now
http://uk.messenger.yahoo.com/download/index.html
- [STUMP] bindings change, rudimentary window groups, odd bug,
Julian Fondren <=