Skip to content

Use dynamic resource paths relative to the script location - #435

Open
fridrich wants to merge 1 commit into
linuxmint:masterfrom
fridrich:fix-resource-paths
Open

fridrich wants to merge 1 commit into
linuxmint:masterfrom
fridrich:fix-resource-paths

Conversation

@fridrich

@fridrich fridrich commented Oct 16, 2026 •

Copy link
Copy Markdown

Hypnotix hardcodes /usr/share/hypnotix and /usr/share/locale for its UI files, CSS, pictures, country list and translations. As a result it only works when installed under /usr.

This change derives the paths from the script's own location:

  • PREFIX = two levels above hypnotix.py (<prefix>/lib/hypnotix/hypnotix.py → <prefix>)
  • PKG_DATA_DIR = <prefix>/share/hypnotix
  • LOCALE_DIR = <prefix>/share/locale

os.path.realpath resolves symlinks, so a symlinked script still finds its data.

For the standard /usr install, the resulting paths are the same as before, so packaging is unaffected. It also makes Hypnotix work:

  • when installed under another prefix, e.g. /usr/local or /opt
  • when run straight from a git checkout (./usr/lib/hypnotix/hypnotix.py), which is handy for testing changes without installing. The GSettings schema still needs to be installed.

Not changed: /usr/share/circle-flags-svg belongs to an external package, and the usr/bin/hypnotix launcher still calls /usr/lib/hypnotix/hypnotix.py.

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.

1 participant