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

Removing fcntl calls to get pywal16 to work on windows #49

Closed
RioNight opened this issue May 28, 2024 · 7 comments
Closed

Removing fcntl calls to get pywal16 to work on windows #49

RioNight opened this issue May 28, 2024 · 7 comments
Milestone

Comments

@RioNight
Copy link

pywal originally worked on Windows to generate color schemes.
It had to be run with wal -n, which skipped setting the wallpaper, but the colorscheme generation worked fine, and you were able to theme bash, vscode, your browser, etc.
pywal16 however does not seem to work because of the fcntl calls present in one function here.
fcntl is not available on Windows, so could it be replaced with something more portable or removed altogether?
Thanks.

@eylles
Copy link
Owner

eylles commented May 28, 2024

Ah that was added back in pull request #40 to fix a problem that had been dragged since the original pywal, which was pywal getting stuck trying to write onto write blocked terminals, but flow control as a concept doesn't exist on the windows platform...

After some search the only options seem to be: check if [portalocker](https://github.com/wolph/portalocker) supports checking for nonblocking io OR modify the code such that flow control is only used on platforms that support it.

@RioNight
Copy link
Author

For what it's worth, if you install git for Windows, you get a bash.exe with a posix environment which you can use in any terminal. Ctrl-S suspends works in bash to suspend things.

@eylles
Copy link
Owner

eylles commented May 29, 2024

So you can do have write blocked processes, files and file descriptors on windows... then simply using an if to decide if the platform supports flow control is not enough, there needs to be a way to avoid writing to write blocked file and file descriptors on windows...

Okay got it, will have to check if portalocker supports the functionality or find a library that supports the functionality and supports unices and windows.

@eylles eylles added this to the 3.6.0 milestone Jun 2, 2024
@eylles
Copy link
Owner

eylles commented Jun 6, 2024

okay, i'm not sure portalocker supports the functionality on windows to check if a file is not accepting input, or at least i'm not capable of navigating the portalocker documentation to find a function equivalent of the calls to get an io error in:

pywal16/pywal/util.py

Lines 180 to 186 in b9ce25b

# Get the current flags and add non-blocking mode
# to skip TTYs suspended by Flow Control
# https://www.gnu.org/software/libc/manual/html_node/Getting-File-Status-Flags.html
# https://www.gnu.org/software/libc/manual/html_node/Open_002dtime-Flags.html
flags = fcntl.fcntl(file, fcntl.F_GETFL)
fcntl.fcntl(file, fcntl.F_SETFL, flags | os.O_NONBLOCK)
file.write(data)

so the way i will proceed will be a check to see if pywal is running on a platform that supports fcntl before even importing the module.

@eylles
Copy link
Owner

eylles commented Jun 27, 2024

couldn't figure out migrating the fcntl calls to portalocker so went with a try except and an if on #53

@eylles
Copy link
Owner

eylles commented Jun 29, 2024

i plan to push the next release before the next month, will close this on the next version.

@eylles
Copy link
Owner

eylles commented Jul 2, 2024

yeh sure, before next month... anyway, closing now since i want to have the release this week.

@eylles eylles closed this as completed Jul 2, 2024
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

No branches or pull requests

2 participants