[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [XWEM]: Fun with frames
From: |
Zajcev Evgeny |
Subject: |
Re: [XWEM]: Fun with frames |
Date: |
Wed, 05 May 2004 13:54:42 +0400 |
User-agent: |
Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.5 (celery, berkeley-unix) |
Steve Youngs <address@hidden> writes:
> I found another user problem with xwem (read: Steve has gotten himself
> stuck and can't find a way out).
>
> After having about 50 xwem client windows open and getting totally
> lost I figured it was time to start working with multiple xwem
> frames. A few `M-x xwem-make-frame' later and I could pretend that I
> was organised.
>
> Very soon thereafter, I found that all these new frames had names like
> "Frame 0: default", "Frame 1: default", "Frame 3: default". Now
> there's gotta be a way to rename these frames... And there is!
> `xwem-frame-set-name'. Now here's my first question...
>
> How do I rename a frame when there is no XEmacs frame in sight?
>
> Can I create a new xwem frame _and_ give it a name at the same time?
>
> Can I start an application and have it go into a specific frame
> without being in that frame when I start the app? Something like the
> following pseudo code...
>
> (save-excursion
> (xwem-switch-frame (xwem-find-frame "foo"))
> (xwem-launch-program))
>
Yes, will describe below.
> Can I switch frames by name instead of doing multiple `H-x H-n' or
> `H-x H-p' until I get to the frame I want?
here is what i have in my xwemrc:
;; Fast frame switcher
(defun my-xwem-switch-frame (key)
"To be used by H-C-<digit> bindings."
(interactive (list (event-key xwem-last-event)))
(xwem-frame-switch-nth (- (char-to-int key) 48)))
(define-key xwem-global-map (xwem-kbd "H-C-0") 'my-xwem-switch-frame)
(define-key xwem-global-map (xwem-kbd "H-C-1") 'my-xwem-switch-frame)
(define-key xwem-global-map (xwem-kbd "H-C-2") 'my-xwem-switch-frame)
(define-key xwem-global-map (xwem-kbd "H-C-3") 'my-xwem-switch-frame)
(define-key xwem-global-map (xwem-kbd "H-C-4") 'my-xwem-switch-frame)
(define-key xwem-global-map (xwem-kbd "H-C-5") 'my-xwem-switch-frame)
(define-key xwem-global-map (xwem-kbd "H-C-6") 'my-xwem-switch-frame)
(define-key xwem-global-map (xwem-kbd "H-C-7") 'my-xwem-switch-frame)
(define-key xwem-global-map (xwem-kbd "H-C-8") 'my-xwem-switch-frame)
(define-key xwem-global-map (xwem-kbd "H-C-9") 'my-xwem-switch-frame)
NOTE:
After today commit, which i will performe in few hours, really big
commit which even changes core things in xwem a little, so will need
testing, it will be possible to write something like:
(define-xwem-command my-xwem-switch-frame (name)
"Switch to xwem frame named by NAME."
(xwem-interactive (list (xwem-completing-read "XWEM Frame: "
(mapcar (lambda (f) (list (xwem-frame-name f)))
xwem-frames-list))))
(let ((frame (xwem-frame-find 'name name)))
(when (xwem-frame-p frame)
(xwem-frame-select frame))))
>
> That should be enough to keep me going for a while. :-)
Hehe, your investigations really great!, do you dig in code :)? Here
is a little discription about working with frames, clients, windows,
etc.
*XWEM FRAMES*:
General function to create frames is `xwem-make-frame-1'. It takes
all arguments needed to change any parameter of xwem frame at
creation time. Arguments are:
o EMBEDDED-P - non-nil if creating embedded frame, i.e. which is
frame and client at the same time.
o PARAMS - frame's parameters. List in form '(:token1 val1
:token2 val2 .. ), where token is one of:
:name - Frame's name.
:state - Frame's state.
... others not really used.
o PROPS - frame's properties, plist, known keys are:
'inner-border-width
'otter-border-width
'title-height
'title-thickness
Values are numbers.
o NON-SELECT - Non-nil to not select newly created frame.
Default keybindings to deal with frames:
H-x 5 0 xwem-frame-destroy
H-x 5 1 xwem-frame-fit-screen
Enlarge frame to most close X screen, get knowledge about
xinerama and enlarges to most close xineramed screen if
xinerama enabled.
H-x 5 2 xwem-frame-sbs-vert-split
Side-by-side vertical split. Side-by-side splitting is also a
way to create frames. Here is ascii art how sbs splitting
works.
Horizontal sbs split:
+--------+ +----+----+--...--+----+
+--------+ +----+----+--...--+----+
| 1 | `xwem-frame-split-sbs' |--> | 1 | 2 | | N |
| | | | | | |
+--------+
+----+----+--...--+----+
1, 2, .. - frame numbers, i.e. result of `xwem-frame-num'.
H-x 5 3 xwem-frame-sbs-hor-split
See above.
H-x 5 5 xwem-make-frame
Create generic frame.
H-x 5 Z xwem-frame-showroot
H-x 5 b xwem-cl-switch-other-frame
H-x 5 n xwem-frame-set-name
This answers question about renaming frame without accesing
XEmacs frame.
H-x 5 r xwem-launch-program-other-frame
H-x 5 z xwem-frame-hide
H-x 5 C-l xwem-frame-lower
H-x 5 C-r xwem-frame-raise
H-x 5 H-t xwem-transpose-frames
H-x 5 H-a m xwem-launch-lupe-other-frame
H-x 5 H-a x xwem-launch-xterm-other-frame
Weird keybindings to start application in other frame. i.e.
frame will be created and client managed in its root window.
*XWEM WINDOWS*:
Window is subpart of xwem frame, as XEmacs windows to XEmacs
frames. You can split window, delete window, resize window, etc.
Normally each window is used to hold xwem client. Client resized
to windows size, so normally there is no clients overlapping inside
one frame. Windows has support for really cute thing -
expectances.
Expectance is special window mark, which is used to manage
particular clients in this window. For example you want to start
xterm application but do not want to manage it in current
window. So you install expectance in some other window and just
start xterm. xwem will catch xterm application, find window
which has xterm expectance installed in manage xterm in this
window. If no such window found - manage xterm in current
window.
To show how expectances works, just try: H-o r xterm RET
This will start xterm application withot changing selected
window.
Here is windows oriented keyboard bindings:
H-x 1 xwem-frame-del-others
H-x 2 xwem-frame-split-vert
H-x 3 xwem-frame-split-horiz
Bindings to create new windows.
H-x 0 xwem-frame-del-win
To delete window.
H-r h xwem-frame-win-enlarge-hor
H-r v xwem-frame-win-enlarge-ver
Bindings to resize window. Example H-x 2 H-1 0 0 H-r v
H-x + xwem-balance-windows
When you have multiple windows, which has different sized,
this will try to make windows with same width/height, just
like `balance-windows' for XEmacs windows.
H-o 0 xwem-kill-cl-and-window
Kill client in current window, and delete window.
H-o b xwem-cl-switch-other-win
H-o r xwem-launch-program-other-win
H-o C-o xwem-cl-switch-other-win
H-o H-t xwem-transpose-windows
Exchange clients in window and other window.
H-o C-H-l xwem-cl-switch-to-other-in-other-win
H-o H-a m xwem-launch-lupe-other-win
H-o H-a x xwem-launch-xterm-other-win
Here also support for window configurations. i.e. if using
`xwem-register' addon, here is bindings to work with window
configurations:
H-x 6 xwem-register-win-config
Save window configuration to register.
H-x j xwem-register-jump
Restore window configuration from register.
Working with window expectances:
For example you have frame:4 selected, and want to launch xterm in
other(than selected) frame. Here is how it may look:
(define-xwem-command my-launch-in-oframe (cmd)
"Run CMD in other frame."
(xwem-interactive "eMy launch other frame: ")
(let ((frame (or (xwem-frame-other (xwem-frame-selected))
(xwem-make-frame-1 nil nil nil t))))
(xwem-win-expt-inc (xwem-frame-selwin oframe) cmd)
(xwem-execute-program cmd)))
What it does? Just obtain another frame, or create new if no other
frames available, intall expectance in selected window, and run
CMD.
*XWEM CLIENTS*:
xwem client is normal X application, such as xterm, xclock, etc.
They manages according to entries in manage database. Generic way
to manage client is remap it to some xwem frame and resize to xwem
window sizes.
Ways to run new clients.
H-x r <cmd> RET - very generic way to create new client.
If application start time is pretty long, f.i: 20 secs, and you
dont want to wait time it will be managed, you can try using window
expectance feature. H-u H-x r <cmd> RET - this will install
expectance in current window, so you can switch to another frame,
do something, i.e. continue xweming. Programm <cmd> that you have
started, will be managed to window which was selected at start
time, i.e. there will be no unexpected popups for you, except if
you continue working in that window.
Once you started some applcation you can use H-x 7 2 - run copy
command. This will examine current client and try to run another
instance of this application, f.i.:
H-x r xterm RET .. wait client mapping .. H-x 7 2
Here is various variants of H-x 7 2 commands, to run copy in other
window, other frame.
H-x 7 4 xwem-client-run-copy-other-win
H-x 7 5 xwem-client-run-copy-other-frame
When some client already managed, and you have lost where it was
managed, but remeber its name, you can try using `H-x 7 p' - this
command will find where client managed and switch to its frame,
window, and client, so it is one of fastest way to find losted
client.
xwem client can be marked, just like you can mark position in
XEmacs buffer. H-@ - mark current client. Then you can switch to
last marked client using H-u address@hidden
If using xwem-register addon. You can push client to some register
H-x / <reg> - push current client to register <REG>, then using
H-x j <reg> - pop to client in <REG>.
To obtain some info about current client, use H-x 7 i - this will
show in xwem minibuffer clients name, sizes, and even uptime!
*HELP SUBSYSEM*
xwem uses great Emacs feature - selfdocumenting. xwem help
subsystem is pretty sily, but it may help sometimes. Here is
bindigs:
H-h b - List all xwem bindings.
H-h k - Describe binding
H-h s - List all xwem strokes.
Also here is help key(H-h), i.e. when you press help key after
starting new keymap prefix it will describe bindings for this
prefix. f.i.: H-x H-h - will describe H-x bindings.
Proposals about what should be in xwem help subsystem are very
very welcome, so dont hesistate.
It was very short description. I understand that many things is
pretty hard, and needs very detailed description in manuals. But I
still can't have time to write good doc, and also my english so ugly,
that I can't understand what I wrote after 7 days :(
Thanks again that you not give up fighting with xwem :).
Really I begin to understand that everything for Xing can be done in
xwem environment, as everything can be done in Emacs for editing :)
--
lg