summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-03-23 15:21:11 +1100
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-03-23 15:21:11 +1100
commitacae35aa52e78af08763e56157867e0459132ad9 (patch)
tree98d923622072c301f5cc2cc833bf81704d68d23f
parentscss: add popover styles (diff)
downloadcaelestia-shell-acae35aa52e78af08763e56157867e0459132ad9.tar.gz
caelestia-shell-acae35aa52e78af08763e56157867e0459132ad9.tar.bz2
caelestia-shell-acae35aa52e78af08763e56157867e0459132ad9.zip
config: add transparency option
Also remove options for removed features
-rw-r--r--app.tsx22
-rw-r--r--config.ts22
2 files changed, 22 insertions, 22 deletions
diff --git a/app.tsx b/app.tsx
index acb50fa..220d2c2 100644
--- a/app.tsx
+++ b/app.tsx
@@ -5,20 +5,33 @@ import Osds from "@/modules/osds";
import Popdowns from "@/modules/popdowns";
import Session from "@/modules/session";
import Monitors from "@/services/monitors";
-import Palette from "@/services/palette";
+import Palette, { type Hex } from "@/services/palette";
import Players from "@/services/players";
import Schemes from "@/services/schemes";
import Wallpapers from "@/services/wallpapers";
import type PopupWindow from "@/widgets/popupwindow";
import { execAsync, idle, timeout, writeFileAsync } from "astal";
import { App } from "astal/gtk3";
-import { initConfig, updateConfig } from "config";
+import { initConfig, style, updateConfig } from "config";
+
+const shouldBeTransparent = (name: string) =>
+ name === "base" ||
+ name === "mantle" ||
+ name === "crust" ||
+ name.startsWith("surface") ||
+ name.startsWith("overlay");
+
+const applyTransparency = (name: string, hex: Hex) => {
+ if (style.transparency.get() === "off" || !shouldBeTransparent(name)) return hex;
+ const amount = style.transparency.get() === "high" ? 0.58 : 0.78;
+ return `color.change(${hex}, $alpha: ${amount})`;
+};
export const loadStyleAsync = async () => {
const schemeColours = Object.entries(Palette.get_default().colours)
- .map(([name, hex]) => `$${name}: ${hex};`)
+ .map(([name, hex]) => `$${name}: ${applyTransparency(name, hex)};`)
.join("\n");
- await writeFileAsync(`${SRC}/scss/scheme/_index.scss`, schemeColours);
+ await writeFileAsync(`${SRC}/scss/scheme/_index.scss`, `@use "sass:color";\n${schemeColours}`);
App.apply_css(await execAsync(`sass ${SRC}/style.scss`), true);
};
@@ -29,6 +42,7 @@ App.start({
const now = Date.now();
loadStyleAsync().catch(console.error);
+ style.transparency.subscribe(() => loadStyleAsync().catch(console.error));
Palette.get_default().connect("notify::colours", () => loadStyleAsync().catch(console.error));
initConfig();
diff --git a/config.ts b/config.ts
index f02bb39..86f0f4e 100644
--- a/config.ts
+++ b/config.ts
@@ -46,6 +46,9 @@ export const initConfig = () => {
};
const DEFAULTS = {
+ style: {
+ transparency: "normal", // One of "off", "normal", "high"
+ },
// Modules
bar: {
vertical: true,
@@ -92,13 +95,6 @@ const DEFAULTS = {
actionPrefix: ">", // Prefix for launcher actions
apps: {
maxResults: 30, // Actual max results, -1 for infinite
- pins: [
- ["zen", "firefox", "waterfox", "google-chrome", "chromium", "brave-browser"],
- ["foot", "alacritty", "kitty", "wezterm"],
- ["thunar", "nemo", "nautilus"],
- ["codium", "code", "clion", "intellij-idea-ultimate-edition"],
- ["spotify-adblock", "spotify", "audacious", "elisa"],
- ],
},
files: {
maxResults: 40, // Actual max results, -1 for infinite
@@ -108,16 +104,6 @@ const DEFAULTS = {
math: {
maxResults: 40, // Actual max results, -1 for infinite
},
- windows: {
- maxResults: -1, // Actual max results, -1 for infinite
- weights: {
- // Weights for fuzzy sort
- title: 1,
- class: 1,
- initialTitle: 0.5,
- initialClass: 0.5,
- },
- },
todo: {
notify: true,
},
@@ -158,7 +144,6 @@ const DEFAULTS = {
directories: {
left: {
top: "󰉍 Downloads",
-
middle: "󱧶 Documents",
bottom: "󱍙 Music",
},
@@ -207,6 +192,7 @@ const DEFAULTS = {
const config = convertSettings(DEFAULTS);
export const {
+ style,
bar,
launcher,
notifpopups,