-
Notifications
You must be signed in to change notification settings - Fork 175
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
Consistently use XDG base directiories #381
Conversation
There's a problem though. I found that on my Arch Linux, echo "1$XDG_CONFIG_HOME 2$XDG_CACHE_HOME 3$XDG_STATE_HOME" Outputs According to Arch Wiki, it seems that these vars are not set by default. To solve this problem, if it's in a bash script, we can use |
I don't believe I do appreciate your help and offer, though. As far as these variables not being defined, yes, that can happen and is perfectly compliant with the spec. The fix you propose is already included in this PR. If you check the first lines of the shell scripts I changed, you will find I have added the block
This is done simply so we don't have to include the default value everywhere and keep the rest of the file easier to read. As far as code in AGS is concerned, it doesn't need any particular workaround: |
As far as I know, the environment variables of a process are only passed to its sub-process, which means if AGS is running some bash scripts containing those default values for XDGs, AGS will not able to know these values, since AGS is their parent process. I don't know well about AGS. Maybe you are right. |
You are right that these variables are not passed to AGS. These variables aren't even passed to child processes: that only happens to variables marked with However, this is fully intended and not a problem. Every script has its own fallback definitions and AGS does not explicitly need the fallbacks. The behavior of the built-in functions |
Hi! I just rebased this on current main and fixed any issues that cropped up (that I could find). Is there anything I could do to help get this merged? |
f7afed2
to
21fae43
Compare
Unfortunately, I have just found a potential issue with how the SCSS is handled. I'll look into it and patch it asap. |
It turns out this line in the dart-sass docs is only mildly accurate:
The current directory always wins over any load paths. Therefore I had to move |
ugh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No other problem in the code
Btw sorry for being lazy
.config/ags/config.js
Outdated
Utils.exec(`bash -c 'echo "" > ${App.configDir}/scss/_musicwal.scss'`); // reset music styles | ||
Utils.exec(`bash -c 'echo "" > ${App.configDir}/scss/_musicmaterial.scss'`); // reset music styles | ||
Utils.exec(`bash -c 'echo "" > ${GLib.get_user_state_dir()}/ags/scss/_musicwal.scss'`); // reset music styles | ||
Utils.exec(`bash -c 'echo "" > ${GLib.get_user_state_dir()}/ags/scss/_musicmaterial.scss'`); // reset music styles | ||
async function applyStyle() { | ||
Utils.exec(`mkdir -p ${COMPILED_STYLE_DIR}`); | ||
Utils.exec(`sass ${App.configDir}/scss/main.scss ${COMPILED_STYLE_DIR}/style.css`); | ||
Utils.exec(`sass -I "${GLib.get_user_state_dir()}/ags/scss" -I "${App.configDir}/scss/fallback" "${App.configDir}/scss/main.scss" "${COMPILED_STYLE_DIR}/style.css"`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
messes up styles ¯_(ツ)_/¯
.config/ags/config_overviewOnly.js
Outdated
Utils.exec(`bash -c 'echo "" > ${App.configDir}/scss/_musicwal.scss'`); // reset music styles | ||
Utils.exec(`bash -c 'echo "" > ${App.configDir}/scss/_musicmaterial.scss'`); // reset music styles | ||
const COMPILED_STYLE_DIR = `${GLib.get_user_cache_dir()}/ags/user/generated` | ||
Utils.exec(`bash -c 'echo "" > ${GLib.get_user_state_dir()}/ags/scss/_musicwal.scss'`); // reset music styles | ||
Utils.exec(`bash -c 'echo "" > ${GLib.get_user_state_dir()}/ags/scss/_musicmaterial.scss'`); // reset music styles | ||
async function applyStyle() { | ||
Utils.exec(`mkdir -p ${COMPILED_STYLE_DIR}`); | ||
Utils.exec(`sass ${App.configDir}/scss/main.scss ${COMPILED_STYLE_DIR}/style.css`); | ||
Utils.exec(`sass -I "${GLib.get_user_state_dir()}/ags/scss" -I "${App.configDir}/scss/fallback" "${App.configDir}/scss/main.scss" "${COMPILED_STYLE_DIR}/style.css"`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
/* Error: Can't find stylesheet to import.
* ,
* 2 | @import 'musicmaterial';
* | ^^^^^^^^^^^^^^^
* '
* .config/ags/scss/_music.scss 2:9 @import
* .config/ags/scss/main.scss 27:9 root stylesheet */
body::before {
font-family: "Source Code Pro", "SF Mono", Monaco, Inconsolata, "Fira Mono",
"Droid Sans Mono", monospace, monospace;
white-space: pre;
display: block;
padding: 1em;
margin-bottom: 1em;
border-bottom: 2px solid black;
content: "Error: Can't find stylesheet to import.\a \2577 \a 2 \2502 @import 'musicmaterial';\a \2502 ^^^^^^^^^^^^^^^\a \2575 \a .config/ags/scss/_music.scss 2:9 @import\a .config/ags/scss/main.scss 27:9 root stylesheet";
} |
No need to be sorry! I'm thankful you're developing this! I believe I know the issue and why it's working for me and not for you. I forgot to create ~/.local/state/ags/scss if it doesn't already exist. I must have inadvertently done that and not realized that step is missing. I'll push a fix for this. |
seems good, i'll merge |
is there anything else that needs to be done to make sure nix users are happy? |
Thanks for merging! I have a lot of things working right now in a Nix environment. You can simply run If one also (manually) applied your other configs, I imagine dynamic color generation would work. In my setup it works only for AGS, but not for Hyprland, since my Hyprland config is also read-only. I'm still working on making more things work and as I discover ways to do that, I'll discuss and submit more patches. EDIT: The code for my Nix package is here (technically also here and here). |
it's not needed anymore This reverts commit 8f3721e.
Hi! First off: thank you for the wonderful work you've done in this project! Everything looks so extremely polished.
This PR serves two main functions:
First, it consistently uses the XDG base directory spec. Before, it was already used in many places (via the GLib functions
get_user_xyz_dir
), but not everywhere. Other locations used the default values for these paths directly (e.g.~/.config
and~/.cache
). While it is rare to see a system that changes these defaults, it could happen and the inconsistent handling would break your config.Further, it moves some files from XDG_CONFIG_HOME and XDG_CACHE_HOME to XDG_STATE_HOME. This happens for two different reasons:
applycolor.sh
still writes to the config folders of other programs. Unfortunately, I do believe there is no simple, generic solution to avoid this.I have done my best to seperate these changes into smaller commits that make sense individually.
I did not spot any regressions, but I'm not familiar with all of the features, so it's possible I missed some. In particular, much of the dynamic color feature does not currently/not yet work on my NixOS setup, therefore my tests pertaining it are rather superficial.