LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-21-2018, 07:19 AM   #1
jakfish
Member
 
Registered: Aug 2016
Posts: 52

Rep: Reputation: Disabled
Need Help Remapping Right Alt Key in Mate 18.3/GPD Pocket


In /usr/share/X11/xkb/symbols/pc, I've successfully remapped several keys on the keyboard of my GPD Pocket. But I'm lost at how to remap the right alt key into a Delete key. For now, my workaround is to use the deprecated xmodmap in this startup script:

xmodmap -e "remove mod1 = Alt_R"
xmodmap -e "keycode 108 = Delete"

Which works, but I would like the remapping to be in /usr/share/X11/xkb/symbols/pc. Here is the pc file--can anyone advise where-and-what I would change to make the right alt key function as a repeating delete key?

default partial alphanumeric_keys modifier_keys
xkb_symbols "pc105" {

key <ESC> { [ Escape ] };

// The extra key on many European keyboards:
key <LSGT> { [ less, greater, bar, brokenbar ] };

// The following keys are common to all layouts.
key <BKSL> { [ backslash, bar ] };
key <SPCE> { [ space ] };

include "srvr_ctrl(fkey2vt)"
include "pc(editing)"
include "keypad(x11)"

key <BKSP> { [ BackSpace, BackSpace ] };

key <TAB> { [ Tab, ISO_Left_Tab ] };
key <RTRN> { [ Return ] };

key <CAPS> { [ Caps_Lock ] };
key <NMLK> { [ Num_Lock ] };

key <LFSH> { [ Shift_L ] };
key <LCTL> { [ Control_L ] };
key <LWIN> { [ Super_L ] };

key <RTSH> { [ Shift_R ] };
key <RCTL> { [ Control_R ] };
key <RWIN> { [ Super_R ] };
key <MENU> { [ Menu ] };

// Beginning of modifier mappings.
modifier_map Shift { Shift_L, Shift_R };
modifier_map Lock { Caps_Lock };
modifier_map Control{ Control_L, Control_R };
modifier_map Mod2 { Num_Lock };
modifier_map Mod4 { Super_L, Super_R };

// Fake keys for virtual<->real modifiers mapping:
key <LVL3> { [ ISO_Level3_Shift ] };
key <MDSW> { [ Mode_switch ] };
modifier_map Mod5 { <LVL3>, <MDSW> };

key <ALT> { [ NoSymbol, Alt_L ] };
include "altwin(meta_alt)"

key <META> { [ NoSymbol, Meta_L ] };
modifier_map Mod1 { <META> };

key <SUPR> { [ NoSymbol, Super_L ] };
modifier_map Mod4 { <SUPR> };

key <HYPR> { [ NoSymbol, Hyper_L ] };
modifier_map Mod4 { <HYPR> };
// End of modifier mappings.

key <OUTP> { [ XF86Display ] };
key <KITG> { [ XF86KbdLightOnOff ] };
key <KIDN> { [ XF86KbdBrightnessDown ] };
key <KIUP> { [ XF86KbdBrightnessUp ] };
};

hidden partial alphanumeric_keys
xkb_symbols "editing" {
key <PRSC> {
type= "PC_ALT_LEVEL2",
symbols[Group1]= [ Print, Sys_Req ]
};
key <SCLK> { [ Scroll_Lock ] };
key <PAUS> {
type= "PC_CONTROL_LEVEL2",
symbols[Group1]= [ Pause, Break ]
};
key <INS> { [ Insert ] };
key <HOME> { [ Home ] };
key <PGUP> { [ Prior ] };
key <DELE> { [ BackSpace, BackSpace ] };
key <END> { [ End ] };
key <PGDN> { [ Next ] };

key <UP> { [ Up ] };
key <LEFT> { [ Left ] };
key <DOWN> { [ Down ] };
key <RGHT> { [ Right ] };
};
 
Old 04-21-2018, 11:09 AM   #2
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 6,131

Rep: Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302
The quickest way is to alter /usr/share/X11/xkb/keycodes/evdev instead. You'll see it has the entries
<RALT> = 108;
<DELE> = 119;
Swap the numbers and that's it.
 
Old 04-21-2018, 04:51 PM   #3
jakfish
Member
 
Registered: Aug 2016
Posts: 52

Original Poster
Rep: Reputation: Disabled
Many thanks for your quick post.

I did as said suggested, but ran into technical difficulties perhaps because my Delete key is already remapped as a BackSpace.

