Re: key macros

2002-06-05 Thread darren chamberlain

* David T-G [EMAIL PROTECTED] [2002-06-04 13:17]:
 It looks like that's the case for Ctl, anyway, and maybe for Shf.
 Given, thanks to my new friend Bob, the handy
 
   perl -lpe '$_ = join  , unpack(c*, $_)'
 
 to take input per line and spit out key codes and then running
 
   echo ctl-v f1 | ...
   echo ctl-v shf-f1 | ...
   echo ctl-v ctl-ft | ...
 
 we get
 
   27 79 80
   27 91 50 51 126
   27 79 80
 
 (where F1 and Ctl-F1 appear as '^[OP' and Shf-F1 is '^[[23~'), so
 there is no difference whatsoever between F1 and C-F1, while S-F1
 might be tricky to recognize because it's longer (and, in fact, the
 same as F11, as Kurt showed).

I get: 

  $ echo ctrl-v f1 | perl -lpe '$_ = join  , unpack(c*, $_)'
  27 79 80
  $ echo ctrl-v ctrl-F1 | perl -lpe '$_ = join  , unpack(c*, $_)'
  27 79 53 80

I'm using a happy hacking keyboard, which might make a difference, but I
doubt it.

(darren)

-- 
People who are willing to give up freedom for the sake of short term
security, deserve neither freedom nor security.
-- Ben Franklin



Re: key macros

2002-06-05 Thread Thomas E. Dickey

On Wed, 5 Jun 2002, darren chamberlain wrote:

 I get:

   $ echo ctrl-v f1 | perl -lpe '$_ = join  , unpack(c*, $_)'
   27 79 80
   $ echo ctrl-v ctrl-F1 | perl -lpe '$_ = join  , unpack(c*, $_)'
   27 79 53 80

 I'm using a happy hacking keyboard, which might make a difference, but I
 doubt it.

