Subject: 'window shortcuts'

From: Dominik Vogt <[email-masked]>
Date: Fri, 12 Mar 1999 10:44:48 +0100

Last evening I had an idea for a new feature that seems quite
useful to me: window shortcuts. What I am thinking about is this:
Most people have several windows they use all the time (a couple
of shells, perhaps netscape or xemacs). With the new feature you
can assign the window id to some kind of register that can be called
from functions etc. The default should be to switch to the desk/page
with the bound window, raise and focus it and put the pointer into
it. This should speed up switching the focus tremendously.

Proposed syntax:

  To bind a register to a window:
 
    WindowShortcut Assign <register>

  To apply a function to a window with a shortcut:

    WindowShortcut Apply <register> <function>

  Use the window id from a shortcut in a function:

    $r1, ..., $r<n>

  In Next/Prev,...

    Next (register) <function>

  or

    Next (register <n>) <function>

Example:

    AddToFunction Choose-Window
     + "I" Iconify off
     + "I" WindowShade off
     + "I" Raise
     + "I" WarpToWindow 50 +5p
     + "I" Focus

    # bind assignment keys
    Key F1 A S  WindowShortcut Assign 1
    Key F2 A S  WindowShortcut Assign 2
    Key F3 A S  WindowShortcut Assign 3
    Key F4 A S  WindowShortcut Assign 4

    # go to user defined windows
    Key F1 A N  WindowShortcut Apply 1 Choose-Window
    Key F2 A N  WindowShortcut Apply 2 Choose-Window
    Key F3 A N  WindowShortcut Apply 3 Choose-Window
    Key F4 A N  WindowShortcut Apply 4 Choose-Window

    # Assign standard windows on startup
    Next (rxvt) WindowShortcut Assign 1
    Next (rxvt) WindowShortcut Assign 2
    Next (XMessages) WindowShortcut Assign 3

Now you can press shift-F1-F4 to assign a window to a function
key and when you press the key without shift the window will be
brought up in a way that you can immediately type into it. I'm
not sure how assigning shortcuts during startup would work since
fvwm doesn't wait for the windows of exec'd functions. I'm sure
there is a lot more one could do with this.

Ideas for improvements? Comments?

Bye

Dominik

-- 
Dominik Vogt, Hewlett-Packard GmbH, Dept. BVS
Herrenberger Str.130, 71034 Boeblingen, Germany
phone: 07031/14-4596, fax: 07031/14-3883, [email-masked]
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Tim Phipps <[email-masked]>
Date: Fri, 12 Mar 1999 11:10:30 +0000

>   Use the window id from a shortcut in a function:

I don't think you need a new set of commands for this.  I think you can
do it by creating functions for the storage.  It might not be as nice
but does the following work

DestroyFunc Assign1 # one of these for each register
AddToFunc Assign1
+ I DestroyFunc Apply1
+ I AddToFunc Apply1 I WindowID $0 \$0 \$1 \$2 \$3 ...

# Apply1 looks like: WindowID 1234567 $0 $1 ...

Key F1 A C Assign1 $w
Key F1 A M Apply1 <function> <args>

I don't know if \$0 is possible, it needs some method of defering the
expansion of $0 until Apply1 is called.  If it doesn't work it might be
easier to get it working than creating new commands and state, it would
be less to test as well.

Cheers,
Tim.

---

From: Dominik Vogt <[email-masked]>
Date: Fri, 12 Mar 1999 12:21:37 +0100

> easier to get it working than creating new commands and state, it would

Hmm, I'll try it at home. But this approach convinces me even more
that we need it. I've talked to one of our students about it and
he likes the whole idea very much. We cannot expect the average
user (or the expert user for that matter) to be able to implement
such a functionality with a syntax like this. I believe that this
'feature' would be a tremendous leap ahead in usability. I've
watched some of my colleagues (not that they are using fvwm, but
anyway), and what I always see is that they switch between two
full sized windows again and again. It could be so easy, if there
was only a simple way to do it.

I'd even go a step further to simplify configuration like this:

  WindowShortcut Key F1, Action Choose-Window

This would automatically do the key bindings from the example above.
One could still use the Apply/Assign syntax for better configurability.
And I'd create a WindowShortcutFunction that is preloaded with
the Choose-Window function from the example but can be changed like
the InitFunction. With this, the example from above reduces to this:

  WindowShortcut Key F1
  WindowShortcut Key F2
  WindowShortcut Key F3
  WindowShortcut Key F4

  Next (rxvt) WindowShortcut Assign F1
  Next (rxvt) WindowShortcut Assign F2
  Next (XMessages) WindowShortcut Assign F3

This simply assumes that shortcuts are assigned with the shift
key pressed and called without any modifier pressed.

Bye

Dominik

---

From: Dominik Vogt <[email-masked]>
Date: Fri, 12 Mar 1999 19:25:34 +0100

> + I AddToFunc Apply1 I WindowID $0 \$0 \$1 \$2 \$3 ...
                                     ^^  ^^  ^^  ^^

'$$' is the right syntax.

> easier to get it working than creating new commands and state, it would

It does work, but as I said before, only very few people would think
of something like this. I will make a stab at implementing my version.

Bye

Dominik

--
Dominik Vogt, [email-masked]
Reply-To: [email-masked]

---

From: Dominik Vogt <[email-masked]>
Date: Sat, 13 Mar 1999 19:20:32 +0100

> easier to get it working than creating new commands and state, it would

I thought about this a bit and came up with some more ideas.
Why should you only bind shortcuts on the fly to windows?
There is no reason why you shouldn't be able to bind often
used menus, functions or applications:

To bind windows or menus:

  # current menu or window
  Shortcut Key F1, Action ...

  # current window
  Shortcut CurrentWindow, Key F1, Action ...

  # preload a window that matches options (like in 'Next')
  Shortcut Window (options), Key F1, Action ...

  # current menu
  Shortcut CurrentMenu, Key F1, Action ...

  # preload a named menu
  Shortcut Menu <name>, Key F1, Action ...

To bind the last application that was started with 'Exec'
(i.e. store/recall the last 'exec' command).

  Shortcut LastApplication, Key F1

To bind the last executed function:

  Shortcut LastFunction, Key F1

And not quite the same, but related:
Repeat the last (top level) function

  RepeatFunction

I really think this idea has great potential. Any ideas how
to improve this even more?

Bye

Dominik