When I did your switch, the Right Alt became a BackSpace for some reason, and my remapped Delete-to-BackSpace had no response at all.

Is there another remap that comes to mind?

Again, thank you for your help,
Jake
 
Old 04-22-2018, 11:18 AM   #4
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 6,131

Rep: Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302
Your symbols/pc file sets BKSP to BackSpace, so the problem must be in the evdev file. Look there and see what's mapped to <BKSP>. I have 22. You can find the keycodes by running xev, which gives results like
Code:
KeyPress event, serial 32, synthetic NO, window 0x3200001,
    root 0x112, subw 0x0, time 893490, (297,-205), root:(536,328),
    state 0x0, keycode 22 (keysym 0xff08, BackSpace), same_screen YES,
    XLookupString gives 1 bytes: (08) "
    XmbLookupString gives 1 bytes: (08) "
    XFilterEvent returns: False
Check the keycodes and make sure that evdev assigns them to what you need.
 
Old 04-22-2018, 04:07 PM   #5
jakfish
Member
 
Registered: Aug 2016
Posts: 52

Original Poster
Rep: Reputation: Disabled
Thank you for your follow-up.

I'm still at a loss but your help has perhaps helped me understand the problem.

Since I've already programmed the Delete key to be a BackSpace in the pc file, I no longer have an actual substitute key in evdev to finish the remapped equation <RALT> = ;

While my Delete key may be mapped in evdev as <DELE> = 119; the pc file has it as:

key <DELE> { [ BackSpace, BackSpace ] };

And the pc file appears to trump.

And I was incorrect when I said my delete-to-backspace was dead after putting in your evdev suggestions--it actually became a right alt key, leading me to believe that evdev needs to have keys switched rather than willing to lose the right alt altogether.

What I'm striving for is:

Right Alt = Delete
Delete = BackSpace
BackSpace = BackSpace

Which has no "key = Right Alt" in any equation, either in pc or evdev file.

It does seem that xmodmap is still necessary; I was only hoping to make the remapping cleaner, taking place only in /usr/share/X11/xkb

And my curiosity was piqued; you always feel that there's a solution in Linux.

Last edited by jakfish; 04-22-2018 at 04:09 PM.
 
Old 04-23-2018, 11:37 AM   #6
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 6,131

Rep: Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302
Quote:
Originally Posted by jakfish View Post
While my Delete key may be mapped in evdev as <DELE> = 119; the pc file has it as:
key <DELE> { [ BackSpace, BackSpace ] };
And the pc file appears to trump.
What's happening is that the two files are used together to create a driver that is then compiled. In that, 119 is directly equated to BackSpace. The reason for the intermediate use of the names like BKSP is to enable Linux to use keyboards other than the normal PC (Sun, Apple, etc) where the scancodes are quite different. Currently the Alternate keys are being handles by the file symbols/altwin, not symbols/pc. You can alter them from the pc file, though, as that trumps altwin!

So,
1. Use xev to find the codes of BKSP, DELE, and RALT. Make sure that evdev has them correctly assigned.
2. Make sure that pc has DELE and BKSP both defined as BackSpace
3. Add a line to pc
key <RALT> {[Delete]};
 
Old 04-23-2018, 06:11 PM   #7
jakfish
Member
 
Registered: Aug 2016
Posts: 52

Original Poster
Rep: Reputation: Disabled
I very much appreciate you sticking with this.

I followed your latest instructions and while I have both backspace and delete acting as BackSpace, when I add:

key <RALT> {[Delete]};

to pc, it remains a right alt.

I'm not certain it's compiling b/c when I run:

sudo dpkg-reconfigure keyboard-configuration

I get this in console after all gui windows come up:

Your console font configuration will be updated the next time your system
boots. If you want to update it now, run 'setupcon' from a virtual console.
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
update-initramfs: deferring update (trigger activated)

I've never see that message when I was remapping other keys successfully.

Rebooting only produces a right alt = right alt
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ALT+B, ALT+F key combinations in xterm don't work nIMBVS cAos 5 05-06-2020 09:23 AM
LXer: GPD Pocket, The 7-Inch Ubuntu Laptop, is Now Shipping LXer Syndicated Linux News 0 08-16-2017 02:40 PM
The Newest GPD Pocket with Z8700 CPU Windows 10 or Ubuntu System e114 General 2 02-09-2017 04:41 PM
[SOLVED] Remapping left alt to AltGr ChaotiCc` Linux - General 2 08-02-2012 10:57 AM
Key remapping erickFis Slackware 0 02-12-2004 05:00 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration