configurable notification timeout, default 3s

This commit is contained in:
Damocles 2026-04-13 00:08:45 +02:00
parent 28fb0e4d00
commit dea4541718
3 changed files with 11 additions and 3 deletions

View file

@ -20,7 +20,8 @@ QtObject {
enable: true enable: true
}) })
property var notifications: ({ property var notifications: ({
enable: true enable: true,
timeout: 3000
}) })
property var mpris: ({ property var mpris: ({
enable: true enable: true

View file

@ -4,6 +4,7 @@ import QtQuick
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
import Quickshell.Services.Notifications import Quickshell.Services.Notifications
import "." as M
QtObject { QtObject {
id: root id: root
@ -84,7 +85,7 @@ QtObject {
// Auto-expire popup // Auto-expire popup
if (data.popup) { if (data.popup) {
const timeout = notif.expireTimeout > 0 ? notif.expireTimeout : 5000; const timeout = notif.expireTimeout > 0 ? notif.expireTimeout : (M.Modules.notifications.timeout || 3000);
Qt.callLater(() => { Qt.callLater(() => {
_expireTimer.createObject(root, { _expireTimer.createObject(root, {
_notifId: data.id, _notifId: data.id,

View file

@ -82,7 +82,6 @@ in
"tray" "tray"
"windowTitle" "windowTitle"
"clock" "clock"
"notifications"
"mpris" "mpris"
"volume" "volume"
"idleInhibitor" "idleInhibitor"
@ -91,6 +90,13 @@ in
in in
simpleModules simpleModules
// { // {
notifications = moduleOpt "notifications" {
timeout = lib.mkOption {
type = lib.types.int;
default = 3000;
description = "Notification popup timeout in milliseconds.";
};
};
bluetooth = moduleOpt "bluetooth" (intervalOpt 5000); bluetooth = moduleOpt "bluetooth" (intervalOpt 5000);
network = moduleOpt "network" (intervalOpt 5000); network = moduleOpt "network" (intervalOpt 5000);
powerProfile = moduleOpt "powerProfile" (intervalOpt 5000); powerProfile = moduleOpt "powerProfile" (intervalOpt 5000);