Compare commits
No commits in common. "92853657323daa63c55612135dd7487e3c506fa2" and "660b34fde5fd2e51bd1bb1a7ee0a6e3d36baa496" have entirely different histories.
9285365732
...
660b34fde5
9 changed files with 34 additions and 161 deletions
|
|
@ -121,11 +121,6 @@ in
|
||||||
default = true;
|
default = true;
|
||||||
description = "Show volume slider on the lock screen.";
|
description = "Show volume slider on the lock screen.";
|
||||||
};
|
};
|
||||||
weather = lib.mkOption {
|
|
||||||
type = lib.types.bool;
|
|
||||||
default = true;
|
|
||||||
description = "Show weather summary on the lock screen.";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
notifications = moduleOpt "notifications" {
|
notifications = moduleOpt "notifications" {
|
||||||
timeout = lib.mkOption {
|
timeout = lib.mkOption {
|
||||||
|
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
import QtQuick
|
|
||||||
import "../services" as S
|
|
||||||
|
|
||||||
Column {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
required property color accentColor
|
|
||||||
|
|
||||||
// Weather icon + summary
|
|
||||||
Item {
|
|
||||||
width: parent.width
|
|
||||||
height: 28
|
|
||||||
|
|
||||||
Text {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: 12
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
text: S.WeatherService.icon
|
|
||||||
color: root.accentColor
|
|
||||||
font.pixelSize: S.Theme.fontSize + 2
|
|
||||||
font.family: S.Theme.fontFamily
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Forecast details from wttrbar tooltip
|
|
||||||
Text {
|
|
||||||
width: parent.width - 24
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
text: S.WeatherService.tooltip
|
|
||||||
color: S.Theme.base05
|
|
||||||
font.pixelSize: S.Theme.fontSize - 2
|
|
||||||
font.family: S.Theme.fontFamily
|
|
||||||
wrapMode: Text.WordWrap
|
|
||||||
lineHeight: 1.3
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
width: 1
|
|
||||||
height: 4
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -11,5 +11,4 @@ MprisApplet 1.0 MprisApplet.qml
|
||||||
NetworkApplet 1.0 NetworkApplet.qml
|
NetworkApplet 1.0 NetworkApplet.qml
|
||||||
TemperatureApplet 1.0 TemperatureApplet.qml
|
TemperatureApplet 1.0 TemperatureApplet.qml
|
||||||
VolumeApplet 1.0 VolumeApplet.qml
|
VolumeApplet 1.0 VolumeApplet.qml
|
||||||
WeatherApplet 1.0 WeatherApplet.qml
|
|
||||||
# keep-sorted end
|
# keep-sorted end
|
||||||
|
|
|
||||||
|
|
@ -27,34 +27,13 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
implicitHeight: _widgetContent.implicitHeight
|
implicitHeight: _widgetContent.implicitHeight
|
||||||
visible: _weatherCard.visible || _mprisCard.visible || _volumeCard.visible || _backlightCard.visible || _notifPills.visible
|
visible: _mprisCard.visible || _volumeCard.visible || _backlightCard.visible || _notifPills.visible
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: _widgetContent
|
id: _widgetContent
|
||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: 12
|
spacing: 12
|
||||||
|
|
||||||
// Weather widget
|
|
||||||
Rectangle {
|
|
||||||
id: _weatherCard
|
|
||||||
width: parent.width
|
|
||||||
height: _weatherContent.implicitHeight + 16
|
|
||||||
radius: S.Theme.radius + 2
|
|
||||||
color: Qt.rgba(S.Theme.base01.r, S.Theme.base01.g, S.Theme.base01.b, 0.7)
|
|
||||||
border.color: Qt.rgba(S.Theme.base03.r, S.Theme.base03.g, S.Theme.base03.b, 0.3)
|
|
||||||
border.width: 1
|
|
||||||
visible: (S.Modules.lock.weather ?? true) && S.WeatherService.available
|
|
||||||
|
|
||||||
C.WeatherApplet {
|
|
||||||
id: _weatherContent
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.topMargin: 8
|
|
||||||
accentColor: S.Theme.base0C
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Notification pills
|
// Notification pills
|
||||||
LockNotifPills {
|
LockNotifPills {
|
||||||
id: _notifPills
|
id: _notifPills
|
||||||
|
|
|
||||||
|
|
@ -1,53 +1,41 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell.Io
|
||||||
import "." as M
|
import "." as M
|
||||||
import "../services" as S
|
import "../services" as S
|
||||||
import "../applets" as C
|
|
||||||
|
|
||||||
M.BarSection {
|
M.BarSection {
|
||||||
id: root
|
id: root
|
||||||
spacing: S.Theme.moduleSpacing
|
spacing: S.Theme.moduleSpacing
|
||||||
tooltip: ""
|
tooltip: root.weatherTooltip
|
||||||
visible: S.Modules.weather.enable && S.WeatherService.available
|
|
||||||
|
|
||||||
property bool _pinned: false
|
property string weatherTooltip: ""
|
||||||
readonly property bool _anyHover: root._hovered || hoverPanel.panelHovered
|
|
||||||
readonly property bool _showPanel: _anyHover || _pinned
|
|
||||||
|
|
||||||
on_AnyHoverChanged: {
|
Process {
|
||||||
if (_anyHover)
|
id: proc
|
||||||
_unpinTimer.stop();
|
running: true
|
||||||
else if (_pinned)
|
command: ["wttrbar"].concat(S.Modules.weather.args)
|
||||||
_unpinTimer.start();
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
try {
|
||||||
|
const data = JSON.parse(text);
|
||||||
|
label.icon = data.text ?? "";
|
||||||
|
root.weatherTooltip = data.tooltip ?? "";
|
||||||
|
} catch (e) {
|
||||||
|
label.icon = "";
|
||||||
|
root.weatherTooltip = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: _unpinTimer
|
interval: S.Modules.weather.interval || 3600000
|
||||||
interval: 500
|
running: true
|
||||||
onTriggered: root._pinned = false
|
repeat: true
|
||||||
|
onTriggered: proc.running = true
|
||||||
}
|
}
|
||||||
|
|
||||||
M.BarIcon {
|
M.BarIcon {
|
||||||
icon: S.WeatherService.icon
|
id: label
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
TapHandler {
|
|
||||||
onTapped: root._pinned = !root._pinned
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
M.HoverPanel {
|
|
||||||
id: hoverPanel
|
|
||||||
showPanel: root._showPanel
|
|
||||||
screen: QsWindow.window?.screen ?? null
|
|
||||||
anchorItem: root
|
|
||||||
accentColor: root.accentColor
|
|
||||||
panelNamespace: "nova-weather"
|
|
||||||
panelTitle: "Weather"
|
|
||||||
contentWidth: 280
|
|
||||||
|
|
||||||
C.WeatherApplet {
|
|
||||||
width: hoverPanel.contentWidth
|
|
||||||
accentColor: root.accentColor
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,22 +11,19 @@ QtObject {
|
||||||
|
|
||||||
readonly property var dev: UPower.displayDevice
|
readonly property var dev: UPower.displayDevice
|
||||||
readonly property bool available: dev?.isLaptopBattery ?? false
|
readonly property bool available: dev?.isLaptopBattery ?? false
|
||||||
readonly property real percent: {
|
readonly property real pct: (dev?.percentage ?? 0) * 100
|
||||||
const p = dev?.percentage;
|
|
||||||
return (p !== undefined && p !== null && !isNaN(p)) ? p * 100 : 0;
|
|
||||||
}
|
|
||||||
readonly property bool charging: dev?.state === UPowerDeviceState.Charging
|
readonly property bool charging: dev?.state === UPowerDeviceState.Charging
|
||||||
readonly property real changeRate: dev?.changeRate ?? 0
|
readonly property real changeRate: dev?.changeRate ?? 0
|
||||||
readonly property int timeToFull: dev?.timeToFull ?? 0
|
readonly property int timeToFull: dev?.timeToFull ?? 0
|
||||||
readonly property int timeToEmpty: dev?.timeToEmpty ?? 0
|
readonly property int timeToEmpty: dev?.timeToEmpty ?? 0
|
||||||
readonly property bool healthSupported: dev?.healthSupported ?? false
|
readonly property bool healthSupported: dev?.healthSupported ?? false
|
||||||
readonly property real healthPercent: (dev?.healthPercentage ?? 1) * 100
|
readonly property real healthPct: (dev?.healthPercentage ?? 1) * 100
|
||||||
|
|
||||||
readonly property int critThresh: S.Modules.battery.critical || 15
|
readonly property int critThresh: S.Modules.battery.critical || 15
|
||||||
readonly property int warnThresh: S.Modules.battery.warning || 25
|
readonly property int warnThresh: S.Modules.battery.warning || 25
|
||||||
readonly property bool critical: percent < critThresh && !charging
|
readonly property bool critical: pct < critThresh && !charging
|
||||||
|
|
||||||
readonly property color stateColor: charging ? S.Theme.base0B : critical ? S.Theme.base09 : percent < warnThresh ? S.Theme.base0A : S.Theme.base05
|
readonly property color stateColor: charging ? S.Theme.base0B : critical ? S.Theme.base09 : pct < warnThresh ? S.Theme.base0A : S.Theme.base05
|
||||||
|
|
||||||
// 24h history (1440 samples @ 60s)
|
// 24h history (1440 samples @ 60s)
|
||||||
property var history: []
|
property var history: []
|
||||||
|
|
@ -37,7 +34,7 @@ QtObject {
|
||||||
repeat: true
|
repeat: true
|
||||||
triggeredOnStart: true
|
triggeredOnStart: true
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
const h = root.history.concat([root.percent]);
|
const h = root.history.concat([root.pct]);
|
||||||
root.history = h.length > 1440 ? h.slice(h.length - 1440) : h;
|
root.history = h.length > 1440 ? h.slice(h.length - 1440) : h;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -52,15 +49,15 @@ QtObject {
|
||||||
root._warnSent = false;
|
root._warnSent = false;
|
||||||
root._critSent = false;
|
root._critSent = false;
|
||||||
}
|
}
|
||||||
function onPercentChanged() {
|
function onPctChanged() {
|
||||||
if (root.charging)
|
if (root.charging)
|
||||||
return;
|
return;
|
||||||
if (root.percent < root.critThresh && !root._critSent) {
|
if (root.pct < root.critThresh && !root._critSent) {
|
||||||
root._critSent = true;
|
root._critSent = true;
|
||||||
root._warnSent = true;
|
root._warnSent = true;
|
||||||
_notifProc.command = ["notify-send", "--urgency=critical", "--icon=battery-low", "--category=device", "Very Low Battery", "Connect to power now!"];
|
_notifProc.command = ["notify-send", "--urgency=critical", "--icon=battery-low", "--category=device", "Very Low Battery", "Connect to power now!"];
|
||||||
_notifProc.running = true;
|
_notifProc.running = true;
|
||||||
} else if (root.percent < root.warnThresh && !root._warnSent) {
|
} else if (root.pct < root.warnThresh && !root._warnSent) {
|
||||||
root._warnSent = true;
|
root._warnSent = true;
|
||||||
_notifProc.command = ["notify-send", "--icon=battery-caution", "--category=device", "Low Battery"];
|
_notifProc.command = ["notify-send", "--icon=battery-caution", "--category=device", "Low Battery"];
|
||||||
_notifProc.running = true;
|
_notifProc.running = true;
|
||||||
|
|
|
||||||
|
|
@ -98,8 +98,7 @@ QtObject {
|
||||||
screenshot: true,
|
screenshot: true,
|
||||||
notifications: true,
|
notifications: true,
|
||||||
mpris: true,
|
mpris: true,
|
||||||
volume: true,
|
volume: true
|
||||||
weather: true
|
|
||||||
})
|
})
|
||||||
property var statsDaemon: ({
|
property var statsDaemon: ({
|
||||||
interval: -1
|
interval: -1
|
||||||
|
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
pragma Singleton
|
|
||||||
|
|
||||||
import QtQuick
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
import "." as S
|
|
||||||
|
|
||||||
QtObject {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property string icon: ""
|
|
||||||
property string tooltip: ""
|
|
||||||
readonly property bool available: icon !== ""
|
|
||||||
|
|
||||||
property Process _proc: Process {
|
|
||||||
running: S.Modules.weather.enable
|
|
||||||
command: ["wttrbar"].concat(S.Modules.weather.args)
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: {
|
|
||||||
try {
|
|
||||||
const data = JSON.parse(text);
|
|
||||||
root.icon = data.text ?? "";
|
|
||||||
root.tooltip = data.tooltip ?? "";
|
|
||||||
} catch (e) {
|
|
||||||
root.icon = "";
|
|
||||||
root.tooltip = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
property Timer _poll: Timer {
|
|
||||||
interval: S.Modules.weather.interval || 3600000
|
|
||||||
running: S.Modules.weather.enable
|
|
||||||
repeat: true
|
|
||||||
onTriggered: root._proc.running = true
|
|
||||||
}
|
|
||||||
|
|
||||||
function refresh() {
|
|
||||||
_proc.running = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -15,5 +15,4 @@ singleton PowerProfileService 1.0 PowerProfileService.qml
|
||||||
singleton ScreenshotService 1.0 ScreenshotService.qml
|
singleton ScreenshotService 1.0 ScreenshotService.qml
|
||||||
singleton SystemStats 1.0 SystemStats.qml
|
singleton SystemStats 1.0 SystemStats.qml
|
||||||
singleton Theme 1.0 Theme.qml
|
singleton Theme 1.0 Theme.qml
|
||||||
singleton WeatherService 1.0 WeatherService.qml
|
|
||||||
# keep-sorted end
|
# keep-sorted end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue