RedBearAK / toshy

Keymapper config to make Linux work like a 'Tosh!
https://toshy.app
GNU General Public License v3.0
226 stars 15 forks source link

Add KDE3/TDE support (Enh) #213

Closed gazecube closed 3 months ago

gazecube commented 3 months ago

Is your feature request related to a problem? Please describe. I can't use toshy on my openSUSE install since I decided to go with KDE3 as my desktop environment. Yes, it's still supported and maintained by the community for some reason.

Describe the solution you'd like I'd like to have KDE3 be autodetected and supported in toshy

Describe alternatives you've considered Only alternative is another DE, which I really don't wanna do.

Additional context N/A

RedBearAK commented 3 months ago

@gazecube

Need more info. Is TDE short for the Trinity Desktop Environment? I had that working on Q4OS.

What actual issues do you run into when trying to use Toshy? Errors during the install? Or it installs but doesn’t work correctly?

Also, are you on Leap or Tumbleweed? And how exactly did you get this desktop environment installed? Some kind of package pattern, or a community repo?

gazecube commented 3 months ago

@RedBearAK I used the community-maintained KDE3:KDE3 repo to install the desktop environment. Display manager is KDM, running on Leap 15.5, and it's throwing "(EE) ERROR: Desktop Environment not found in XDG_SESSION_DESKTOP or XDG_CURRENT_DESKTOP. (EE) ERROR: Config file will not be able to adapt automatically to Desktop Environment." when I run ./setup_toshy.py install. When I set XDG_CURRENT_DESKTOP to "kde" when running the script, toshy doesn't want to accept that KDE3 exists, throwing (EE) KDE_SESSION_VERSION contains unrecognized value: '3'. And yes, TDE is short for Trinity.

If you want to replicate my exact setup, I used this to get it going. This should produce the exact setup I had as of the time I first tried installing toshy, though I added p7zip-full to my system so I could extract 7z archives, since the way I did it makes a very minimal install.

RedBearAK commented 3 months ago

@gazecube

Is there a kpackagetool command, or kpackagetool3?

Whoever maintains the packages should fix that problem with the environment variable not being set. Luckily you knew how to set it yourself, but that won't stick when you reboot or log out.

I just made a couple of changes to the dev_beta branch. If you switch to that branch on the main page and download the zip again, it might let you get through the install.

I'll be out for a while but I'll check back on this.

gazecube commented 3 months ago

@gazecube

Is there a kpackagetool command, or kpackagetool3?

Whoever maintains the packages should fix that problem with the environment variable not being set. Luckily you knew how to set it yourself, but that won't stick when you reboot or log out.

I just made a couple of changes to the dev_beta branch. If you switch to that branch on the main page and download the zip again, it might let you get through the install.

I'll be out for a while but I'll check back on this.

There does not seem to be a kpackagetool command. I'm currently trying the dev_beta branch now.

RedBearAK commented 3 months ago

Are any of these process names present when running KDE 3?

            'kde':          ['plasmashell', 'kwin_ft', 'kwin_wayland', 'kwin_x11'],

Maybe there would only be something called kwin. If you can find a relevant process name I can add to the list, the environment module will probably be able to overcome the problem with the environment variable not being set, and identify the DE as "kde".

gazecube commented 3 months ago

I see "kwin", "kworker", and "kwrapper" in the activity monitor

gazecube commented 3 months ago

It seems like the install finished, though it did so with an issue. Applying KDE Plasma desktop tweaks... (EE) ERROR: Desktop tweaks for KDE cannot be applied. (EE) KDE major version invalid: '3'

Not sure what exactly this entails, but I'll reboot and see if it worked.

Edit: Rebooted, toshy shows up in my systemtray, however the keybinds haven't changed.

RedBearAK commented 3 months ago

That should be a superficial error during the install, since there would be no known tweaks to apply to KDE 3. But that means I should make that version check its own little function so I don't have redundant code to maintain.

A useful thing to know is the default shortcut is in that environment for opening the application menu (was it even searchable back then?) or some kind of "launcher". I try to assign that to Cmd+Space for each environment. Without a specific remap it would default to Alt+F1.

Edit: Rebooted, toshy shows up in my systemtray, however the keybinds haven't changed.

Now is the time for the verbose command, to see what it says. I haven't fixed the environment detector yet, but the desktop environment shouldn't matter to the keymapper if the session is X11, no Wayland.

See what this has to say:

toshy-env

And then run the verbose command and see what it says:

toshy-config-verbose-start

Opening this in a separate tab can also be useful:

toshy-services-log

Maybe run that before running the verbose command, to see what kind of issues the systemd services are having.

The base distro of Leap 15.5 should be fully supported in general.

RedBearAK commented 3 months ago

I just added 'kwin' to that list in the environment module, so if you download a new zip and reinstall (delete the earlier folder and 'cd' back to home if you still had it open in the terminal), then the config file and toshy-env should at least identify the DE as "kde". But without knowing why it isn't starting up I'm not sure how much that will help.

