mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-20 23:51:40 +01:00
feat(wm): themes for the borders
A theme gives the borders their colors, in place of choosing the color of each kind of window: a Catppuccin theme, a Base16 theme or a palette of one's own, with the color it gives each of the six kinds of border and its default for the ones it does not name. The Theme message puts the six colors where the border manager keeps them and asks for the look again. The palette of a picture is made by the same generator as komorebi for Windows, which takes seconds for a large picture, so each one is kept in the cache directory, in a file named for the picture, a hash of its path, size and time of last change, and the variant: the palette of a picture painted over, or of one of the same name in another folder, is made again and not mistaken. The themes come from komorebi-themes at the revision komorebi-layouts is at. It pulls egui for its types, which the license list, the sources and the advisories of deny.toml now have to allow, and the colors the border manager keeps are the themes' own again. A subscriber that asks for the changes of the state only is sent a Theme message all the same: the colors of the borders are not part of the state, so a theme never changes it, and the subscriber would not hear of the colors at all. komorebi.json takes border_colours, a color for each kind of window as red, green and blue or as a hex color, and a theme, which wins over them.
This commit is contained in:
1 parent
9a0693f5d1
commit
e6ddb5a7c9
27 files changed
+7051
-154
No files matched your search
Generated
+3470
-56
File diff suppressed because it is too large.
Load diff
@@ -12,11 +12,14 @@ version = "0.1.0"
|
||||
komorebi-layouts = { git = "https://github.com/LGUG2Z/komorebi", rev = "f08aa55511d77ca56ab0e789efabeb0a237a463e", features = [
|
||||
"schemars",
|
||||
] }
|
||||
# the themes (and the palettes made from pictures), from the same upstream revision
|
||||
komorebi-themes = { git = "https://github.com/LGUG2Z/komorebi", rev = "f08aa55511d77ca56ab0e789efabeb0a237a463e" }
|
||||
|
||||
chrono = "0.4"
|
||||
clap = { version = "4", features = ["derive", "wrap_help"] }
|
||||
color-eyre = "0.6"
|
||||
crossbeam-channel = "0.5"
|
||||
crossbeam-utils = "0.8"
|
||||
dirs = "6"
|
||||
hotwatch = "0.5"
|
||||
lazy_static = "1"
|
||||
|
||||
@@ -70,8 +70,9 @@ without a checkout of the toolchain.
|
||||
the settings of KWin's it needs in the user's `kwinrc`, the parking desktop it
|
||||
hides the back of a stack and the windows behind a monocle on, and the borders
|
||||
and animations it has KWin draw (`kwin`), the border and animation settings and
|
||||
the look they make (`border_manager`, `animation`), the opacity of the windows
|
||||
that do not have the focus (`transparency_manager`),
|
||||
the look they make (`border_manager`, `animation`), the colors a theme gives the
|
||||
borders (`theme_manager`), the opacity of the windows that do not have the focus
|
||||
(`transparency_manager`),
|
||||
the model of what it tiles (`monitor`, `workspace`, `container`, `window`), the
|
||||
window manager that keeps the model (`window_manager`), loads it from the
|
||||
backend (`desktop`) and changes it when the compositor reports an event
|
||||
@@ -263,7 +264,8 @@ animated by another effect, Geometry Change, which `animation`,
|
||||
`animation-duration` and `animation-style` turn on and set. `transparency` makes
|
||||
the windows that do not have the focus see-through, by the opacity KWin gives a
|
||||
window, and `focus-follows-mouse` has KWin give the focus to the window under the
|
||||
pointer, by its own focus policy.
|
||||
pointer, by its own focus policy. A theme gives the borders their colors, and
|
||||
the palette of a picture is made and kept in the cache directory.
|
||||
|
||||
## Documentation
|
||||
|
||||
|
||||
@@ -16,15 +16,22 @@ ignore = [
|
||||
{ id = "RUSTSEC-2026-0370", reason = "zvariant is maintained inside zbus from zbus 6; komorebi talks to KWin with zbus 5" },
|
||||
{ id = "RUSTSEC-2026-0371", reason = "zbus_names is maintained inside zbus from zbus 6; komorebi talks to KWin with zbus 5" },
|
||||
{ id = "RUSTSEC-2026-0372", reason = "zvariant_derive is maintained inside zbus from zbus 6; komorebi talks to KWin with zbus 5" },
|
||||
{ id = "RUSTSEC-2024-0320", reason = "yaml-rust comes with serde_yaml 0.8 under flavours, which komorebi-themes makes palettes with; not using any yaml features from this library" },
|
||||
{ id = "RUSTSEC-2025-0056", reason = "adler comes with the image decoder under flavours, which komorebi-themes makes palettes with; only used for color palette generation" },
|
||||
{ id = "RUSTSEC-2026-0192", reason = "ttf-parser comes with the fonts of egui, which komorebi-themes pulls in for its theme types; komorebi draws no text" },
|
||||
]
|
||||
|
||||
[licenses]
|
||||
allow = [
|
||||
"Apache-2.0",
|
||||
"BSD-2-Clause",
|
||||
"BSD-3-Clause",
|
||||
"CC0-1.0",
|
||||
"ISC",
|
||||
"MIT",
|
||||
"MPL-2.0",
|
||||
"OFL-1.1",
|
||||
"Ubuntu-font-1.0",
|
||||
"Unicode-3.0",
|
||||
"Zlib",
|
||||
"LicenseRef-Komorebi-2.0",
|
||||
@@ -51,11 +58,21 @@ crate = "komorebic"
|
||||
expression = "LicenseRef-Komorebi-2.0"
|
||||
license-files = []
|
||||
|
||||
[[licenses.clarify]]
|
||||
crate = "komorebi-themes"
|
||||
expression = "LicenseRef-Komorebi-2.0"
|
||||
license-files = []
|
||||
|
||||
[[licenses.clarify]]
|
||||
crate = "version"
|
||||
expression = "LicenseRef-Komorebi-2.0"
|
||||
license-files = []
|
||||
|
||||
[[licenses.clarify]]
|
||||
crate = "base16-egui-themes"
|
||||
expression = "MIT"
|
||||
license-files = []
|
||||
|
||||
[bans]
|
||||
multiple-versions = "allow"
|
||||
wildcards = "allow"
|
||||
@@ -67,4 +84,10 @@ external-default-features = "allow"
|
||||
unknown-registry = "deny"
|
||||
unknown-git = "deny"
|
||||
allow-registry = ["https://github.com/rust-lang/crates.io-index"]
|
||||
allow-git = ["https://github.com/LGUG2Z/komorebi"]
|
||||
allow-git = [
|
||||
"https://github.com/LGUG2Z/base16-egui-themes",
|
||||
"https://github.com/LGUG2Z/base16_color_scheme",
|
||||
"https://github.com/LGUG2Z/catppuccin-egui",
|
||||
"https://github.com/LGUG2Z/flavours",
|
||||
"https://github.com/LGUG2Z/komorebi",
|
||||
]
|
||||
@@ -363,12 +363,13 @@ notified.
|
||||
its socket, writes the JSON and closes the connection, all on the thread that handled the
|
||||
event or the message, with the window manager still locked. A subscriber with
|
||||
`filter_state_changes` is skipped when the state did not change, unless the notification is
|
||||
about a window being shown or a subscriber being added. A subscriber that cannot be
|
||||
connected to is removed, with its socket file, after the loop. Writing to a subscriber that
|
||||
was connected to has no timeout, and a failed write returns an error from the call that
|
||||
handled the event or the message. A subscriber that stops reading therefore holds the window
|
||||
manager, and with it the thread that handles events: the backend's events wait in the
|
||||
channel of [`window_manager_event_listener`], and past 20 the backend drops them.
|
||||
about a window being shown, a subscriber being added, a theme being set (the colors of the
|
||||
borders are not part of the state) or the configuration being reloaded. A subscriber that
|
||||
cannot be connected to is removed, with its socket file, after the loop. Writing to a
|
||||
subscriber that was connected to has no timeout, and a failed write returns an error from the
|
||||
call that handled the event or the message. A subscriber that stops reading therefore holds
|
||||
the window manager, and with it the thread that handles events: the backend's events wait in
|
||||
the channel of [`window_manager_event_listener`], and past 20 the backend drops them.
|
||||
|
||||
When the daemon stops ([`WindowManager::stop`], or `SIGINT` and `SIGTERM` in `main.rs`), it
|
||||
connects to each subscriber and shuts the connection down without writing anything.
|
||||
@@ -824,6 +825,23 @@ once, when the effect is the stock one: every border is then the focused or the
|
||||
the look.
|
||||
[PLATFORM.md](PLATFORM.md#kwin-effects) has the effect, its settings and what was measured.
|
||||
|
||||
## Themes
|
||||
|
||||
A theme gives the borders their colors. The `Theme` message carries a [`KomorebiTheme`]: a
|
||||
Catppuccin theme, a Base16 theme or a Base16 palette, each with the color it gives to each of the
|
||||
six kinds of border, and a default for the ones it does not name.
|
||||
[`theme_manager::send_notification`] puts the six colors into the statics of [`border_manager`],
|
||||
keeps the theme as [`theme_manager::CURRENT_THEME`] and asks the backend for the look again, on
|
||||
the thread that handled the message; [`border_manager::update_colours`] hands them to the border
|
||||
effect with the next event or message. The palette of a picture is made by
|
||||
`komorebi-themes` ([`komorebi_themes::generate_base16_palette`]), which takes seconds, so
|
||||
[`theme_manager::wallpaper_palette`] keeps each palette it makes in `komorebi` in the user's cache
|
||||
directory, in a file named by [`theme_manager::palette_file`] for the picture, a hash of its path,
|
||||
size and time of last change, and the variant: a picture that was painted over, or one of the same
|
||||
name in another folder, has a palette of its own. A picture it cannot make a palette from (it
|
||||
cannot be read, or has fewer than eight colors) has none, and the borders keep their colors.
|
||||
[DESIGN.md](DESIGN.md#why-is-a-palette-kept-by-the-hash-of-its-picture) has the reason.
|
||||
|
||||
## Transparency
|
||||
|
||||
The opacity of a window is a property KWin has, so komorebi sets it ([`Backend::set_opacity`],
|
||||
@@ -953,6 +971,8 @@ module's unit.
|
||||
- [`border_manager`](../../komorebi/src/border_manager/mod.rs): the border settings, and the
|
||||
[`Look`] they make, which it asks the backend for.
|
||||
- [`animation`](../../komorebi/src/animation/mod.rs): the animation settings, which the look has.
|
||||
- [`theme_manager`](../../komorebi/src/theme_manager.rs): a theme's colors for the borders, and the
|
||||
palettes made from pictures.
|
||||
- [`transparency_manager`](../../komorebi/src/transparency_manager.rs): which windows are
|
||||
see-through, and the opacity they are given.
|
||||
- [`kwin::effects`](../../komorebi/src/kwin/effects.rs): the KWin effect that draws the border,
|
||||
@@ -1106,6 +1126,9 @@ the fake. The window manager is its only caller, through [`backend`]. The contra
|
||||
| Every style is a curve Qt has | test: [`AnimationStyle::qt_curve`] is a `match` of every style, and the test checks each against its name without the "Ease" | `every_style_is_a_curve_qt_has`, the doctest of `qt_curve`, `vm-features` (section D: two curves are in different places at the same moment) | a cubic Bézier is an ease out |
|
||||
| Only the windows the rules make see-through are, and only while transparency is on | framework path: [`transparency_manager::apply`] asks [`transparency_manager::transparent_windows`] and sends the difference from [`WindowManager::opacity_applied`] | `unfocused_windows_are_transparent_and_the_focused_one_is_not`, `turning_transparency_off_makes_everything_opaque_again`, `a_monocled_window_is_not_transparent`, `windows_the_rules_ignore_keep_their_opacity`, `vm-features` (section B) | none |
|
||||
| The `transparency` keys of the file are the settings, and a key the file leaves out has the default | framework path: `StaticConfig::apply_globals` stores `transparency` and `transparency_alpha` whether the file has them or not, and adds the ignore rules to `TRANSPARENCY_BLACKLIST` | `the_transparency_keys_of_the_file_are_the_transparency_settings` | none |
|
||||
| A theme gives every kind of border a color, the one it names or the theme's default | framework path: [`theme_manager::send_notification`] stores a color for each of the six kinds, from the theme's own defaults for the ones the message does not name | `a_named_theme_colours_every_kind_of_border` | none |
|
||||
| The `border_colours` of the file are the border colors, and a theme in the file wins over them | framework path: `StaticConfig::apply_globals` stores each color the file names, and then calls [`theme_manager::send_notification`] for the `theme` | `the_colour_and_theme_keys_of_the_file_are_the_border_colours` | none |
|
||||
| A picture's palette is made again when the picture changes, and is not mistaken for another picture's | framework path: [`theme_manager::palette_file`] names the file by a hash of the picture's path, size and time of last change, and the variant | the doctest of `palette_file` | the hash is not a proof of identity |
|
||||
| A window komorebi made see-through is opaque again when komorebi exits | framework path: [`WindowManager::stop`] and `main.rs` call [`transparency_manager::restore`] | `what_komorebi_made_see_through_is_opaque_again_when_it_exits` | `SIGKILL`: the windows stay as they were drawn |
|
||||
| What the backend sends for an opacity is what the bridge sets | tests: the `opacity` command of [`fixtures`] is what the backend's test sends and what the bridge's test answers with, checking the window's `opacity` | `the_commands_of_a_session_go_to_the_bridge_as_the_bridges_tests_answer_it`, `what the bridge sends for a session is what the daemon's tests read`, `a window is given the opacity it is asked for, and one KWin has not got is given back` | none |
|
||||
| The user's focus policy is put back when focus follows mouse is turned off and when komorebi exits | framework path: [`Kwinrc`] records the first value of each key it sets, `set_focus_follows_mouse(false)` puts the two keys back with [`Kwinrc::restore_keys`] and `shutdown` puts back all | `one_key_can_be_put_back_while_the_others_in_its_group_stay_changed`, `what_komorebi_changed_is_put_back_exactly_and_what_it_added_is_removed`, `vm-focus-follows-mouse` | `SIGKILL`: the next run puts it back when it stops |
|
||||
@@ -1247,7 +1270,9 @@ A window is shown, and ends up on a tile:
|
||||
[`komorebi/tests/animation.rs`](../../komorebi/tests/animation.rs), the messages that set the
|
||||
animation, [`komorebi/tests/animation_config.rs`](../../komorebi/tests/animation_config.rs), its
|
||||
key of the file, and [`komorebi/tests/animation_stack.rs`](../../komorebi/tests/animation_stack.rs),
|
||||
the stack commands that turn it off; [`komorebi/tests/focus_follows_mouse.rs`](../../komorebi/tests/focus_follows_mouse.rs),
|
||||
the stack commands that turn it off; [`komorebi/tests/themes.rs`](../../komorebi/tests/themes.rs),
|
||||
a named theme and [`komorebi/tests/theme_config.rs`](../../komorebi/tests/theme_config.rs), the
|
||||
colors and the theme of the file; [`komorebi/tests/focus_follows_mouse.rs`](../../komorebi/tests/focus_follows_mouse.rs),
|
||||
focus follows mouse; [`komorebi/tests/transparency.rs`](../../komorebi/tests/transparency.rs)
|
||||
and [`komorebi/tests/transparency_config.rs`](../../komorebi/tests/transparency_config.rs),
|
||||
transparency and its keys of the file; [`komorebi/tests/border_colours.rs`](../../komorebi/tests/border_colours.rs) and
|
||||
@@ -1343,6 +1368,12 @@ A window is shown, and ends up on a tile:
|
||||
[`border_manager::send_notification`]: ../../komorebi/src/border_manager/mod.rs
|
||||
[`BORDER_DRAWN`]: ../../komorebi/src/border_manager/mod.rs
|
||||
[`animation`]: ../../komorebi/src/animation/mod.rs
|
||||
[`KomorebiTheme`]: ../../komorebi/src/core/mod.rs
|
||||
[`theme_manager::send_notification`]: ../../komorebi/src/theme_manager.rs
|
||||
[`theme_manager::CURRENT_THEME`]: ../../komorebi/src/theme_manager.rs
|
||||
[`theme_manager::wallpaper_palette`]: ../../komorebi/src/theme_manager.rs
|
||||
[`theme_manager::palette_file`]: ../../komorebi/src/theme_manager.rs
|
||||
[`komorebi_themes::generate_base16_palette`]: https://github.com/LGUG2Z/komorebi/tree/f08aa55511d77ca56ab0e789efabeb0a237a463e/komorebi-themes
|
||||
[`WindowManager::focus_follows_mouse`]: ../../komorebi/src/window_manager.rs
|
||||
[`Backend::set_focus_follows_mouse`]: ../../komorebi/src/backend/mod.rs
|
||||
[`Kwinrc::restore_keys`]: ../../komorebi/src/kwin/kwinrc.rs
|
||||
|
||||
@@ -481,6 +481,15 @@ which is KWin's setting for no delay between the pointer entering a window and t
|
||||
given the focus; why 0 and not the delay KWin has by default is not written down, and needs a
|
||||
reason.
|
||||
|
||||
## Why is a palette kept by the hash of its picture?
|
||||
|
||||
Because the name of a picture alone does not say which picture it is: two folders can each have a
|
||||
`wallpaper.png`, and one wallpaper can be painted over. A palette takes seconds to make for a
|
||||
large picture, so it is kept, in the user's cache directory (`~/.cache/komorebi`), where it
|
||||
outlives a login; the runtime directory, where the socket is, does not. The file is named after the
|
||||
picture, a hash of its path, size and time of last change, and the variant. A palette that cannot
|
||||
be kept is made again the next time. komorebi for Windows keeps them by file name alone.
|
||||
|
||||
## Why are the effects patched?
|
||||
|
||||
Because the stock effects lack what komorebi needs of them. Each patch leaves the effect
|
||||
|
||||
+3
-2
@@ -62,8 +62,9 @@ configuration of a running daemon.
|
||||
[Borders](usage/borders.md) explains how komorebi has KWin draw a border around each window,
|
||||
[Animation](usage/animation.md) how it has KWin animate the windows going to their places, and
|
||||
[Transparency](usage/transparency.md) how it makes the windows that do not have the focus
|
||||
see-through, and [Focus follows mouse](usage/focus-follows-mouse.md) how it has KWin give the focus
|
||||
to the window under the pointer.
|
||||
see-through, [Focus follows mouse](usage/focus-follows-mouse.md) how it has KWin give the focus
|
||||
to the window under the pointer, and [Themes](usage/themes.md) how a theme gives the borders their
|
||||
colors.
|
||||
[Subscribing to notifications](usage/subscribing-to-notifications.md) explains how a program
|
||||
such as a status bar follows what komorebi does. The [CLI reference](cli/start.md) has a page
|
||||
for every `komorebic` command, generated from its help.
|
||||
|
||||
@@ -90,6 +90,19 @@ starts and when the file changes; a key it leaves out leaves the setting as it i
|
||||
}
|
||||
```
|
||||
|
||||
`border_colours` sets the colors of the kinds of window above, each as red, green and blue or as
|
||||
a hex color, and leaves out the kinds it does not name. A [theme](themes.md), which the
|
||||
`theme` key of the file gives too, replaces them.
|
||||
|
||||
```json
|
||||
{
|
||||
"border_colours": {
|
||||
"single": { "r": 255, "g": 128, "b": 0 },
|
||||
"unfocused": "#404040"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## What is put back
|
||||
|
||||
The effect keeps its settings in the user's `kwinrc`, in the group `[Round-Corners]`. komorebi
|
||||
|
||||
@@ -38,8 +38,9 @@ trailing commas.
|
||||
Reading the file again sets every setting of the daemon from it, and a key the file leaves out is
|
||||
the default of the setting: a `resize-delta` given with a command is gone when the file changes.
|
||||
These stay as they were when the file leaves them out: `default_workspace_padding`,
|
||||
`default_container_padding`, `display_index_preferences`, the four settings of the borders and the
|
||||
animation, when the file has no `animation`. The rules add up, as
|
||||
`default_container_padding`, `display_index_preferences`, the four settings of the borders, each
|
||||
color of `border_colours` the file does not name, the theme and the animation, when the file has no
|
||||
`animation`. The rules add up, as
|
||||
[Rules](#rules) says. A workspace the file lists gets its name, padding, offsets and rules from
|
||||
its entry, and its layout when the entry names one; a workspace the file does not list is left as
|
||||
it is.
|
||||
@@ -101,6 +102,8 @@ can have values of their own, which come before the default.
|
||||
| `border_width` | `10` | How thick the border is, in pixels (`active_window_border_width`) |
|
||||
| `border_offset` | `0` | How much more room than the width the layout leaves around each window (`active_window_border_offset`) |
|
||||
| `border_radius` | `10` | How round the corners of the border are, in pixels |
|
||||
| `border_colours` | see [Borders](borders.md#colors) | The color of the border of each kind of window: `single`, `stack`, `monocle`, `floating`, `unfocused` and `unfocused_locked`, each as `{ "r": 66, "g": 165, "b": 245 }` or `"#42A5F5"` (`active_window_border_colours`). A theme replaces them |
|
||||
| `theme` | none | A theme that gives every kind of border its color: a Catppuccin theme, a Base16 scheme or a palette of your own ([Themes](themes.md)). It wins over `border_colours` |
|
||||
|
||||
[Borders](borders.md) explains what the compositor draws and what the layout leaves room for.
|
||||
`komorebic border`, `border-width` and `border-offset` change the first three while the daemon
|
||||
|
||||
@@ -50,8 +50,9 @@ sent.
|
||||
A subscriber can ask to be sent a notification only when the event or the message changed
|
||||
the state, with the `filter_state_changes` option. It is still sent the notification of a
|
||||
window that is shown, of every new subscription, so it receives the state as soon as it
|
||||
subscribes, and of every reload of `komorebi.json`. `komorebic subscribe-socket` has no option for it; a program writes the message
|
||||
on the daemon's socket itself:
|
||||
subscribes, of a theme, which changes the colors of the borders and nothing in the state,
|
||||
and of every reload of `komorebi.json`. `komorebic subscribe-socket` has no option for it; a
|
||||
program writes the message on the daemon's socket itself:
|
||||
|
||||
```sh
|
||||
printf '%s' '{"type":"AddSubscriberSocketWithOptions","content":["bar.sock",{"filter_state_changes":true}]}' |
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
# Themes
|
||||
|
||||
A theme gives the borders their colors. Instead of choosing the color of each kind of window with
|
||||
[`komorebic border-colour`](../cli/border-colour.md), a program tells the daemon to take a theme,
|
||||
and the six kinds of border (`single`, `stack`, `monocle`, `floating`, `unfocused` and
|
||||
`unfocused-locked`) take the colors the theme gives them: a Catppuccin theme, a Base16 theme, or a
|
||||
Base16 palette of your own.
|
||||
|
||||
There is no `komorebic` command for it: the daemon takes it from the `theme` key of
|
||||
[`komorebi.json`](configuration.md#borders), or as a message on its socket, the `Theme` message,
|
||||
which a program sends with [`komorebi-client`](../../komorebi-client/src/lib.rs) or a script writes
|
||||
as a line of JSON.
|
||||
|
||||
```rust
|
||||
use komorebi_client::SocketMessage;
|
||||
use komorebi_client::send_message;
|
||||
|
||||
let theme: SocketMessage = r#"{
|
||||
"type": "Theme",
|
||||
"content": { "palette": "Catppuccin", "name": "Mocha" }
|
||||
}"#
|
||||
.parse()?;
|
||||
send_message(&theme)?;
|
||||
```
|
||||
|
||||
The key has the same fields as the message, and wins over `border_colours` of the file, which has
|
||||
no effect while a theme is set:
|
||||
|
||||
```json
|
||||
{
|
||||
"theme": { "palette": "Catppuccin", "name": "Mocha" }
|
||||
}
|
||||
```
|
||||
|
||||
The file sets the theme when the daemon starts and when the file changes. A file without `theme`
|
||||
leaves the one the daemon has.
|
||||
|
||||
## What a theme gives
|
||||
|
||||
`palette` is the kind of theme (`Catppuccin`, `Base16` or `Custom`), and `name` the theme: one of
|
||||
Catppuccin's four, `Latte`, `Frappe`, `Macchiato` and `Mocha`, or one of the Base16 schemes
|
||||
(`Custom` has a `colours` of the sixteen Base16 colors instead). A kind of border that the message
|
||||
does not name takes the theme's default for it:
|
||||
|
||||
| Border | Catppuccin | Base16 |
|
||||
|---|---|---|
|
||||
| `single_border` | Blue | Base0D |
|
||||
| `stack_border` | Green | Base0B |
|
||||
| `monocle_border` | Pink | Base0F |
|
||||
| `floating_border` | Yellow | Base09 |
|
||||
| `unfocused_border` | Base | Base01 |
|
||||
| `unfocused_locked_border` | Red | Base08 |
|
||||
|
||||
The message can name another color of the theme for any of them, as `"single_border": "Mauve"`
|
||||
for Catppuccin or `"single_border": "Base0E"` for Base16.
|
||||
|
||||
A theme sets the colors that `border-colour` sets, and replaces them, and the colors set after it
|
||||
replace the theme's. The theme is kept as the current one. The border has to be on and drawn by
|
||||
the effect for any of it to show ([Borders](borders.md)).
|
||||
|
||||
## Palettes from a picture
|
||||
|
||||
The Base16 palette of a picture can be made from the picture itself: the same palette generator as
|
||||
komorebi for Windows takes the picture's colors and gives a light or a dark variant. A palette
|
||||
takes seconds to make for a large picture, so each one is kept in `$XDG_CACHE_HOME/komorebi`
|
||||
(`~/.cache/komorebi`), in a file named for the picture, a hash of its path, size and time of last
|
||||
change, and the variant. It is made again when the path, the size or the time of change differ. A
|
||||
picture with fewer than eight colors has no palette.
|
||||
@@ -5,6 +5,7 @@ edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
komorebi = { path = "../komorebi", default-features = false }
|
||||
komorebi-themes = { workspace = true }
|
||||
|
||||
serde_json = { workspace = true }
|
||||
|
||||
|
||||
@@ -84,6 +84,9 @@ pub use komorebi::static_config::StaticConfig;
|
||||
pub use komorebi::window::Window;
|
||||
pub use komorebi::workspace::Workspace;
|
||||
pub use komorebi::workspace::WorkspaceLayer;
|
||||
pub use komorebi_themes::KomorebiTheme;
|
||||
pub use komorebi_themes::colour::Colour;
|
||||
pub use komorebi_themes::colour::Rgb;
|
||||
use std::borrow::Borrow;
|
||||
use std::io::BufReader;
|
||||
use std::io::Read;
|
||||
@@ -319,8 +322,8 @@ pub fn subscribe(name: &str) -> std::io::Result<UnixListener> {
|
||||
/// The same as [`subscribe`], with the [`SubscribeOptions`] the daemon applies to this subscriber
|
||||
///
|
||||
/// With `filter_state_changes`, the daemon sends a notification only when the event or the message
|
||||
/// changed the [`State`], and always when a window is shown, when a subscriber is added and when
|
||||
/// the configuration is reloaded.
|
||||
/// changed the [`State`], and always when a window is shown, when a subscriber is added, when a
|
||||
/// theme is set and when the configuration is reloaded.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
|
||||
@@ -25,6 +25,9 @@ use komorebi_client::SubscribeOptions;
|
||||
use komorebi_client::send_query;
|
||||
use komorebi_client::subscribe;
|
||||
use komorebi_client::subscribe_with_options;
|
||||
use komorebi_themes::Catppuccin;
|
||||
use komorebi_themes::KomorebiTheme;
|
||||
use komorebi_themes::KomorebiThemeCatppuccin;
|
||||
use parking_lot::Mutex;
|
||||
use std::io::ErrorKind;
|
||||
use std::io::Read;
|
||||
@@ -249,6 +252,37 @@ fn a_subscriber_that_filters_state_changes_is_not_sent_what_changed_nothing()
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_subscriber_that_filters_state_changes_is_sent_a_theme()
|
||||
-> Result<(), Box<dyn std::error::Error>> {
|
||||
let (_turn, _daemon) = daemon();
|
||||
let options = SubscribeOptions {
|
||||
filter_state_changes: true,
|
||||
};
|
||||
let filtered = Subscriber::new("theme.sock", subscribe_with_options("theme.sock", options)?);
|
||||
filtered.subscribed();
|
||||
|
||||
// the colors of the borders are not part of the state, so the state is the same after a theme
|
||||
// as before it; a message that changes nothing else is not sent
|
||||
send_query(&SocketMessage::State)?;
|
||||
let theme = KomorebiTheme::Catppuccin(KomorebiThemeCatppuccin {
|
||||
name: Catppuccin::Mocha,
|
||||
bar_accent: None,
|
||||
single_border: None,
|
||||
stack_border: None,
|
||||
monocle_border: None,
|
||||
floating_border: None,
|
||||
unfocused_border: None,
|
||||
unfocused_locked_border: None,
|
||||
});
|
||||
send_query(&SocketMessage::Theme(Box::new(theme)))?;
|
||||
|
||||
let received =
|
||||
filtered.until(|event| matches!(event, NotificationEvent::Socket(SocketMessage::Theme(_))));
|
||||
assert_eq!(received.len(), 1, "{received:?}");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_subscriber_that_is_gone_is_dropped_and_not_tried_again()
|
||||
-> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
@@ -5,12 +5,14 @@ description = "A tiling window manager for KDE Plasma"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
komorebi-themes = { workspace = true }
|
||||
komorebi-layouts = { workspace = true }
|
||||
version = { path = "../version" }
|
||||
|
||||
clap = { workspace = true }
|
||||
color-eyre = { workspace = true }
|
||||
crossbeam-channel = { workspace = true }
|
||||
crossbeam-utils = { workspace = true }
|
||||
ctrlc = { version = "3", features = ["termination"] }
|
||||
dirs = { workspace = true }
|
||||
hotwatch = { workspace = true }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! The borders around the windows, which the compositor draws.
|
||||
//! The borders around the windows, which the compositor draws, and their colors.
|
||||
//!
|
||||
//! komorebi draws no border itself. KWin's KDE Rounded Corners effect draws an outline outside
|
||||
//! each window, in the gap komorebi leaves between tiles, and this module decides what it looks
|
||||
@@ -13,9 +13,9 @@
|
||||
//! is to the layout ([`window_kinds`]). Only komorebi's build of the effect takes them; the
|
||||
//! stock one draws the look's two colors, one for the active window and one for the others.
|
||||
//!
|
||||
//! The settings are the statics of this module, which the `komorebic border*` commands set and
|
||||
//! the `border*` keys of `komorebi.json` ([`crate::static_config::StaticConfig`]) give their
|
||||
//! first values.
|
||||
//! The settings are the statics of this module, which the `komorebic border*` commands and the
|
||||
//! themes set, and the `border*` keys of `komorebi.json` ([`crate::static_config::StaticConfig`])
|
||||
//! give their first values.
|
||||
|
||||
use crate::backend::AnimationLook;
|
||||
use crate::backend::BorderLook;
|
||||
@@ -25,6 +25,8 @@ use crate::core::WindowKind;
|
||||
use crate::core::animation::AnimationStyle;
|
||||
use crate::window_manager::WindowManager;
|
||||
use color_eyre::eyre;
|
||||
use komorebi_themes::colour::Colour;
|
||||
use komorebi_themes::colour::Rgb;
|
||||
use lazy_static::lazy_static;
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::sync::atomic::AtomicI32;
|
||||
@@ -46,18 +48,23 @@ pub static BORDER_RADIUS: AtomicI32 = AtomicI32::new(10);
|
||||
pub static BORDER_ENABLED: AtomicBool = AtomicBool::new(true);
|
||||
|
||||
lazy_static! {
|
||||
/// The color of the focused window's border, as [`pack`] stores it.
|
||||
pub static ref FOCUSED: AtomicU32 = AtomicU32::new(pack(66, 165, 245));
|
||||
/// The color of the border of every other window, as [`pack`] stores it.
|
||||
pub static ref UNFOCUSED: AtomicU32 = AtomicU32::new(pack(128, 128, 128));
|
||||
/// The color of the focused window's border, red, green and blue in one number.
|
||||
pub static ref FOCUSED: AtomicU32 =
|
||||
AtomicU32::new(u32::from(Colour::Rgb(Rgb::new(66, 165, 245))));
|
||||
/// The color of the border of every other window.
|
||||
pub static ref UNFOCUSED: AtomicU32 =
|
||||
AtomicU32::new(u32::from(Colour::Rgb(Rgb::new(128, 128, 128))));
|
||||
/// The color of the border of a locked container that does not have the focus.
|
||||
pub static ref UNFOCUSED_LOCKED: AtomicU32 = AtomicU32::new(pack(158, 8, 8));
|
||||
pub static ref UNFOCUSED_LOCKED: AtomicU32 =
|
||||
AtomicU32::new(u32::from(Colour::Rgb(Rgb::new(158, 8, 8))));
|
||||
/// The color of the border of a monocled window.
|
||||
pub static ref MONOCLE: AtomicU32 = AtomicU32::new(pack(255, 51, 153));
|
||||
pub static ref MONOCLE: AtomicU32 =
|
||||
AtomicU32::new(u32::from(Colour::Rgb(Rgb::new(255, 51, 153))));
|
||||
/// The color of the border of a stack that has the focus.
|
||||
pub static ref STACK: AtomicU32 = AtomicU32::new(pack(0, 165, 66));
|
||||
pub static ref STACK: AtomicU32 = AtomicU32::new(u32::from(Colour::Rgb(Rgb::new(0, 165, 66))));
|
||||
/// The color of the border of a floating window that has the focus.
|
||||
pub static ref FLOATING: AtomicU32 = AtomicU32::new(pack(245, 245, 165));
|
||||
pub static ref FLOATING: AtomicU32 =
|
||||
AtomicU32::new(u32::from(Colour::Rgb(Rgb::new(245, 245, 165))));
|
||||
}
|
||||
|
||||
/// Returns the kind of border the stock border effect gives a window of this kind.
|
||||
@@ -170,11 +177,8 @@ pub fn window_colours(wm: &WindowManager) -> Vec<(u32, u32)> {
|
||||
window_kinds(wm)
|
||||
.into_iter()
|
||||
.map(|(id, kind)| {
|
||||
let (r, g, b) = unpack(kind_colour(kind));
|
||||
(
|
||||
id,
|
||||
(u32::from(r) << 16) | (u32::from(g) << 8) | u32::from(b),
|
||||
)
|
||||
let rgb = Rgb::from(kind_colour(kind));
|
||||
(id, (rgb.r << 16) | (rgb.g << 8) | rgb.b)
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
@@ -197,29 +201,6 @@ pub fn update_colours(wm: &WindowManager) {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns a color as the statics store it: red in the low byte, then green, then blue.
|
||||
///
|
||||
/// ```rust
|
||||
/// use komorebi::border_manager::pack;
|
||||
/// use komorebi::border_manager::unpack;
|
||||
///
|
||||
/// assert_eq!(pack(1, 2, 3), 0x030201);
|
||||
/// assert_eq!(unpack(pack(66, 165, 245)), (66, 165, 245));
|
||||
/// ```
|
||||
pub const fn pack(r: u32, g: u32, b: u32) -> u32 {
|
||||
r | (g << 8) | (b << 16)
|
||||
}
|
||||
|
||||
/// Returns the red, green and blue of a color as the statics store it. The bits above the third
|
||||
/// byte are dropped.
|
||||
pub const fn unpack(colour: u32) -> (u8, u8, u8) {
|
||||
(
|
||||
(colour & 0xff) as u8,
|
||||
((colour >> 8) & 0xff) as u8,
|
||||
((colour >> 16) & 0xff) as u8,
|
||||
)
|
||||
}
|
||||
|
||||
/// Whether the compositor is drawing the borders, as the backend last answered
|
||||
/// [`send_notification`].
|
||||
///
|
||||
@@ -235,11 +216,11 @@ pub static BORDER_DRAWN: AtomicBool = AtomicBool::new(false);
|
||||
///
|
||||
/// ```rust
|
||||
/// use komorebi::border_manager::look;
|
||||
/// use komorebi::border_manager::pack;
|
||||
/// use komorebi::core::animation::AnimationStyle;
|
||||
/// use komorebi_themes::colour::Rgb;
|
||||
///
|
||||
/// let blue = pack(66, 165, 245);
|
||||
/// let grey = pack(128, 128, 128);
|
||||
/// let blue = u32::from(Rgb::new(66, 165, 245));
|
||||
/// let grey = u32::from(Rgb::new(128, 128, 128));
|
||||
///
|
||||
/// let on = look(
|
||||
/// true,
|
||||
@@ -265,12 +246,17 @@ pub fn look(
|
||||
unfocused: u32,
|
||||
animation: Option<(u64, AnimationStyle)>,
|
||||
) -> Look {
|
||||
let rgb = |colour: u32| {
|
||||
let rgb = Rgb::from(colour);
|
||||
(rgb.r as u8, rgb.g as u8, rgb.b as u8)
|
||||
};
|
||||
|
||||
Look {
|
||||
border: enabled.then(|| BorderLook {
|
||||
width: width.max(0),
|
||||
radius: radius.max(0),
|
||||
focused: unpack(focused),
|
||||
unfocused: unpack(unfocused),
|
||||
focused: rgb(focused),
|
||||
unfocused: rgb(unfocused),
|
||||
}),
|
||||
animation: animation.map(|(duration_ms, style)| AnimationLook {
|
||||
duration_ms,
|
||||
@@ -326,8 +312,8 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn the_stored_colours_become_red_green_and_blue() {
|
||||
let blue = pack(66, 165, 245);
|
||||
let grey = pack(128, 128, 128);
|
||||
let blue: u32 = Colour::Rgb(Rgb::new(66, 165, 245)).into();
|
||||
let grey: u32 = Colour::Rgb(Rgb::new(128, 128, 128)).into();
|
||||
|
||||
let look = look(true, 10, 12, blue, grey, None);
|
||||
let border = look.border.unwrap();
|
||||
|
||||
@@ -17,6 +17,7 @@ use crate::core::animation::AnimationStyle;
|
||||
use crate::core::pathext::ResolvedPathBuf;
|
||||
use clap::ValueEnum;
|
||||
use color_eyre::eyre;
|
||||
use komorebi_themes::KomorebiTheme;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use std::num::NonZeroUsize;
|
||||
@@ -291,8 +292,8 @@ pub enum StateQuery {
|
||||
/// sent a notification for every event and message the window manager handles. With
|
||||
/// `filter_state_changes`, it is sent one only when the event or the message changed the
|
||||
/// [`State`](crate::state::State), and always when a window is shown, when a subscriber is added
|
||||
/// (so a new subscriber receives the state as soon as it subscribes) and when the configuration is
|
||||
/// reloaded.
|
||||
/// (so a new subscriber receives the state as soon as it subscribes), when a theme is set (the
|
||||
/// colors of the borders are not part of the state) and when the configuration is reloaded.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
@@ -473,6 +474,7 @@ pub enum SocketMessage {
|
||||
// WatchConfiguration(bool),
|
||||
// CompleteConfiguration,
|
||||
// AltFocusHack(bool),
|
||||
Theme(Box<KomorebiTheme>),
|
||||
Transparency(bool),
|
||||
ToggleTransparency,
|
||||
TransparencyAlpha(u8),
|
||||
|
||||
+5
-2
@@ -13,7 +13,7 @@
|
||||
//!
|
||||
//! On KDE Plasma the backend is [`kwin::KWinBackend`], which talks to a script it loads into KWin.
|
||||
//! The compositor also draws what the windows look like: [`border_manager`] asks the backend for
|
||||
//! the borders, [`animation`] holds how windows are animated going to their places, and
|
||||
//! the borders, [`theme_manager`] colors them from a theme, [`animation`] holds how windows are animated going to their places, and
|
||||
//! [`transparency_manager`] makes the windows that do not have the focus see-through.
|
||||
//!
|
||||
//! The daemon also listens on a socket, `komorebi.sock` in [`struct@DATA_DIR`], for the messages
|
||||
@@ -69,6 +69,7 @@ pub mod process_command;
|
||||
pub mod process_event;
|
||||
pub mod state;
|
||||
pub mod static_config;
|
||||
pub mod theme_manager;
|
||||
pub mod transparency_manager;
|
||||
pub mod window;
|
||||
pub mod window_manager;
|
||||
@@ -263,7 +264,8 @@ pub struct Notification {
|
||||
/// Each subscriber is sent the notification as JSON on a new connection to its socket, which is
|
||||
/// closed after it. A subscriber with `filter_state_changes` in its [`SubscribeOptions`] is sent it
|
||||
/// only if `state_has_been_modified`, or if the notification is about a window being shown, a
|
||||
/// subscriber being added or the configuration being reloaded.
|
||||
/// subscriber being added, a theme being set (the colors of the borders are not part of the
|
||||
/// [`State`]) or the configuration being reloaded.
|
||||
///
|
||||
/// A subscriber that cannot be connected to (its program has exited, or its socket was removed)
|
||||
/// is removed, with its socket file, and is not tried again: it has to subscribe again. The
|
||||
@@ -323,6 +325,7 @@ pub fn notify_subscribers(
|
||||
notification.event,
|
||||
NotificationEvent::Socket(SocketMessage::AddSubscriberSocket(_))
|
||||
| NotificationEvent::Socket(SocketMessage::AddSubscriberSocketWithOptions(_, _))
|
||||
| NotificationEvent::Socket(SocketMessage::Theme(_))
|
||||
| NotificationEvent::Socket(SocketMessage::ReloadStaticConfiguration(_))
|
||||
| NotificationEvent::WindowManager(WindowManagerEvent::Show(_, _))
|
||||
);
|
||||
|
||||
@@ -248,6 +248,7 @@ use crate::notify_subscribers;
|
||||
use crate::state::GlobalState;
|
||||
use crate::state::State;
|
||||
use crate::static_config::StaticConfig;
|
||||
use crate::theme_manager;
|
||||
use crate::transparency_manager;
|
||||
use crate::window::RuleDebug;
|
||||
use crate::window::Window;
|
||||
@@ -258,6 +259,7 @@ use crate::workspace::WorkspaceWindowLocation;
|
||||
use color_eyre::eyre;
|
||||
use color_eyre::eyre::Context;
|
||||
use color_eyre::eyre::OptionExt;
|
||||
use komorebi_themes::colour::Rgb;
|
||||
use parking_lot::Mutex;
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
@@ -424,7 +426,11 @@ impl WindowManager {
|
||||
message: SocketMessage,
|
||||
mut reply: impl std::io::Write,
|
||||
) -> eyre::Result<()> {
|
||||
tracing::info!("processing command: {message}");
|
||||
if matches!(message, SocketMessage::Theme(_)) {
|
||||
tracing::trace!("processing command: {message}");
|
||||
} else {
|
||||
tracing::info!("processing command: {message}");
|
||||
}
|
||||
|
||||
// a window that is maximized (by `toggle-maximize`) is not in the layout, and what is
|
||||
// asked of the layout is not asked of it: nothing happens until it is restored, by
|
||||
@@ -1990,6 +1996,9 @@ impl WindowManager {
|
||||
border_manager::destroy_all_borders()?;
|
||||
}
|
||||
}
|
||||
SocketMessage::Theme(ref theme) => {
|
||||
theme_manager::send_notification(*theme.clone());
|
||||
}
|
||||
SocketMessage::Transparency(enable) => {
|
||||
transparency_manager::TRANSPARENCY_ENABLED.store(enable, Ordering::SeqCst);
|
||||
}
|
||||
@@ -2002,24 +2011,23 @@ impl WindowManager {
|
||||
}
|
||||
SocketMessage::BorderColour(kind, r, g, b) => match kind {
|
||||
WindowKind::Single => {
|
||||
border_manager::FOCUSED.store(border_manager::pack(r, g, b), Ordering::SeqCst);
|
||||
border_manager::FOCUSED.store(Rgb::new(r, g, b).into(), Ordering::SeqCst);
|
||||
}
|
||||
WindowKind::Stack => {
|
||||
border_manager::STACK.store(border_manager::pack(r, g, b), Ordering::SeqCst);
|
||||
border_manager::STACK.store(Rgb::new(r, g, b).into(), Ordering::SeqCst);
|
||||
}
|
||||
WindowKind::Monocle => {
|
||||
border_manager::MONOCLE.store(border_manager::pack(r, g, b), Ordering::SeqCst);
|
||||
border_manager::MONOCLE.store(Rgb::new(r, g, b).into(), Ordering::SeqCst);
|
||||
}
|
||||
WindowKind::Unfocused => {
|
||||
border_manager::UNFOCUSED
|
||||
.store(border_manager::pack(r, g, b), Ordering::SeqCst);
|
||||
border_manager::UNFOCUSED.store(Rgb::new(r, g, b).into(), Ordering::SeqCst);
|
||||
}
|
||||
WindowKind::UnfocusedLocked => {
|
||||
border_manager::UNFOCUSED_LOCKED
|
||||
.store(border_manager::pack(r, g, b), Ordering::SeqCst);
|
||||
.store(Rgb::new(r, g, b).into(), Ordering::SeqCst);
|
||||
}
|
||||
WindowKind::Floating => {
|
||||
border_manager::FLOATING.store(border_manager::pack(r, g, b), Ordering::SeqCst);
|
||||
border_manager::FLOATING.store(Rgb::new(r, g, b).into(), Ordering::SeqCst);
|
||||
}
|
||||
},
|
||||
SocketMessage::BorderWidth(width) => {
|
||||
@@ -2081,7 +2089,11 @@ impl WindowManager {
|
||||
border_manager::update_colours(self);
|
||||
transparency_manager::apply(self);
|
||||
|
||||
tracing::info!("processed command: {message}");
|
||||
if matches!(message, SocketMessage::Theme(_)) {
|
||||
tracing::trace!("processed command: {message}");
|
||||
} else {
|
||||
tracing::info!("processed command: {message}");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@ use crate::core::config_generation::WorkspaceMatchingRule;
|
||||
use crate::core::pathext::ResolvedPathBuf;
|
||||
use crate::monitor::Monitor;
|
||||
use crate::ring::Ring;
|
||||
use crate::theme_manager;
|
||||
use crate::transparency_manager;
|
||||
use crate::window::AspectRatio;
|
||||
use crate::window::PredefinedAspectRatio;
|
||||
@@ -85,6 +86,8 @@ use color_eyre::eyre;
|
||||
use crossbeam_channel::Receiver;
|
||||
use hotwatch::EventKind;
|
||||
use hotwatch::Hotwatch;
|
||||
use komorebi_themes::KomorebiTheme;
|
||||
use komorebi_themes::colour::Colour;
|
||||
use parking_lot::Mutex;
|
||||
use regex::Regex;
|
||||
use serde::Deserialize;
|
||||
@@ -98,6 +101,32 @@ use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||
/// Border colours for different container states
|
||||
///
|
||||
/// These options will have no effect if a `theme` is set
|
||||
pub struct BorderColours {
|
||||
/// Border colour when the container contains a single window
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub single: Option<Colour>,
|
||||
/// Border colour when the container contains multiple windows
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub stack: Option<Colour>,
|
||||
/// Border colour when the container is in monocle mode
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub monocle: Option<Colour>,
|
||||
/// Border colour when the container is in floating mode
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub floating: Option<Colour>,
|
||||
/// Border colour when the container is unfocused
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub unfocused: Option<Colour>,
|
||||
/// Border colour when the container is unfocused and locked
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub unfocused_locked: Option<Colour>,
|
||||
}
|
||||
|
||||
// serde_as must be before derive
|
||||
#[serde_with::serde_as]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
@@ -445,6 +474,10 @@ pub struct StaticConfig {
|
||||
#[serde(alias = "active_window_border")]
|
||||
#[cfg_attr(feature = "schemars", schemars(extend("default" = border_manager::BORDER_ENABLED)))]
|
||||
pub border: Option<bool>,
|
||||
/// Window border colours for different container types (has no effect if a theme is defined)
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
#[serde(alias = "active_window_border_colours")]
|
||||
pub border_colours: Option<BorderColours>,
|
||||
// /// Active window border style (default: System)
|
||||
// #[serde(skip_serializing_if = "Option::is_none")]
|
||||
// #[serde(alias = "active_window_border_style")]
|
||||
@@ -528,6 +561,11 @@ pub struct StaticConfig {
|
||||
/// Animations configuration options
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub animation: Option<AnimationsConfig>,
|
||||
/// Theme configuration options
|
||||
///
|
||||
/// If a theme is specified, `border_colours` will have no effect
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub theme: Option<KomorebiTheme>,
|
||||
/// Aspect ratio to resize with when toggling floating mode for a window
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub floating_window_aspect_ratio: Option<AspectRatio>,
|
||||
@@ -605,6 +643,25 @@ impl From<&WindowManager> for StaticConfig {
|
||||
monitors.push(MonitorConfig::from(m));
|
||||
}
|
||||
|
||||
let border_colours = if border_manager::FOCUSED.load(Ordering::SeqCst) == 0 {
|
||||
None
|
||||
} else {
|
||||
Option::from(BorderColours {
|
||||
single: Option::from(Colour::from(border_manager::FOCUSED.load(Ordering::SeqCst))),
|
||||
stack: Option::from(Colour::from(border_manager::STACK.load(Ordering::SeqCst))),
|
||||
monocle: Option::from(Colour::from(border_manager::MONOCLE.load(Ordering::SeqCst))),
|
||||
floating: Option::from(Colour::from(
|
||||
border_manager::FLOATING.load(Ordering::SeqCst),
|
||||
)),
|
||||
unfocused: Option::from(Colour::from(
|
||||
border_manager::UNFOCUSED.load(Ordering::SeqCst),
|
||||
)),
|
||||
unfocused_locked: Option::from(Colour::from(
|
||||
border_manager::UNFOCUSED_LOCKED.load(Ordering::SeqCst),
|
||||
)),
|
||||
})
|
||||
};
|
||||
|
||||
Self {
|
||||
// invisible_borders: None,
|
||||
resize_delta: Option::from(value.resize_delta),
|
||||
@@ -642,6 +699,7 @@ impl From<&WindowManager> for StaticConfig {
|
||||
border_offset: Option::from(border_manager::BORDER_OFFSET.load(Ordering::SeqCst)),
|
||||
border_radius: Option::from(border_manager::BORDER_RADIUS.load(Ordering::SeqCst)),
|
||||
border: Option::from(border_manager::BORDER_ENABLED.load(Ordering::SeqCst)),
|
||||
border_colours,
|
||||
transparency: Option::from(
|
||||
transparency_manager::TRANSPARENCY_ENABLED.load(Ordering::SeqCst),
|
||||
),
|
||||
@@ -682,6 +740,7 @@ impl From<&WindowManager> for StaticConfig {
|
||||
display_index_preferences: Option::from(DISPLAY_INDEX_PREFERENCES.read().clone()),
|
||||
// stackbar: None,
|
||||
animation: None,
|
||||
theme: None,
|
||||
// slow_application_compensation_time: Option::from(
|
||||
// SLOW_APPLICATION_COMPENSATION_TIME.load(Ordering::SeqCst),
|
||||
// ),
|
||||
@@ -796,6 +855,33 @@ impl StaticConfig {
|
||||
border_manager::BORDER_ENABLED.store(border_enabled, Ordering::SeqCst);
|
||||
}
|
||||
|
||||
if let Some(colours) = &self.border_colours {
|
||||
if let Some(single) = colours.single {
|
||||
border_manager::FOCUSED.store(u32::from(single), Ordering::SeqCst);
|
||||
}
|
||||
|
||||
if let Some(stack) = colours.stack {
|
||||
border_manager::STACK.store(u32::from(stack), Ordering::SeqCst);
|
||||
}
|
||||
|
||||
if let Some(monocle) = colours.monocle {
|
||||
border_manager::MONOCLE.store(u32::from(monocle), Ordering::SeqCst);
|
||||
}
|
||||
|
||||
if let Some(floating) = colours.floating {
|
||||
border_manager::FLOATING.store(u32::from(floating), Ordering::SeqCst);
|
||||
}
|
||||
|
||||
if let Some(unfocused) = colours.unfocused {
|
||||
border_manager::UNFOCUSED.store(u32::from(unfocused), Ordering::SeqCst);
|
||||
}
|
||||
|
||||
if let Some(unfocused_locked) = colours.unfocused_locked {
|
||||
border_manager::UNFOCUSED_LOCKED
|
||||
.store(u32::from(unfocused_locked), Ordering::SeqCst);
|
||||
}
|
||||
}
|
||||
|
||||
// STYLE.store(self.border_style.unwrap_or_default());
|
||||
//
|
||||
// if !*WINDOWS_11
|
||||
@@ -940,6 +1026,10 @@ impl StaticConfig {
|
||||
// }
|
||||
// }
|
||||
//
|
||||
if let Some(theme) = &self.theme {
|
||||
theme_manager::send_notification(theme.clone());
|
||||
}
|
||||
|
||||
if let Some(path) = &self.app_specific_configuration_path {
|
||||
match path {
|
||||
AppSpecificConfigurationPath::Single(path) => handle_asc_file(
|
||||
|
||||
@@ -0,0 +1,278 @@
|
||||
//! Turns a theme into border colors: a named theme or a palette of one's own, or the palette made
|
||||
//! from a picture.
|
||||
//!
|
||||
//! [`send_notification`] puts a theme's six border colors into the statics of
|
||||
//! [`border_manager`], which hands them to the border effect. The palette of a picture takes
|
||||
//! seconds to make, so [`wallpaper_palette`] keeps each one it makes in komorebi's cache directory
|
||||
//! ([`palette_file`]).
|
||||
|
||||
use crate::border_manager;
|
||||
use crossbeam_utils::atomic::AtomicCell;
|
||||
use komorebi_themes::Base16ColourPalette;
|
||||
use komorebi_themes::Base16Wrapper;
|
||||
use komorebi_themes::KomorebiTheme;
|
||||
use komorebi_themes::KomorebiThemeBase16;
|
||||
use komorebi_themes::KomorebiThemeCatppuccin;
|
||||
use komorebi_themes::KomorebiThemeCustom;
|
||||
use komorebi_themes::ThemeVariant;
|
||||
use komorebi_themes::colour::Colour;
|
||||
use std::hash::Hash;
|
||||
use std::hash::Hasher;
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
/// Returns the directory the palettes made from wallpapers are kept in: `komorebi` in the user's
|
||||
/// cache directory (`$XDG_CACHE_HOME`, else `~/.cache`), else in the log directory.
|
||||
///
|
||||
/// A palette takes seconds to make, so it should outlive a login, and the runtime directory, where
|
||||
/// komorebi's socket is, does not.
|
||||
fn palette_dir() -> PathBuf {
|
||||
dirs::cache_dir()
|
||||
.unwrap_or_else(|| crate::LOG_DIR.clone())
|
||||
.join("komorebi")
|
||||
}
|
||||
|
||||
/// Returns the file the palette of the picture at `path`, in this variant, is kept in.
|
||||
///
|
||||
/// The name alone is not enough to know a wallpaper by: two folders can each have a
|
||||
/// `wallpaper.png`, and one wallpaper can be painted over. The file is named after the picture, a
|
||||
/// hash of its path, size and time of last change, and the variant, so the palette is made again
|
||||
/// when the path, the size or the time of the last change differ.
|
||||
///
|
||||
/// ```rust
|
||||
/// use komorebi::theme_manager::palette_file;
|
||||
/// use komorebi_themes::ThemeVariant;
|
||||
/// use std::path::Path;
|
||||
///
|
||||
/// let file = palette_file(Path::new("/nonexistent/dunes.png"), ThemeVariant::Dark);
|
||||
/// let name = file.file_name().unwrap().to_string_lossy().into_owned();
|
||||
/// assert!(name.starts_with("dunes-") && name.ends_with(".base16.dark.json"), "{name}");
|
||||
///
|
||||
/// // a picture of the same name in another folder has a palette of its own
|
||||
/// let elsewhere = palette_file(Path::new("/elsewhere/dunes.png"), ThemeVariant::Dark);
|
||||
/// assert_ne!(file, elsewhere);
|
||||
/// ```
|
||||
pub fn palette_file(path: &Path, variant: ThemeVariant) -> PathBuf {
|
||||
let mut hasher = std::collections::hash_map::DefaultHasher::new();
|
||||
path.hash(&mut hasher);
|
||||
if let Ok(meta) = std::fs::metadata(path) {
|
||||
meta.len().hash(&mut hasher);
|
||||
meta.modified().ok().hash(&mut hasher);
|
||||
}
|
||||
|
||||
palette_dir().join(format!(
|
||||
"{}-{:016x}.base16.{variant}.json",
|
||||
path.file_stem().unwrap_or_default().to_string_lossy(),
|
||||
hasher.finish()
|
||||
))
|
||||
}
|
||||
|
||||
/// Returns the Base16 palette of a picture, in this variant: from the cache if it was made before,
|
||||
/// else made now (which can take a few seconds for a large picture) and kept.
|
||||
///
|
||||
/// Returns `None`, and logs why, when no palette can be made from the picture: it cannot be read,
|
||||
/// or it has fewer than the eight colors a palette needs. A palette that cannot be kept is made
|
||||
/// again the next time.
|
||||
pub fn wallpaper_palette(path: &Path, variant: ThemeVariant) -> Option<Base16ColourPalette> {
|
||||
let cached = palette_file(path, variant);
|
||||
|
||||
if let Ok(text) = std::fs::read_to_string(&cached)
|
||||
&& let Ok(palette) = serde_json::from_str::<Base16ColourPalette>(&text)
|
||||
{
|
||||
tracing::info!(
|
||||
"colour palette for wallpaper {} found in cache",
|
||||
cached.display()
|
||||
);
|
||||
return Some(palette);
|
||||
}
|
||||
|
||||
let palette = match komorebi_themes::generate_base16_palette(path, variant) {
|
||||
Ok(palette) => palette,
|
||||
Err(error) => {
|
||||
tracing::error!(
|
||||
"could not make a colour palette from {}: {error}",
|
||||
path.display()
|
||||
);
|
||||
return None;
|
||||
}
|
||||
};
|
||||
|
||||
// not being able to keep it only means making it again next time
|
||||
let kept = std::fs::create_dir_all(palette_dir()).and_then(|()| {
|
||||
std::fs::write(
|
||||
&cached,
|
||||
serde_json::to_string_pretty(&palette).map_err(std::io::Error::other)?,
|
||||
)
|
||||
});
|
||||
match kept {
|
||||
Ok(()) => tracing::info!("colour palette for wallpaper {} cached", cached.display()),
|
||||
Err(error) => tracing::warn!("could not keep {}: {error}", cached.display()),
|
||||
}
|
||||
|
||||
Some(palette)
|
||||
}
|
||||
|
||||
pub static CURRENT_THEME: AtomicCell<Option<KomorebiTheme>> = AtomicCell::new(None);
|
||||
|
||||
/// Makes `theme` the theme of the borders: puts its colors into the statics of [`border_manager`]
|
||||
/// and the theme into [`CURRENT_THEME`], and asks the compositor for the new look, on the
|
||||
/// caller's thread.
|
||||
pub fn send_notification(theme: KomorebiTheme) {
|
||||
apply(&theme);
|
||||
CURRENT_THEME.store(Some(theme));
|
||||
border_manager::send_notification();
|
||||
}
|
||||
|
||||
/// Puts the six border colors of a theme into the statics of [`border_manager`]: the color the
|
||||
/// theme names for each kind of border, else the theme's default for that kind.
|
||||
fn apply(theme: &KomorebiTheme) {
|
||||
let (
|
||||
single_border,
|
||||
stack_border,
|
||||
monocle_border,
|
||||
floating_border,
|
||||
unfocused_border,
|
||||
unfocused_locked_border,
|
||||
) = match theme {
|
||||
KomorebiTheme::Catppuccin(KomorebiThemeCatppuccin {
|
||||
name,
|
||||
single_border,
|
||||
stack_border,
|
||||
monocle_border,
|
||||
floating_border,
|
||||
unfocused_border,
|
||||
unfocused_locked_border,
|
||||
..
|
||||
}) => {
|
||||
let single_border = single_border
|
||||
.unwrap_or(komorebi_themes::CatppuccinValue::Blue)
|
||||
.color32(name.as_theme());
|
||||
|
||||
let stack_border = stack_border
|
||||
.unwrap_or(komorebi_themes::CatppuccinValue::Green)
|
||||
.color32(name.as_theme());
|
||||
|
||||
let monocle_border = monocle_border
|
||||
.unwrap_or(komorebi_themes::CatppuccinValue::Pink)
|
||||
.color32(name.as_theme());
|
||||
|
||||
let floating_border = floating_border
|
||||
.unwrap_or(komorebi_themes::CatppuccinValue::Yellow)
|
||||
.color32(name.as_theme());
|
||||
|
||||
let unfocused_border = unfocused_border
|
||||
.unwrap_or(komorebi_themes::CatppuccinValue::Base)
|
||||
.color32(name.as_theme());
|
||||
|
||||
let unfocused_locked_border = unfocused_locked_border
|
||||
.unwrap_or(komorebi_themes::CatppuccinValue::Red)
|
||||
.color32(name.as_theme());
|
||||
|
||||
(
|
||||
single_border,
|
||||
stack_border,
|
||||
monocle_border,
|
||||
floating_border,
|
||||
unfocused_border,
|
||||
unfocused_locked_border,
|
||||
)
|
||||
}
|
||||
KomorebiTheme::Base16(KomorebiThemeBase16 {
|
||||
name,
|
||||
single_border,
|
||||
stack_border,
|
||||
monocle_border,
|
||||
floating_border,
|
||||
unfocused_border,
|
||||
unfocused_locked_border,
|
||||
..
|
||||
}) => {
|
||||
let single_border = single_border
|
||||
.unwrap_or(komorebi_themes::Base16Value::Base0D)
|
||||
.color32(Base16Wrapper::Base16(*name));
|
||||
|
||||
let stack_border = stack_border
|
||||
.unwrap_or(komorebi_themes::Base16Value::Base0B)
|
||||
.color32(Base16Wrapper::Base16(*name));
|
||||
|
||||
let monocle_border = monocle_border
|
||||
.unwrap_or(komorebi_themes::Base16Value::Base0F)
|
||||
.color32(Base16Wrapper::Base16(*name));
|
||||
|
||||
let unfocused_border = unfocused_border
|
||||
.unwrap_or(komorebi_themes::Base16Value::Base01)
|
||||
.color32(Base16Wrapper::Base16(*name));
|
||||
|
||||
let unfocused_locked_border = unfocused_locked_border
|
||||
.unwrap_or(komorebi_themes::Base16Value::Base08)
|
||||
.color32(Base16Wrapper::Base16(*name));
|
||||
|
||||
let floating_border = floating_border
|
||||
.unwrap_or(komorebi_themes::Base16Value::Base09)
|
||||
.color32(Base16Wrapper::Base16(*name));
|
||||
|
||||
(
|
||||
single_border,
|
||||
stack_border,
|
||||
monocle_border,
|
||||
floating_border,
|
||||
unfocused_border,
|
||||
unfocused_locked_border,
|
||||
)
|
||||
}
|
||||
KomorebiTheme::Custom(KomorebiThemeCustom {
|
||||
colours,
|
||||
single_border,
|
||||
stack_border,
|
||||
monocle_border,
|
||||
floating_border,
|
||||
unfocused_border,
|
||||
unfocused_locked_border,
|
||||
..
|
||||
}) => {
|
||||
let single_border = single_border
|
||||
.unwrap_or(komorebi_themes::Base16Value::Base0D)
|
||||
.color32(Base16Wrapper::Custom(colours.clone()));
|
||||
|
||||
let stack_border = stack_border
|
||||
.unwrap_or(komorebi_themes::Base16Value::Base0B)
|
||||
.color32(Base16Wrapper::Custom(colours.clone()));
|
||||
|
||||
let monocle_border = monocle_border
|
||||
.unwrap_or(komorebi_themes::Base16Value::Base0F)
|
||||
.color32(Base16Wrapper::Custom(colours.clone()));
|
||||
|
||||
let unfocused_border = unfocused_border
|
||||
.unwrap_or(komorebi_themes::Base16Value::Base01)
|
||||
.color32(Base16Wrapper::Custom(colours.clone()));
|
||||
|
||||
let unfocused_locked_border = unfocused_locked_border
|
||||
.unwrap_or(komorebi_themes::Base16Value::Base08)
|
||||
.color32(Base16Wrapper::Custom(colours.clone()));
|
||||
|
||||
let floating_border = floating_border
|
||||
.unwrap_or(komorebi_themes::Base16Value::Base09)
|
||||
.color32(Base16Wrapper::Custom(colours.clone()));
|
||||
|
||||
(
|
||||
single_border,
|
||||
stack_border,
|
||||
monocle_border,
|
||||
floating_border,
|
||||
unfocused_border,
|
||||
unfocused_locked_border,
|
||||
)
|
||||
}
|
||||
};
|
||||
|
||||
border_manager::FOCUSED.store(u32::from(Colour::from(single_border)), Ordering::SeqCst);
|
||||
border_manager::MONOCLE.store(u32::from(Colour::from(monocle_border)), Ordering::SeqCst);
|
||||
border_manager::STACK.store(u32::from(Colour::from(stack_border)), Ordering::SeqCst);
|
||||
border_manager::FLOATING.store(u32::from(Colour::from(floating_border)), Ordering::SeqCst);
|
||||
border_manager::UNFOCUSED.store(u32::from(Colour::from(unfocused_border)), Ordering::SeqCst);
|
||||
border_manager::UNFOCUSED_LOCKED.store(
|
||||
u32::from(Colour::from(unfocused_locked_border)),
|
||||
Ordering::SeqCst,
|
||||
);
|
||||
}
|
||||
@@ -13,6 +13,7 @@ use komorebi::border_manager;
|
||||
use komorebi::core::SocketMessage;
|
||||
use komorebi::core::WindowKind;
|
||||
use komorebi::window_manager::WindowManager;
|
||||
use komorebi_themes::colour::Rgb;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
@@ -68,10 +69,8 @@ fn the_border_messages_set_the_border_and_the_compositor_is_asked_for_it() {
|
||||
(border.focused, border.unfocused),
|
||||
((10, 20, 30), (40, 50, 60))
|
||||
);
|
||||
assert_eq!(
|
||||
border_manager::unpack(border_manager::FLOATING.load(Ordering::SeqCst)),
|
||||
(70, 80, 90)
|
||||
);
|
||||
let floating = Rgb::from(border_manager::FLOATING.load(Ordering::SeqCst));
|
||||
assert_eq!((floating.r, floating.g, floating.b), (70, 80, 90));
|
||||
|
||||
send(&mut wm, SocketMessage::Border(false));
|
||||
assert_eq!(last_look(), Look::default());
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//! ships (`docs/komorebi.example.json`) and files of komorebi for Windows, which has keys that
|
||||
//! mean nothing on KDE Plasma. Every fixture must deserialize with [`StaticConfig`], round-trip
|
||||
//! through its serializer, and lose only the top-level keys that are Windows-only
|
||||
//! ([`WINDOWS_ONLY`]) or that are read once the feature they configure is there ([`NOT_YET`]).
|
||||
//! ([`WINDOWS_ONLY`]).
|
||||
//! Run with `--nocapture` to see exactly which paths each config has silently dropped.
|
||||
//!
|
||||
//! Extra configs (for example your own) can be checked without copying them into the repo:
|
||||
@@ -39,16 +39,6 @@ const WINDOWS_ONLY: &[&str] = &[
|
||||
"window_hiding_behaviour",
|
||||
];
|
||||
|
||||
/// Top-level fields that `StaticConfig` has when the feature they configure is there, and that are
|
||||
/// ignored until then. Each comment says which commit of the plan brings the feature, and takes
|
||||
/// the key off this list.
|
||||
const NOT_YET: &[&str] = &[
|
||||
// a color for each kind of window's border, whose type is komorebi-themes' (49)
|
||||
"border_colours",
|
||||
// themes (49)
|
||||
"theme",
|
||||
];
|
||||
|
||||
fn repo_root() -> PathBuf {
|
||||
Path::new(env!("CARGO_MANIFEST_DIR"))
|
||||
.parent()
|
||||
@@ -114,7 +104,7 @@ fn dropped(input: &Value, output: &Value, path: &str, out: &mut Vec<String>) {
|
||||
|
||||
#[test]
|
||||
fn fixtures_load_round_trip_and_only_lose_windows_only_keys() {
|
||||
let windows_only: BTreeSet<&str> = WINDOWS_ONLY.iter().chain(NOT_YET).copied().collect();
|
||||
let windows_only: BTreeSet<&str> = WINDOWS_ONLY.iter().copied().collect();
|
||||
let files = fixtures();
|
||||
assert!(
|
||||
files.len() >= 3,
|
||||
@@ -158,7 +148,7 @@ fn fixtures_load_round_trip_and_only_lose_windows_only_keys() {
|
||||
.collect();
|
||||
assert!(
|
||||
unexpected.is_empty(),
|
||||
"{name}: dropped top-level keys that are neither Windows-only nor not yet read: {unexpected:?}"
|
||||
"{name}: dropped top-level keys that are not Windows-only: {unexpected:?}"
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -180,7 +170,6 @@ fn the_lists_name_no_key_that_is_read() {
|
||||
|
||||
let stale: Vec<_> = WINDOWS_ONLY
|
||||
.iter()
|
||||
.chain(NOT_YET)
|
||||
.filter(|key| read.contains(**key))
|
||||
.collect();
|
||||
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
//! The `border_colours` and `theme` keys of `komorebi.json` are the border colors: the file sets
|
||||
//! the colors it names when the daemon starts and when it is read again, a color it leaves out is
|
||||
//! left as it is, a theme wins over the colors, and the colors come out again in the configuration
|
||||
//! the daemon generates.
|
||||
//!
|
||||
//! This file has one test because it changes the process-wide border colors, which every other test
|
||||
//! that asks for the look would see.
|
||||
|
||||
use color_eyre::eyre;
|
||||
use komorebi::backend::fake::FakeBackend;
|
||||
use komorebi::backend::with_backend;
|
||||
use komorebi::border_manager;
|
||||
use komorebi::static_config::StaticConfig;
|
||||
use komorebi::window_manager::WindowManager;
|
||||
use komorebi_themes::colour::Colour;
|
||||
use komorebi_themes::colour::Rgb;
|
||||
use parking_lot::Mutex;
|
||||
use std::os::unix::net::UnixListener;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
fn write_config(name: &str, json: &str) -> PathBuf {
|
||||
let path = PathBuf::from(format!("/tmp/kmb-theme-{name}-{}.json", std::process::id()));
|
||||
std::fs::write(&path, json).unwrap();
|
||||
path
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_colour_and_theme_keys_of_the_file_are_the_border_colours() {
|
||||
let fake = Arc::new(FakeBackend::with_one_monitor());
|
||||
let colour = |slot: &std::sync::atomic::AtomicU32| slot.load(Ordering::SeqCst);
|
||||
|
||||
let path = write_config(
|
||||
"colours",
|
||||
r##"{
|
||||
"border_colours": {
|
||||
"single": { "r": 1, "g": 2, "b": 3 },
|
||||
"stack": "#040506"
|
||||
}
|
||||
}"##,
|
||||
);
|
||||
let (_sender, receiver) = crossbeam_channel::bounded(1);
|
||||
let socket = PathBuf::from(format!("/tmp/kmb-theme-config-{}.sock", std::process::id()));
|
||||
let listener = UnixListener::bind(&socket).unwrap();
|
||||
|
||||
let wm = with_backend(fake.clone(), || -> eyre::Result<WindowManager> {
|
||||
let mut wm = StaticConfig::preload(&path, receiver, Some(listener))?;
|
||||
wm.init()?;
|
||||
Ok(wm)
|
||||
})
|
||||
.unwrap();
|
||||
let wm = Arc::new(Mutex::new(wm));
|
||||
with_backend(fake.clone(), || StaticConfig::postload(&path, &wm)).unwrap();
|
||||
let _ = std::fs::remove_file(&socket);
|
||||
|
||||
// the colors the file names are the border's, in red, green and blue; the others are as they were
|
||||
assert_eq!(colour(&border_manager::FOCUSED), 0x03_02_01);
|
||||
assert_eq!(colour(&border_manager::STACK), 0x06_05_04);
|
||||
assert_eq!(colour(&border_manager::UNFOCUSED), 0x80_80_80);
|
||||
|
||||
// and they come out again in the generated configuration
|
||||
let generated = StaticConfig::from(&*wm.lock()).border_colours.unwrap();
|
||||
assert_eq!(generated.single, Some(Colour::Rgb(Rgb::new(1, 2, 3))));
|
||||
assert_eq!(generated.stack, Some(Colour::Rgb(Rgb::new(4, 5, 6))));
|
||||
|
||||
// the old name of the key is the same key
|
||||
let aliased = StaticConfig::read_raw(
|
||||
r#"{ "active_window_border_colours": { "floating": { "r": 7, "g": 8, "b": 9 } } }"#,
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
aliased.border_colours.unwrap().floating,
|
||||
Some(Colour::Rgb(Rgb::new(7, 8, 9)))
|
||||
);
|
||||
|
||||
// a theme wins over the colors that come with it
|
||||
let themed = write_config(
|
||||
"themed",
|
||||
r#"{
|
||||
"border_colours": { "single": { "r": 9, "g": 9, "b": 9 } },
|
||||
"theme": { "palette": "Catppuccin", "name": "Mocha" }
|
||||
}"#,
|
||||
);
|
||||
with_backend(fake.clone(), || {
|
||||
StaticConfig::reload(&themed, &mut wm.lock()).unwrap();
|
||||
});
|
||||
assert_eq!(
|
||||
colour(&border_manager::FOCUSED),
|
||||
0xFA_B4_89,
|
||||
"Mocha's blue, and not the 9 9 9 of the file"
|
||||
);
|
||||
|
||||
// and a file with neither leaves the colors as they are
|
||||
let empty = write_config("empty", "{}");
|
||||
with_backend(fake.clone(), || {
|
||||
StaticConfig::reload(&empty, &mut wm.lock()).unwrap();
|
||||
});
|
||||
assert_eq!(colour(&border_manager::FOCUSED), 0xFA_B4_89);
|
||||
|
||||
for file in [path, themed, empty] {
|
||||
let _ = std::fs::remove_file(file);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
//! Named themes, against an in-memory desktop: a theme gives every kind of border its color.
|
||||
//!
|
||||
//! Window ids are in the 70_000s. The colors are process-wide, so the tests of this file take
|
||||
//! turns.
|
||||
|
||||
use komorebi::backend::fake::FakeBackend;
|
||||
use komorebi::backend::with_backend;
|
||||
use komorebi::border_manager;
|
||||
use komorebi::core::SocketMessage;
|
||||
use komorebi::window::Window;
|
||||
use komorebi::window_manager::WindowManager;
|
||||
use komorebi::window_manager_event::KWinNotification;
|
||||
use komorebi::window_manager_event::SystemNotification;
|
||||
use komorebi::window_manager_event::WindowManagerEvent;
|
||||
use komorebi_themes::KomorebiTheme;
|
||||
use komorebi_themes::KomorebiThemeCatppuccin;
|
||||
use parking_lot::Mutex;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
static TURN: Mutex<()> = Mutex::new(());
|
||||
|
||||
fn desktop() -> (Arc<FakeBackend>, WindowManager) {
|
||||
let fake = Arc::new(FakeBackend::with_one_monitor());
|
||||
let (_sender, receiver) = crossbeam_channel::bounded(1);
|
||||
let socket = PathBuf::from(format!("/tmp/kmf-wallpaper-{}.sock", std::process::id()));
|
||||
|
||||
let wm = with_backend(fake.clone(), || {
|
||||
let mut wm = WindowManager::new(receiver, Some(socket)).unwrap();
|
||||
wm.init().unwrap();
|
||||
wm
|
||||
});
|
||||
|
||||
(fake, wm)
|
||||
}
|
||||
|
||||
fn command(fake: &Arc<FakeBackend>, wm: &mut WindowManager, message: SocketMessage) {
|
||||
with_backend(fake.clone(), || wm.process_command(message, Vec::new())).unwrap();
|
||||
}
|
||||
|
||||
fn focused_border() -> u32 {
|
||||
border_manager::FOCUSED.load(Ordering::SeqCst)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_named_theme_colours_every_kind_of_border() {
|
||||
let _turn = TURN.lock();
|
||||
let (fake, mut wm) = desktop();
|
||||
|
||||
fake.open_window(70_001, "foot", "foot", "terminal");
|
||||
with_backend(fake.clone(), || {
|
||||
wm.process_event(WindowManagerEvent::Show(
|
||||
SystemNotification::KWin(KWinNotification::WindowAdded),
|
||||
Window::from(70_001),
|
||||
))
|
||||
})
|
||||
.unwrap();
|
||||
border_manager::BORDER_ENABLED.store(true, Ordering::SeqCst);
|
||||
|
||||
command(
|
||||
&fake,
|
||||
&mut wm,
|
||||
SocketMessage::Theme(Box::new(KomorebiTheme::Catppuccin(
|
||||
KomorebiThemeCatppuccin {
|
||||
name: komorebi_themes::Catppuccin::Mocha,
|
||||
bar_accent: None,
|
||||
single_border: None,
|
||||
stack_border: None,
|
||||
monocle_border: None,
|
||||
floating_border: None,
|
||||
unfocused_border: None,
|
||||
unfocused_locked_border: None,
|
||||
},
|
||||
))),
|
||||
);
|
||||
|
||||
// Mocha's blue, which is the default for the focused window: kept as Windows keeps colours
|
||||
// (0x00BBGGRR), and given to the compositor as 0xRRGGBB
|
||||
assert_eq!(focused_border(), 0xFAB489);
|
||||
assert_eq!(
|
||||
fake.border_colour_of(70_001),
|
||||
Some(0x89B4FA),
|
||||
"{:?}",
|
||||
fake.commands()
|
||||
);
|
||||
|
||||
border_manager::BORDER_ENABLED.store(false, Ordering::SeqCst);
|
||||
}
|
||||
+573
-1
@@ -1,4 +1,4 @@
|
||||
# schema-sha256: c001e5dc47908d250a272d3be32faaccd8e0b57629a62a0537d7880a53183ae5
|
||||
# schema-sha256: 475a8bc02a8f0e0e68cc0fbb41bd949ff7743feda00fac5c4bf02565d2848561
|
||||
{ lib, ... }:
|
||||
let
|
||||
animationStyle = (
|
||||
@@ -46,6 +46,77 @@ let
|
||||
})
|
||||
]
|
||||
);
|
||||
base16Value = (
|
||||
lib.types.enum [
|
||||
"Base00"
|
||||
"Base01"
|
||||
"Base02"
|
||||
"Base03"
|
||||
"Base04"
|
||||
"Base05"
|
||||
"Base06"
|
||||
"Base07"
|
||||
"Base08"
|
||||
"Base09"
|
||||
"Base0A"
|
||||
"Base0B"
|
||||
"Base0C"
|
||||
"Base0D"
|
||||
"Base0E"
|
||||
"Base0F"
|
||||
]
|
||||
);
|
||||
catppuccinValue = (
|
||||
lib.types.enum [
|
||||
"Rosewater"
|
||||
"Flamingo"
|
||||
"Pink"
|
||||
"Mauve"
|
||||
"Red"
|
||||
"Maroon"
|
||||
"Peach"
|
||||
"Yellow"
|
||||
"Green"
|
||||
"Teal"
|
||||
"Sky"
|
||||
"Sapphire"
|
||||
"Blue"
|
||||
"Lavender"
|
||||
"Text"
|
||||
"Subtext1"
|
||||
"Subtext0"
|
||||
"Overlay2"
|
||||
"Overlay1"
|
||||
"Overlay0"
|
||||
"Surface2"
|
||||
"Surface1"
|
||||
"Surface0"
|
||||
"Base"
|
||||
"Mantle"
|
||||
"Crust"
|
||||
]
|
||||
);
|
||||
colour = (
|
||||
lib.types.oneOf [
|
||||
(lib.types.submodule {
|
||||
options = {
|
||||
b = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
description = "Blue";
|
||||
};
|
||||
g = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
description = "Green";
|
||||
};
|
||||
r = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
description = "Red";
|
||||
};
|
||||
};
|
||||
})
|
||||
lib.types.str
|
||||
]
|
||||
);
|
||||
defaultLayout = (
|
||||
lib.types.enum [
|
||||
"BSP"
|
||||
@@ -292,6 +363,48 @@ in
|
||||
default = true;
|
||||
description = "Display window borders";
|
||||
};
|
||||
border_colours = lib.mkOption {
|
||||
type = (
|
||||
lib.types.nullOr (
|
||||
lib.types.submodule {
|
||||
options = {
|
||||
floating = lib.mkOption {
|
||||
type = (lib.types.nullOr colour);
|
||||
default = null;
|
||||
description = "Border colour when the container is in floating mode";
|
||||
};
|
||||
monocle = lib.mkOption {
|
||||
type = (lib.types.nullOr colour);
|
||||
default = null;
|
||||
description = "Border colour when the container is in monocle mode";
|
||||
};
|
||||
single = lib.mkOption {
|
||||
type = (lib.types.nullOr colour);
|
||||
default = null;
|
||||
description = "Border colour when the container contains a single window";
|
||||
};
|
||||
stack = lib.mkOption {
|
||||
type = (lib.types.nullOr colour);
|
||||
default = null;
|
||||
description = "Border colour when the container contains multiple windows";
|
||||
};
|
||||
unfocused = lib.mkOption {
|
||||
type = (lib.types.nullOr colour);
|
||||
default = null;
|
||||
description = "Border colour when the container is unfocused";
|
||||
};
|
||||
unfocused_locked = lib.mkOption {
|
||||
type = (lib.types.nullOr colour);
|
||||
default = null;
|
||||
description = "Border colour when the container is unfocused and locked";
|
||||
};
|
||||
};
|
||||
}
|
||||
)
|
||||
);
|
||||
default = null;
|
||||
description = "Window border colours for different container types (has no effect if a theme is defined)";
|
||||
};
|
||||
border_offset = lib.mkOption {
|
||||
type = (lib.types.nullOr lib.types.int);
|
||||
default = 0;
|
||||
@@ -635,6 +748,465 @@ in
|
||||
default = null;
|
||||
description = "Accepted so that a configuration written for another platform loads, and ignored: a KWin\nwindow has no native tabs";
|
||||
};
|
||||
theme = lib.mkOption {
|
||||
type = (
|
||||
lib.types.nullOr (
|
||||
lib.types.submodule {
|
||||
options = {
|
||||
palette = lib.mkOption {
|
||||
type = (
|
||||
lib.types.enum [
|
||||
"Catppuccin"
|
||||
"Base16"
|
||||
"Custom"
|
||||
]
|
||||
);
|
||||
};
|
||||
monocle_border = lib.mkOption {
|
||||
type = (
|
||||
lib.types.nullOr (
|
||||
lib.types.oneOf [
|
||||
(lib.types.nullOr catppuccinValue)
|
||||
(lib.types.nullOr base16Value)
|
||||
]
|
||||
)
|
||||
);
|
||||
default = null;
|
||||
};
|
||||
colours = lib.mkOption {
|
||||
type = (
|
||||
lib.types.nullOr (
|
||||
lib.types.submodule {
|
||||
options = {
|
||||
base_00 = lib.mkOption {
|
||||
type = colour;
|
||||
description = "Base00";
|
||||
};
|
||||
base_01 = lib.mkOption {
|
||||
type = colour;
|
||||
description = "Base01";
|
||||
};
|
||||
base_02 = lib.mkOption {
|
||||
type = colour;
|
||||
description = "Base02";
|
||||
};
|
||||
base_03 = lib.mkOption {
|
||||
type = colour;
|
||||
description = "Base03";
|
||||
};
|
||||
base_04 = lib.mkOption {
|
||||
type = colour;
|
||||
description = "Base04";
|
||||
};
|
||||
base_05 = lib.mkOption {
|
||||
type = colour;
|
||||
description = "Base05";
|
||||
};
|
||||
base_06 = lib.mkOption {
|
||||
type = colour;
|
||||
description = "Base06";
|
||||
};
|
||||
base_07 = lib.mkOption {
|
||||
type = colour;
|
||||
description = "Base07";
|
||||
};
|
||||
base_08 = lib.mkOption {
|
||||
type = colour;
|
||||
description = "Base08";
|
||||
};
|
||||
base_09 = lib.mkOption {
|
||||
type = colour;
|
||||
description = "Base09";
|
||||
};
|
||||
base_0a = lib.mkOption {
|
||||
type = colour;
|
||||
description = "Base0A";
|
||||
};
|
||||
base_0b = lib.mkOption {
|
||||
type = colour;
|
||||
description = "Base0B";
|
||||
};
|
||||
base_0c = lib.mkOption {
|
||||
type = colour;
|
||||
description = "Base0C";
|
||||
};
|
||||
base_0d = lib.mkOption {
|
||||
type = colour;
|
||||
description = "Base0D";
|
||||
};
|
||||
base_0e = lib.mkOption {
|
||||
type = colour;
|
||||
description = "Base0E";
|
||||
};
|
||||
base_0f = lib.mkOption {
|
||||
type = colour;
|
||||
description = "Base0F";
|
||||
};
|
||||
};
|
||||
}
|
||||
)
|
||||
);
|
||||
default = null;
|
||||
};
|
||||
unfocused_locked_border = lib.mkOption {
|
||||
type = (
|
||||
lib.types.nullOr (
|
||||
lib.types.oneOf [
|
||||
(lib.types.nullOr catppuccinValue)
|
||||
(lib.types.nullOr base16Value)
|
||||
]
|
||||
)
|
||||
);
|
||||
default = null;
|
||||
};
|
||||
unfocused_border = lib.mkOption {
|
||||
type = (
|
||||
lib.types.nullOr (
|
||||
lib.types.oneOf [
|
||||
(lib.types.nullOr catppuccinValue)
|
||||
(lib.types.nullOr base16Value)
|
||||
]
|
||||
)
|
||||
);
|
||||
default = null;
|
||||
};
|
||||
name = lib.mkOption {
|
||||
type = (
|
||||
lib.types.nullOr (
|
||||
lib.types.oneOf [
|
||||
(lib.types.enum [
|
||||
"Frappe"
|
||||
"Latte"
|
||||
"Macchiato"
|
||||
"Mocha"
|
||||
])
|
||||
(lib.types.enum [
|
||||
"3024"
|
||||
"Apathy"
|
||||
"Apprentice"
|
||||
"Ashes"
|
||||
"AtelierCaveLight"
|
||||
"AtelierCave"
|
||||
"AtelierDuneLight"
|
||||
"AtelierDune"
|
||||
"AtelierEstuaryLight"
|
||||
"AtelierEstuary"
|
||||
"AtelierForestLight"
|
||||
"AtelierForest"
|
||||
"AtelierHeathLight"
|
||||
"AtelierHeath"
|
||||
"AtelierLakesideLight"
|
||||
"AtelierLakeside"
|
||||
"AtelierPlateauLight"
|
||||
"AtelierPlateau"
|
||||
"AtelierSavannaLight"
|
||||
"AtelierSavanna"
|
||||
"AtelierSeasideLight"
|
||||
"AtelierSeaside"
|
||||
"AtelierSulphurpoolLight"
|
||||
"AtelierSulphurpool"
|
||||
"Atlas"
|
||||
"AyuDark"
|
||||
"AyuLight"
|
||||
"AyuMirage"
|
||||
"Aztec"
|
||||
"Bespin"
|
||||
"BlackMetalBathory"
|
||||
"BlackMetalBurzum"
|
||||
"BlackMetalDarkFuneral"
|
||||
"BlackMetalGorgoroth"
|
||||
"BlackMetalImmortal"
|
||||
"BlackMetalKhold"
|
||||
"BlackMetalMarduk"
|
||||
"BlackMetalMayhem"
|
||||
"BlackMetalNile"
|
||||
"BlackMetalVenom"
|
||||
"BlackMetal"
|
||||
"Blueforest"
|
||||
"Blueish"
|
||||
"Brewer"
|
||||
"Bright"
|
||||
"Brogrammer"
|
||||
"BrushtreesDark"
|
||||
"Brushtrees"
|
||||
"Caroline"
|
||||
"CatppuccinFrappe"
|
||||
"CatppuccinLatte"
|
||||
"CatppuccinMacchiato"
|
||||
"CatppuccinMocha"
|
||||
"Chalk"
|
||||
"Circus"
|
||||
"ClassicDark"
|
||||
"ClassicLight"
|
||||
"Codeschool"
|
||||
"Colors"
|
||||
"Cupcake"
|
||||
"Cupertino"
|
||||
"DaOneBlack"
|
||||
"DaOneGray"
|
||||
"DaOneOcean"
|
||||
"DaOnePaper"
|
||||
"DaOneSea"
|
||||
"DaOneWhite"
|
||||
"DanqingLight"
|
||||
"Danqing"
|
||||
"Darcula"
|
||||
"Darkmoss"
|
||||
"Darktooth"
|
||||
"Darkviolet"
|
||||
"Decaf"
|
||||
"DefaultDark"
|
||||
"DefaultLight"
|
||||
"Dirtysea"
|
||||
"Dracula"
|
||||
"EdgeDark"
|
||||
"EdgeLight"
|
||||
"Eighties"
|
||||
"EmbersLight"
|
||||
"Embers"
|
||||
"Emil"
|
||||
"EquilibriumDark"
|
||||
"EquilibriumGrayDark"
|
||||
"EquilibriumGrayLight"
|
||||
"EquilibriumLight"
|
||||
"Eris"
|
||||
"Espresso"
|
||||
"EvaDim"
|
||||
"Eva"
|
||||
"EvenokDark"
|
||||
"EverforestDarkHard"
|
||||
"Everforest"
|
||||
"Flat"
|
||||
"Framer"
|
||||
"FruitSoda"
|
||||
"Gigavolt"
|
||||
"Github"
|
||||
"GoogleDark"
|
||||
"GoogleLight"
|
||||
"Gotham"
|
||||
"GrayscaleDark"
|
||||
"GrayscaleLight"
|
||||
"Greenscreen"
|
||||
"Gruber"
|
||||
"GruvboxDarkHard"
|
||||
"GruvboxDarkMedium"
|
||||
"GruvboxDarkPale"
|
||||
"GruvboxDarkSoft"
|
||||
"GruvboxLightHard"
|
||||
"GruvboxLightMedium"
|
||||
"GruvboxLightSoft"
|
||||
"GruvboxMaterialDarkHard"
|
||||
"GruvboxMaterialDarkMedium"
|
||||
"GruvboxMaterialDarkSoft"
|
||||
"GruvboxMaterialLightHard"
|
||||
"GruvboxMaterialLightMedium"
|
||||
"GruvboxMaterialLightSoft"
|
||||
"Hardcore"
|
||||
"Harmonic16Dark"
|
||||
"Harmonic16Light"
|
||||
"HeetchLight"
|
||||
"Heetch"
|
||||
"Helios"
|
||||
"Hopscotch"
|
||||
"HorizonDark"
|
||||
"HorizonLight"
|
||||
"HorizonTerminalDark"
|
||||
"HorizonTerminalLight"
|
||||
"HumanoidDark"
|
||||
"HumanoidLight"
|
||||
"IaDark"
|
||||
"IaLight"
|
||||
"Icy"
|
||||
"Irblack"
|
||||
"Isotope"
|
||||
"Jabuti"
|
||||
"Kanagawa"
|
||||
"Katy"
|
||||
"Kimber"
|
||||
"Lime"
|
||||
"Macintosh"
|
||||
"Marrakesh"
|
||||
"Materia"
|
||||
"MaterialDarker"
|
||||
"MaterialLighter"
|
||||
"MaterialPalenight"
|
||||
"MaterialVivid"
|
||||
"Material"
|
||||
"MeasuredDark"
|
||||
"MeasuredLight"
|
||||
"MellowPurple"
|
||||
"MexicoLight"
|
||||
"Mocha"
|
||||
"Monokai"
|
||||
"Moonlight"
|
||||
"Mountain"
|
||||
"Nebula"
|
||||
"NordLight"
|
||||
"Nord"
|
||||
"Nova"
|
||||
"Ocean"
|
||||
"Oceanicnext"
|
||||
"OneLight"
|
||||
"OnedarkDark"
|
||||
"Onedark"
|
||||
"OutrunDark"
|
||||
"OxocarbonDark"
|
||||
"OxocarbonLight"
|
||||
"Pandora"
|
||||
"PapercolorDark"
|
||||
"PapercolorLight"
|
||||
"Paraiso"
|
||||
"Pasque"
|
||||
"Phd"
|
||||
"Pico"
|
||||
"Pinky"
|
||||
"Pop"
|
||||
"Porple"
|
||||
"PreciousDarkEleven"
|
||||
"PreciousDarkFifteen"
|
||||
"PreciousLightWarm"
|
||||
"PreciousLightWhite"
|
||||
"PrimerDarkDimmed"
|
||||
"PrimerDark"
|
||||
"PrimerLight"
|
||||
"Purpledream"
|
||||
"Qualia"
|
||||
"Railscasts"
|
||||
"Rebecca"
|
||||
"RosePineDawn"
|
||||
"RosePineMoon"
|
||||
"RosePine"
|
||||
"Saga"
|
||||
"Sagelight"
|
||||
"Sakura"
|
||||
"Sandcastle"
|
||||
"SelenizedBlack"
|
||||
"SelenizedDark"
|
||||
"SelenizedLight"
|
||||
"SelenizedWhite"
|
||||
"Seti"
|
||||
"ShadesOfPurple"
|
||||
"ShadesmearDark"
|
||||
"ShadesmearLight"
|
||||
"Shapeshifter"
|
||||
"SilkDark"
|
||||
"SilkLight"
|
||||
"Snazzy"
|
||||
"SolarflareLight"
|
||||
"Solarflare"
|
||||
"SolarizedDark"
|
||||
"SolarizedLight"
|
||||
"Spaceduck"
|
||||
"Spacemacs"
|
||||
"Sparky"
|
||||
"StandardizedDark"
|
||||
"StandardizedLight"
|
||||
"Stella"
|
||||
"StillAlive"
|
||||
"Summercamp"
|
||||
"SummerfruitDark"
|
||||
"SummerfruitLight"
|
||||
"SynthMidnightDark"
|
||||
"SynthMidnightLight"
|
||||
"Tango"
|
||||
"Tarot"
|
||||
"Tender"
|
||||
"TerracottaDark"
|
||||
"Terracotta"
|
||||
"TokyoCityDark"
|
||||
"TokyoCityLight"
|
||||
"TokyoCityTerminalDark"
|
||||
"TokyoCityTerminalLight"
|
||||
"TokyoNightDark"
|
||||
"TokyoNightLight"
|
||||
"TokyoNightMoon"
|
||||
"TokyoNightStorm"
|
||||
"TokyoNightTerminalDark"
|
||||
"TokyoNightTerminalLight"
|
||||
"TokyoNightTerminalStorm"
|
||||
"TokyodarkTerminal"
|
||||
"Tokyodark"
|
||||
"TomorrowNightEighties"
|
||||
"TomorrowNight"
|
||||
"Tomorrow"
|
||||
"Tube"
|
||||
"Twilight"
|
||||
"UnikittyDark"
|
||||
"UnikittyLight"
|
||||
"UnikittyReversible"
|
||||
"Uwunicorn"
|
||||
"Vesper"
|
||||
"Vice"
|
||||
"Vulcan"
|
||||
"Windows10Light"
|
||||
"Windows10"
|
||||
"Windows95Light"
|
||||
"Windows95"
|
||||
"WindowsHighcontrastLight"
|
||||
"WindowsHighcontrast"
|
||||
"WindowsNtLight"
|
||||
"WindowsNt"
|
||||
"Woodland"
|
||||
"XcodeDusk"
|
||||
"Zenbones"
|
||||
"Zenburn"
|
||||
])
|
||||
]
|
||||
)
|
||||
);
|
||||
default = null;
|
||||
};
|
||||
stack_border = lib.mkOption {
|
||||
type = (
|
||||
lib.types.nullOr (
|
||||
lib.types.oneOf [
|
||||
(lib.types.nullOr catppuccinValue)
|
||||
(lib.types.nullOr base16Value)
|
||||
]
|
||||
)
|
||||
);
|
||||
default = null;
|
||||
};
|
||||
floating_border = lib.mkOption {
|
||||
type = (
|
||||
lib.types.nullOr (
|
||||
lib.types.oneOf [
|
||||
(lib.types.nullOr catppuccinValue)
|
||||
(lib.types.nullOr base16Value)
|
||||
]
|
||||
)
|
||||
);
|
||||
default = null;
|
||||
};
|
||||
single_border = lib.mkOption {
|
||||
type = (
|
||||
lib.types.nullOr (
|
||||
lib.types.oneOf [
|
||||
(lib.types.nullOr catppuccinValue)
|
||||
(lib.types.nullOr base16Value)
|
||||
]
|
||||
)
|
||||
);
|
||||
default = null;
|
||||
};
|
||||
bar_accent = lib.mkOption {
|
||||
type = (
|
||||
lib.types.nullOr (
|
||||
lib.types.oneOf [
|
||||
(lib.types.nullOr catppuccinValue)
|
||||
(lib.types.nullOr base16Value)
|
||||
]
|
||||
)
|
||||
);
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
}
|
||||
)
|
||||
);
|
||||
default = null;
|
||||
description = "Theme configuration options\n\nIf a theme is specified, `border_colours` will have no effect";
|
||||
};
|
||||
titleless_applications = lib.mkOption {
|
||||
type = (lib.types.nullOr (lib.types.listOf lib.types.str));
|
||||
default = null;
|
||||
|
||||
+2165
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user