DonTizi / ReMind

Your Local Artificial Memory on your Device.
https://www.recallmemory.io/
Apache License 2.0
412 stars 22 forks source link

PyAutoGUI issues: Only works for x11 on Linux systems #6

Closed kikisprdx closed 1 month ago

kikisprdx commented 4 months ago

First off I want to say I'm loving the idea behind this and its great to see a local and open source alternative to RewindAI. I'm a big fan.

The issue I'm facing right now is regarding with how screenshots are handled. I'm running an Arch linux system, on a wayland display server. Hence, the conflict here is that PyAutoGUI is just not compatible and as it stand only systems running x11 are supported. I'm also interested in what are the future plans for linux support?

Potential Solutions:

  1. Provide a fallback mechanism to use alternative libraries or approaches for Wayland environments, such as python-evdev, pynput, or D-Bus.

Error Stack:

Traceback (most recent call last):
  File "/home/kikis/Workplace/reMind/memory_capture/record_photo.py", line 8, in <module>
    import pyautogui
  File "/home/kikis/Workplace/reMind/venv/lib/python3.12/site-packages/pyautogui/__init__.py", line 246, in <module>
    import mouseinfo
  File "/home/kikis/Workplace/reMind/venv/lib/python3.12/site-packages/mouseinfo/__init__.py", line 223, in <module>
    _display = Display(os.environ['DISPLAY'])
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kikis/Workplace/reMind/venv/lib/python3.12/site-packages/Xlib/display.py", line 80, in __init__
    self.display = _BaseDisplay(display)
                   ^^^^^^^^^^^^^^^^^^^^^
  File "/home/kikis/Workplace/reMind/venv/lib/python3.12/site-packages/Xlib/display.py", line 62, in __init__
    display.Display.__init__(*(self, ) + args, **keys)
  File "/home/kikis/Workplace/reMind/venv/lib/python3.12/site-packages/Xlib/protocol/display.py", line 60, in __init__
    auth_name, auth_data = connect.get_auth(self.socket,
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kikis/Workplace/reMind/venv/lib/python3.12/site-packages/Xlib/support/connect.py", line 91, in get_auth
    return mod.get_auth(sock, dname, h
ost, dno)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kikis/Workplace/reMind/venv/lib/python3.12/site-packages/Xlib/support/unix_connect.py", line 103, in new_get_auth
    au = xauth.Xauthority()
         ^^^^^^^^^^^^^^^^^^
  File "/home/kikis/Workplace/reMind/venv/lib/python3.12/site-packages/Xlib/xauth.py", line 45, in __init__
    raise error.XauthError('~/.Xauthority: %s' % err)
Xlib.error.XauthError: ~/.Xauthority: [Errno 2] No such file or directory: '/root/.Xauthority'
josh-at-straker commented 4 months ago

I'd like to also add to this that the screenshot function under Wayland require gnome-screenshot, which is probably the most annoying way to screenshot on Linux.

When gnome-screenshot triggers, the screen flashes white, and a camera shutter alert is played. So, having your screen flash white and make sound every x seconds is not too fun! :)

It would be great to use something else that does not do this, or see if PyAutoGUI has other options.