headlines: enable button
Also disable news from no api key notif
This commit is contained in:
parent
6f62023574
commit
8d4c6bc830
2 changed files with 8 additions and 1 deletions
|
|
@ -5,6 +5,7 @@ import { capitalize } from "@/utils/strings";
|
|||
import { bind, execAsync, Variable } from "astal";
|
||||
import { Gtk } from "astal/gtk3";
|
||||
import { sidebar } from "config";
|
||||
import { setConfig } from "config/funcs";
|
||||
|
||||
const fixGoogleNews = (colours: IPalette, title: string, desc: string) => {
|
||||
// Add separator, bold and split at domain (domain is at the end of each headline)
|
||||
|
|
@ -153,7 +154,11 @@ const HeadlinesDisabled = () => (
|
|||
<box className="header-bar">
|
||||
<label label="Top news headlines" />
|
||||
<box hexpand />
|
||||
<button sensitive={false} label=" Reload" />
|
||||
<button
|
||||
cursor="pointer"
|
||||
onClicked={() => setConfig("sidebar.modules.headlines.enabled", true)}
|
||||
label=" Enable"
|
||||
/>
|
||||
</box>
|
||||
<NoNews disabled />
|
||||
</box>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { notify } from "@/utils/system";
|
||||
import { execAsync, GLib, GObject, property, readFileAsync, register, writeFileAsync } from "astal";
|
||||
import { news as config } from "config";
|
||||
import { setConfig } from "config/funcs";
|
||||
|
||||
export interface IArticle {
|
||||
title: string;
|
||||
|
|
@ -55,6 +56,7 @@ export default class News extends GObject.Object {
|
|||
urgency: "critical",
|
||||
actions: {
|
||||
"Get API key": () => execAsync("app2unit -O -- https://newsdata.io").catch(console.error),
|
||||
Disable: () => setConfig("sidebar.modules.headlines.enabled", false),
|
||||
},
|
||||
});
|
||||
this.#notified = true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue