Friday, April 26, 2024
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 2652  / 2 Years ago, mon, september 5, 2022, 10:50:59

I'm trying to re-map my left Alt key to the Alt Gr and Alt Gr to left Alt. So far I've been able to do it in terminal, but it never runs it on start up. I've read multiple Ask Ubuntu questions, but none of them have worked so far.



I have tried multiple commands and methods, but none of them worked



Putting the script in /etc/rc.local like this:



sh /home/dani/Scripts/altgr_to_alt.sh


Adding it in cron



@reboot sh /home/dani/Scripts/altgr_to_alt.sh
@reboot bash /home/dani/Scripts/altgr_to_alt.sh
/home/dani/Scripts/altgr_to_alt.sh


Putting it in /etc/init.d/



/etc/init.d/alt_to_gr.sh


Adding it as a startup program, the command being



/home/dani/Scripts/altgr_to_alt.sh
sh /home/dani/Scripts/altgr_to_alt.sh

More From » keyboard-layout

 Answers
5

Solved it myself



The second post here solved it
Add the following line to the command field in Startup Applications



/home/dani/Scripts/altgr_to_alt.sh


And here is what the script looks like if someone is wondering



#!/bin/bash
echo "Changing keys..."
xmodmap -e "clear mod1"

xmodmap -e "keycode 108 = Alt_L Meta_L"
xmodmap -e "keycode 64 = ISO_Level3_Shift"
xmodmap -e "add mod1 = Alt_L Meta_L"

echo "Changed keys!"
echo


You have to make it executable if you want to run it at startup. I did this with
chmod 755 altgr_to_alt.sh


[#27624] Wednesday, September 7, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
sharall

Total Points: 407
Total Questions: 127
Total Answers: 121

Location: Saint Helena
Member since Fri, Mar 26, 2021
3 Years ago
;