end-4 / dots-hyprland

Modern, feature-rich and accessible desktop configuration.
https://end-4.github.io/dots-hyprland-wiki/en/
GNU General Public License v3.0
3.08k stars 197 forks source link

[Feature] Respect User Configured XDG Environment Variables #549

Closed Makrennel closed 3 weeks ago

Makrennel commented 1 month ago

What would you like to be added? Support for the XDG Base Directories and XDG User Directories environment variables

How will it help It will help for users who have their environment variables set to use different paths besides $HOME/.config, $HOME/.local/share, and so on, as well as allowing users to save screenshots and screenrecording to user configured directories, rather than forcing use of $HOME/Videos and $HOME/Pictures

Extra info https://wiki.archlinux.org/title/XDG_Base_Directory https://wiki.archlinux.org/title/XDG_user_directories

I am willing to work on this myself and PR it if you aren't interested on doing this.

end-4 commented 1 month ago

am i missing something

Makrennel commented 1 month ago

install.sh autocreates and uses hardcoded paths. I'm not sure what can be done for ~/.local/bin as the xdg base dirs specification doesn't officially provide a variable for that, although I have seen people use and discuss XDG_BIN_HOME.

end-4 commented 1 month ago

@clsty 👉👈

clsty commented 1 month ago

install.sh autocreates and uses hardcoded paths. I'm not sure what can be done for ~/.local/bin as the xdg base dirs specification doesn't officially provide a variable for that, although I have seen people use and discuss XDG_BIN_HOME.

Currently the ~/.local/bin is only for fuzzel-emoji and rubyshot which are actually "import manually" thingy.

So, just remove the v rsync -av ".local/bin/" "$HOME/.local/bin/" line in install.sh will do; also the lines in uninstall.sh.

For other things, you may give a default value when it's not presented, e.g.

[[ -z "${XDG_CONFIG_HOME}" ]] && export XDG_CONFIG_HOME=${HOME}/.config

# ...
# Replace all the remainder ~/.config with ${XDG_CONFIG_HOME}

@end-4 Sorry I'm not near my home PC recently. Could you please handle this for me? Or leave it to me but wait for some days.

Makrennel commented 1 month ago

You can shorten that to

XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config}

I've managed to adapt install.sh, I can PR that (I'm going to test it first though), but update-dots.sh is taking me a second to wrap my head around.

Looking at uninstall.sh, it has a whole bunch of its own problems, like using debian's adduser/deluser scripts (doesn't exist on other distros by default) and no state checking on paths so if something doesn't exist it just fails and the script cannot be rerun. Also some dependencies it expects to remove seem to be missing.

I think it might be a good idea to use meta packages to list packages needed so that dependencies from a series can be uninstalled by removing a meta package, and the package manager can handle orphans by itself without having to manually edit every dependency that needs removing as and when they are added or removed to the install. Both yay and paru can build local PKGBUILDs the -B flag

clsty commented 1 month ago

I've managed to adapt install.sh, I can PR that (I'm going to test it first though), but update-dots.sh is taking me a second to wrap my head around.

Welcome to PR for that. As for update-dots.sh, you may just skip that one or work on it in future.

Looking at uninstall.sh, it has a whole bunch of its own problems, like using debian's adduser/deluser scripts (doesn't exist on other distros by default) and no state checking on paths so if something doesn't exist it just fails and the script cannot be rerun. Also some dependencies it expects to remove seem to be missing.

I think it might be a good idea to use meta packages to list packages needed so that dependencies from a series can be uninstalled by removing a meta package, and the package manager can handle orphans by itself without having to manually edit every dependency that needs removing as and when they are added or removed to the install. Both yay and paru can build local PKGBUILDs the -B flag

The uninstall.sh is not well maintained and user is not recommended to use it.

About the meta package, I've also thought of the same thing when I was writing install.sh, but I still don't know how to write PKGBUILD currently. PR is welcomed.

Makrennel commented 1 month ago

The uninstall.sh is not well maintained and user is not recommended to use it.

To be frank, given it's pretty destructive and it doesn't even work, it should probably just be removed until a better solution can be come to.

About the meta package, I've also thought of the same thing when I was writing install.sh, but I still don't know how to write PKGBUILD currently. PR is welcomed.

I'll look into it.

Makrennel commented 3 weeks ago

Should be finished, if I notice anything else I'll make a PR.