Skip to content

Fix TypeError when XDG_CONFIG_HOME is set in environment#147

Open
FaulkNet wants to merge 1 commit intotrackmastersteve:masterfrom
FaulkNet:master
Open

Fix TypeError when XDG_CONFIG_HOME is set in environment#147
FaulkNet wants to merge 1 commit intotrackmastersteve:masterfrom
FaulkNet:master

Conversation

@FaulkNet
Copy link
Copy Markdown
Contributor

@FaulkNet FaulkNet commented Mar 2, 2026

Summary

os.environ is a mapping object and must be accessed with square brackets ([]), not called as a function (()).

In themefile.py, line 79 uses os.environ("XDG_CONFIG_HOME") which raises a TypeError for any user who has XDG_CONFIG_HOME set in their environment. This exception is silently caught by the surrounding try/except, leaving self._theme_dir unset. Any subsequent operation that accesses self._theme_dir then raises an AttributeError, preventing alienfx from applying any theme.

Fix

# Before
os.environ("XDG_CONFIG_HOME")

# After
os.environ["XDG_CONFIG_HOME"]

Test plan

  • Set XDG_CONFIG_HOME in your environment
  • Run alienfx --theme <name> and confirm it applies without error
  • Unset XDG_CONFIG_HOME and confirm default ~/.config/alienfx path still works

os.environ is a mapping object and must be accessed with square
brackets, not called as a function. Using os.environ() raises a
TypeError which is silently swallowed, leaving _theme_dir unset
and causing an AttributeError on any subsequent theme operation.

Fixes alienfx crashing for users who have XDG_CONFIG_HOME set.
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