diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-04-01 19:53:28 +1100 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-04-01 19:53:28 +1100 |
| commit | 27b12681f61188d458560480e74d377c141fff52 (patch) | |
| tree | b10ecf5f0f8565322dae651ee7845801377385ef | |
| parent | calendar: cache calendars (diff) | |
| download | caelestia-shell-27b12681f61188d458560480e74d377c141fff52.tar.gz caelestia-shell-27b12681f61188d458560480e74d377c141fff52.tar.bz2 caelestia-shell-27b12681f61188d458560480e74d377c141fff52.zip | |
feat: toggle borders option
| -rw-r--r-- | app.tsx | 13 | ||||
| -rw-r--r-- | scss/_lib.scss | 6 | ||||
| -rw-r--r-- | scss/bar.scss | 15 | ||||
| -rw-r--r-- | scss/common.scss | 2 | ||||
| -rw-r--r-- | scss/launcher.scss | 7 | ||||
| -rw-r--r-- | scss/notifpopups.scss | 10 | ||||
| -rw-r--r-- | scss/session.scss | 2 | ||||
| -rw-r--r-- | scss/sidebar.scss | 8 | ||||
| -rw-r--r-- | scss/widgets.scss | 15 | ||||
| -rw-r--r-- | src/config/defaults.ts | 1 | ||||
| -rw-r--r-- | src/config/types.ts | 1 |
11 files changed, 61 insertions, 19 deletions
@@ -28,6 +28,13 @@ const applyTransparency = (name: string, hex: string) => { const applyVibrancy = (hex: string) => (style.vibrant.get() ? `color.scale(${hex}, $saturation: 40%)` : hex); +const getVars = () => { + const vars = { light: Palette.get_default().mode === "light", borders: style.borders.get() }; + return Object.entries(vars) + .map(([k, v]) => `$${k}: ${v}`) + .join(";"); +}; + const styleLoader = new (class { #running = false; #dirty = false; @@ -47,10 +54,7 @@ const styleLoader = new (class { const schemeColours = Object.entries(Palette.get_default().colours) .map(([name, hex]) => `$${name}: ${applyVibrancy(applyTransparency(name, hex))};`) .join("\n"); - await writeFileAsync( - `${SRC}/scss/scheme/_index.scss`, - `@use "sass:color";\n$light: ${Palette.get_default().mode === "light"};\n${schemeColours}` - ); + await writeFileAsync(`${SRC}/scss/scheme/_index.scss`, `@use "sass:color";\n${getVars()};\n${schemeColours}`); App.apply_css(await execAsync(`sass ${SRC}/style.scss`), true); } })(); @@ -66,7 +70,6 @@ App.start({ await initConfig(); loadStyleAsync().catch(console.error); - style.transparency.subscribe(() => loadStyleAsync().catch(console.error)); Palette.get_default().connect("notify::colours", () => loadStyleAsync().catch(console.error)); Palette.get_default().connect("notify::mode", () => loadStyleAsync().catch(console.error)); diff --git a/scss/_lib.scss b/scss/_lib.scss index e222b59..ef8cc8d 100644 --- a/scss/_lib.scss +++ b/scss/_lib.scss @@ -12,8 +12,10 @@ $scale: 0.068rem; -gtk-outline-radius: s($tl) s($tr) s($br) s($bl); } -@mixin border($colour, $alpha: 1, $width: 1, $style: solid) { - border: s($width) $style color.change($colour, $alpha: $alpha); +@mixin border($colour, $alpha: 1, $width: 1, $style: solid, $force: false) { + @if $force or scheme.$borders { + border: s($width) $style color.change($colour, $alpha: $alpha); + } } @mixin shadow($colour: black, $alpha: 0.64, $x: 0, $y: 0, $blur: 3, $spread: 0) { diff --git a/scss/bar.scss b/scss/bar.scss index 452d2ed..b8d36e4 100644 --- a/scss/bar.scss +++ b/scss/bar.scss @@ -15,6 +15,7 @@ @include font.mono; font-size: lib.s(14); + padding-right: lib.s(3); label.icon { font-size: lib.s(18); @@ -190,10 +191,24 @@ .os-icon { @include lib.border(scheme.$yellow); + + @if not scheme.$borders { + @include lib.shadow; + + background-color: scheme.$yellow; + color: scheme.$base; + } } .power { @include lib.border(scheme.$red); + + @if not scheme.$borders { + @include lib.shadow; + + background-color: scheme.$red; + color: scheme.$base; + } } &.horizontal { diff --git a/scss/common.scss b/scss/common.scss index de9f424..3448bb5 100644 --- a/scss/common.scss +++ b/scss/common.scss @@ -14,10 +14,8 @@ label.icon { .notification { .inner { - @include lib.rounded(8); @include font.main; - background-color: scheme.$base; color: scheme.$text; padding: lib.s(10) lib.s(12); diff --git a/scss/launcher.scss b/scss/launcher.scss index 5ca8ee0..bd5c430 100644 --- a/scss/launcher.scss +++ b/scss/launcher.scss @@ -5,6 +5,8 @@ @mixin launcher($mode, $colour) { &.#{$mode} { + @include lib.border($colour, 0.7, 2); + label.icon { color: $colour; } @@ -24,7 +26,7 @@ &.lines { .search-bar { .mode { - @include lib.border($colour, $width: 2); + @include lib.border($colour, $width: 2, $force: true); } .entry { @@ -66,6 +68,7 @@ .launcher { @include lib.rounded(10); + @include lib.element-decel; @include lib.shadow; @include font.mono; @@ -176,7 +179,7 @@ min-height: lib.s(32); &.left { - @include lib.border(scheme.$overlay0, 0.3); + @include lib.border(scheme.$overlay0, 0.3, $force: true); border-right: none; border-top-right-radius: 0; diff --git a/scss/notifpopups.scss b/scss/notifpopups.scss index 89e5eea..92d2760 100644 --- a/scss/notifpopups.scss +++ b/scss/notifpopups.scss @@ -16,7 +16,7 @@ .notifpopups { min-width: lib.s(425); padding-left: lib.s(10); // So notifications can overshoot for init animation - padding-right: lib.s(10); + padding-right: lib.s(5); padding-top: lib.s(5); .notification { @@ -25,9 +25,11 @@ } .inner { - @include lib.rounded(8); + @include lib.rounded(10); @include lib.shadow; + background-color: scheme.$base; + &.low { @include popup(scheme.$overlay0); } @@ -39,6 +41,10 @@ &.critical { @include lib.border(scheme.$error, 0.5); @include popup(scheme.$error); + + @if not scheme.$borders { + background-color: color.mix(scheme.$base, scheme.$error, 95%); + } } } } diff --git a/scss/session.scss b/scss/session.scss index 71c436d..4421b71 100644 --- a/scss/session.scss +++ b/scss/session.scss @@ -8,7 +8,7 @@ .inner { @include lib.rounded(8); - @include lib.border(scheme.$overlay0, 0.1); + @include lib.border(scheme.$flamingo, 0.5, 2); @include lib.shadow; @include font.mono; diff --git a/scss/sidebar.scss b/scss/sidebar.scss index 5616ce3..10139e2 100644 --- a/scss/sidebar.scss +++ b/scss/sidebar.scss @@ -240,6 +240,10 @@ &.low { @include notification(if(scheme.$light, scheme.$surface1, scheme.$overlay0)); + + @if not scheme.$borders { + background-color: color.change(scheme.$surface0, $alpha: 0.4); + } } &.normal { @@ -250,6 +254,10 @@ &.critical { @include lib.border(scheme.$error, 0.8); @include notification(scheme.$error); + + @if not scheme.$borders { + background-color: color.change(color.mix(scheme.$surface1, scheme.$error, 80%), $alpha: 0.4); + } } } diff --git a/scss/widgets.scss b/scss/widgets.scss index 254b0fa..719e82c 100644 --- a/scss/widgets.scss +++ b/scss/widgets.scss @@ -40,11 +40,10 @@ menu { font-size: lib.s(14); & > menuitem { + @include lib.element-decel; @include lib.rounded(8); padding: lib.s(5) lib.s(8); - background: transparent; - transition: 0.2s ease background-color; &:hover, &:focus { @@ -84,19 +83,25 @@ menu { tooltip, .tooltip { - @include lib.rounded(5); + @include lib.rounded(10); @include lib.border(scheme.$primary, 0.7); @include font.mono; background-color: scheme.$surface0; color: scheme.$text; - padding: lib.s(4) lib.s(8); + padding: lib.s(5) lib.s(10); } tooltip { @include -appear(200ms); } +.tooltip { + @include lib.shadow; + + margin: lib.s(3); +} + scrollbar { slider { @include lib.rounded(1000); @@ -125,7 +130,7 @@ popover { @include font.mono; padding: lib.s(8); - background-color: scheme.$base; + background-color: color.mix(scheme.$base, scheme.$yellow, 90%); color: scheme.$text; font-size: lib.s(14); } diff --git a/src/config/defaults.ts b/src/config/defaults.ts index e933050..e8e67ac 100644 --- a/src/config/defaults.ts +++ b/src/config/defaults.ts @@ -3,6 +3,7 @@ import { Astal } from "astal/gtk3"; export default { style: { transparency: "normal", // One of "off", "normal", "high" + borders: true, vibrant: false, // Extra saturation }, // Modules diff --git a/src/config/types.ts b/src/config/types.ts index 7bea7bf..dd92040 100644 --- a/src/config/types.ts +++ b/src/config/types.ts @@ -6,6 +6,7 @@ const OBJ_ARR = (shape: object) => ARR(JSON.stringify(shape)); export default { "style.transparency": ["off", "normal", "high"], + "style.borders": BOOL, "style.vibrant": BOOL, // Bar "bar.vertical": BOOL, |