esc [ 5 P is XFree86 xterm PC-style control/F1, documented in
ctlseqs.ms, e.g.,

In normal mode, i.e., a Sun/PC keyboard when the sunKeyboard resource is
false, xterm recognizes function key modifiers which are parameters
appended before the final character of the control sequence.

  Code Modifiers
-
   2   Shift
   3   Alt
   4   Shift + Alt
   5   Control
   6   Shift + Control
   7   Alt + Control
   8   Shift + Alt + Control

For example, shift-F5 would be sent as CSI 1 5 ; 2 ~


-- 
T.E.Dickey [EMAIL PROTECTED]
http://invisible-island.net
ftp://invisible-island.net




Re: key macros

2002-06-04 Thread David T-G

Kurt --

...and then Kurt Hindenburg said...
% 
% This works 
% macro index f2 change-folder~/Mail/mutt\n
% 
% Let's say I want to use Ctrl F2 or Shift F2.  I could not find 
% anything in the manual.  I did see ESC, but nothing for the Shift
% nor Ctrl keys.

That's an interesting one.  For control you can probably use

  \cF2

in the typical ctrl- notation (well, typical for mutt, anyway, though
I've seen it elsewhere).  I suppose you'll have to whip out your term
program to see what keycode shft-F2 generates and work from there, but
perhaps someone can come along and provide a better idea.


HTH  HAND

:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg28582/pgp0.pgp
Description: PGP signature


Re: key macros

2002-06-04 Thread Rocco Rutte

Hi,

* David T-G [2002-06-04 17:50:33 CEST] wrote:
 ...and then Kurt Hindenburg said...

 % This works 
 % macro index f2 change-folder~/Mail/mutt\n
 % 
 % Let's say I want to use Ctrl F2 or Shift F2.  I could not find 
 % anything in the manual.  I did see ESC, but nothing for the Shift
 % nor Ctrl keys.

 That's an interesting one.

Indeed.

 For control you can probably use

   \cF2

Tried it? Doesn't work (here).

Cheers, Rocco



Re: key macros

2002-06-04 Thread Kurt Hindenburg

* Rocco Rutte [EMAIL PROTECTED] [2002-06-04 11:32]:
 Hi,
 
 * David T-G [2002-06-04 17:50:33 CEST] wrote:
  ...and then Kurt Hindenburg said...
 
  % This works 
  % macro index f2 change-folder~/Mail/mutt\n
  % 
  % Let's say I want to use Ctrl F2 or Shift F2.  I could not find 
  % anything in the manual.  I did see ESC, but nothing for the Shift
  % nor Ctrl keys.
 
  That's an interesting one.
 
 Indeed.
 
  For control you can probably use
 
\cF2
 
 Tried it? Doesn't work (here).

Same here, I get 'key is not bound'.  Which makes you think it is
possible.
I noticed that on my keyboard that f11 == pressing Shift + F1,
f12 == Shift + F2, etc...





Re: key macros

2002-06-04 Thread David T-G

Rocco, et al --

...and then Rocco Rutte said...
% 
% Hi,

Hello!


% 
% * David T-G [2002-06-04 17:50:33 CEST] wrote:
%  ...and then Kurt Hindenburg said...
% 
...
%  % Let's say I want to use Ctrl F2 or Shift F2.  I could not find 
...
%  For control you can probably use
% 
%\cF2
% 
% Tried it? Doesn't work (here).

Darn.  Back to the key codes, I guess.

There's a handy utility that spits out the keycodes it gets, though I'm
sure the equivalent could be whipped in perl as a one-liner.  Anybody
recall it?


% 
% Cheers, Rocco


HTH  HAND

:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg28585/pgp0.pgp
Description: PGP signature


Re: key macros

2002-06-04 Thread Michael Elkins

Kurt Hindenburg wrote:
 Let's say I want to use Ctrl F2 or Shift F2.  I could not find 
 anything in the manual.  I did see ESC, but nothing for the Shift
 nor Ctrl keys.

There is no way (that I know of, and I'm sure Thomas Dickey will correct
me here if I'm wrong) to use control or shift with function keys.



Re: key macros

2002-06-04 Thread David Champion

* On 2002.06.04, in [EMAIL PROTECTED],
*   David T-G [EMAIL PROTECTED] wrote:
 
 There's a handy utility that spits out the keycodes it gets, though I'm
 sure the equivalent could be whipped in perl as a one-liner.  Anybody
 recall it?

You might be thinking of dumpkeys, but it's a Linux thing. Anyway,
keycodes are keyboard event numbers, and they don't necessarily
correspond to ASCII key sequences that the terminal emulation can
respond to. There are no particular control-function or shift-function
codes that I'm aware of.

OTOH, depending on your OS, you could remap those input events via
the keyboard driver and keymap settings to send some other terminal
sequence, so that, for example, control-f1 delivers an ESC-O + ESC-D, or
some such complexity. That could be remapped inside mutt.

-- 
 -D.[EMAIL PROTECTED]NSITUniversity of Chicago



Re: key macros

2002-06-04 Thread David T-G

Michael, et al --

...and then Michael Elkins said...
% 
% Kurt Hindenburg wrote:
%  Let's say I want to use Ctrl F2 or Shift F2.  I could not find 
%  anything in the manual.  I did see ESC, but nothing for the Shift
%  nor Ctrl keys.
% 
% There is no way (that I know of, and I'm sure Thomas Dickey will correct
% me here if I'm wrong) to use control or shift with function keys.

It looks like that's the case for Ctl, anyway, and maybe for Shf.
Given, thanks to my new friend Bob, the handy

  perl -lpe '$_ = join  , unpack(c*, $_)'

to take input per line and spit out key codes and then running

  echo ctl-v f1 | ...
  echo ctl-v shf-f1 | ...
  echo ctl-v ctl-ft | ...

we get

  27 79 80
  27 91 50 51 126
  27 79 80

(where F1 and Ctl-F1 appear as '^[OP' and Shf-F1 is '^[[23~'), so there
is no difference whatsoever between F1 and C-F1, while S-F1 might be
tricky to recognize because it's longer (and, in fact, the same as F11,
as Kurt showed).

Hmmm...  The keyboard stops at F12, but Shf-F3 carries on in the same
fashion.  Perhaps one could use the shifted keys as long as one expects
to only go 1-10 and for 1112 to be mapped back over to the other side...

Anyway, I've forgotten how to (if you can!) define macros by key code,
but perhaps a macro rather than a binding would do the trick.


HTH  HAND

:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg28591/pgp0.pgp
Description: PGP signature


Re: key macros - dumpkeys + showkey

2002-06-04 Thread Sven Guckes

* David Thorburn-Gundlach [EMAIL PROTECTED] [2002-06-04]:
 It looks like that's the case for Ctl, anyway, and maybe for Shf.
 Given, thanks to my new friend Bob, the handy
   perl -lpe '$_ = join  , unpack(c*, $_)'
 to take input per line and spit out key codes and then running

kewl.  talk about killing a sparrow with perl..

man dumpkeys
man showkey

and even if you'll get xmodmap to do something for
pressing Extended-Meta-Alternate-Control-Shift -
forget all about it when using mutt (or whataever)
within a terminal over some connection.

Sven  [always using ASCII - because it *works*]



Re: key macros - dumpkeys + showkey

2002-06-04 Thread David T-G

Sven, et al --

...and then Sven Guckes said...
% 
% * David Thorburn-Gundlach [EMAIL PROTECTED] [2002-06-04]:
%  It looks like that's the case for Ctl, anyway, and maybe for Shf.
%  Given, thanks to my new friend Bob, the handy
%perl -lpe '$_ = join  , unpack(c*, $_)'
%  to take input per line and spit out key codes and then running
% 
% kewl.  talk about killing a sparrow with perl..

Hey, if it works...


% 
% man dumpkeys
% man showkey

The former was pointed out to me earlier, and I'm grateful for the pointer
to the latter, though I had seen it but couldn't use it.  I tried looking
a bit for these sorts of things earlier and got something much like

  [zero] [3:19pm] ~  man -k key | grep code
  keybound (3ncurses)  - return definition of keycode ..
  showkey (1)  - examine the codes sent by the keyboard
  define_key (3ncurses) - define a keycode ..
  getkeycodes (8)  - print kernel scancode-to-keycode mapping table
  keyok (3ncurses) - enable or disable a keycode ..
  setkeycodes (8)  - load kernel scancode-to-keycode mapping table entries

but trying something that looked promising yielded

  [zero] [3:19pm] ~  showkey
  Couldnt get a file descriptor referring to the console

and so I didn't really bother to pursue it much more.  After all, I'm not
the one who's trying to bind shifted function keys.


% 
% and even if you'll get xmodmap to do something for

Well, that sort of assumes you're running under X, now, doesn't it?


% pressing Extended-Meta-Alternate-Control-Shift -
% forget all about it when using mutt (or whataever)
% within a terminal over some connection.
% 
% Sven  [always using ASCII - because it *works*]

It sure does!


Thanks  HAND

:-D the only true ELQ
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg28602/pgp0.pgp
Description: PGP signature


Re: key macros - dumpkeys + showkey

2002-06-04 Thread Sven Guckes

* DavidThorburn-Gundlach [EMAIL PROTECTED] [2002-06-04 20:23]:
 %perl -lpe '$_ = join  , unpack(c*, $_)'
 % kewl.  talk about killing a sparrow with perl..
 Hey, if it works...

overkill.

   [zero] [3:19pm] ~  man -k key | grep code

some people will know man -k as apropos..

 but trying something that looked promising yielded
   [zero] [3:19pm] ~  showkey
   Couldnt get a file descriptor referring to the console

well, you need to use it on the console, i guess.

 and so I didn't really bother to pursue it much more. After
 all, I'm not the one who's trying to bind shifted function keys.

 % and even if you'll get xmodmap to do something for
 Well, that sort of assumes you're running under X, now, doesn't it?

sort of.  it was just an example.

 Thanks  HAND
 
 :-D the only true ELQ

that reminds me to update my display_filter...

Sven