Merge branch 'rebuild' of github.com:Ly-sec/Noctalia into rebuild
This commit is contained in:
commit
c49e59220a
10 changed files with 569 additions and 214 deletions
|
|
@ -15,6 +15,8 @@ Variants {
|
|||
required property ShellScreen modelData
|
||||
readonly property real scaling: Scaling.scale(screen)
|
||||
|
||||
property var settingsPanel: null
|
||||
|
||||
screen: modelData
|
||||
implicitHeight: Style.barHeight * scaling
|
||||
color: "transparent"
|
||||
|
|
|
|||
29
Modules/Bar/NotificationHistory.qml
Normal file
29
Modules/Bar/NotificationHistory.qml
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
NIconButton {
|
||||
id: root
|
||||
|
||||
readonly property real scaling: Scaling.scale(screen)
|
||||
sizeMultiplier: 0.8
|
||||
showBorder: false
|
||||
icon: "notifications"
|
||||
tooltipText: "Notification History"
|
||||
onClicked: {
|
||||
if (!notificationHistoryPanelLoader.active) {
|
||||
notificationHistoryPanelLoader.isLoaded = true
|
||||
}
|
||||
if (notificationHistoryPanelLoader.item) {
|
||||
notificationHistoryPanelLoader.item.visible = !notificationHistoryPanelLoader.item.visible
|
||||
}
|
||||
}
|
||||
|
||||
NotificationHistoryPanel {
|
||||
id: notificationHistoryPanelLoader
|
||||
}
|
||||
}
|
||||
162
Modules/Bar/NotificationHistoryPanel.qml
Normal file
162
Modules/Bar/NotificationHistoryPanel.qml
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Services.Notifications
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
// Loader for Notification History panel
|
||||
NLoader {
|
||||
id: root
|
||||
|
||||
content: Component {
|
||||
NPanel {
|
||||
id: notificationPanel
|
||||
|
||||
Connections {
|
||||
target: notificationPanel
|
||||
ignoreUnknownSignals: true
|
||||
function onDismissed() {
|
||||
notificationPanel.visible = false
|
||||
}
|
||||
}
|
||||
|
||||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand
|
||||
|
||||
Rectangle {
|
||||
color: Colors.backgroundSecondary
|
||||
radius: Style.radiusMedium * scaling
|
||||
border.color: Colors.backgroundTertiary
|
||||
border.width: Math.max(1, Style.borderMedium * scaling)
|
||||
width: 400 * scaling
|
||||
height: 500 * scaling
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
anchors.topMargin: Style.marginTiny * scaling
|
||||
anchors.rightMargin: Style.marginTiny * scaling
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: Style.marginLarge * scaling
|
||||
spacing: Style.marginMedium * scaling
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginMedium * scaling
|
||||
|
||||
NText {
|
||||
text: "notifications"
|
||||
font.family: "Material Symbols Outlined"
|
||||
font.pointSize: Style.fontSizeXL * scaling
|
||||
color: Colors.accentPrimary
|
||||
}
|
||||
|
||||
NText {
|
||||
text: "Notification History"
|
||||
font.pointSize: Style.fontSizeLarge * scaling
|
||||
font.bold: true
|
||||
color: Colors.textPrimary
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
NIconButton {
|
||||
icon: "delete"
|
||||
sizeMultiplier: 0.8
|
||||
tooltipText: "Clear history"
|
||||
onClicked: NotificationService.clearHistory()
|
||||
}
|
||||
|
||||
NIconButton {
|
||||
icon: "close"
|
||||
sizeMultiplier: 0.8
|
||||
onClicked: {
|
||||
notificationPanel.visible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NDivider {}
|
||||
|
||||
ListView {
|
||||
id: notificationList
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
model: NotificationService.historyModel
|
||||
spacing: Style.marginMedium * scaling
|
||||
clip: true
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
|
||||
delegate: Rectangle {
|
||||
width: notificationList ? (notificationList.width - 20) : 380 * scaling
|
||||
height: 80
|
||||
radius: Style.radiusMedium * scaling
|
||||
color: notificationMouseArea.containsMouse ? Colors.accentPrimary : "transparent"
|
||||
|
||||
RowLayout {
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: 15
|
||||
}
|
||||
spacing: 15
|
||||
|
||||
// Notification content
|
||||
Column {
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
spacing: 5
|
||||
|
||||
NText {
|
||||
text: (summary || "No summary").substring(0, 100)
|
||||
font.pointSize: Style.fontSizeMedium * scaling
|
||||
font.weight: Font.Medium
|
||||
color: notificationMouseArea.containsMouse ? Colors.backgroundPrimary : Colors.textPrimary
|
||||
wrapMode: Text.Wrap
|
||||
width: parent.width - 30
|
||||
maximumLineCount: 2
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
NText {
|
||||
text: (body || "").substring(0, 150)
|
||||
font.pointSize: Style.fontSizeSmall * scaling
|
||||
color: notificationMouseArea.containsMouse ? Colors.backgroundPrimary : Colors.textSecondary
|
||||
wrapMode: Text.Wrap
|
||||
width: parent.width - 30
|
||||
maximumLineCount: 3
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
NText {
|
||||
text: NotificationService.formatTimestamp(timestamp)
|
||||
font.pointSize: Style.fontSizeSmall * scaling
|
||||
color: notificationMouseArea.containsMouse ? Colors.backgroundPrimary : Colors.textSecondary
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: notificationMouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
console.log("[NotificationHistory] Removing notification:", summary)
|
||||
NotificationService.historyModel.remove(index)
|
||||
NotificationService.saveHistory()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
active: true
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -10,6 +10,13 @@ Item {
|
|||
width: pill.width
|
||||
height: pill.height
|
||||
|
||||
// Reference to settings panel
|
||||
property var settingsPanel: null
|
||||
|
||||
Component.onCompleted: {
|
||||
console.log("[Volume] settingsPanel received:", !!settingsPanel)
|
||||
}
|
||||
|
||||
// Used to avoid opening the pill on Quickshell startup
|
||||
property bool firstVolumeReceived: false
|
||||
|
||||
|
|
@ -21,17 +28,17 @@ Item {
|
|||
}
|
||||
|
||||
function getIconColor() {
|
||||
return (Audio.volume <= 1.0) ? Colors.textPrimary : getVolumeColor()
|
||||
return (getDisplayVolume() <= 1.0) ? Colors.textPrimary : getVolumeColor()
|
||||
}
|
||||
|
||||
function getVolumeColor() {
|
||||
if (Audio.volume <= 1.0) {
|
||||
if (getDisplayVolume() <= 1.0) {
|
||||
return Colors.accentPrimary
|
||||
}
|
||||
|
||||
// Indicate that the volume is over 100%
|
||||
// Calculate interpolation factor (0 at 100%, 1.0 at 200%)
|
||||
let factor = (Audio.volume - 1.0)
|
||||
let factor = (getDisplayVolume() - 1.0)
|
||||
|
||||
// Blend between accent and warning colors
|
||||
return Qt.rgba(Colors.accentPrimary.r + (Colors.error.r - Colors.accentPrimary.r) * factor,
|
||||
|
|
@ -39,6 +46,15 @@ Item {
|
|||
Colors.accentPrimary.b + (Colors.error.b - Colors.accentPrimary.b) * factor, 1)
|
||||
}
|
||||
|
||||
function getDisplayVolume() {
|
||||
// If volumeOverdrive is false, clamp to 100%
|
||||
if (!Settings.data.audio || !Settings.data.audio.volumeOverdrive) {
|
||||
return Math.min(Audio.volume, 1.0)
|
||||
}
|
||||
// If volumeOverdrive is true, allow up to 200%
|
||||
return Math.min(Audio.volume, 2.0)
|
||||
}
|
||||
|
||||
// Connection used to open the pill when volume changes
|
||||
Connections {
|
||||
target: Audio.sink?.audio ? Audio.sink?.audio : null
|
||||
|
|
@ -59,9 +75,9 @@ Item {
|
|||
iconCircleColor: getVolumeColor()
|
||||
collapsedIconColor: getIconColor()
|
||||
autoHide: true
|
||||
text: Math.round(Audio.volume * 100) + "%"
|
||||
text: Math.round(getDisplayVolume() * 100) + "%"
|
||||
tooltipText: "Volume: " + Math.round(
|
||||
Audio.volume * 100) + "%\nLeft click for advanced settings.\nScroll up/down to change volume."
|
||||
getDisplayVolume() * 100) + "%\nLeft click for advanced settings.\nScroll up/down to change volume."
|
||||
|
||||
onWheel: function (angle) {
|
||||
if (angle > 0) {
|
||||
|
|
@ -71,7 +87,15 @@ Item {
|
|||
}
|
||||
}
|
||||
onClicked: {
|
||||
audioDeviceSelector.isLoaded = !audioDeviceSelector.isLoaded
|
||||
// Open settings panel and navigate to Audio tab
|
||||
console.log("[Volume] Attempting to open settings panel...")
|
||||
try {
|
||||
settingsPanel.isLoaded = true
|
||||
settingsPanel.content.currentTabIndex = 5 // Audio tab index
|
||||
console.log("[Volume] Settings panel opened successfully")
|
||||
} catch (error) {
|
||||
console.log("[Volume] Error opening settings panel:", error)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue