Skip to content

Conversation

@ddlees
Copy link

@ddlees ddlees commented Dec 8, 2025

This changeset replaces the statically declared icon theme paths with a list built by inspecting the XDG Data directories, XDG_DATA_DIRS and XDG_DATA_HOME, for icons and defaulting to /usr/local/share/icons and /usr/share/icons if the relevant XDG environment variables are undeclared. It will also search for icons in the non-XDG compliant ~/.icons directory to preserve existing function.

The motivation for this change is to allow hyprtoolkit to search for icon themes in non-FHS compliant distributions (e.g. NixOS) more easily. For example, NixOS does not use /usr/share or /usr/local/share directories. Instead, it sets XDG_DATA_DIRS to include /run/current-system/sw/share. I wrote this so I didn't have to wrap the existing nix derivation in a buildFHSEnv or author a patch.

  • Built and tested locally
  • Please forgive my C++. I am very rusty 🙇

#include <filesystem>
#include <fstream>

#include <glib.h>
Copy link
Member

Choose a reason for hiding this comment

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

I will genuinely ban you from all hypr repos if you include glib in my code again

#cmake-build-*

build/
result
Copy link
Member

Choose a reason for hiding this comment

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

what is this for?

}

// system icons (e.g. /usr/local/share/icons, /usr/share/icons)
const gchar* const* systemDataDirs = g_get_system_data_dirs();
Copy link
Member

Choose a reason for hiding this comment

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

these can be trivially hardcoded as static / constexpr arrays of path suffixes, we do that everywhere else.

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