The issue seems to be Keysharp interfering!

Original post:


I have this set up as a startup script, but it only sometimes triggers, despite setting a 20-second delay:

#!/bin/bash
sleep 2
xmodmap -e "clear lock"
xmodmap -e "keycode 66 = Return"

I have the startup command set to bash "path/Remap_Caps_Lock_to_Enter.sh". What's going on? It works when I press the triangle button when it doesn't work on boot.

you are viewing a single comment's thread
view the rest of the comments
[–] [S] 1 point 5 months ago (13 children)

I have almost no idea of what half of what you're saying is; I've heard of systemd, initd, and cron, but I don't know what exactly they are and I don't know what "shell configs" are.

I thought it was obvious that I'm running Linux Mint since I posted this in !linuxmint@programming.dev. I'm using Zena, 22.3 on kernel 7.0.0-14, which seems to be the latest one that Update Manager is showing me.

  1. Create the file /home/user/another_folder/remap_caps_to_enter.sh containing the code above
  2. Open Startup Applications and set it to bash the above path as a command
  3. It initially works, but then after a few min, it reverts to native Caps Lock behavior. Manually rerunning the file again makes it work for the rest of the session until I shut down the PC.
  • source
  • parent
  • hideshow 13 child comments
  • [–] 2 points 5 months ago* (last edited 5 months ago) (12 children)

    I see. Thank you for the details shared!

    I've never experienced Linux Mint, but a quick Google shows an option "Caps Lock acts as Return" in the desktop environment (DE) settings. Is that the main idea?


    Regarding the custom script case. Is it possible a system-wide service executes after your boot/startup script, slightly later, remapping it again?

    We may try investigating. For instance, in a new terminal on the very system start, via xev, to try capture the moment it changes:

    xev;
    

    Or manually:

    #! /usr/bin/env bash
    
    declare s='' s2='';
    
    while :;
    do
        s="$( xmodmap -pke | grep -E 'keycode\s+66'; )";
        
        if [[ "$s" != "$s2" ]];
        then
            printf -- ' [%s] Changed from "%s" to "%s".\n' "$( date -- '+%F_%H-%M-%S'; )" "$s2" "$s";
    
            s2="$s";
        fi
    
        sleep 1;
    done
    

    I would also try checking out logs:

    journalctl --user -f | grep -E 'settings|keyboard|layout|xkb';
    
    # Or: journalctl -f | grep ...
    

    Edit 2026-06-13

    -- xev -event mapping;
    ++ xev;
    

    Thank you, @Flagstaff@programming.dev (source)

  • source
  • parent
  • hideshow 12 child comments
  • [–] [S] 1 point 5 months ago (1 child)
    xev: unrecognized event mask 'mapping'
    

    I forgot to check these before already applying it... It's okay... I'll just tolerate it for now. I may try the other code later but am wiped out... Thanks for all the ideas, though.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 1 point 5 months ago* (last edited 5 months ago)

    Sincere apologies! Apparently, the mapping was in my dated local custom build of the tool...
    Have you tried recording the general xev (with no , without any explicit filtering?

    Your xev build/Man/Info message should list the supported. For example, in v1.2.3, these are supported:

    $ man xev;
    # ...
    -event event_mask  
    When not specified, all events are selected... Available event masks: keyboard mouse expose visibility structure substructure focus property colormap owner_grab_button randr button
    

    Yet, today we found the actual possible culprit, and monitoring the events is probably not required. We know that it will just change, and the issue source should be a separate whole system-wide service that changes your initial change to its own configured, eventually.

    There are many custom key remapping tools, including keyd, but I would try realizing/experiment with the standards first, and I appreciate you for still trying! It may help you in the future.

  • source
  • parent
  • load more comments (10 replies)
  • load more comments (10 replies)