-
Notifications
You must be signed in to change notification settings - Fork 218
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
Update all references to device attribute 'fn' to use 'path' in keymapper #891
Comments
And I also updated the @staticmethod
def print_list():
# Get all devices
devices = Devices.all()
# Define column widths
DEVICE_WIDTH = 20
NAME_WIDTH = 35
# Calculate the total width needed for the table
max_phys_length = max(len(device.phys) for device in devices)
total_width = DEVICE_WIDTH + NAME_WIDTH + max_phys_length + 3 # +3 for spaces between columns
# Print header
print("-" * total_width)
print(f"{'Device':<{DEVICE_WIDTH}} {'Name':<{NAME_WIDTH}} {'Phys'}")
print("-" * total_width)
# Print each device
for device in devices:
if len(device.name) > NAME_WIDTH:
# Handle long names by printing on two lines
print(f"{device.path:<{DEVICE_WIDTH}} {device.name[:NAME_WIDTH]:<{NAME_WIDTH}}")
print(f"{'':<{DEVICE_WIDTH + NAME_WIDTH}} {device.phys}")
else:
# Print everything on one line
print(f"{device.path:<{DEVICE_WIDTH}} {device.name:<{NAME_WIDTH}} {device.phys}")
print() This is entirely optional and makes no real difference to how the method works. It's just more readable and searchable than the older style of string formatting. |
@RedBearAK I think I have the same issue Is there some quick fix or workaround available for this? And because of this, I am unable to remap the keys on freshly installed Linux Mint. |
Toshy is my alternative to Kinto that has already fixed this issue. You can remove Kinto and try Toshy instead. https://github.com/RedBearAK/toshy Otherwise you’d have to fix it yourself in the Python file referenced in the error message. Find the four instances of “.fn” and replace them with “.path” to make the error go away. |
@RedBearAK Thank you so much, toshy saved my day |
@ rbreaves
FYI, I just had to do a quick update in
xwaykeyz
, my fork ofxkeysnail/keyszer
, due to the apparent removal of a deprecatedInputDevice
attribute name in an update toevdev
that just happened this morning. (Saturday, Feb. 8, 2025)This will most likely need to be dealt with in all forks of this keymapper. Anyone newly installing them along with
evdev
1.9.0 or later will probably run into an AttributeError when attempting to run the keymapper.There was a deprecation warning in the
evdev
code (inevdev/device.py
), probably for quite some time now.And there's the note about the removal of the deprecated attribute in the
evdev
change log:https://python-evdev.readthedocs.io/en/latest/changelog.html#feb-08-2025
I found that everywhere that
device.fn
was used needed to be updated todevice.path
in the keymapper'sdevices.py
module. Including a couple of references that were in a formatting syntax in this, so it was a bit more abstract and needed more than a single simple find/replace operation:That needed to be updated like this, with
{1.path:<20}
replacing the two{1.fn:<20}
instances:And that is all I know about that.
The fix worked for me after experiencing the
AttributeError
on a fresh install of Toshy this morning, and a Toshy user quickly confirmed that the updatedxwaykeyz
1.4.0 release no longer had theAttributeError
when the Toshy installer was run again and cloned the new version of the keymapper.I'll be cross-posting this to the
keyzer
andxkeysnail
GitHub issues.The text was updated successfully, but these errors were encountered: