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

Added note about Linux-only support #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JonTheNiceGuy
Copy link

Further to the notes in #3 and #16

@verdverm
Copy link
Member

It actually only supports XOrg on linux, not Wayland. It actually wouldn't be difficult to put some OS checks around the 2-3 features which break cross platform, just disable them on mac/win.

@JonTheNiceGuy Any interest in doing the coding if I show you where to make the changes?

@JonTheNiceGuy
Copy link
Author

Apologies for the delays, life rather got in the way. Yes, I'm happy to do that, let me know what you need changing! :)

@lowpair
Copy link

lowpair commented Feb 24, 2021

@verdverm @JonTheNiceGuy
Hi, when will it be updated to support different OS functions?
Where are the features that need to be modified to broken across platforms?

@JonTheNiceGuy
Copy link
Author

Apologies @lowpair, I never got the list of things which needed changing, but to be fair, I never chased it up, as things dragged me in lots of different directions, and I don't have the time, space or capacity to look into this right now :(

@verdverm
Copy link
Member

@lowpair Most functionality is in this file: https://github.com/hofstadter-io/self-driving-desktop/blob/master/self_driving_desktop/parser.py

a lot is determined by pyautogui, but Xorg is being used in places, so...

  • we can cross platform whatever pyautogui supports (as it is cross platform)
  • checks around Xorg need to happen and those commands probably need some error message, or better an alternative.

Xorg is used mainly for recording, finding the active window, and setting focus to a window.

@lowpair
Copy link

lowpair commented Feb 25, 2021

@JonTheNiceGuy @verdverm
Hi, I have the win system. After a simple attempt, play can run on win10, but record doesn't have time to improve. maybe It need a lot of modification;

Now the revised part is introduced as follows(parser.py):

import win32gui , need run : pip install pypiwin32

import platform
if platform.system().lower() == 'windows':
import win32gui,win32con
else:
from Xlib import display, X
d = display.Display()

Modify the active and focus sections

if t.data == "active": # Name the new window
    name = t.children[0]
    if platform.system().lower() == 'windows':
        w = win32gui.GetForegroundWindow() # get the top active window
    else:
        w = d.get_input_focus().focus
    wins[name] = w
    return


if t.data == "focus":
    name = t.children[0]
    w = wins[name]
    if platform.system().lower() == 'windows':
        win32gui.ShowWindow(w, win32con.SW_SHOWNORMAL)
    else:
        w.set_input_focus(X.RevertToNone, X.CurrentTime)
        w.configure(stack_mode=X.Above)
        d.sync()
    return

I can run now, but I haven't done a comprehensive test;

@verdverm
Copy link
Member

@lowpair do you have a link to that python lib for windows? I have a system I may be able to try it out on, and also against linux at the same time. Would like to take a look around that library to see if there are any other useful functions for doing the other stuff Xorg is doing.

Will probably have to do something for Wayland as well... Assuming Mac might be out of reach b/c they lock down more and have increased that lockdown more recently

@lowpair
Copy link

lowpair commented Mar 2, 2021

@verdverm
I just run pip install pypiwin32 , and installed the pypiwin32 module.

I looked up github, and I think it’s the project

https://github.com/Googulator/pypiwin32

Hope is useful to you;

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

Successfully merging this pull request may close these issues.

None yet

3 participants