RedBearAK commented 3 months ago

@gazecube

And that should clear up the superficial error in the installer, in a more maintainable way. Latest dev_beta zip will have the change.

As soon as you can show me the logs we can probably get it working fairly quickly.

RedBearAK commented 3 months ago

@gazecube

There are definitely some problems, but they seem to be intermittent. I think some of it comes from the sheer age of the software.

Mar 21 21:58:38 localhost bash[4638]: Xlib.xauth: warning, no xauthority details available
Mar 21 21:58:38 localhost bash[4638]: (EE) Can't connect to display ":0": b'Authorization required, but no authorization protocol specified\n'
Mar 21 21:58:38 localhost bash[4638]: Xlib.xauth: warning, no xauthority details available
Mar 21 21:58:38 localhost bash[4638]: (EE) Can't connect to display ":0": b'Authorization required, but no authorization protocol specified\n'
Mar 21 21:58:38 localhost bash[4638]: Xlib.xauth: warning, no xauthority details available
Mar 21 21:58:38 localhost bash[4638]: (EE) Can't connect to display ":0": b'Authorization required, but no authorization protocol specified\n'

And there was an oddball Xlib exception that I only saw once, and I'm not sure what caused it. I think I've seen it before, but it's very rare.

Xlib.error.BadValue: <class 'Xlib.error.BadValue'>: code = 2, resource_id = 10, sequence_number = 128, major_opcode = 20, minor_opcode = 0

But aside from that, Toshy actually seems to work. I did have to restart Toshy services from the tray icon when the Xlib.auth errors were happening.

The default Cmd+Space remap is Alt+F1, which works with the KDE 3.5 app menu.

One thing that can make it seem like the remaps are not working is an app like Konsole not having some of the expected shortcuts set to anything by default. I had to open the Konsole shortcuts config dialog and set the shortcut for "New Linux Console" (which opens a new tab) and the shortcut for "Close Session" before I could open and close tabs with Cmd+T/Cmd+W.

Same goes for Copy/Paste. Copy had no shortcut configured, and Paste had a default shortcut of Shift+Insert. So I had to configure Copy to be Ctrl+Shift+C and set the Paste alternate shortcut to Ctrl+Shift+V. Then it all works as expected with Cmd+C/Cmd+V.

The "close tab" shortcut needs to be set with the physical Ctrl+Shift+W keys, not by pressing the physical equivalent of Cmd+W (because right now the Toshy config is doing a "dialog" remap to Escape). Or, you can always stop Toshy, set the shortcut, and restart Toshy.

Shortcuts inside an app like Konsole need to be what they would normally be in other Linux terminal apps, like they would be in Konsole on a more modern KDE desktop. Toshy doesn't change keybindings, it just remaps from the Mac combo onto the native Linux combo (when necessary).

So other than those glitchy X11 errors, I can't really find anything stopping Toshy from working. It just might need to be restarted sometimes after logging in, if it doesn't seem to be working right away. Opening the services log from the tray icon menu should make it clear when there are errors happening.

FYI, Leap has a problem documented in the FAQ section of the README, which is that you need to add your user to the systemd-journal group in order to see the services log output. (And that requires logging out or rebooting.)

I'll try to look into that Xlib exception, but I'm not sure I'll be able to figure out what causes it or how to prevent it.

RedBearAK commented 3 months ago

I actually have XDG_SESSION_DESKTOP set to "kde" here, and I didn't do anything about that manually. So there is something different about your setup. Maybe because I didn't bother to change the login manager to KDM. I left it the way it was with the "Generic Desktop" IceWM setup. I think KDM is failing to set the environment variable when it starts the session.

Also, the Konqueror file browser is so old and quirky that I haven't included it in the Finder Mods (but I did recently add Krusader, as well as I could). So some of the nice things that work in all the more recent Linux file managers won't work in Konqueror.

RedBearAK commented 3 months ago

I think I've done all I can do. Tweaked a few things to get more consistent behavior, but there are some strange things about this specific environment that I've never seen in any other environment.

Put in some code in the keymapper to catch that BadValue exception.

Other than that, I don't know of anything else to do. There will be a number of odd things just due to the nature of the environment. The Toshy apps don't show up in the app menu, for instance, perhaps because the user's local applications location is not recognized by the thing that scans for new apps. They can be loaded with these commands:

nohup toshy-tray &>/dev/null &
nohup toshy-gui &>/dev/null &

The extra stuff around the commands is to make them separate themselves from the shell, so they keep running if you close the shell, and don't push random output to the shell.

Trinity on Q4OS actually seemed to work a bit better than this, even though they should be closely related.

RedBearAK commented 3 months ago

All the changes I made for this KDE 3 environment have been merged into the main branch.

RedBearAK commented 3 months ago

I'm considering this resolved. Open a new issue if there are other problems encountered.