Skip to content

Latest commit

 

History

History
707 lines (619 loc) · 28.6 KB

pana-cf-r5-usable.org

File metadata and controls

707 lines (619 loc) · 28.6 KB

trying to get a Panasonic CF-R5 up and running

control key

out of the box, emacs 24 says, when pressing the “CAPS LOCK” key

<eisu-toggle> is undefined

then, if i run

setxkbmap -option ctrl:swapcaps

CAPS LOCK key works as a control key. and, Ctrl key works as CAPS LOCK (which i don’t really like).

setxkbmap -option ctrl:nocaps

makes both CAPS LOCK and Ctrl work as control keys. that’s what we want!

more escapes

setxkbmap -option japan:hztg_escape

would be nice

win key

setxkbmap -I ./my-xkb/ -option altwin:alt_win

makes the win key an extra alt key

meta key

i want to use either Muhenkan or Windows key as meta key, both in shell and in Emacs.

in emacs, out of the box, hitting key to {left,right,second right,third right} of space bar says

<muhenkan> is undefined
<henkan> is undefined
<hiragana-katagana> is undefined
M-x (i.e., generates M-x)

also, seemingly out of the box, Alt works as Meta in emacs. maybe i should just use that? but, would be nice to have something on r.h.s. of keyboard as well. plus, on mbp, i`m used to using Command keys, which are immediately left and right of space bar.

awk '$1 != "#" { print $0; system("xmodmap -e \"" $0 "\"")}' revertxmodmap.txt
xmodmap -pm

here is a nice (emacs-centric) discussion of meta key issues. this discusses using xkb for doing this.

xkbcomp $DISPLAY ${fname}

what’s in /usr/share/X11/xkb/rules/base?

the xkb wikipedia page points at kosmulski, and also at charvolant, which seems very good. it includes these definitions

key codes
    A translation of the scan codes from the keyboard into a suitable symbolic form.

key symbols
    A translation of symbolic key codes into actual symbols, such as an A or an .

compatibility map
    A specification of what actions various special-purpose keys produce.

type
    A specification of what various shift combinations produce.

geometry
    A description of the physical layout of a keyboard. 

also, this statement

The basic modifier keys are all very well but it would be handy to be able to introduce a level of abstraction, so that you can talk about modifier keys by function, rather than by explicit key name. XKB allows the use of virtual modifier keys, where a basic modifier key (or combination) is mapped onto a named virtual modifier. Virtual modifiers can then be used to describe the behaviour of the keyboard, decoupling the exact physical capabilities of the keyboard you are using from the sort of characters that you want to type. The types and compat components are largely responsible for handling this side of things.

it points at /usr/include/X11/keysymdef.h, which includes lines like

#define XK_Muhenkan                      0xff22  /* Cancel Conversion */
#define XK_Henkan_Mode                   0xff23  /* Start/Stop Conversion */
#define XK_Henkan                        0xff23  /* Alias for Henkan_Mode */
#define XK_Hiragana_Katakana             0xff27  /* Hiragana/Katakana toggle */
#define XK_Alt_L                         0xffe9  /* Left alt */

and, in fact, pressing the Alt key on lhs of space bar produces Alt_L, 0xffe9.

running xev, looking at keys on bottom row, from Fn (which doesn’t appear to generate anything) to Ctrl_R, we get (looking only at KeyPress events):

KeyPress event, serial 29, synthetic NO, window 0x1c00001,
    root 0x7f, subw 0x0, time 14839081, (667,371), root:(668,372),
    state 0x0, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 32, synthetic NO, window 0x1c00001,
    root 0x7f, subw 0x0, time 14839956, (667,371), root:(668,372),
    state 0x0, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 32, synthetic NO, window 0x1c00001,
    root 0x7f, subw 0x0, time 14840771, (667,371), root:(668,372),
    state 0x0, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 32, synthetic NO, window 0x1c00001,
    root 0x7f, subw 0x0, time 14841571, (667,371), root:(668,372),
    state 0x0, keycode 102 (keysym 0xff22, Muhenkan), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 32, synthetic NO, window 0x1c00001,
    root 0x7f, subw 0x0, time 14842506, (667,371), root:(668,372),
    state 0x0, keycode 65 (keysym 0x20, space), same_screen YES,
    XLookupString gives 1 bytes: (20) " "
    XmbLookupString gives 1 bytes: (20) " "
    XFilterEvent returns: False

KeyPress event, serial 32, synthetic NO, window 0x1c00001,
    root 0x7f, subw 0x0, time 14843466, (667,371), root:(668,372),
    state 0x0, keycode 100 (keysym 0xff23, Henkan_Mode), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 32, synthetic NO, window 0x1c00001,
    root 0x7f, subw 0x0, time 14844215, (667,371), root:(668,372),
    state 0x0, keycode 101 (keysym 0xff27, Hiragana_Katakana), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 32, synthetic NO, window 0x1c00001,
    root 0x7f, subw 0x0, time 14845020, (667,371), root:(668,372),
    state 0x0, keycode 135 (keysym 0xff67, Menu), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 32, synthetic NO, window 0x1c00001,
    root 0x7f, subw 0x0, time 14845820, (667,371), root:(668,372),
    state 0x0, keycode 105 (keysym 0xffe4, Control_R), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

xorg is also useful.

/usr/share/X11/xkb/keycodes/evdev includes lines like

// Microsoft keyboard extra keys
<LWIN> = 133;
<COMP> = 135;
alias <MENU> = <COMP>;

// Keys that are generated on Japanese keyboards
<HKTG> = 101;   // Hiragana/Katakana toggle
<HENK> = 100;   // Henkan
<MUHE> = 102;   // Muhenkan
<AE13> = 132;   // Yen
<KATA> =  98;   // Katakana
<HIRA> =  99;   // Hiragana
<JPCM> = 103;   // KPJPComma
//<RO>   =  97; // Romaji

while file: /usr/share/X11/xkb/symbols/inet includes lines like

key <HKTG>   {      [ Hiragana_Katakana     ]       };
key <HENK>   {      [ Henkan                ]       };
key <MUHE>   {      [ Muhenkan              ]       };
key <KATA>   {      [ Katakana              ]       };
key <HIRA>   {      [ Hiragana              ]       };
key <RO>     {      [ Romaji                ]       };

(while file: /usr/share/X11/xkb/symbols/jp doesn’t include, e.g., <MUHE>.)

here’s where, e.g., Muhenkan is used

bash minshall-CF-R5KWPAXP: {316} find /usr/share/X11/xkb/ -type f -exec grep -Hi muhenkan \{\} \;
/usr/share/X11/xkb/keycodes/evdev:      <MUHE> = 102;   // Muhenkan
/usr/share/X11/xkb/keycodes/xfree86:    <NFER> =   131;         // Muhenkan
/usr/share/X11/xkb/geometry/hhk:// SW = 000 Layout with Muhenkan and Henkan keys
/usr/share/X11/xkb/geometry/hhk:// SW = 001 Layout with Muhenkan and Henkan keys swapped with Alt keys
/usr/share/X11/xkb/symbols/nec_vndr/jp:    key <NFER> { [ Muhenkan              ]       };
/usr/share/X11/xkb/symbols/jp:    key <NFER> { [ Muhenkan               ] };
/usr/share/X11/xkb/symbols/jp:    key <NFER> { [ Muhenkan               ]       };
/usr/share/X11/xkb/symbols/inet:    key <MUHE>   {      [ Muhenkan              ]       };
/usr/share/X11/xkb/symbols/fujitsu_vndr/jp:         key <UNK7> { [ Muhenkan     ]       };
/usr/share/X11/xkb/symbols/sgi_vndr/jp:    key <NFER> {         [        Muhenkan ] };
bash minshall-CF-R5KWPAXP: {317} 

so, keycodes gives the hardware code, and symbols maps that to a function. s.th. like that.

here’s a more complete “transitive closure” grep

find /usr/share/X11/xkb/ -type f -exec egrep -Hi 'henkan|nfer|muhe|hiragana_katakana|hktg|henk' \{\} \;
/usr/share/X11/xkb/keycodes/digital_vndr/lk:// LK421-JJ = lk421aj+MUHE+KANJ+HIRA
/usr/share/X11/xkb/keycodes/digital_vndr/lk:// LK401-BJ = lk401  +MUHE+KANJ+HIRA
/usr/share/X11/xkb/keycodes/digital_vndr/lk:    <MUHE>  = 94;
/usr/share/X11/xkb/keycodes/digital_vndr/lk:    <MUHE>  = 94;
/usr/share/X11/xkb/keycodes/digital_vndr/pc:// PCXAJ-AA = pc+BKSL+AC12+AB11+MUHE+KANJ+HIRA+indicator
/usr/share/X11/xkb/keycodes/digital_vndr/pc:// LK411-AJ = lk411+MUHE+KANJ+HIRA
/usr/share/X11/xkb/keycodes/digital_vndr/pc:// LK411-JJ = lk411+BKSL+AZ01+MUHE+KANJ+HIRA
/usr/share/X11/xkb/keycodes/digital_vndr/pc:    <MUHE>  = 133;
/usr/share/X11/xkb/keycodes/digital_vndr/pc:    <MUHE>  = 133;
/usr/share/X11/xkb/keycodes/evdev:	<HKTG> = 101;	// Hiragana/Katakana toggle
/usr/share/X11/xkb/keycodes/evdev:	<HENK> = 100;	// Henkan
/usr/share/X11/xkb/keycodes/evdev:	<MUHE> = 102;	// Muhenkan
/usr/share/X11/xkb/keycodes/xfree98:    <NFER> =  89;
/usr/share/X11/xkb/keycodes/sun:    <HENK> = 124;
/usr/share/X11/xkb/keycodes/sun:    alias <EXEC> = <NFER>;  // 131
/usr/share/X11/xkb/keycodes/sun:    alias <HENK> = <HKTG>;  // 208
/usr/share/X11/xkb/keycodes/sgi_vndr/indy:    <NFER> = 141;
/usr/share/X11/xkb/keycodes/sgi_vndr/indy:    <HKTG> = 143;
/usr/share/X11/xkb/keycodes/xfree86:    <HKTG> =   208;		// Hiragana_Katakana toggle
/usr/share/X11/xkb/keycodes/xfree86:    <XFER> =   129;		// Henkan
/usr/share/X11/xkb/keycodes/xfree86:    <NFER> =   131;		// Muhenkan
/usr/share/X11/xkb/keycodes/xfree86:    alias <I03> = <NFER>;
/usr/share/X11/xkb/keycodes/xfree86:    alias <K70> = <HKTG>;	// <I50>
/usr/share/X11/xkb/geometry/digital_vndr/lk:		    { <MUHE>, "LONG" },
/usr/share/X11/xkb/geometry/digital_vndr/pc:		    { <MUHE>, "NORM" }, 
/usr/share/X11/xkb/geometry/digital_vndr/unix:		    { <MUHE>, "LONG" },
/usr/share/X11/xkb/geometry/nec:	    keys { { <ALGR>, 35 } , <LALT>, { <NFER>, "FUNC" },
/usr/share/X11/xkb/geometry/typematrix:// – WWW key becomes <HKTG>
/usr/share/X11/xkb/geometry/typematrix:// NFER/MEHU and XFER/KANJ: TMx keeps LWIN (and RWIN if it happens to exist).
/usr/share/X11/xkb/geometry/typematrix:// HKTG/HIRA: TMx keeps MENU/COMP, but locates this key in alpha section (see above).
/usr/share/X11/xkb/geometry/typematrix:            keys { <HKTG> };
/usr/share/X11/xkb/geometry/pc:	    keys { <LCTL>, { <LALT>, 20 },<NFER>,
/usr/share/X11/xkb/geometry/pc:		   <XFER>,<HKTG>,<RALT>, { <RCTL>, 17 }
/usr/share/X11/xkb/geometry/sun:		 { <SPCE>, "SPCE" }, { <KANJ>, "KANJ" }, <HENK>,
/usr/share/X11/xkb/geometry/hhk:// SW = 000 Layout with Muhenkan and Henkan keys
/usr/share/X11/xkb/geometry/hhk:				{ <NFER>, "DIAM" },
/usr/share/X11/xkb/geometry/hhk:// SW = 001 Layout with Muhenkan and Henkan keys swapped with Alt keys
/usr/share/X11/xkb/geometry/hhk:				<NFER>,
/usr/share/X11/xkb/geometry/hhk:// SW = 010 Layout with Henkan key and left-diamond as Fn
/usr/share/X11/xkb/geometry/hhk:// SW = 001 Layout with Henkan key swapped with Alt keys and left-Alt as Fn
/usr/share/X11/xkb/geometry/sgi_vndr/O2:	    keys { <LCTL>, { <LALT>, 20 },<NFER>,
/usr/share/X11/xkb/geometry/sgi_vndr/O2:		   <XFER>,<HKTG>,<RALT>, { <RCTL>, 17 }
/usr/share/X11/xkb/geometry/sgi_vndr/indy:	    keys { <LCTL>, { <LALT>, 20 },<NFER>,
/usr/share/X11/xkb/geometry/sgi_vndr/indy:		   <XFER>,<HKTG>,<RALT>, { <RCTL>, 17 }
/usr/share/X11/xkb/geometry/sanwa:                   <LWIN>, <LALT>, <NFER>, {<SPCE>, "SPCE" }, <XFER>, <HKTG>,
/usr/share/X11/xkb/symbols/nec_vndr/jp:    key <NFER> { [ Muhenkan		]	};
/usr/share/X11/xkb/symbols/nec_vndr/jp:    key <XFER> { [ Henkan, Kanji	]	};
/usr/share/X11/xkb/symbols/sun_vndr/jp:    key <HENK> { [ Henkan_Mode		        ]	};
/usr/share/X11/xkb/symbols/sun_vndr/jp:    key <TLDE> { [ Henkan_Mode                          ]   };
/usr/share/X11/xkb/symbols/sun_vndr/jp:    key <HENK> { [ Kana_Lock, Mode_switch               ]   };
/usr/share/X11/xkb/symbols/sun_vndr/tw:    key <ALGR> { [ Henkan_Mode          ]                       };
/usr/share/X11/xkb/symbols/kpdl:// when entering data by the keyboard; the comma can then be inferred
/usr/share/X11/xkb/symbols/jp:    key <NFER> { [ Muhenkan		] };
/usr/share/X11/xkb/symbols/jp:	symbols[Group1]= [ Henkan, Mode_switch ]
/usr/share/X11/xkb/symbols/jp:    key <HKTG> {
/usr/share/X11/xkb/symbols/jp:	symbols[Group1]= [ Hiragana_Katakana, Romaji ]
/usr/share/X11/xkb/symbols/jp:	symbols[Group1]= [ Hiragana_Katakana ]
/usr/share/X11/xkb/symbols/jp:    key <NFER> { [ Muhenkan		]	};
/usr/share/X11/xkb/symbols/jp:	symbols[Group1]= [ Henkan, Mode_switch ]
/usr/share/X11/xkb/symbols/jp:    key <HKTG> {
/usr/share/X11/xkb/symbols/jp:	symbols[Group1]= [ Hiragana_Katakana, Romaji ]
/usr/share/X11/xkb/symbols/inet:    key <HKTG>   {      [ Hiragana_Katakana     ]       };
/usr/share/X11/xkb/symbols/inet:    key <HENK>   {      [ Henkan                ]       };
/usr/share/X11/xkb/symbols/inet:    key <MUHE>   {      [ Muhenkan              ]       };
/usr/share/X11/xkb/symbols/inet:    key <NFER>  {       [ XF86AudioPrev         ]       };
/usr/share/X11/xkb/symbols/inet:    key <HKTG> {         [     XF86Launch7 ] };
/usr/share/X11/xkb/symbols/inet:    key <NFER> {         [     XF86Launch2 ] };
/usr/share/X11/xkb/symbols/inet:    key <NFER>	{	[ XF86Launch2		]	};
/usr/share/X11/xkb/symbols/inet:    key <NFER>	{	[ XF86Launch2		]	};
/usr/share/X11/xkb/symbols/fujitsu_vndr/jp:	    key <UNK7> { [ Muhenkan	]	};
/usr/share/X11/xkb/symbols/fujitsu_vndr/jp:	    key <UNK8> { [ Henkan	]	};
/usr/share/X11/xkb/symbols/sgi_vndr/jp:    key <NFER> {         [        Muhenkan ] };
/usr/share/X11/xkb/symbols/sgi_vndr/jp:    key <HKTG> {         [ Hiragana_Katakana ] };
/usr/share/X11/xkb/symbols/macintosh_vndr/jp:    replace key <HJCV> { [ Hiragana_Katakana ] };

now

bash minshall-CF-R5KWPAXP: {318} grep -w meta_win /usr/share/X11/xkb/rules/base
  altwin:meta_win       =       +altwin(meta_win)

and, in /usr/share/X11/xkb/symbols/altwin

partial modifier_keys 
xkb_symbols "meta_win" {
    key <LALT> { [ Alt_L, Alt_L ] };
    key <RALT> { type[Group1] = "TWO_LEVEL",
                 symbols[Group1] = [ Alt_R, Alt_R ] };
    key <LWIN> { [ Meta_L ] };
    key <RWIN> { [ Meta_R ] };
    modifier_map Mod1 { Alt_L, Alt_R };
    modifier_map Mod4 { <META>, Meta_L, Meta_R };
};

so, that appears to be the binding between rules/ and other things?

e.g., in /usr/share/X11/xkb/symbols/ctrl, we have

// Eliminate CapsLock, making it another Ctrl.
partial modifier_keys 
xkb_symbols "nocaps" {
    replace key <CAPS>  { [ Control_L, Control_L ] };
    modifier_map  Control { <CAPS>, <LCTL> };
};

corresponding, presumably, to

ctrl:nocaps           =       +ctrl(nocaps)

in /usr/share/X11/xkb/rules/base.

interpret Meta_L    {
    action = SetMods(modifiers=Meta);
};

in /usr/share/X11/xkb/compat/misc. maybe we need something like this for Muhenkan, etc.? i guess question is, where to do the mapping. could be in symbols/inet directory (map to Meta_L, Meta_R) or in compat (map Muhenkan to Meta).

according to xev(1), on mbp, (the left versions of) control and caps lock generate Control_L; option generates Mode_switch; and command generates Meta_L. (and, like on panasonic, fn doesn’t generate anything.)

maybe, given rules/symbols mapping above, we should make something in symbols like japanmeta, which has xkb_symbols “japanmeta” { … }, then invoke from rules/base. something like:

// Eliminate CapsLock, making it another Ctrl.
partial modifier_keys 
xkb_symbols "nocaps" {
    replace key <CAPS>  { [ Control_L, Control_L ] };
    modifier_map  Control { <CAPS>, <LCTL> };
};

i guess xev(1) doesn’t map through Alt_L to Alt.

setxkbmap(1) has a -Idirectory directive to add directories for rules, [etc.?]. that may be key.

setxkbma(1) is annoying in that it doesn’t seem to report errors when options aren’t found, etc.

here’s our try at some files. turns out XkbRF_Load(3), that setxkbmap uses, needs to have rules/foo.lst, if one specifies -rules foo.

mkdir my-xkb
mkdir my-xkb/rules
mkdir my-xkb/symbols
cat > my-xkb/rules/my-evdev <<EOF
! option			=	symbols
  japan:muhenkan_meta		=	+my-jp(muhenkan_meta)
  japan:henkan_meta		=	+my-jp(henkan_meta)
  japan:hiragana-katakana_alt	=	+my-jp(hiragana-katakana_alt)
EOF
cat > my-xkb/rules/my-evdev.lst <<EOF
! option
japan:muhenkan_meta		Muhenkan as Meta_L
japan:henkan_meta		Henkan as Meta_R
japan:hiragana_katakana_alt	Hiragana-Katakana as Alt_R
EOF
cat > my-xkb/symbols/my-jp <<EOF
// Make the Muhenkan key a left Meta.
partial modifier_keys
xkb_symbols "muhenkan_meta" {
    replace key <MUHE>	{ [ Meta_L ] };
};

// Make the Muhenkan key a right Meta.
partial modifier_keys
xkb_symbols "henkan_meta" {
    replace key <HENK>	{ [ Meta_R ] };
};

// Make the Hiragana-Katakana key a right Alt.
partial modifier_keys
xkb_symbols "hiragana-katakana_alt" {
    replace key <HKTG>	{ [ Alt_R ] };
};
EOF

hard getting this to work. if i

setxkbmap $DISPLAY
<edit>
setxkbmap server-0.xkb
setxkbmap server-0.xkm

then emacs (but not bash!) works.

the <edit> bit is as

bash minshall-CF-R5KWPAXP: {877} diff -cb server-0.xkb works.xkb 
*** server-0.xkb        2016-01-27 16:21:39.928866288 +0200
--- works.xkb   2016-01-27 16:14:43.362510720 +0200
***************
*** 1321,1332 ****
      key <AB11> {         [       backslash,      underscore ] };
      key <KATA> {         [        Katakana ] };
      key <HIRA> {         [        Hiragana ] };
!     key <HENK> {         [     Henkan_Mode ] };
!     key <HKTG> {
!         type= "PC_ALT_LEVEL2",
!         symbols[Group1]= [ Hiragana_Katakana,          Romaji ]
!     };
!     key <MUHE> {         [        Muhenkan ] };
      key <KPEN> {         [        KP_Enter ] };
      key <RCTL> {         [       Control_R ] };
      key <KPDV> {
--- 1321,1329 ----
      key <AB11> {         [       backslash,      underscore ] };
      key <KATA> {         [        Katakana ] };
      key <HIRA> {         [        Hiragana ] };
!     key <HENK> {         [     Meta_R ] };
!     key <HKTG> {         [     Alt_R ] };
!     key <MUHE> {         [        Meta_L ] };
      key <KPEN> {         [        KP_Enter ] };
      key <RCTL> {         [       Control_R ] };
      key <KPDV> {
bash minshall-CF-R5KWPAXP: {878} 

so, sadly, it turns out one needs to point setxkbmap at an entire e.g., rules file.

bash minshall-CF-R5KWPAXP: {600} setxkbmap -I ./my-xkb/ -rules their-evdev -option "" -option ctrl:nocaps -option japan:henkan_meta -v 10
Setting verbose level to 10
locale is C
Warning! Multiple definitions of rules file
         Using command line, ignoring X server
Trying to load rules file ./rules/their-evdev...
Trying to load rules file /usr/share/X11/xkb/rules/their-evdev...
Trying to load rules file ./my-xkb//rules/their-evdev...
Success.
Applied rules from their-evdev:
rules:      their-evdev
model:      pc105
layout:     jp
options:    ctrl:nocaps,japan:henkan_meta
Trying to build keymap using the following components:
keycodes:   evdev+aliases(qwerty)
types:      complete
compat:     complete+japan
symbols:    pc+jp+inet(evdev)+ctrl(nocaps)+my-jp(henkan_meta)
geometry:   pc(pc105)
Error loading new keyboard description
bash minshall-CF-R5KWPAXP: {601} 

so, maybe copy evdev over, rename it, append our changes (above)? no, that doesn’t appear to work – maybe one needs all the files in the same place? no, tar everything over, ‘their-evdev’ still generates an error. file name appears somewhere else? no, turned out we were finally processing japan:henkan_meta, and that i guess was failing?

yes. if i put in ‘-option henkan_foo’, it’s silently ignored. however, ‘-option henkan_meta’ fails. maybe their can’t be two option sections in rules file? try hand editing. nope, that’s not the problem.

hmm, even if i get rid of that rule in the symbols file, i get the same error. is it the - in the file name? no, got rid of that, still same problem.

turns out setxkbmap is telling the server to use our macro, but the server has never seen it. so, need to “chain” with xkbcomp(1) (see man page for setxkbmap).

setxkbmap -I ./my-xkb/ -rules their-evdev -option "" -option ctrl:nocaps -option japan:henkan_meta -print | xkbcomp -I./my-xkb/ -

works. so does

setxkbmap -I ./my-xkb/ -rules their-evdev -option "" -option ctrl:nocaps -option japan:henkan_meta -option japan:muhenkan_meta -print | xkbcomp -I./my-xkb/ - $DISPLAY 2>&1 | less

hiragana-katakana <HKTG>

but, currently, hiragana-katakana_alt doesn’t work. it’s defined as some sort of “group” shift character in the normal flow of things. setxkbmap seems happy enough with it, but xkbcomp doesn’t do much with it.

setxkbmap -I ./my-xkb/ -rules their-evdev -option japan:hiragana-katakana_alt -print | xkbcomp -I./my-xkb -xkb -w 10 - 2>&1 | less

gives lines including

Warning:          Symbol map for key <HKTG> redefined
                  Using last definition for conflicting fields
Warning:          Multiple symbols for level 1/group 1 on key <CAPS>
                  Using Control_L, ignoring Eisu_toggle
Warning:          Multiple symbols for level 2/group 1 on key <CAPS>
                  Using Control_L, ignoring Caps_Lock
Warning:          Symbol map for key <CAPS> redefined
                  Using last definition for conflicting fields
Warning:          Multiple symbols for level 1/group 1 on key <MUHE>
                  Using Meta_L, ignoring Muhenkan
Warning:          Symbol map for key <MUHE> redefined
                  Using last definition for conflicting fields
Warning:          Multiple symbols for level 1/group 1 on key <HENK>
                  Using Meta_R, ignoring Henkan_Mode
Warning:          Symbol map for key <HENK> redefined
                  Using last definition for conflicting fields
Warning:          Multiple symbols for level 1/group 1 on key <HKTG>
                  Using Alt_R, ignoring Hiragana_Katakana
Warning:          Symbol map for key <HKTG> redefined
                  Using last definition for conflicting fields

and, out of that, <HENK> and <MUHE> work, while <HKTG> doesn’t. well, maybe. this works:

setxkbmap -I ./my-xkb/ -rules their-evdev -option "" -option ctrl:nocaps -option japan:henkan_meta -option japan:muhenkan_meta -option japan:hiragana-katakana_alt -print | xkbcomp -I./my-xkb/ -w 10 - $DISPLAY 2>&1 | less

bash

also, Alt does not work for the shell. on mbp, i have ~/.Xresources, with a line

Xterm*metaSendsEscape: true

which may be the reason? well, if i ever get meta working, we’ll see!

well, seems to work with lxterminal, but not xterm.

if i set metaSendsEscape (using C-down-mouse-1), it works.

if i run “xterm -class Xterm”, a) the screen goes black-on-white (rather than white-on-black), and b) meta-esc is i) displayed, and ii) works. the a) behavior seems to be talked about in the man page

foreground (class Foreground)
        Specifies  the  color  to  use  for  displaying text in the window.  Setting the class name instead of the
        instance name is an easy way to have everything that would normally appear in the text color change color.
        The default is “XtDefaultForeground”.

xprop(1) seems to say that xterm’s normal class is xterm, XTerm.

WM_CLASS(STRING) = "xterm", "XTerm"

oops. i was setting Xterm*metaSendsEscape, rather than XTerm*metaSendsEscape. change

XTerm*metaSendsEscape: true

sigh. now works.

ratpoison launches lxterminal, not xterm

ratpoison ‘C-t c’ is bound to ‘exec x-terminal-emulator’, which is a symbolic link to /etc/alternatives/x-terminal-emulator, which is itself a symbolic link to /usr/bin/lxterminal. apparently, update-alternatives(8) is the way this mechanism is managed.

sudo update-alternatives --config x-terminal-emulator

allowed me to change to have xterm be the primary. (at the expense of losing the ability to use keys to copy/paste.)

xterm copy/paste

according to the xterm(1) man page, the following might allow us to use C-S-c for copy, C-S-v for paste:

! make M-b, et al., work
XTerm*metaSendsEscape: true
! in xterm (and friends), make C-S-c copy, and C-S-v paste
*VT100*translations:    #override \n\
    Shift Ctrl <KeyPress> c: copy-selection(PRIMARY, CLIPBOARD) \n\
    Shift Ctrl <KeyPress> v: insert-selection(PRIMARY, CLIPBOARD)

seems to work.

del key

i’d like, at least in emacs, for the DEL key to act as Backspace.

the xmodmap(1) manpage says that

xmodmap -e "keysym BackSpace = Delete"

should do the trick. almost (read the manual wrong?). this does it:

xmodmap -e "keysym Delete = BackSpace"

track pad

the track pad, when “tapped”, generates a mouse event, which is annoying

ButtonPress event, serial 32, synthetic NO, window 0x1c00001,
    root 0x7f, subw 0x0, time 25837517, (54,446), root:(55,447),
    state 0x0, button 1, same_screen YES

ButtonRelease event, serial 32, synthetic NO, window 0x1c00001,
    root 0x7f, subw 0x0, time 25837618, (54,446), root:(55,447),
    state 0x100, button 1, same_screen YES

(from xev(1)).

maybe comes from

interpret Pointer_Button_Dflt+AnyOfOrNone(all) {
    action= PtrBtn(button=default);
};

in output from xkbcome $DISPLAY, or, more originally?, from

   interpret Pointer_Button_Dflt {
	action= PointerButton(button=default);
   };

et al., in /usr/share/X11/xkb/compat/mousekeys.

oof. maybe need to modify some xorg.conf file?

or, if synaptics client, use something like:

synclient TapButton1=0

does the trick! (see “man 4 synaptics”.)

click to activate

as distributed, focus is by mouse. it would be nice to have “click to activate”

ls sorts .x near x

something to do with locale.

emacs keys for firefox

some firefox shortcuts.

and, here’s the answer for emacs/readline bindings.

put this is ~/.gtkrc-2.0

gtk-key-theme-name = "Emacs"

packages for development

this ubuntu page documents some of the main packages to start developing. here is listing of packages (for “trusty”, which i think is the release we’re running).

make vertical scrolling [modern] Mac-like

see synaptics(4).

synclient VertScrollDelta=-`synclient | grep VertScrollDelta | awk '{print $3}'`

that does it.

% sudo dmidecode -s system-product-name
CF-R5KWPAXP