diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-04-10 19:28:13 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-04-10 19:28:13 +1000 |
| commit | f0bab936ed89b152675d4bc0f123f666bd909616 (patch) | |
| tree | 6c8c76764b4fd65af85d0b44a197c02c0a67f8a9 /src/modules/sidebar | |
| parent | sidebar: dashboard current desktop -> date (diff) | |
| download | caelestia-shell-f0bab936ed89b152675d4bc0f123f666bd909616.tar.gz caelestia-shell-f0bab936ed89b152675d4bc0f123f666bd909616.tar.bz2 caelestia-shell-f0bab936ed89b152675d4bc0f123f666bd909616.zip | |
config: allow disabling headlines sidebar module
Diffstat (limited to 'src/modules/sidebar')
| -rw-r--r-- | src/modules/sidebar/modules/headlines.tsx | 28 |
1 files changed, 24 insertions, 4 deletions
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 = () => ( </box> ); -const NoNews = () => ( +const NoNews = ({ disabled }: { disabled?: boolean }) => ( <box homogeneous name="empty"> <box vertical halign={Gtk.Align.CENTER} valign={Gtk.Align.CENTER} className="empty"> <label className="icon" label="full_coverage" /> - <label label="No news headlines!" /> + <label label={disabled ? "Headlines disabled" : "No news headlines!"} /> </box> </box> ); -export default ({ monitor }: { monitor: Monitor }) => ( - <box vertical className="headlines"> +const HeadlinesDisabled = () => ( + <> + <box vertical className="headlines"> + <box className="header-bar"> + <label label="Top news headlines" /> + <box hexpand /> + <button sensitive={false} label=" Reload" /> + </box> + <NoNews disabled /> + </box> + </> +); + +const Headlines = ({ monitor }: { monitor: Monitor }) => ( + <> <box className="header-bar"> <label label="Top news headlines" /> <box hexpand /> @@ -173,5 +187,11 @@ export default ({ monitor }: { monitor: Monitor }) => ( <List /> </scrollable> </stack> + </> +); + +export default ({ monitor }: { monitor: Monitor }) => ( + <box vertical className="headlines"> + {bind(sidebar.modules.headlines.enabled).as(e => (e ? <Headlines monitor={monitor} /> : <HeadlinesDisabled />))} </box> ); |