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

Provide nicer interface for CURRENTWINDOW #13

Open
rshk opened this issue Feb 1, 2016 · 0 comments
Open

Provide nicer interface for CURRENTWINDOW #13

rshk opened this issue Feb 1, 2016 · 0 comments

Comments

@rshk
Copy link
Owner

rshk commented Feb 1, 2016

Many Xdo methods have a signature like method(window, ...), but it would be nice to have window optional, and default to CURRENTWINDOW.

One alternative can be to swap arguments, but either:

  • we create inconsistency with the C library, making things harder for the user
  • we create two versions of each function

One option might be to have some Window(window_id) object, whose methods are (in a controlled way!) equivalent to name = partial(name, window_id)

NOTE: we need to pass the Xdo instance as well along the way to Window

import xdo
x = xdo.Xdo()

current_window = x.get_window()  # Returns a Window(xdo, 0)

some_id = x.get_window_at_mouse()
some_window = x.get_window(some_id)  # Returns a Window(xdo, window_id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant