Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Feb 2015 04:54:05 -0500
From:      Thomas Dickey <dickey@his.com>
To:        Matthias Apitz <guru@unixarea.de>, Thomas Dickey <dickey@his.com>, freebsd-questions@freebsd.org
Subject:   Re: key Shift+Prior not working for scroll-up in xterm but in urxvt
Message-ID:  <20150209095405.GA32691@aerie.jexium-island.net>
In-Reply-To: <20150206130348.GA2764@c720-r276659>
References:  <20150206081525.GA1828@c720-r276659> <20150206092525.GA3070@aerie.jexium-island.net> <20150206130348.GA2764@c720-r276659>

next in thread | previous in thread | raw e-mail | index | archive | help

--xHFwDpU9dbj6ez1V
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Feb 06, 2015 at 02:03:48PM +0100, Matthias Apitz wrote:
> El d=C3=ADa Friday, February 06, 2015 a las 04:25:25AM -0500, Thomas Dick=
ey escribi=C3=B3:
>=20
> > > I run this 11C on a small netbook (Acer C720) which does not have phy=
sical
> > > keys for PG_UP/DOWN; that's why I use xmodmap to define=20
> > >=20
> > > Mode_switch + UP --> Prior
> > > Mdee_switch + Down --> Next
> > >=20
> > > xmodmap -e "keycode 98  =3D  Up   Up   Prior"
> > > xmodmap -e "keycode 104 =3D  Down Down Next"
> > >=20
> > > When I now do in the terminal urxvt holding down both Mode_switch and
> > > Shift, it scrolls fine with the Up and Down keys as expected: the
> > > terminal window is scrolled up and down.
> > >=20
> > > When I do the same, the key is delivered to the xterm itself and I can
> > > see them, for example, with 'od -c' as:
> > >=20
> > > $ od -c
> > > ^[[5;2~^[[5;2~
> > > ^[[6;2~^[[6;2~
> > > 0000000  033   [   5   ;   2   ~ 033   [   5   ;   2   ~  \n 033   [ =
  6
> > > 0000020    ;   2   ~ 033   [   6   ;   2   ~  \n                     =
  =20
> > > 0000032
> > >=20
> > > The 033 [ 5 ; 2 ~ for Up and the 033 [ 6 ; 2 ~ for down.
> > >=20
> > > Why this does not work in xterm?
> >=20
> > That depends on what you want it to do (you did not say).
>=20
> I think, I said what I want: that with Mode_switch+Shift+Up/Down it does
> scrolling in xterm as it does in uRxvt.
>=20
> I followed your hints an tried configurations in the file
> ~/.Xdefaults-hostname:
>=20
> *VT100.translations: #override \
> 	Shift<Key>Up:		scroll-back(1,page) \n\
> 	Shift<Key>Down:		scroll-forw(1,page) \n\
> 	Shift<Key>F9: string("hola")
>=20
> (the last line for F9 is only to see if the file works at all).
>=20
> With the above config it now scrolls in xterm with Shift-Up/Down. But
> I'm unable to configure that it scrolls with Mode_switch+Shift+Up/Down
> and I want to have this to use the same key sequence in xterm and uRxvt
> and not always have to think where I am.
>=20
> Any idea? Thanks

not immediately: my keyboard does not have a mode_switch key
(unless I tinker with xmodmap...).

But here's a guess:

Xt's translations don't know about mode_switch as such, so a fix is
likely to be in xmodmap.  While xmodmap's manpage is vague about the
recognized modifiers, mentioning them by name only once:

       clear MODIFIERNAME
               This removes all entries in the modifier map for the given m=
od=E2=80=90
               ifier,  where valid name are: Shift, Lock, Control, Mod1, Mo=
d2,
               Mod3, Mod4, and Mod5 (case does not matter in  modifier  nam=
es,
               although  it  does  matter  for all other names).  For examp=
le,
               ``clear Lock'' will remove all any keys that were bound to  =
the
               shift lock modifier.

The source code for the xmodmap program does not have a table of these name=
s.
That is in the library.  The library defines this table:

	static ModifierRec modifiers[] =3D {
	    {"Shift",	0,	ParseModImmed,ShiftMask},
	    {"Lock",	0,	ParseModImmed,LockMask},
	    {"Ctrl",	0,	ParseModImmed,ControlMask},
	    {"Mod1",	0,	ParseModImmed,Mod1Mask},
	    {"Mod2",	0,	ParseModImmed,Mod2Mask},
	    {"Mod3",	0,	ParseModImmed,Mod3Mask},
	    {"Mod4",	0,	ParseModImmed,Mod4Mask},
	    {"Mod5",	0,	ParseModImmed,Mod5Mask},
	    {"Meta",	0,	ParseModSym,  XK_Meta_L},
	    {"m",       0,      ParseModSym,  XK_Meta_L},
	    {"h",       0,      ParseModSym,  XK_Hyper_L},
	    {"su",      0,      ParseModSym,  XK_Super_L},
	    {"a",       0,      ParseModSym,  XK_Alt_L},
	    {"Hyper",   0,      ParseModSym,  XK_Hyper_L},
	    {"Super",   0,      ParseModSym,  XK_Super_L},
	    {"Alt",     0,      ParseModSym,  XK_Alt_L},
	    {"Button1",	0,	ParseModImmed,Button1Mask},
	    {"Button2",	0,	ParseModImmed,Button2Mask},
	    {"Button3",	0,	ParseModImmed,Button3Mask},
	    {"Button4",	0,	ParseModImmed,Button4Mask},
	    {"Button5",	0,	ParseModImmed,Button5Mask},
	    {"c",	0,	ParseModImmed,ControlMask},
	    {"s",	0,	ParseModImmed,ShiftMask},
	    {"l",	0,	ParseModImmed,LockMask},
	};

and also in the library it treats the mode-switch specially (without naming
it):

InitialI.h:307:    Modifiers mode_switch;          /* keyboard group modifi=
ers */
TMkey.c:451:    pd->mode_switch =3D 0;
TMkey.c:464:            if ((keysym =3D=3D XK_Mode_switch) && (i > 2))
TMkey.c:465:            pd->mode_switch |=3D 1 << i;
TMkey.c:531:    *modifiers_return =3D (ShiftMask|LockMask) | pd->mode_switc=
h | pd->num_lock;
TMkey.c:541:    if ((per > 2) && (modifiers & pd->mode_switch)) {

So... I think that you could make this work by using xmodmap to assign
one of the mod1-mod5 modifier names to the mode-switch key, and using
that modifier in a translations resource binding for xterm.

--=20
Thomas E. Dickey <dickey@invisible-island.net>
http://invisible-island.net
ftp://invisible-island.net

--xHFwDpU9dbj6ez1V
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAlTYg70ACgkQcCNT4PfkjtsTSACg3PYoZzvq8ciKtHSCzapWyZYI
SsgAoK7t6xjKoIBwP0v0RsKbFNp6+cN0
=3dzR
-----END PGP SIGNATURE-----

--xHFwDpU9dbj6ez1V--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150209095405.GA32691>