LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 08-30-2017, 02:23 PM   #1
Bob Fletcher
Member
 
Registered: Nov 2008
Location: Hinckley UK
Distribution: Manjaro Cinnamon
Posts: 140

Rep: Reputation: 1
Modifying keyboard for extra key strokes.


I am running Arch Gnome with a US keyboard. I am trying to modify keys. The goal is to ideally have the ‘sterling’ sign on CTL+4 and the degrees sign “°” on another key so I can write 20°C etc.
I have looked at xmodmap but this does not seem to be flexible enough. That has brought me to
Code:
/usr/share/X11/xkb/symbols/us
. My keyboard layout is US Basic. I have tried modifying the line
Code:
key <AE03> {	[	  3,	numbersign	]	};
by adding key
Code:
<AE03> {	[	  3,	numbersign, sterling	]	}
That doesn't work. I have tried switching to US Intl but the dead key R-Alt does not work I take it my keyboard is not generating the AltGR scan code.
That is as far as I have got can anyone help?
 
Old 08-30-2017, 05:05 PM   #2
Michael Uplawski
Senior Member
 
Registered: Dec 2015
Posts: 1,624
Blog Entries: 40

Rep: Reputation: Disabled
Good ... morning (it appears to be 2 minutes past midnight in central Europe, oops.)

Quote:
Originally Posted by Bob Fletcher View Post
I have looked at xmodmap but this does not seem to be flexible enough.
PSE elaborate.
So far you talk about adding two symbols, but I do not understand where xmodmap does not allow you to do it.

Here is my own xmodmap file in use and it is commented to be self-documenting:
Code:
! Ω and @
keycode  24 = q Q q Q at Greek_OMEGA at
! ś and Ś 
keycode  32 = o O o O oe OE oe
! λ and Λ (greek_lambda)
keycode  46 = l L l L U03BB U039B U03BB  
! δ and Δ (greek_delta)
keycode  40 = d D d D U03B4 U0394 U03B4
! ω (greek_omega)
keycode  25 = w W w W U03C9
! ✅ and ✔
keycode  44 = j J j J U2705 U2714
I found these changes swift and easy. Works like a charm...
 
Old 08-31-2017, 04:38 AM   #3
Bob Fletcher
Member
 
Registered: Nov 2008
Location: Hinckley UK
Distribution: Manjaro Cinnamon
Posts: 140

Original Poster
Rep: Reputation: 1
Thank you so much Michael. I copied you code to .Xmodmap and it was loaded using xmodmap -pke. Still not working. Silly me. I had loaded the US Basic keymap that lacks the dead keys and AltGr. Loaded the US International with dead keys and all is working well now. I only used xmodmap a few years ago to swap the caps lock to shift on a UK keyboard. Spend most of my life in Australia but in the UK now and I just hate that UK keyboard layout.
Thanks again and have a good day.
 
Old 08-31-2017, 11:21 AM   #4
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Salix
Posts: 6,153

Rep: Reputation: 2316Reputation: 2316Reputation: 2316Reputation: 2316Reputation: 2316Reputation: 2316Reputation: 2316Reputation: 2316Reputation: 2316Reputation: 2316Reputation: 2316
As a little extra,

1. AltGr may need to be added to the basic US layout, by either using the desktop's keyboard configuration tool or by adding
Code:
include "level3(ralt_switch)"
to the driver.

2. If the Compose key is enabled, using the desktop's tool (the Windows MENU key is a convenient location), you have
degree from Compose o o
sterling from Compose - L
 
Old 08-31-2017, 03:25 PM   #5
Bob Fletcher
Member
 
Registered: Nov 2008
Location: Hinckley UK
Distribution: Manjaro Cinnamon
Posts: 140

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by DavidMcCann View Post
As a little extra,

1. AltGr may need to be added to the basic US layout, by either using the desktop's keyboard configuration tool or by adding
Code:
include "level3(ralt_switch)"
to the driver.

2. If the Compose key is enabled, using the desktop's tool (the Windows MENU key is a convenient location), you have
degree from Compose o o
sterling from Compose - L
Thank you. Choosing the US International layout made it all work I just did some modification to the Xmodmap to suit my requirements.
Thanks...
 
Old 09-01-2017, 11:32 AM   #6
Bob Fletcher
Member
 
Registered: Nov 2008
Location: Hinckley UK
Distribution: Manjaro Cinnamon
Posts: 140

Original Poster
Rep: Reputation: 1
I’m back again. I cannot get ~/.Xmodmap to auto load at startup, well not quite true I have added xmodmap ~/.Xmodmap to a script I run at startup to load a network drive, but that is not the way, even if it does work. Going back to the days when I was running LM I just put the file in my home directory.
From all the reading and playing around it seems to be dependant on the DE and the DM as well as the distro. Most people seem to say that it should be added to ~/.xinitrc but that will only work when using startx.

