eylles / pywal16

16 colors fork of pywal
MIT License
157 stars 24 forks source link

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

Closed RioNight closed 2 months ago

RioNight commented 3 months ago

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 commented 3 months ago

Ah that was added back in pull request https://github.com/eylles/pywal16/pull/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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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: https://github.com/eylles/pywal16/blob/b9ce25b085a6d0801a48c85574e1b310f78305de/pywal/util.py#L180-L186

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 commented 2 months ago

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

eylles commented 2 months ago

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

eylles commented 2 months ago

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