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

Waypaper is still trying to write to the configuraiton file, even if use_xdg_state = True #98

Open
diegoroccia opened this issue Nov 17, 2024 · 6 comments

Comments

@diegoroccia
Copy link

diegoroccia commented Nov 17, 2024

I have the following configuration

[Settings]
language = en
folder = ~/Pictures/wallpapers
backend = hyprpaper
monitors = All
fill = Fill
sort = name
color = #ffffff
subfolders = True
number_of_columns = 3
post_command = 
show_hidden = False
show_gifs_only = False
use_xdg_state = True

So I would expect that the config.ini file doesn't need to be touched by the app. I am using home-manager on Ubuntu and this file is set as immutable/readonly. When I try to change wallpaper, though, this is what happens:

> ~/.local/pipx/venvs/waypaper/bin/waypaper --random
We got: en
True # <- This is just me testing that the use_xdg_state was currently set
Traceback (most recent call last):
  File "~/.local/pipx/venvs/waypaper/bin/waypaper", line 8, in <module>
    sys.exit(run())
             ^^^^^
  File "~/.local/pipx/venvs/waypaper/lib/python3.12/site-packages/waypaper/__main__.py", line 67, in run
    cf.save()
  File "~/.local/pipx/venvs/waypaper/lib/python3.12/site-packages/waypaper/config.py", line 214, in save
    with open(self.config_file, "w") as configfile:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '~/.config/waypaper/config.ini'
@anufrievroman
Copy link
Owner

I see. Yes, it tries to overwrite the config even if you use state file. To be honest, I never used the immutable systems like that, so I'm not sure what's the expected behavior is. Currently, state file only stores information about monitors and wallpaper (according to previous discussions). But all the other settings are still stored in the config (and overwritten when changed). So, for you, the expected behavior would be that everything is stored in the state file, or just that it does not crash if permission denied? Or all the things that can be changed via GUI should be stored in the state file (which is almost all things)?

anufrievroman added a commit that referenced this issue Nov 19, 2024
@darth62969
Copy link
Contributor

I think that using state files in general might be the better option. Especially if you are using them in the first place. otherwise we should use the config file.

@jgregoire
Copy link

I manage my dotfiles with git. Every time I run waypaper --random it changes the file, which shows up as an annoying change in the repo.

The config file should not change if I haven't launched the GUI and changed settings. State and config should not share a file, IMO.

I would like to see either a separate state file, or a config option like stateful = False since I just want a random wallpaper every boot.

@darth62969
Copy link
Contributor

darth62969 commented Dec 20, 2024

Why are you managing your dot files in your dot files? You should keep them separate and use a script to port the changes over.

Rule one of development, never run prod off your development server. :P

Like seriously though. copy your dot files somewhere else and then copy them over once you are done modifying them to test. This will avoid this issue entirely.

example script:
https://github.com/darth62969/BeyondTheWired_Theme/blob/master/UpdateConfigs.sh

@anufrievroman
Copy link
Owner

Hmm, I thought that if we use a state file, then config.ini is not rewritten upon --random just to save a new wallpaper. I'll see, probably we can fix that...

@jgregoire
Copy link

Why are you managing your dot files in your dot files? You should keep them separate and use a script to port the changes over.

Rule one of development, never run prod off your development server. :P

Like seriously though. copy your dot files somewhere else and then copy them over once you are done modifying them to test. This will avoid this issue entirely.

example script: https://github.com/darth62969/BeyondTheWired_Theme/blob/master/UpdateConfigs.sh

Thanks for the unsolicited advice.

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

4 participants