Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shortcuts are properly remapped but cmd and ctrl aren't swapped #4

Open
ezamelczyk opened this issue Feb 5, 2024 · 7 comments
Open

Comments

@ezamelczyk
Copy link

I followed the installation instructions properly but my ctrl acts like cmd should. I don't know how to troubleshoot this.

@yesudeep
Copy link

yesudeep commented Feb 5, 2024

Same here.

@jk464
Copy link

jk464 commented Mar 1, 2024

Issue seems to be with the ./install.sh script assuming your distro is Ubuntu when enabling xremap to run w/o sudo

# Run xremap without sudo
sudo gpasswd -a ${USER} input
echo 'KERNEL=="uinput", GROUP="input", TAG+="uaccess"' | sudo tee /etc/udev/rules.d/input.rules

From https://github.com/k0kubun/xremap - how to do this depends on your distro (pasting relevant instructions from the xremap README below)

Running the correct instructions for my distro manually and then rebooting allows the systemd service to run xremap and I've now got CMD and Ctrl swapped.

I now have the issue instead that the reverse remapping of CMD and Ctrl in my Terminal doesn't work (CMD-C now acts as Ctrl-C, instead of Copy, and leaving Ctrl-C as Ctrl-C)


Running xremap without sudo

To do so, your normal user should be able to use evdev and uinput without sudo.
In Ubuntu, this can be configured by running the following commands and rebooting your machine.

sudo gpasswd -a YOUR_USER input
echo 'KERNEL=="uinput", GROUP="input", TAG+="uaccess"' | sudo tee /etc/udev/rules.d/input.rules

Arch Linux

The following can be used on Arch.

lsmod | grep uinput

If this module is not loaded, add to /etc/modules-load.d/uinput.conf:

uinput

Then add udev rule.

echo 'KERNEL=="uinput", GROUP="input", TAG+="uaccess"' | sudo tee /etc/udev/rules.d/99-input.rules

Then reboot the machine.

Debian

Make sure uinput is loaded same as in Arch:

lsmod | grep uinput

If it shows up empty:

echo uinput | sudo tee /etc/modules-load.d/uinput.conf

Add your user to the input group and add the same udev rule as in Ubuntu:

sudo gpasswd -a YOUR_USER input
echo 'KERNEL=="uinput", GROUP="input", TAG+="uaccess"' | sudo tee /etc/udev/rules.d/input.rules

Reboot the machine afterwards or try:

sudo modprobe uinput
sudo udevadm control --reload-rules && sudo udevadm trigger

Other platforms

In other platforms, you might need to create an input group first
and run echo 'KERNEL=="event*", NAME="input/%k", MODE="660", GROUP="input"' | sudo tee /etc/udev/rules.d/input.rules as well.

If you do this, in some environments, --watch may fail to recognize new devices due to temporary permission issues.
Using sudo might be more useful in such cases.

@petrstepanov
Copy link
Owner

petrstepanov commented Mar 2, 2024

Hi, @yesudeep @ezamelczyk could you please run gsettings reset org.gnome.desktop.input-sources xkb-options in Terminal and see if it resolves the issue?

@petrstepanov
Copy link
Owner

petrstepanov commented Mar 2, 2024

@jk464 I agree that running xremap without sudo can introduce more issues. I think it is better to switch to sudo - namely pkexec and add a Policy Kit XML action allowing to run it without password. I will look at it some time soon.

@petrstepanov
Copy link
Owner

@jk464 I tried to make the recent Xremap version work with administrative privileges. Unfortunately there seem to be issues with application-specific remapping. Additionally, the Xremap developer specifies that it is rather challenging to implement the per-app remapping with sudo. Therefore for now I would stick to the non-sudo method. I created a branch with-sudo which is not currently working but may be improved later.

@bradleyd
Copy link

Same here. On arch linux fwiw

@bradleyd
Copy link

bradleyd commented Mar 28, 2024

OK, I have figured rootless xremap on Arch. Systemd specific udev uaccess rules must come before 73-seat-late.rules for uaccess tags. The example in xremap for Arch rule is correct. Just switch the name of the udev rule to 72-{name}.rules. The lexical name of 99 never gets evaluated in the correct order/time. Once I did that /dev/uinput is now modified for group input. Dont forget to make sure uinput is loaded on boot.

Now, the problem still remains in terminals. [Alacritty or console shipped with Gnome] The CMD key acts like control still. But in Firefox and gedit they behave correctly. Any ideas? I assume it is the config file calling out gnome-terminal?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants