Skip to content
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

Linux Support #9

Open
mysticaltech opened this issue Jan 22, 2025 · 3 comments
Open

Linux Support #9

mysticaltech opened this issue Jan 22, 2025 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@mysticaltech
Copy link

This is absolutely amazing. Please support Linux, platforms like Ubuntu and Fedora, via PyAutoGui.

Context:

Yes, pyautogui supports Ubuntu, Fedora, and most other Linux distributions as long as Python is installed. However, there are some considerations and dependencies specific to Linux:


Steps to Use PyAutoGUI on Linux

  1. Install Python

    • Both Ubuntu and Fedora come with Python pre-installed. Use the following commands to ensure it's installed or to update it:
      sudo apt update && sudo apt install python3 python3-pip  # Ubuntu
      sudo dnf install python3 python3-pip  # Fedora
  2. Install PyAutoGUI

    • Install pyautogui via pip:
      pip3 install pyautogui
  3. Install Additional Dependencies

    • On Linux, pyautogui relies on python3-xlib, scrot, and xdotool for certain functionalities:
      • Ubuntu:
        sudo apt install python3-xlib scrot xdotool
      • Fedora:
        sudo dnf install python3-xlib scrot xdotool
  4. Test PyAutoGUI

    • Create a simple script to verify that pyautogui works:
      import pyautogui
      print(pyautogui.size())  # Should output your screen resolution

Key Features Supported on Linux

  • Mouse Control: Move the mouse, click, drag, and scroll.
  • Keyboard Control: Type strings, press keys, or trigger hotkeys.
  • Screenshot: Capture the screen or parts of it using scrot.
  • Image Recognition: Locate on-screen elements with screenshots.

Known Limitations on Linux

  • Wayland: If your desktop environment uses Wayland (common in Fedora and newer Ubuntu releases), pyautogui may face issues with capturing screenshots or mouse movements. Wayland restricts certain screen and input controls for security.

    • Workaround:
      • Switch to an X11 session (use the login screen to choose an X11 session).
      • For GNOME, run:
        sudo apt install gnome-session
        Log in with "GNOME on Xorg."
  • Permission Issues: Some environments require elevated permissions to control the screen or input. Use sudo cautiously for testing but avoid it for scripts in production.


Conclusion

Yes, pyautogui works on Ubuntu and Fedora, but you may need to adjust for dependencies and potential limitations if running on Wayland. For full compatibility, consider using X11.

@152334H
Copy link

152334H commented Jan 22, 2025

please do not clutter this repository with 4o generated garbage.

this codebase does not even use python, it is implemented in TypeScript.

@ycjcl868 ycjcl868 self-assigned this Jan 22, 2025
@ycjcl868 ycjcl868 added the enhancement New feature or request label Jan 22, 2025
@malv-c
Copy link

malv-c commented Jan 23, 2025

how to install in linux ?
please ;)
also support this please https://github.com/NexaAI/nexa-sdk.git
thanks

@QuinsZouls
Copy link

QuinsZouls commented Jan 23, 2025

Wayland support is a must for linux today.
We need alternatives for both display servers
Edit:
After a quick search, I found that the library https://github.com/nut-tree/nut.js that they use for control computer has Linux support, however only support X11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants