Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[meta] Aesthetics & customization #1289

Open
bynect opened this issue Feb 21, 2024 · 12 comments
Open

[meta] Aesthetics & customization #1289

bynect opened this issue Feb 21, 2024 · 12 comments
Labels

Comments

@bynect
Copy link
Member

bynect commented Feb 21, 2024

For the great joy of the ricing community I want to add some options to customize the look and feel of dunst.
So this is a summary for the customization related issue & prs

Done

Mostly done or WIP

TODO

Future ideas

Known problems

Obviously if you have any idea feel free to write here or open an issue with feature request

@bynect
Copy link
Member Author

bynect commented Feb 21, 2024

@fwsmit if you have anything to add feel free or let me know. Could you please add the proper tags to this issue?

@fwsmit fwsmit added the meta label Feb 22, 2024
@fwsmit
Copy link
Member

fwsmit commented Feb 22, 2024

I have a few ideas for improving the theming of Dunst. The default theme of Dunst could be improved (probably some default settings as well).
Another thing is to add a theme keyword that allows you to switch theme with one line. Dunst could ship some default themes

@bynect
Copy link
Member Author

bynect commented Feb 22, 2024

I have a few ideas for improving the theming of Dunst. The default theme of Dunst could be improved (probably some default settings as well).
Another thing is to add a theme keyword that allows you to switch theme with one line. Dunst could ship some default themes

Nice👍

I was thinking that when we add multiple windows, different windows/screens could have different themes (so a theme can be chosen by a rule or something like that)

For the default themes I like the idea, we could add things like gruvbox out of the box

@bynect
Copy link
Member Author

bynect commented Feb 22, 2024

I was thinking of adding a theme section which contains all the theme related things for every theme.

[theme]
name = whatever
background =
foreground =
corners =
corner_radius =
frame =

And then you can use a set_theme to use the theme. And using rules you can still override the theme

@fwsmit
Copy link
Member

fwsmit commented Feb 22, 2024

I was thinking about making a themes directory, like ~/.config/dunst/themes and /etc/dunst/themes. Each file in the directory could just use the standard config format, maybe excluding some keywords that don't relate to theming. It would work similar to the proposal of the include keyword, #796, but more focused. It might sound like it's more limited, and that's true, but it would be way easier to use. That is also worth a lot.

@bynect
Copy link
Member Author

bynect commented Feb 22, 2024

I was thinking about making a themes directory, like ~/.config/dunst/themes and /etc/dunst/themes. Each file in the directory could just use the standard config format, maybe excluding some keywords that don't relate to theming. It would work similar to the proposal of the include keyword, #796, but more focused. It might sound like it's more limited, and that's true, but it would be way easier to use. That is also worth a lot.

Well, maybe we can do a combination of the approach? Basically theming is done in a special section of the ini file. And we can split the theme in other config files (like the dunstrc.d). So basically if a user wants to use the theme in the main file he can, otherwise he can create another config file specific to themes. And the syntax is still ini to be consistent.

Also, I remembered that in ini the section name should be unique, so maybe we can add subsections for theming. like

[theme.gruvbox]
//...

[theme.mocha]
...

[theme.atom-dark]
...

@bynect
Copy link
Member Author

bynect commented Feb 22, 2024

I have one big perplexity though: should themes be associated with a single notification or with a window? (given that multiple window support will be implemented sooner or later)

Because having a theme for every single notification is quite strange for me personally, especially if different notification have themes that are not "compatible" with each other (think: different corners, frames, spacing).

So I would say that a theme should be associated with a window and in general be the original source of all the colors and layout, which can then be overridden by the rules. (it would be also interesting to match rules based on theme)

edit:
It just occurred to me that every theme should define different values for each urgency level.
Or alternatively we can do something like

[theme AtomDark]

[.low_urgency]
color =
corners = 
etc.

[.critical_urgency]
...

or this

[theme Gruvbox]

low_urgency.color =
low_urgency.background =
low_urgency.corners =

critical_urgency.color =

//... using _ is also fine

normal_background = #fff

the above idea are meant to replace low/normal/critical_urgency sections.

another possibility is creating multiple low/normal/critical_urgency and matching them against themes. so they are more similar to rules. Every theme then defines the appropriate sections.

But either way, I am sure that each theme has to be linked directly to the low/normal/critical_urgency settings.
We have to somehow decide what's the best way to handle this

@bynect
Copy link
Member Author

bynect commented Feb 22, 2024

@fwsmit if you could please merge #1268 and review #1286 I will start implementing the theming.
The main idea of how theming should work in the comment up, if you think I missed anything please tell me.

Also, I don't know if we should ask other users if they like the idea?

@fwsmit
Copy link
Member

fwsmit commented Feb 23, 2024

I have one big perplexity though: should themes be associated with a single notification or with a window? (given that multiple window support will be implemented sooner or later)

Most theming in dunst can be done per notitifcation using rules, so it might make sense to allow the theme to also be set via a rule. It depends on how a theme defines theming rules.

Because having a theme for every single notification is quite strange for me personally, especially if different notification have themes that are not "compatible" with each other (think: different corners, frames, spacing).

So I would say that a theme should be associated with a window and in general be the original source of all the colors and layout, which can then be overridden by the rules. (it would be also interesting to match rules based on theme)

edit: It just occurred to me that every theme should define different values for each urgency level. Or alternatively we can do something like

[theme AtomDark]

[.low_urgency]
color =
corners = 
etc.

[.critical_urgency]
...

The ini parser doesn't support nested sections I think. And I don't know if that's standard ini syntax.

or this

[theme Gruvbox]

low_urgency.color =
low_urgency.background =
low_urgency.corners =

critical_urgency.color =

//... using _ is also fine

normal_background = #fff

This one is not backward compatible. Another option is to only allow themes in a separate file. Then the name of the theme could be taken from the filename or something.

the above idea are meant to replace low/normal/critical_urgency sections.

another possibility is creating multiple low/normal/critical_urgency and matching them against themes. so they are more similar to rules. Every theme then defines the appropriate sections.

But either way, I am sure that each theme has to be linked directly to the low/normal/critical_urgency settings. We have to somehow decide what's the best way to handle this

Note that it should also be possible to easily change theme. For example from dark mode to light mode. Dunst could even integrate with the desktop api for dark/light theme so this happens automatically.

@bynect
Copy link
Member Author

bynect commented Feb 23, 2024

Most theming in dunst can be done per notitifcation using rules, so it might make sense to allow the theme to also be set via a rule. It depends on how a theme defines theming rules.

The idea was to allow rules to set themes. But the problem I see is that themes may define "general" options that don't change a single notification but the whole window. For example I was thinking of adding a window_frame (name temporary) that is basically an additional border for all notifications (see #738). This and other things (think about separator, which to choose between the top and bottom if they have different themes?) break if theme is notification specific. So I was thinking on making themes tied to a window (yes I am working on the multiple window 🤣).

The ini parser doesn't support nested sections I think. And I don't know if that's standard ini syntax.

It is an informal convention and should be added to the parser yes.
Maybe something less breaking would be

[theme.atom]

normal_urgency_background =
# different from background and only available in theme sections

# or alternatively
color = (low_urgency_color,  normal_color2, critical_color3)

This one is not backward compatible. Another option is to only allow themes in a separate file. Then the name of the theme could be taken from the filename or something.

If possible I would avoid these for two reason:

  1. makes themes different from the other configuration with the risk of creating another pseudo-language
  2. A lot of people hate clutter files
  3. They are potentially similars to the drop-ins in dunstrc.d

Note that it should also be possible to easily change theme. For example from dark mode to light mode. Dunst could even integrate with the desktop api for dark/light theme so this happens automatically.

this is surely a design goal. Maybe we can add a match_system_theme or something to the rules? (But I would add that to window rules and not notification rules for the reason added in the above comment).

All in all, maybe I should focus first on the multiple windows implementation before the theming (for less friction)

@bynect
Copy link
Member Author

bynect commented Feb 23, 2024

pixel-imperfect

I was watching closely the layout and I noticed several pixel imperfections, which are either caused by cairo antialiasing or by precision error in the drawing code (possibly due to the dpi floating scaling).

The white arrow presents no line.
The red arrow presents a grey line.
The blue arrow presents a purplish (frame color) line.

I also highlighted in yellow that some lines "bleed" into the frame, in every notification but the first

@bynect
Copy link
Member Author

bynect commented Mar 2, 2024

I noticed several problem in the icon handling code, so I will start delving into that. On my system, the recursive lookup does never work. I think the find_in_theme is the culprit.

Edit:
I rediscovered #1116 and #1094

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants