Closed markopw closed 1 week ago
It should work if you use --devices
, but I think you need to put all devices (either the path, or the string name in quotes) that you want it to grab. It should not grab other devices in that case.
There was talk of adding a type of ignore setting inside the keymapper, but I don't think anything ever happened with that.
To run a manual keymapper command, you have to first engage the Toshy Python virtual environment:
source toshy-venv
Then you should be able to run xwaykeyz
, the current keymapper fork that gets installed, with your -c
(config file) and then the added --devices
option and arguments. Look inside the toshy-config-start
script if you're not sure about the command. Maybe leave off the -w
option.
less $(toshy-config-start)
I'll have to add to this later.
Ahhh, sorry for not looking a bit more into the code.
--devices
should be changed in toshy-config-start
as well as toshy-service-config
- this is called when you restart from the tray menu, that is why it wasn't working for me.
If someone needs this:
To make it work only for keychron I changed in .config/toshy/scripts/toshy-service-config.sh
and .config/toshy/scripts/bin/toshy-config-start.sh
:
FROM:
xwaykeyz -w -c "$HOME/.config/toshy/toshy_config.py"
TO:
xwaykeyz -w -c "$HOME/.config/toshy/toshy_config.py" --devices "Keychron Keychron K2"
You can find device name with toshy-devices
.
Excellent work there. That would of course all be overwritten if you reinstall Toshy. There’s also the verbose script you may want to modify. In case you need to debug config changes.
I should look into having a way to save the devices the user wants to add and/or ignore to some kind of settings file that the launcher scripts can read into a variable. To make this customization of the command more maintainable. Shouldn’t be too hard, but I can’t get to it immediately.
I’m not sure about this but the -w
option may cause the keymapper to grab the mouse device if it gets disconnected and reconnected. Or it might just keep ignoring any device but the specified device.
You may need to check the behavior and remove that option if necessary.
It seems like --devices
have grater priority than -w
option, meaning -w
only monitor for devices specified with --devices
. I tried unpluging and powering off/on the mouse and windows keyboard and it didn't attach to toshy or should I say xwaykeyz.
That is good news. Without the -w
it probably wouldn’t even re-grab the designated device, which would be quite annoying.
Thanks for your support. Let me know if you have any other issues with Toshy. I’ll leave this open until I have a chance to add that enhancement.
@markopw
FYI, I just added a new API function into the keymapper (xwaykeyz
), that operates in exactly the same way as the --devices
command-line arguments. Any new install of Toshy should have the 1.3.0 version of the keymapper (or later), and should be able to use this new API:
###################################################################################################
### SLICE_MARK_START: keymapper_api ### EDITS OUTSIDE THESE MARKS WILL BE LOST ON UPGRADE
# Keymapper-specific config settings - REMOVE OR SET TO DEFAULTS FOR DISTRIBUTION
dump_diagnostics_key(Key.F15) # default key: F15
emergency_eject_key(Key.F16) # default key: F16
timeouts(
multipurpose = 1, # default: 1 sec
suspend = 1, # default: 1 sec, try 0.1 sec for touchpads/trackpads
)
# Delays often needed for Wayland and/or virtual machines or slow systems
throttle_delays(
key_pre_delay_ms = 12, # default: 0 ms, range: 0-150 ms, suggested: 1-50 ms
key_post_delay_ms = 18, # default: 0 ms, range: 0-150 ms, suggested: 1-100 ms
)
devices_api(
# Only the specified devices will be "grabbed" and watched for during
# device connections/disconnections.
only_devices = [
# 'Example Disconnected Keyboard',
# 'Example Connected Keyboard',
]
)
### SLICE_MARK_END: keymapper_api ### EDITS OUTSIDE THESE MARKS WILL BE LOST ON UPGRADE
###################################################################################################
If you place that new API in your tagged keymapper_api
editable slice like shown here, and put the devices you want to grab in the only_devices
list, you could save the config and reinstall Toshy from a new zip file. That should wipe out the changes you made to the launcher scripts, and take the same device argument from the API call inside the config file.
For your device name it could look like this:
devices_api(
only_devices = [
'Keychron Keychron K2',
]
)
The difference being that you could reinstall Toshy for any reason, possibly to upgrade and get new features or remaps every few months, and your "devices" argument will be preserved in the config file. Plus, you won't need to hack the launcher scripts again.
Let me know if you ever get a chance to try it out. The example as shown above will be in the default Toshy config file from now on.
Remember that, when using this or --devices
, if you get another input device and want Toshy's remapping to apply to that device, you'd have to add its device name to the list, or it would get ignored like everything else.
A device on the list doesn't need to be connected, but at least one device has to be successfully grabbed as the keymapper starts, or it will just have an error.
If you reinstall from a new zip at this point, you should be able to use a simpler alias to see the verbose output for troubleshooting:
toshy-debug
That's the same as either of these:
toshy-config-start-verbose
toshy-config-verbose-start
It would be nice if we could disable/ignore some keyboards or devices. I didn't find a way in the configuration file. I only found layout remap per device and excluding from Forced Numpad.
The problem: I have two keyboards, one is apple type and other is windows. I would like to ignore the windows keyboard by toshy completely.
Also toshy detects my mouse logitech mx master 3 as keyboard so any system settings for the mouse stops working like scrolling direction or pointer speed. I would like to add it to disable/ignore list. I tried adding --device / --devices but it didn't work.
Thank you for reading.