rbreaves / kinto

Mac-style shortcut keys for Linux & Windows.
http://kinto.sh
GNU General Public License v2.0
4.41k stars 213 forks source link

Failure on upgrade to XUbuntu 23.04 #805

Closed nikolayg closed 1 year ago

nikolayg commented 1 year ago

Describe the bug After upgrading to Xubuntu 23.04 Kinto no longer works. I uninstalled and then installed again. I can see an error regarding xkeysnail in the logs. I installed xkeysnail, but that didn't help:

sudo apt install python3-pip
sudo pip3 install xkeysnail

Kinto-bug

Logs and status if relevant

# xkeysnail
$ sudo systemctl status xkeysnail
● xkeysnail.service - xkeysnail
     Loaded: loaded (/lib/systemd/system/xkeysnail.service; disabled; preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Wed 2023-04-26 14:33:07 AEST; 329ms ago
    Process: 11787 ExecStart=/usr/bin/sudo /bin/bash -c /usr/bin/xhost +SI:localuser:root && /home/nikolay/.config/kinto/killdups.sh && /usr/local/bin/xkeysnail --quiet --watc>
   Main PID: 11787 (code=exited, status=1/FAILURE)
        CPU: 195ms
RedBearAK commented 1 year ago

@nikolayg

That looks like an odd Python problem, with the launcher stub file for xkeysnail being unable to import the cli_main module from... itself. It's not a problem with the xkeysnail package not being installed, it's more like some kind of Python path issue.

All the file at that location contains is this:

#!/usr/bin/python3
# -*- coding: utf-8 -*-

if __name__ == '__main__':
    from xkeysnail import cli_main
    cli_main()

That looks for the module to be installed somewhere in the "paths" that Python knows about. What do you get from these commands:

python3 -c "import sys; print(sys.path)"
echo $PYTHONPATH

This last one will probably have no output.

nikolayg commented 1 year ago

I think the problem is that Ubuntu 23.04 uses a newer python 3.10, which limits how dependencies are installed. Here is the log I get when I run the installation script locally (from git):

Kinto--bug2

RedBearAK commented 1 year ago

@rbreaves @nikolayg

This seems to be triggered by the attempt to use pip to install additional Python packages. Xubuntu is managing the Python environment with its own packaging system and is discouraging the use of pip to install Python packages that aren't available in native DEB packages.

Suggested solutions are using pipx (sudo apt install pipx) or some other method to create a virtual environment.

This is kind of outside my knowledge area, but it looks like the installation procedure will need to be reworked a bit.

I installed pipx and then used it to install the patched version of xkeysnail from the folder that the Kinto installer cloned, then I was able to get through the terminal install.

pipx install ~/Downloads/kinto-master/xkeysnail

If you don't use the patched version of xkeysnail you'll find that shortcuts like Cmd+Tab, Tab, Tab won't work correctly.

Additional package that needs to be installed to get the GUI app to appear, so that the keyboard type can be set:

gir1.2-vte-2.91

Also, Xubuntu has a background application that takes over the Meta key (Super/Win key). That needs to be disabled so that you can successfully get through the install GUI.

Open the "Session and Startup" control panel app, go to the "Application Autostart" tab, and uncheck the "Bind Super Key" item. That will stop the xcape command from running at startup.

Then kill the existing process that is binding the Super/Win/Meta key:

killall xcape

Strangely, that didn't let me get through the GUI installer by tapping the Meta key, so I just hit "Alt" and then changed the keyboard type with the menu from "Apple" to "Windows" once the main Kinto window appeared.

That's the best I can do for now with an explanation and solution to this.

Additional packages needed to get the tray icon working:

gir1.2-notify-0.7

and 

gir1.2-appindicator3-0.1
  or
gir1.2-ayatanaappindicator3-0.1

Edit: Also kept working after a reboot, so it seems there isn't a larger problem at work. Just the Python environment glitches.

zachfeldman commented 1 year ago

This also happened to me on the latest Ubuntu (Lunar Lobster) and exacerbated this closed issue: https://github.com/rbreaves/kinto/issues/616#issuecomment-1529755673

nikolayg commented 1 year ago

I can confirm that the following works for me now on Ubuntu 23.4, based on this answer:

sudo apt install pipx
git clone https://github.com/rbreaves/kinto.git
cd kinto
pipx install xkeysnail
python3 ./setup.py

I'm closing this issue, although this probably needs to be documented or fixed in the main installation script.

Thanks @RedBearAK !

RedBearAK commented 1 year ago

@nikolayg

I don't think you or others will end up with the correct version (patched for "held" keys) of xkeysnail if you do it this way:

pipx install xkeysnail

That will probably try to grab the version of xkeysnail available to pip, which is v0.4.0, without the patch.

What you probably want to do instead is install from the local folder, like in my post above.

pipx install ~/Downloads/kinto-master/xkeysnail

And that needs to be done by running the Kinto installer once and letting it fail, so that it grabs its preferred version of xkeysnail. Before the Kinto installer runs, that local folder won't exist.

In other words, the installer really needs to be fixed.

I may be wrong, but I suspect if you try to do Cmd+Tab, Tab, Tab or Cmd+Grave, Grave, Grave you'll find that it won't behave like you expect.

nikolayg commented 1 year ago

Thanks @RedBearAK - it seems to be working at the moment, so I won't touch it 😅

If I encounter any issues, I'll reinstall as suggested!