Skip to content

Support light themes - #52

Closed
al3rez wants to merge 1 commit into
omacom:devfrom
al3rez:feat/issues-6
Closed

al3rez wants to merge 1 commit into
omacom:devfrom
al3rez:feat/issues-6

Conversation

@al3rez

@al3rez al3rez commented Jul 4, 2025

Copy link
Copy Markdown

I've successfully made Omarchy's theme system configurable to support light themes like Rose Pine. Here's what I implemented:

  1. Theme Configuration System: Created theme.conf files for each theme containing:
    - variant (light/dark)
    - gtk_theme (e.g., Adwaita or Adwaita-dark)
    - gtk_color_scheme (prefer-dark or default)
    - Icon and cursor theme settings

  2. Updated omarchy-theme-next: Now reads theme.conf and applies:
    - GTK theme settings via gsettings
    - Creates theme.env file for runtime use
    - Updates desktop files automatically

  3. Created Helper Scripts:
    - omarchy-launch-themed: Launches apps with correct GTK_THEME
    - omarchy-update-desktop-files: Generates theme-aware desktop files

  4. Updated Configuration Files:
    - Waybar config now uses omarchy-launch-themed
    - Desktop files use the launcher script
    - install/theme.sh applies theme settings from config

  5. Added Rose Pine Example: Created a skeleton Rose Pine theme with light variant settings

The system is now fully theme-aware and will switch between light and dark modes based on each theme's configuration when using
omarchy-theme-next.

@al3rez

al3rez commented Jul 4, 2025

Copy link
Copy Markdown
Author

resolves #6

@dhh
dhh changed the base branch from master to dev July 5, 2025 00:07
@dhh

dhh commented Jul 14, 2025

Copy link
Copy Markdown
Contributor

I think this is really clever! But I'm a bit concerned about doing source THEME.conf. We've been moving away from doing that with the theme installer, such that we're not exposing everyone to running random code when they install a theme from the internet. Maybe @npenza has some ideas here on what we could do instead? Maybe this is finally pushing us towards the idea of having a theme.toml file? Where we can specify everything from these theme ENVs to possible extra fonts or backgrounds that need to be downloaded from the internet.

@al3rez

al3rez commented Jul 14, 2025

Copy link
Copy Markdown
Author

I can take a look at @npenza's PR and see how can we do another approach

@npenza

npenza commented Jul 14, 2025

Copy link
Copy Markdown
Contributor

@al3rez Really nice work with this one. Having a light mode will allow for a wider variety of themes from the community, and I think it'll be a great addition to Omarchy.

I agree that we should not run random code for theme installations. Directly sourcing a configuration file (like a source THEME.conf) poses security risks. I think a structured data solution is needed, and the responsibility of downloading fonts or backgrounds the theme requires, is delegated to the omarchy-theme-install script.

@dhh Agreed. I think a theme.toml makes sense here. I think this approach is the happy medium for customization and security. Instead of theme.conf, each theme should have a theme.toml file located in its root. This file would define the theme's properties. For example:

# General theme information
[theme]
name = "Rose Pine"
variant = "light" # or "dark"

# GTK settings
[gtk]
theme = "RosePine-Light-GTK"
color_scheme = "default" # or "prefer-light", "prefer-dark"

# Icon and Cursor settings
[icons]
theme = "Adwaita" 
cursor_theme = "Adwaita" 

# Optional: Font settings
[fonts]
monospace = "JetBrains Mono Nerd Font 10"
sans_serif = "Inter 10"

# Optional: Backgrounds
[[background]] # First background entry
url = "https://unsplash.com/images/rose-pine-light.png"

[[background]] # Another background entry
url = "https://unsplash.com/images/rose-pine-light-2.png"

[[background]] # A third background entry
url = "https://unsplash.com/images/rose-pine-light-3.png"

# Optional: Environment variables specific to this theme
[env]
GTK_THEME_VARIANT = "light"

The omarchy-theme-install script will need to be updated, to:

  1. Find the theme.toml file for the selected theme and read the content of the file.
  2. Use an external TOML parser to extract values. A tool like stoml, toml-cli, or yq could be used here. I think it would come down to the deps and simplicity.
  3. Download any specified fonts, backgrounds or gtk themes. Then store backgrounds in the theme's backgrounds dir (and fonts in the global fonts dir)

I think theme.toml makes sense, and is a much safer approach then sourcing the raw files from the repo. Keen to hear your thoughts on this one.

@al3rez
al3rez force-pushed the feat/issues-6 branch 7 times, most recently from 0e82db2 to d9624ef Compare July 16, 2025 14:56
- Add support for light themes (Rose Pine as first light theme)
- Migrate from theme.conf to theme.toml format
- Use tomlq (from yq package) for TOML parsing
- Add secure theme resource installation script
- Update desktop files with theme-specific GTK settings
- Add comprehensive tests using bats

Breaking changes:
- Removed theme.conf support (only theme.toml)
- Requires yq package for TOML parsing
@al3rez

al3rez commented Jul 16, 2025 •

Copy link
Copy Markdown
Author

ready for review @dhh @npenza

image

@dhh

dhh commented Jul 17, 2025

Copy link
Copy Markdown
Contributor

Really appreciate you doing this big exploration. I thought this was where I wanted to see us end up, but seeing it all come together, I think it's too complicated. This does more, but I really want Omarchy to do less. So going with this simple flip switch with theme/light.mode instead. It doesn't have as much flexibility, but it's a fraction of the complexity.

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.

3 participants