How to load Xmodmap or xinitrc

Please post suggestions for improvement of Cinnamon on:
https://github.com/linuxmint/Cinnamon
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
gwideman

How to load Xmodmap or xinitrc

Post by gwideman »

Hi folks,

Short version: What is the official, known-to-work, way of invoking xmodmap at X startup?

Longer version:

What I've tried:

I have a .Xmodmap file which I'd like to invoke when X starts, which seems a standard thing to do. However, I can't get any variant of standard procedure to work.

I have file ~/.xinitrc:

Code: Select all

#!/bin/sh
xmodmap $HOME/.Xmodmap
If I run .xinitrc that from the console, it has the desired effect, changing the behavior of keys.

Now I would expect that .Xmodmap would take effect at X start, either because some script somewhere looks for ~/.Xmodmap and applies it, or invokes ~/.xinitrc.

However, evidently neither of those things happens. I did check ~/.xsession-errors, but there's nothing in there pertaining to .xinitrc or .Xmodmap.

This is for Mint 15 Cinnamon x64.

Ideas? Thanks,

-- Graham
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
gwideman

Re: How to load Xmodmap or xinitrc

Post by gwideman »

After more research, I'm getting the impression that the way(s) that user xmodmap used to get invoked have been removed. I guess the idea is to use the xkb apparatus instead.

Unfortunately there seems to be no documentation on xkb that pertains to the layout of files on Mint 15. So the task of rearranging a few keys continues in the dark....
zogbee

Re: How to load Xmodmap or xinitrc

Post by zogbee »

I solved this by running the command "xmodmap $HOME/.Xmodmap" as a startup program. It's a janky fix, but it worked.
pykler

Re: How to load Xmodmap or xinitrc

Post by pykler »

Seems like Cinnamon is the culprit, still can't find any evidence but it seems when cinnamon starts it wipes the Xmodmap!

Cinnamon is the last thing to start in the

Code: Select all

 /etc/X11/Xsession.d/*
MagnusL3D

Re: How to load Xmodmap or xinitrc

Post by MagnusL3D »

Just thought I'd share my solution, because the "xmodmap $HOME/.Xmodmap" in startup didnt work for me.

What did work was making a text file putting and chmod +x it and then putting that file in the startup.

However since it more or less is just a terminal "macro" at that point the commands have to be as if you write them in the terminal so my file ended up lookling like this:

Code: Select all

xmodmap -e "keycode 64 = Super_L"
xmodmap -e "keycode 133 = Alt_L"
xmodmap -e "keycode 108 = Super_R"
xmodmap -e "keycode 134 = ISO_Level3_Shift"
xmodmap -e "remove Mod1 = Super_L"
xmodmap -e "remove Mod4 = Alt_L"
xmodmap -e "remove Mod5 = Super_R"
xmodmap -e "remove Mod4 = ISO_Level3_Shift"
xmodmap -e "add Mod1 = Alt_L"
xmodmap -e "add Mod4 = Super_L"
xmodmap -e "add Mod5 = ISO_Level3_Shift"
xmodmap -e "add Mod4 = Super_R"
Also I put a 20sec delay on the startup script. And this in the end worked for me.
Locked

Return to “Cinnamon”