Skip to content

Added "source=" capability to Hyprpaper .conf file - #267

Merged
vaxerski merged 2 commits into
hyprwm:mainfrom
Blake-sama:main
Jul 27, 2025
Merged

Added "source=" capability to Hyprpaper .conf file#267
vaxerski merged 2 commits into
hyprwm:mainfrom
Blake-sama:main

Conversation

@Blake-sama

Copy link
Copy Markdown
Contributor

Hi, short answer: I'm creating a Wallpaper Manager in Rust (rs-paper name pending*) and as part of my logic for saving wallpaper "sets", I need to be able to quickly adjust per-display wallpapers without altering other monitors. I've come up with the solution of having .conf files for each display (auto-created by parsing hyprctl -j monitor results) and my app will take a selected wallpaper and update the specific .conf file to that wallpaper.

Using $variables, I can have a file be DP-1.conf and echo into it $DP-1 = path/to/image.png
Now my hyprpaper.conf can read:
preload = $DP-1
wallpaper = DP-1, $DP-1

I never adjust hyprpaper.conf outside of initial setup (which runs on start-up for simplicity) and my logic only targets per-monitor .conf files instead of re-writing the entire hypaper.conf

That said . . . source= was not implemented in hyprpaper like it is in Hyprland. This functionality is crucial for my app design & was very easy to implement (to be clear, I did rely on ChatGPT to assist with this). Hoping you guys could review the pull, feel free to rewrite/adjust the code however, just hoping to see this source= functionality in the main app.

Thank you!

@Blake-sama

Copy link
Copy Markdown
Contributor Author
image Picture of it doing what its intended to. :)

@vaxerski vaxerski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format needed rest lgtm

@Blake-sama

Copy link
Copy Markdown
Contributor Author

Thank you greatly for the review & introduction of clang-format. :)

@vaxerski
vaxerski merged commit 6502c87 into hyprwm:main Jul 27, 2025
1 check passed
jmylchreest added a commit to jmylchreest/hyprpaper that referenced this pull request Dec 31, 2025
Re-implements the source= directive for including external config files,
which was originally added in PR hyprwm#267 for v0.7.6 but lost during the
v0.8.0 hyprtoolkit rewrite.

Features:
- Include external config files using source=/path/to/file.conf
- Glob pattern support (e.g., source=~/.config/hypr/hyprpaper.d/*.conf)
- Tilde expansion for home directory paths
- Relative paths resolved relative to the current config file
- Proper error handling and logging for missing/invalid files

This restores parity with Hyprland's source= behavior, enabling modular
configuration management that was lost in the v0.8.0 transition.

Fixes: hyprwm#302
jmylchreest added a commit to jmylchreest/hyprpaper that referenced this pull request Jan 2, 2026
Re-implements the source= directive for including external config files,
which was originally added in PR hyprwm#267 for v0.7.6 but lost during the
v0.8.0 hyprtoolkit rewrite.

Features:
- Include external config files using source=/path/to/file.conf
- Glob pattern support (e.g., source=~/.config/hypr/hyprpaper.d/*.conf)
- Tilde expansion for home directory paths
- Relative paths resolved relative to the current config file
- Proper error handling and logging for missing/invalid files

This restores parity with Hyprland's source= behavior, enabling modular
configuration management that was lost in the v0.8.0 transition.

Fixes: hyprwm#302
vaxerski pushed a commit that referenced this pull request Jan 2, 2026
* feat(config): re-add source= include directive support

Re-implements the source= directive for including external config files,
which was originally added in PR #267 for v0.7.6 but lost during the
v0.8.0 hyprtoolkit rewrite.

Features:
- Include external config files using source=/path/to/file.conf
- Glob pattern support (e.g., source=~/.config/hypr/hyprpaper.d/*.conf)
- Tilde expansion for home directory paths
- Relative paths resolved relative to the current config file
- Proper error handling and logging for missing/invalid files

This restores parity with Hyprland's source= behavior, enabling modular
configuration management that was lost in the v0.8.0 transition.

Fixes: #302

* feat(config): add debug logging for source= directive

Adds LOG_DEBUG calls to help troubleshoot config include issues:
- Log when source= directive is encountered with resolved path
- Log number of files matched by glob patterns
- Log each file before parsing

* refactor(config): address PR review feedback & rebase against main

- Use Hyprutils::String::trim() instead of manual whitespace trimming
- Use Hyprutils::Utils::CScopeGuard for glob cleanup instead of manual
  globfree() calls
- Remove braces from short single-line if statements per style guide
- Remove duplicate absolutePath(), extend getPath() with optional
  basePath parameter instead

For source= directives, relative paths need to resolve relative to the
config file's directory, not CWD. So `source = ./themes/dark.conf` in
`~/.config/hypr/hyprpaper.conf` resolves to
`~/.config/hypr/themes/dark.conf`, not `$CWD/themes/dark.conf`.

* fix(config): address PR review feedback

- Use std::error_code for filesystem calls to avoid exceptions
- Move getCurrentConfigPath() body from header to cpp file
- Apply clang-format
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

Successfully merging this pull request may close these issues.

2 participants