petrstepanov / gnome-macos-remap-wayland

macOS like keyboard remap for GNOME desktop environment. Works with Wayland and X11.
75 stars 9 forks source link

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

Open ezamelczyk opened 5 months ago

ezamelczyk commented 5 months ago

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

yesudeep commented 5 months ago

Same here.

jk464 commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

@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 commented 4 months ago

@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 commented 3 months ago

Same here. On arch linux fwiw

bradleyd commented 3 months ago

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?