[Question] Why not use symlinks for .current.wall
Hi ^^
So i read in the closed bugs that at some point you had symlinks set up for the .current.wall file and (if I read the code correctly) you are now using an exec command in the hyprland config to copy the wallpaper file on every reload.
My question: what was the issue with using symlinks?
in my fork of the repo i changed the wallpaper system so the python code writes a symlink every time a wallpaper is selected like this:
def on_wallpaper_selected(self, iconview, path):
model = iconview.get_model()
file_name = model[path][1]
full_path = os.path.join(data.WALLPAPERS_DIR, file_name)
selected_scheme = self.scheme_dropdown.get_active_id()
current_wall = os.path.expanduser(f"~/.current.wall")
# new code
if os.path.isfile(current_wall):
os.remove(current_wall)
os.symlink(full_path, current_wall)
# end new code
if self.matugen_switcher.get_active():
# Matugen is enabled: run the normal command.
exec_shell_command_async(f'matugen image {full_path} -t {selected_scheme}') # could also be 'matugen image ~/.current.wall
else:
# Matugen is disabled: run the alternative swww command.
exec_shell_command_async(
f'swww img {full_path} -t outer --transition-duration 1.5 --transition-step 255 --transition-fps 60 -f Nearest'
)
Additionally in the config.py (i have it in the main.py because i can't run config.py with my nixos installation) you could create a symlink to one of the example files if .current.wall does not exist yet:
current_wallpaper = os.path.expanduser("~/.current.wall")
if not os.path.exists(current_wallpaper):
example_wallpaper = os.path.expanduser(f"~/.config/{APP_NAME_CAP}/assets/wallpapers_example/example-1.jpg")
os.symlink(example_wallpaper, current_wallpaper)
I think just linking the files would be better for system resources and also readability of the code, as right now the copying process of the wallpaper file is in the hyprland config and it took me quite a while to find it ^^"
Hi, it was just a hotfix because people were getting some recursive symlinks. But if you found a way to make it work, I would gladly accept a PR. :) I also prefer using symlinks, I just wanted to avoid debugging that at that time lmao.
Ah, i see ^^ I will try to make a PR on the weekend ^^
Let's keep this open until it is implemented. :D