Coder Social home page Coder Social logo

Comments (6)

Pololot64 avatar Pololot64 commented on June 18, 2024 1

Hello! Thanks for all the work you have done so far! Yes, unfortunately when I started this project I had no idea that people used things other than bash. I hope to have them supported and I am open to contributions. I am thinking that a sort of addon system would be good. Pull requests are good and code review is good too. I am aware much of the code is messy :). Part of it is due to the fact that I scrambled to finish it and fix some bugs before summer ended. I have not been able to change much during the school year.

I do not have a list of dependencies written down yet but that can all be installed via pip. They can be found by trial and error I guess but I will make this more clear.

The structure of the program is relatively simple. The file manager.py handles the dashboard gui and shortcut functionality. The file main.py is the service that runs in the notification tray and handles the main vcxsrv instance.

I build it with pyinstaller at the moment. I first bundle main as a onefolder in noconsole mode and then bundle manager. I copy the generated binaries into one folder and ignore file conflicts. They share dependencies. Then copy all the assets other than the original python files into that folder. Running Manager.exe should start the service and pull up the dashboard. Packaging the program for the store is a whole other story and requires other steps but it does not directly affect the rest of the program.

I do not have my development computer on me at the moment so I am writing this from memory but I hope to soon have it documented.

from gwsl-source.

sanzoghenzo avatar sanzoghenzo commented on June 18, 2024

Hi @Pololot64,

I started to analyze and reorganize your code, but I think it's trying to do too many things at once.

So I took another approach, and I hope you don't mind: I extracted and organized the wsl management part into a separate library called wsl-tools.
I think it could be useful also to other projects.

You can install it via pip install wsl-tools.

I still have to publish the api reference on github pages, but you can find the information in the docstrings and in the tests.

here's a quick example:

from wsl_tools import wsl_tools

manager = wsl_tools.WSLManager()
# manager.names holds all the non-blacklisted distros names
distro_name = choose_machine(manager.names)
# access the distro using the name as key
distro = manager[distro_name]
# access the installed GUI apps names
app = choose_app(distro.gui_apps.keys())
# run the app loading .profile first
distro.run_command(app.cmd, load_profile=True)

I found out that you can ignore the default shell and run sh -lc {command} to run sh (=bash on debian or ash on alpine) and load the .profile, so I kept the various settings there.
I also got rid of the helper script and tried to do as much as I could in the WSLDistro class: the various envvar to get from/set to the .profile are properties of that class (gtk_scale, qt_scale, theme, etc.).

I didn't try to use wsl-tools in gwsl yet (and I still need to test gui apps with it!), but if you like this approach I could integrate it along with other things (a settings manager, path manager, cli argument parsing, etc).

from gwsl-source.

Pololot64 avatar Pololot64 commented on June 18, 2024

Wow! This is amazing! I am going to test it as soon as I am able! I am wondering though, how did you get xdg.DesktopEntry to work on Windows? The reason I wrote the whole messy script was because I could not get it to run.

from gwsl-source.

sanzoghenzo avatar sanzoghenzo commented on June 18, 2024

The trick is done in _unc_path_from_cmd method: with it you can convert the wsl POSIX path to the \\wsl$\distro-name path, so you can access and edit the files directly in python.

The method also follows the symlinks, because windows can't do it;
In fact, the .desktop files retrieval has a limitation: since I only use the method to get the directory and then glob all the .desktop files, any entry that is a symlink cannot be read, and it's ignored at the moment. (I should file an issue to remember to fix this!)

from gwsl-source.

Pololot64 avatar Pololot64 commented on June 18, 2024

I see! I never realized that there was a pyxdg 🤦‍♂️. By the way, alot of this could be integrated but it would take some work. Would you want to create a quicker contact system? Maybe the Discord server?

from gwsl-source.

sanzoghenzo avatar sanzoghenzo commented on June 18, 2024

ok, I'll meet you there!

from gwsl-source.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.