My DM is GDM and that loads Gnome 3.24.2. So how to make it load the xmodmap file either for user or globally?
 
Old 09-01-2017, 11:44 AM   #7
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Salix
Posts: 6,153

Rep: Reputation: 2316Reputation: 2316Reputation: 2316Reputation: 2316Reputation: 2316Reputation: 2316Reputation: 2316Reputation: 2316Reputation: 2316Reputation: 2316Reputation: 2316
These might help
https://wiki.archlinux.org/index.php/Xmodmap
https://www.in-ulm.de/~mascheck/X11/xmodmap.html

It's so long since I've used Xmodmap that I've forgotten it!
 
Old 09-01-2017, 12:40 PM   #8
Bob Fletcher
Member
 
Registered: Nov 2008
Location: Hinckley UK
Distribution: Manjaro Cinnamon
Posts: 140

Original Poster
Rep: Reputation: 1
Thanks for your reply. I have spent some time with the Arch Wiki but that does not address this issue. Looking at the second link I did try a ~/.xsession but that does not work.
What I am hoping is for someone who is currently loading the ~/Xmodmap in a similar setup to mine.
 
Old 09-01-2017, 02:45 PM   #9
Michael Uplawski
Senior Member
 
Registered: Dec 2015
Posts: 1,624
Blog Entries: 40

Rep: Reputation: Disabled
As I am running Fluxbox, I put the call to xmodmap in the startup script to the Window-Manager. This does not seem too illogical. Other Window-Managers and desktop-environments should provide similar mechanisms. But I know nothing about that.
 
Old 09-01-2017, 03:07 PM   #10
Bob Fletcher
Member
 
Registered: Nov 2008
Location: Hinckley UK
Distribution: Manjaro Cinnamon
Posts: 140

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by Michael Uplawski View Post
As I am running Fluxbox, I put the call to xmodmap in the startup script to the Window-Manager. This does not seem too illogical. Other Window-Managers and desktop-environments should provide similar mechanisms. But I know nothing about that.
It seems some changes have been made over the years. in my case it may also be GDM. I have trouble with LightDM. There seems to be so many answers to this looking around. Perhaps doing as I am doing now and putting it in a network drive startup script it does work but it seems all wrong to me. What I would like is to put .Xmodmap in my home directory and it be automatically detected. Apparently it will do this in OpenSUSE. A good tutorial is needed I think.
 
Old 09-01-2017, 11:04 PM   #11
Michael Uplawski
Senior Member
 
Registered: Dec 2015
Posts: 1,624
Blog Entries: 40

Rep: Reputation: Disabled
Quote:
Originally Posted by Bob Fletcher View Post
It seems some changes have been made over the years. in my case it may also be GDM. I have trouble with LightDM. There seems to be so many answers to this looking around. Perhaps doing as I am doing now and putting it in a network drive startup script it does work but it seems all wrong to me. What I would like is to put .Xmodmap in my home directory and it be automatically detected. Apparently it will do this in OpenSUSE. A good tutorial is needed I think.
This reads all more complicated than my experience wants me to believe.

Many things are fortunately not standardized and will hopefully never be. On the other hand, there may be Linux-distributions which always seem to divert from the customs which evolve over the time. But all the same, calling xmodmap on a file of keycode expressions is simple and unspectacular.

Find a location that suits your Desktop-environment, wherever that may be. Do not try to identify a “Best Ever” or a convention. If the bible and the Qur'an do not talk about it, I bet the Talmud won't either.

You're the boss.

Last edited by Michael Uplawski; 09-01-2017 at 11:21 PM. Reason: Tie Poo
 
Old 09-02-2017, 02:48 AM   #12
Bob Fletcher
Member
 
Registered: Nov 2008
Location: Hinckley UK
Distribution: Manjaro Cinnamon
Posts: 140

Original Poster
Rep: Reputation: 1
Well said Michael. At least it is working and that is all I should bother about.
Thanks for all your help.
 
  


Reply

Tags
keyboard layout



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
[SOLVED] Injecting key strokes to simulate a keyboard theosys Programming 9 11-03-2016 01:17 PM
I need to Increase keyboard buffer size to allow key strokes at 6000 WPM smokingwheels Linux - Newbie 5 01-17-2015 07:27 AM
[SOLVED] Keyboard doesn't sense key strokes if key kept pressed yogesh_attarde Linux - Software 1 06-24-2014 09:28 AM
USB keyboard - Capture key strokes/input v333k Linux - Software 2 10-19-2009 01:44 PM
What to do with extra Microsoft key on keyboard Lsatenstein Linux - Hardware 4 12-11-2005 08:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 10:46 PM.

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