donniebreve / touchcursor-linux

TouchCursor style keyboard remapping for Linux.
GNU General Public License v2.0
133 stars 28 forks source link

Add uninstall feature #13

Closed vanadu closed 5 years ago

vanadu commented 5 years ago

Installed touchcursor-linux with this touchcursor.conf key mapping:

KEY_I=KEY_UP KEY_J=KEY_LEFT KEY_K=KEY_DOWN KEY_L=KEY_RIGHT KEY_U=KEY_HOME KEY_O=KEY_END KEY_GRAVE=KEY_DELETE KEY_PAGEDOWN=KEY_GRAVE KEY_INSERT=KEY_HOME KEY_DELETE=KEY_END KEY_END=KEY_PAGEDOWN KEY_HOME=KEY_PAGEUP KEY_PAGEUP=KEY_INSERT

After build and install, the default key mappings were implemented, and it appears a touchcursor.conf.bak file was created with my custom mappings appended, but not implemented. make uninstall gives me a 'No rule to make target 'uninstall' message. When I reboot and try to re-make, I get make: Nothing to be done for 'default'. I'd like to uninstall and have a do-over but now the process starts automatically on boot, and I can't find the process to kill. Also, I am seeing that Touchcursor-linux is grabbing the keyboard device, so I'm wondering if it would block any Xorg mappings I might do.So, the questions are: 1) how can I uninstall, reconfigure and reinstall and 2) is to possible to configure as per the key mapping above? Thanks for this tool -- Touchcursor is sorely lacking on Linux.

donniebreve commented 5 years ago

Thanks for the feedback. I never implemented the make uninstall option but I will look into it. If you run the make install command again, the script will overwrite the existing installed files, excluding the configuration file.

The process is called touchcursor. If it does not show up when you start the computer, it likely crashed when loading (probably from the configuration file). You can search through journalctl to see the error messages.

I did not implement anything to backup the existing configuration file, so likely the .bak file was created by you. This is also something I will look at adding though.

As far as additional X11 mappings... you will just have to test it and let me know. I believe touchcursor will be first in line for keyboard input, but really I do not know.

  1. No need to uninstall, just run sudo systemctl stop touchcursor, then make and make install again to overwrite the existing files.
    1. You should edit /etc/touchcursor/touchcursor.conf to reset to the default values as this file is not overwritten by make install. You can copy the default config from the repo.
  2. I think the configuration you posted should be fine.
donniebreve commented 5 years ago

If you pull down the latest version, I added an uninstall option to the Makefile.

donniebreve commented 5 years ago

I changed this one to just adding the uninstall feature. I think the best way to "backup" the config file is to load the config file from the current user's directory if one exists, but I am not sure if that is possible right now since I load the application as root.

vanadu commented 5 years ago

OK, so I stopped the service, uninstalled, made sure touchcursor was gone from /etc, ran the make from /opt/touchcursor-linux and made sure the .conf file was the same as I included at the top of this thread. Then I checked /etc/touchcursor.conf to make sure the .conf file which was generated by the install had non-default mappings, which it did. But the non-default mappings weren't implemented, even after starting and restarting the service. Oddly, not all the default mappings were implemented -- the ones I left out of the .conf appear not to have been implemented, as desired, just the new mappings weren't pulled through. .conf is attached, as txt. touchcursor.conf.txt

donniebreve commented 5 years ago

Can you post the full contents of /etc/touchcursor/touchcursor.conf here. You can use the "insert code" editor option.

vanadu commented 5 years ago
# Touch Cursor Linux configuration file

# Find this line using 'ls /proc/bus/input/devices' and copy the full Name="" line here
[Device]
Name="Cypress USB Keyboard"

# Hyper key
[Hyper]
HYPER1=KEY_SPACE

# Default bindings for IJKLHNUOMPY
# KEY_1=KEY_2
# https://github.com/torvalds/linux/blob/master/include/uapi/linux/input-event-codes.h
[Bindings]
KEY_I=KEY_UP
KEY_J=KEY_LEFT
KEY_K=KEY_DOWN
KEY_L=KEY_RIGHT
KEY_U=KEY_HOME
KEY_O=KEY_END
KEY_GRAVE=KEY_DELETE
KEY_PAGEDOWN=KEY_GRAVE
KEY_INSERT=KEY_HOME
KEY_DELETE=KEY_END
KEY_END=KEY_PAGEDOWN
KEY_HOME=KEY_PAGEUP
KEY_PAGEUP=KEY_INSERT
donniebreve commented 5 years ago

I tried your configuration (simply copy and paste) on my machine and all the mappings worked alright. Is there still an issue?

vanadu commented 5 years ago

Yes, I haven't been able to get these to work:

KEY_GRAVE=KEY_DELETE
KEY_PAGEDOWN=KEY_GRAVE
KEY_INSERT=KEY_HOME
KEY_DELETE=KEY_END
KEY_END=KEY_PAGEDOWN
KEY_HOME=KEY_PAGEUP
KEY_PAGEUP=KEY_INSERT

I'll try again tomorrow. I assume you added them to /etc/touchcursor/touchcursor.conf -- what did you do then (i.e. remake, reboot, restart service)?

donniebreve commented 5 years ago

I tried again, and the only one I saw issues with was the KEY_PAGEUP=KEY_INSERT configuration. It's probable that the KEY_INSERT=KEY_HOME configuration also has an issue, but I do not have an Insert key on my current keyboard to test with. Will do some more research later. The other 5 configurations worked without issue.

This is how I updated the config:

  1. sudo nano /etc/touchcursor/touchcursor.conf
  2. sudo systemctl restart touchcursor
donniebreve commented 5 years ago

I tested again with a full keyboard and all the configurations worked. If you can provide more information, I would be glad to investigate.

vanadu commented 5 years ago

I get it now - a little brain-fart on my part, sorry. Everything works as it should. The problem was that I was trying to replace the default mappings for KEY_GRAVE, KEY_PAGEUP etc with new mappings, not modify them with spacebar +. I see now that the [Hyper] instruction in the .conf affects all subsequent configurations. On my Windows machine, in addition to Touch Cursor I use a utility called KeyTweak that lets you remap the base keyboard configuration. I'm wondering if it's would it be possible to expand this a bit by adding the ability to remap keys without modifiers? I tried just moving my custom configuration above the [Hyper] line but the service failed to start because it didn't see the keyboard definition...

In retrospect, my custom mappings actually work better as a spacebar modifier a la touchcursor, so I'm good and thankful for this great tool. Be prepared for a lot of hits on this repo... there are a LOT of people out there looking for just this thing.

donniebreve commented 5 years ago

Thanks for the description and kind words. I created issue #15 to track your request.