Added configuration options for notifications.
This commit is contained in:
@@ -8,10 +8,14 @@ import { Body } from "./body/index.js";
|
|||||||
import { CloseButton } from "./close/index.js";
|
import { CloseButton } from "./close/index.js";
|
||||||
import { NotificationAnchor } from "lib/types/options";
|
import { NotificationAnchor } from "lib/types/options";
|
||||||
|
|
||||||
const { position } = options.notifications;
|
const { position, timeout, cache_actions } = options.notifications;
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
notifs.popupTimeout = 7000;
|
Utils.merge([timeout.bind("value"), cache_actions.bind("value")], (timeout, doCaching) => {
|
||||||
|
notifs.popupTimeout = timeout;
|
||||||
|
notifs.cacheActions = doCaching;
|
||||||
|
});
|
||||||
|
|
||||||
const getPosition = (pos: NotificationAnchor): ("top" | "bottom" | "left" | "right")[] => {
|
const getPosition = (pos: NotificationAnchor): ("top" | "bottom" | "left" | "right")[] => {
|
||||||
const positionMap: { [key: string]: ("top" | "bottom" | "left" | "right")[] } = {
|
const positionMap: { [key: string]: ("top" | "bottom" | "left" | "right")[] } = {
|
||||||
"top": ["top"],
|
"top": ["top"],
|
||||||
|
|||||||
@@ -719,6 +719,8 @@ const options = mkOptions(OPTIONS, {
|
|||||||
|
|
||||||
notifications: {
|
notifications: {
|
||||||
position: opt<"top" | "top right" | "top left" | "bottom" | "bottom right" | "bottom left">("top right"),
|
position: opt<"top" | "top right" | "top left" | "bottom" | "bottom right" | "bottom left">("top right"),
|
||||||
|
timeout: opt(7000),
|
||||||
|
cache_actions: opt(true),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -2,13 +2,15 @@ import { BarGeneral } from "./general/index";
|
|||||||
import { BarSettings } from "./bar/index";
|
import { BarSettings } from "./bar/index";
|
||||||
import { ClockMenuSettings } from "./menus/clock";
|
import { ClockMenuSettings } from "./menus/clock";
|
||||||
import { DashboardMenuSettings } from "./menus/dashboard";
|
import { DashboardMenuSettings } from "./menus/dashboard";
|
||||||
|
import { NotificationSettings } from "./notifications/index";
|
||||||
|
|
||||||
type Page = "General" | "Bar" | "Clock Menu" | "Dashboard Menu"
|
type Page = "General" | "Bar" | "Clock Menu" | "Dashboard Menu" | "Notifications";
|
||||||
const CurrentPage = Variable<Page>("General");
|
const CurrentPage = Variable<Page>("General");
|
||||||
|
|
||||||
const pagerMap: Page[] = [
|
const pagerMap: Page[] = [
|
||||||
"General",
|
"General",
|
||||||
"Bar",
|
"Bar",
|
||||||
|
"Notifications",
|
||||||
"Clock Menu",
|
"Clock Menu",
|
||||||
"Dashboard Menu",
|
"Dashboard Menu",
|
||||||
]
|
]
|
||||||
@@ -37,6 +39,7 @@ export const SettingsMenu = () => {
|
|||||||
children: {
|
children: {
|
||||||
"General": BarGeneral(),
|
"General": BarGeneral(),
|
||||||
"Bar": BarSettings(),
|
"Bar": BarSettings(),
|
||||||
|
"Notifications": NotificationSettings(),
|
||||||
"Clock Menu": ClockMenuSettings(),
|
"Clock Menu": ClockMenuSettings(),
|
||||||
"Dashboard Menu": DashboardMenuSettings(),
|
"Dashboard Menu": DashboardMenuSettings(),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ export const NotificationSettings = () => {
|
|||||||
children: [
|
children: [
|
||||||
Header('Notification Settings'),
|
Header('Notification Settings'),
|
||||||
Option({ opt: options.notifications.position, title: 'Notification Location', type: 'enum', enums: ['top left', 'top', 'top right', 'bottom right', 'bottom', 'bottom left'] }),
|
Option({ opt: options.notifications.position, title: 'Notification Location', type: 'enum', enums: ['top left', 'top', 'top right', 'bottom right', 'bottom', 'bottom left'] }),
|
||||||
|
Option({ opt: options.notifications.timeout, title: 'Notification Timeout', subtitle: 'How long notification popups will last (in milliseconds).', type: 'number' }),
|
||||||
|
Option({ opt: options.notifications.cache_actions, title: 'Preserve Actions', subtitle: 'This will persist the action buttons of a notification after rebooting.', type: 'boolean' }),
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user