From f0bab936ed89b152675d4bc0f123f666bd909616 Mon Sep 17 00:00:00 2001
From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>
Date: Thu, 10 Apr 2025 19:28:13 +1000
Subject: config: allow disabling headlines sidebar module
---
src/config/defaults.ts | 5 +++++
src/config/types.ts | 1 +
src/modules/sidebar/modules/headlines.tsx | 28 ++++++++++++++++++++++++----
3 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/src/config/defaults.ts b/src/config/defaults.ts
index b365a26..8a510f0 100644
--- a/src/config/defaults.ts
+++ b/src/config/defaults.ts
@@ -111,6 +111,11 @@ export default {
},
sidebar: {
showOnStartup: false,
+ modules: {
+ headlines: {
+ enabled: true,
+ },
+ },
},
navbar: {
persistent: false, // Whether to show all the time or only on hover
diff --git a/src/config/types.ts b/src/config/types.ts
index b79c408..66e0cfe 100644
--- a/src/config/types.ts
+++ b/src/config/types.ts
@@ -57,6 +57,7 @@ export default {
"osds.lock.num.hideDelay": NUM,
// Sidebar
"sidebar.showOnStartup": BOOL,
+ "sidebar.modules.headlines.enabled": BOOL,
// Navbar
"navbar.persistent": BOOL,
"navbar.appearWidth": NUM,
diff --git a/src/modules/sidebar/modules/headlines.tsx b/src/modules/sidebar/modules/headlines.tsx
index 3660f18..9515b28 100644
--- a/src/modules/sidebar/modules/headlines.tsx
+++ b/src/modules/sidebar/modules/headlines.tsx
@@ -5,6 +5,7 @@ import { capitalize } from "@/utils/strings";
import { setupCustomTooltip } from "@/utils/widgets";
import { bind, execAsync, Variable } from "astal";
import { Gtk } from "astal/gtk3";
+import { sidebar } from "config";
const fixGoogleNews = (colours: IPalette, title: string, desc: string) => {
// Add separator, bold and split at domain (domain is at the end of each headline)
@@ -135,17 +136,30 @@ const List = () => (
);
-const NoNews = () => (
+const NoNews = ({ disabled }: { disabled?: boolean }) => (
-
+
);
-export default ({ monitor }: { monitor: Monitor }) => (
-
+const HeadlinesDisabled = () => (
+ <>
+
+
+
+
+
+
+
+
+ >
+);
+
+const Headlines = ({ monitor }: { monitor: Monitor }) => (
+ <>
@@ -173,5 +187,11 @@ export default ({ monitor }: { monitor: Monitor }) => (
+ >
+);
+
+export default ({ monitor }: { monitor: Monitor }) => (
+
+ {bind(sidebar.modules.headlines.enabled).as(e => (e ? : ))}
);
--
cgit v1.2.3-freya