config: allow disabling headlines sidebar module
This commit is contained in:
parent
7a0c4fe6b4
commit
f0bab936ed
3 changed files with 30 additions and 4 deletions
|
|
@ -111,6 +111,11 @@ export default {
|
||||||
},
|
},
|
||||||
sidebar: {
|
sidebar: {
|
||||||
showOnStartup: false,
|
showOnStartup: false,
|
||||||
|
modules: {
|
||||||
|
headlines: {
|
||||||
|
enabled: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
navbar: {
|
navbar: {
|
||||||
persistent: false, // Whether to show all the time or only on hover
|
persistent: false, // Whether to show all the time or only on hover
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ export default {
|
||||||
"osds.lock.num.hideDelay": NUM,
|
"osds.lock.num.hideDelay": NUM,
|
||||||
// Sidebar
|
// Sidebar
|
||||||
"sidebar.showOnStartup": BOOL,
|
"sidebar.showOnStartup": BOOL,
|
||||||
|
"sidebar.modules.headlines.enabled": BOOL,
|
||||||
// Navbar
|
// Navbar
|
||||||
"navbar.persistent": BOOL,
|
"navbar.persistent": BOOL,
|
||||||
"navbar.appearWidth": NUM,
|
"navbar.appearWidth": NUM,
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import { capitalize } from "@/utils/strings";
|
||||||
import { setupCustomTooltip } from "@/utils/widgets";
|
import { setupCustomTooltip } from "@/utils/widgets";
|
||||||
import { bind, execAsync, Variable } from "astal";
|
import { bind, execAsync, Variable } from "astal";
|
||||||
import { Gtk } from "astal/gtk3";
|
import { Gtk } from "astal/gtk3";
|
||||||
|
import { sidebar } from "config";
|
||||||
|
|
||||||
const fixGoogleNews = (colours: IPalette, title: string, desc: string) => {
|
const fixGoogleNews = (colours: IPalette, title: string, desc: string) => {
|
||||||
// Add separator, bold and split at domain (domain is at the end of each headline)
|
// Add separator, bold and split at domain (domain is at the end of each headline)
|
||||||
|
|
@ -135,17 +136,30 @@ const List = () => (
|
||||||
</box>
|
</box>
|
||||||
);
|
);
|
||||||
|
|
||||||
const NoNews = () => (
|
const NoNews = ({ disabled }: { disabled?: boolean }) => (
|
||||||
<box homogeneous name="empty">
|
<box homogeneous name="empty">
|
||||||
<box vertical halign={Gtk.Align.CENTER} valign={Gtk.Align.CENTER} className="empty">
|
<box vertical halign={Gtk.Align.CENTER} valign={Gtk.Align.CENTER} className="empty">
|
||||||
<label className="icon" label="full_coverage" />
|
<label className="icon" label="full_coverage" />
|
||||||
<label label="No news headlines!" />
|
<label label={disabled ? "Headlines disabled" : "No news headlines!"} />
|
||||||
</box>
|
</box>
|
||||||
</box>
|
</box>
|
||||||
);
|
);
|
||||||
|
|
||||||
export default ({ monitor }: { monitor: Monitor }) => (
|
const HeadlinesDisabled = () => (
|
||||||
|
<>
|
||||||
<box vertical className="headlines">
|
<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">
|
<box className="header-bar">
|
||||||
<label label="Top news headlines" />
|
<label label="Top news headlines" />
|
||||||
<box hexpand />
|
<box hexpand />
|
||||||
|
|
@ -173,5 +187,11 @@ export default ({ monitor }: { monitor: Monitor }) => (
|
||||||
<List />
|
<List />
|
||||||
</scrollable>
|
</scrollable>
|
||||||
</stack>
|
</stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
|
||||||
|
export default ({ monitor }: { monitor: Monitor }) => (
|
||||||
|
<box vertical className="headlines">
|
||||||
|
{bind(sidebar.modules.headlines.enabled).as(e => (e ? <Headlines monitor={monitor} /> : <HeadlinesDisabled />))}
|
||||||
</box>
|
</box>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue