Giter VIP home page Giter VIP logo

Comments (14)

logix2 avatar logix2 commented on May 18, 2024 1

Until you get to that, maybe you can at least hardcode it to something like ~/.config/guiscrcpy/ ? (where ~ is the user home dir; this also works: $HOME/.config), or make the config file hidden by adding a . (dot) to the beginning of the filename? Users are generally unhappy with having apps creating files (that are not hidden) directly in their home folder.

from guiscrcpy.

srevinsaju avatar srevinsaju commented on May 18, 2024 1

@logix2 @lhanson The configuration file has been moved to XDG_CONFIG_HOME if it is define, defaults to .config/guiscrcpy. Please review and let me know

from guiscrcpy.

srevinsaju avatar srevinsaju commented on May 18, 2024

Is XDG_CONFIG_HOME works same as C:\Users\xxx\AppData\ in Windows.

The configuration file is not created by the user, but it is created by the python file to save the information. If the user would like to edit the configuration file, one may, the instructions on the config file is in the main.py. I shall transfer it to the README.md

from guiscrcpy.

logix2 avatar logix2 commented on May 18, 2024

I don't know how C:\Users\xxx\AppData\ works on Windows, I rarely use it.

$XDG_CONFIG_HOME defines the base directory relative to which user specific configuration files should be stored. If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used.

There's also $XDG_DATA_HOME for data files.

See this for more information: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

from guiscrcpy.

srevinsaju avatar srevinsaju commented on May 18, 2024

I have to restructure the code for this, applying for both Windows and Linux. The user home directory was easier for me,because on Linux, it points to ~/guiscrcpy.cfg and on Windows, it points to C:/Users//guiscrcpy.cfg

The commit fixing these will be released shortly with the fix for main window resizing problem, hidden landscape button, restructured debug statement with "LOG: ***" , or "ERR: ***" to create a uniformity..

from guiscrcpy.

srevinsaju avatar srevinsaju commented on May 18, 2024

from guiscrcpy.

lhanson avatar lhanson commented on May 18, 2024

No need to guess on a default directory, the spec is clear on what the defaults are if the user hasn't specified an alternate and many libraries exist to derive it for you.

from guiscrcpy.

srevinsaju avatar srevinsaju commented on May 18, 2024

@logix2, guiscrcpy.cfg file is moved to .config in home dir on Linux and AppData/Local on Windows, Home directory on Mac.

Marking this as fixed, you may try it.
I shall close the issue in 2days

from guiscrcpy.

lhanson avatar lhanson commented on May 18, 2024

Does it simply save to $HOME/.config/guiscrcpy.cfg? If so, it shouldn't be hardcoded as such, it should respect $XDG_CONFIG_HOME if set.

from guiscrcpy.

srevinsaju avatar srevinsaju commented on May 18, 2024

It saves to $HOME/.config/guiscrcpy.cfg. I am not sure if $XDG_CONFIG_HOME is available on all Linux platforms, and I would not like to edit System variables as such. Probably I didn't understand @lhanson 's comment on this. @lhanson , could you please explain me?

from guiscrcpy.

lhanson avatar lhanson commented on May 18, 2024

@srevinsaju Sure. $XDG_CONFIG_HOME is not typically set by default on Linux systems, and it's not required by the spec. If the user doesn't set it, the specification says that an application's configuration goes in a subdirectory under $HOME/.config. In this case, it would be a directory called $HOME/.config/guiscrcpy, e.g. the file would be called $HOME/.config/guiscrcpy/guiscrcpy.py; or better yet, for less redundancy, $HOME/.config/guiscrcpy/config.py.

So users don't need to do anything if they are okay with the defaults or don't care, but they're able to express a different preference if they choose to.

It's best not to hardcode this logic in your code, I'd suggest using something like the xdg module; that way, you can just look up the path from the module and it handles the logic for you.

from guiscrcpy.

srevinsaju avatar srevinsaju commented on May 18, 2024

@lhanson, I understood the benfits of using $XDG_CONFIG_HOME, but s this variable predefined in all the Linux distros, for example, in Raspbian, or in Gentoo, and other non-popular Linux Oses. I used ~/.config/guiscrcpy.cfg because, its safer compared to $XDG_CONFIG_HOME, because all the Linux distros have .config folder in their home directory. If $XDG_CONFIG_HOME is predefined in all Linux distros, including Android Linux, I shall implement it. I am planning to implement guiscrcpy for Android as well, which includes Android to Android screen mirroring as well.
Please advise me on $XDG_CONFIG_HOME variable. I would love to know more on this!

from guiscrcpy.

lhanson avatar lhanson commented on May 18, 2024

$XDG_CONFIG_HOME is not predefined on any distro I know of. The point of the specification is to assume a default (~/.config/guiscrcpy/) until/unless the user wants it somewhere else, at which point they have the option to manually set $XDG_CONFIG_HOME, and compliant apps should respect that.

Hardcoding it to ~/.config is not safer because it still ignores the user's wishes if they don't want it there.

I suggest reading over the spec, it's not that long or complicated: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

from guiscrcpy.

srevinsaju avatar srevinsaju commented on May 18, 2024

Hmm, thanks @lhanson for the info, will fix it for the next Linux Release v1.11. As running guiscrcpy config flle from ~/.config is not very tedious, I will keep this issue open, until I commit the $XDG_CONFIG_HOME. Thank you

from guiscrcpy.

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.