Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8177b5e2a2 | ||
|
|
4b5272c124 | ||
|
|
621ec3bfc5 | ||
|
|
ad24015487 | ||
|
|
4c3f4a1691 |
7 changed files with 223 additions and 73 deletions
|
|
@ -122,7 +122,8 @@ programs.nova-shell.modules = {
|
|||
battery.warning = 30; # % for warning notification
|
||||
battery.critical = 10; # % for critical blink + notification
|
||||
cpu.interval = 2000; # polling interval in ms
|
||||
disk.interval = 60000; # polling interval in ms
|
||||
disk.interval = 60000; # polling interval in ms
|
||||
disk.warnThreshold = 85; # % usage to trigger warning color
|
||||
notifications.timeout = 3000; # popup auto-dismiss in ms
|
||||
notifications.maxPopups = 4; # max simultaneous popups (0 to disable)
|
||||
notifications.maxVisible = 10; # scrollable history limit in center
|
||||
|
|
|
|||
|
|
@ -144,7 +144,16 @@ in
|
|||
description = "Maximum notifications kept in history (-1 for unlimited).";
|
||||
};
|
||||
};
|
||||
disk = moduleOpt "disk" (intervalOpt 30000);
|
||||
disk = moduleOpt "disk" (
|
||||
(intervalOpt 30000)
|
||||
// {
|
||||
warnThreshold = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 85;
|
||||
description = "Usage percentage at which the disk module bar turns warning color.";
|
||||
};
|
||||
}
|
||||
);
|
||||
backlight = moduleOpt "backlight" {
|
||||
step = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
|
|
|
|||
|
|
@ -23,11 +23,13 @@ WlSessionLockSurface {
|
|||
color: S.Theme.base00
|
||||
}
|
||||
|
||||
// Clear desktop screenshot from ScreenshotService - visible immediately
|
||||
// Clear desktop screenshot from ScreenshotService - visible immediately.
|
||||
// Hidden when reducedMotion (power saver) since the reveal shader and hex
|
||||
// wave won't animate, leaving an unblurred screenshot visible.
|
||||
Image {
|
||||
anchors.fill: parent
|
||||
source: S.ScreenshotService.get(root.screen?.name ?? "")
|
||||
visible: (S.Modules.lock.screenshot ?? true) && source !== ""
|
||||
visible: (S.Modules.lock.screenshot ?? true) && source !== "" && !S.Theme.reducedMotion
|
||||
opacity: _unlockFade
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
}
|
||||
|
|
@ -59,7 +61,7 @@ WlSessionLockSurface {
|
|||
Image {
|
||||
anchors.fill: parent
|
||||
source: S.ScreenshotService.get(root.screen?.name ?? "")
|
||||
visible: (S.Modules.lock.screenshot ?? true) && source !== ""
|
||||
visible: (S.Modules.lock.screenshot ?? true) && source !== "" && !S.Theme.reducedMotion
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
|
||||
layer.enabled: true
|
||||
|
|
|
|||
|
|
@ -11,6 +11,13 @@ M.BarSection {
|
|||
|
||||
property var _mounts: S.SystemStats.diskMounts
|
||||
property int _rootPct: S.SystemStats.diskRootPct
|
||||
readonly property int _warnThreshold: S.Modules.disk.warnThreshold ?? 85
|
||||
readonly property bool _anyWarn: {
|
||||
for (const m of _mounts)
|
||||
if (m.pct >= _warnThreshold)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
property bool _pinned: false
|
||||
readonly property bool _anyHover: root._hovered || hoverPanel.panelHovered
|
||||
|
|
@ -31,6 +38,7 @@ M.BarSection {
|
|||
|
||||
M.BarIcon {
|
||||
icon: "\uF0C9"
|
||||
color: root._anyWarn ? S.Theme.base09 : root.accentColor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
TapHandler {
|
||||
onTapped: root._pinned = !root._pinned
|
||||
|
|
@ -39,6 +47,7 @@ M.BarSection {
|
|||
M.BarLabel {
|
||||
label: root._rootPct + "%"
|
||||
minText: "100%"
|
||||
color: root._anyWarn ? S.Theme.base09 : root.accentColor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
TapHandler {
|
||||
onTapped: root._pinned = !root._pinned
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ M.BarSection {
|
|||
|
||||
M.BarIcon {
|
||||
icon: "\uDB84\uDCB0"
|
||||
color: root._loadColor(S.SystemStats.gpuUsage)
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
TapHandler {
|
||||
onTapped: root._pinned = !root._pinned
|
||||
|
|
@ -49,7 +48,6 @@ M.BarSection {
|
|||
M.BarLabel {
|
||||
label: S.SystemStats.gpuUsage + "%"
|
||||
minText: "100%"
|
||||
color: root._loadColor(S.SystemStats.gpuUsage)
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
TapHandler {
|
||||
onTapped: root._pinned = !root._pinned
|
||||
|
|
|
|||
|
|
@ -13,89 +13,219 @@ M.HoverPanel {
|
|||
|
||||
readonly property bool _isNiri: Quickshell.env("NIRI_SOCKET") !== ""
|
||||
|
||||
// Confirmation state: null = normal menu, object = pending confirm
|
||||
property var _confirmItem: null
|
||||
|
||||
function _run(cmd) {
|
||||
runCommand(cmd);
|
||||
dismiss();
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: [
|
||||
{
|
||||
label: "Lock",
|
||||
icon: "\uF023",
|
||||
cmd: ["loginctl", "lock-session"],
|
||||
color: S.Theme.base0D
|
||||
},
|
||||
{
|
||||
label: "Suspend",
|
||||
icon: "\uF186",
|
||||
cmd: ["systemctl", "suspend"],
|
||||
color: S.Theme.base0E
|
||||
},
|
||||
{
|
||||
label: "Logout",
|
||||
icon: "\uF2F5",
|
||||
cmd: menuWindow._isNiri ? ["niri", "msg", "action", "quit"] : ["loginctl", "terminate-user", ""],
|
||||
color: S.Theme.base0A
|
||||
},
|
||||
{
|
||||
label: "Reboot",
|
||||
icon: "\uF021",
|
||||
cmd: ["systemctl", "reboot"],
|
||||
color: S.Theme.base09
|
||||
},
|
||||
{
|
||||
label: "Shutdown",
|
||||
icon: "\uF011",
|
||||
cmd: ["systemctl", "poweroff"],
|
||||
color: S.Theme.base08
|
||||
}
|
||||
]
|
||||
function _requestAction(item) {
|
||||
if (item.confirm) {
|
||||
_confirmItem = item;
|
||||
} else {
|
||||
_run(item.cmd);
|
||||
}
|
||||
}
|
||||
|
||||
delegate: Item {
|
||||
id: entry
|
||||
function _cancelConfirm() {
|
||||
_confirmItem = null;
|
||||
}
|
||||
|
||||
required property var modelData
|
||||
required property int index
|
||||
// Normal menu entries
|
||||
Column {
|
||||
visible: !menuWindow._confirmItem
|
||||
width: menuWindow.contentWidth
|
||||
|
||||
width: menuWindow.contentWidth
|
||||
height: 32
|
||||
Repeater {
|
||||
model: [
|
||||
{
|
||||
label: "Lock",
|
||||
icon: "\uF023",
|
||||
cmd: ["loginctl", "lock-session"],
|
||||
color: S.Theme.base0D,
|
||||
confirm: false
|
||||
},
|
||||
{
|
||||
label: "Suspend",
|
||||
icon: "\uF186",
|
||||
cmd: ["systemctl", "suspend"],
|
||||
color: S.Theme.base0E,
|
||||
confirm: false
|
||||
},
|
||||
{
|
||||
label: "Logout",
|
||||
icon: "\uF2F5",
|
||||
cmd: menuWindow._isNiri ? ["niri", "msg", "action", "quit"] : ["loginctl", "terminate-user", ""],
|
||||
color: S.Theme.base0A,
|
||||
confirm: false
|
||||
},
|
||||
{
|
||||
label: "Reboot",
|
||||
icon: "\uF021",
|
||||
cmd: ["systemctl", "reboot"],
|
||||
color: S.Theme.base09,
|
||||
confirm: true
|
||||
},
|
||||
{
|
||||
label: "Shutdown",
|
||||
icon: "\uF011",
|
||||
cmd: ["systemctl", "poweroff"],
|
||||
color: S.Theme.base08,
|
||||
confirm: true
|
||||
}
|
||||
]
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 4
|
||||
anchors.rightMargin: 4
|
||||
color: entryArea.containsMouse ? S.Theme.base02 : "transparent"
|
||||
radius: S.Theme.radius
|
||||
}
|
||||
delegate: Item {
|
||||
id: entry
|
||||
|
||||
Text {
|
||||
id: entryIcon
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 12
|
||||
text: entry.modelData.icon
|
||||
color: entry.modelData.color
|
||||
font.pixelSize: S.Theme.fontSize + 1
|
||||
font.family: S.Theme.iconFontFamily
|
||||
}
|
||||
required property var modelData
|
||||
required property int index
|
||||
|
||||
Text {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: entryIcon.right
|
||||
anchors.leftMargin: 10
|
||||
text: entry.modelData.label
|
||||
color: S.Theme.base05
|
||||
font.pixelSize: S.Theme.fontSize
|
||||
font.family: S.Theme.fontFamily
|
||||
}
|
||||
width: menuWindow.contentWidth
|
||||
height: 32
|
||||
|
||||
MouseArea {
|
||||
id: entryArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked: menuWindow._run(entry.modelData.cmd)
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 4
|
||||
anchors.rightMargin: 4
|
||||
color: entryHover.hovered ? S.Theme.base02 : "transparent"
|
||||
radius: S.Theme.radius
|
||||
}
|
||||
|
||||
Text {
|
||||
id: entryIcon
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 12
|
||||
text: entry.modelData.icon
|
||||
color: entry.modelData.color
|
||||
font.pixelSize: S.Theme.fontSize + 1
|
||||
font.family: S.Theme.iconFontFamily
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: entryIcon.right
|
||||
anchors.leftMargin: 10
|
||||
text: entry.modelData.label
|
||||
color: S.Theme.base05
|
||||
font.pixelSize: S.Theme.fontSize
|
||||
font.family: S.Theme.fontFamily
|
||||
}
|
||||
|
||||
HoverHandler {
|
||||
id: entryHover
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
}
|
||||
|
||||
TapHandler {
|
||||
onTapped: menuWindow._requestAction(entry.modelData)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Confirmation view
|
||||
Column {
|
||||
visible: !!menuWindow._confirmItem
|
||||
width: menuWindow.contentWidth
|
||||
spacing: 4
|
||||
|
||||
Item {
|
||||
width: parent.width
|
||||
height: 28
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: menuWindow._confirmItem ? menuWindow._confirmItem.label + "?" : ""
|
||||
color: menuWindow._confirmItem ? menuWindow._confirmItem.color : S.Theme.base05
|
||||
font.pixelSize: S.Theme.fontSize
|
||||
font.family: S.Theme.fontFamily
|
||||
font.bold: true
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
spacing: 8
|
||||
|
||||
// Cancel
|
||||
Item {
|
||||
width: 72
|
||||
height: 28
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: cancelHover.hovered ? S.Theme.base02 : S.Theme.base01
|
||||
radius: S.Theme.radius
|
||||
border.width: 1
|
||||
border.color: S.Theme.base03
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: "Cancel"
|
||||
color: S.Theme.base05
|
||||
font.pixelSize: S.Theme.fontSize
|
||||
font.family: S.Theme.fontFamily
|
||||
}
|
||||
|
||||
HoverHandler {
|
||||
id: cancelHover
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
}
|
||||
|
||||
TapHandler {
|
||||
onTapped: menuWindow._cancelConfirm()
|
||||
}
|
||||
}
|
||||
|
||||
// Confirm
|
||||
Item {
|
||||
width: 72
|
||||
height: 28
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: {
|
||||
if (!menuWindow._confirmItem)
|
||||
return S.Theme.base02;
|
||||
const c = menuWindow._confirmItem.color;
|
||||
return confirmHover.hovered ? Qt.rgba(c.r, c.g, c.b, 0.3) : Qt.rgba(c.r, c.g, c.b, 0.15);
|
||||
}
|
||||
radius: S.Theme.radius
|
||||
border.width: 1
|
||||
border.color: menuWindow._confirmItem ? menuWindow._confirmItem.color : S.Theme.base03
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: "Confirm"
|
||||
color: menuWindow._confirmItem ? menuWindow._confirmItem.color : S.Theme.base05
|
||||
font.pixelSize: S.Theme.fontSize
|
||||
font.family: S.Theme.fontFamily
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
HoverHandler {
|
||||
id: confirmHover
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
}
|
||||
|
||||
TapHandler {
|
||||
onTapped: {
|
||||
if (menuWindow._confirmItem)
|
||||
menuWindow._run(menuWindow._confirmItem.cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
width: 1
|
||||
height: 4
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,8 @@ QtObject {
|
|||
})
|
||||
property var disk: ({
|
||||
enable: true,
|
||||
interval: 30000
|
||||
interval: 30000,
|
||||
warnThreshold: 85
|
||||
})
|
||||
property var battery: ({
|
||||
enable: true,
|
||||
|
|
|
|||
Reference in a new issue