Compare commits
4
Commits
14da95aa3f
...
9788529f55
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9788529f55 | ||
|
|
94d9dd6fac | ||
|
|
764f8197fb | ||
|
|
36486179d5 |
+9
-3
@@ -12,9 +12,13 @@ QtObject {
|
||||
|
||||
readonly property int small_spacing: 4
|
||||
readonly property int spacing: 8
|
||||
function small_spacing_fun(screenHeight) { return Math.floor(barHeight(screenHeight) / 16) }
|
||||
function spacing_fun(barH) { return Math.floor(barH / 8) }
|
||||
function big_spacing_fun(barH) { return Math.floor(barH / 6) }
|
||||
function bar_small_bar_spacing_fun(barH) { return Math.floor(barHeight(barH) / 16) }
|
||||
function bar_spacing_fun(barH) { return Math.floor(barH / 8) }
|
||||
function bar_big_spacing_fun(barH) { return Math.floor(barH / 6) }
|
||||
|
||||
function screen_small_bar_spacing_fun(screenHeight) { return Math.floor((screenHeight / 1080)*2) }
|
||||
function screen_spacing_fun(screenHeight) { return Math.floor((screenHeight / 1080)*4) }
|
||||
function screen_big_spacing_fun(screenHeight) { return Math.floor((screenHeight / 1080)*8) }
|
||||
|
||||
function font_size(spaceHeight) { return Math.floor(spaceHeight * 0.75) }
|
||||
function font_size_small(spaceHeight) { return Math.floor(spaceHeight * 0.625) }
|
||||
@@ -29,6 +33,8 @@ QtObject {
|
||||
readonly property int radius: 16
|
||||
function small_radius_fun(barHeight) { return Math.floor(barHeight / 8) }
|
||||
function radius_fun(barHeight) { return Math.floor(barHeight / 4) }
|
||||
function screen_radius_fun(screenHeight) { return Math.floor((screenHeight / 1080)*4) }
|
||||
function screen_big_radius_fun(screenHeight) { return Math.floor((screenHeight / 1080)*6) }
|
||||
readonly property int big_radius: 10
|
||||
readonly property int border_width: 2
|
||||
|
||||
|
||||
+5
-5
@@ -14,7 +14,7 @@ PanelWindow {
|
||||
anchors.left: true
|
||||
anchors.right: true
|
||||
|
||||
implicitHeight: Math.floor(screen.height * Config.barHeightRatio(screen.height))
|
||||
implicitHeight: Config.barHeight(screen.height)
|
||||
|
||||
exclusiveZone: height // this is so context menus don't clip into the bar
|
||||
|
||||
@@ -40,8 +40,8 @@ PanelWindow {
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Config.big_spacing_fun(height)
|
||||
spacing: Config.big_spacing_fun(height)
|
||||
anchors.leftMargin: Config.bar_big_spacing_fun(height)
|
||||
spacing: Config.bar_big_spacing_fun(height)
|
||||
|
||||
MenuButton {}
|
||||
|
||||
@@ -57,7 +57,7 @@ PanelWindow {
|
||||
Row { // bar widgets center
|
||||
id: widgetsCenter
|
||||
anchors.centerIn: parent
|
||||
spacing: Config.big_spacing_fun(height)
|
||||
spacing: Config.bar_big_spacing_fun(height)
|
||||
|
||||
Clock {}
|
||||
|
||||
@@ -69,7 +69,7 @@ PanelWindow {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 0
|
||||
spacing: Config.big_spacing_fun(height)
|
||||
spacing: Config.bar_big_spacing_fun(height)
|
||||
|
||||
// TODO: Add bluetooth, network, audio, power, maybe HW monitor
|
||||
Tray{}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
|
||||
|
||||
Item {
|
||||
@@ -8,7 +9,10 @@ Item {
|
||||
model: Quickshell.screens
|
||||
delegate: Loader {
|
||||
active: true // loads object
|
||||
sourceComponent: Bar {screen: modelData} // creates instance of bar component
|
||||
sourceComponent: Bar {
|
||||
screen: modelData
|
||||
visible: !Hyprland.monitorFor(modelData).activeWorkspace.hasFullscreen
|
||||
} // creates instance of bar component
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import Quickshell.Hyprland
|
||||
MouseArea {
|
||||
id: audioButton
|
||||
|
||||
width: Math.max(audioRow.width + Config.spacing_fun(height)*3.5, height)
|
||||
width: Math.max(audioRow.width + Config.bar_spacing_fun(height)*3.5, height)
|
||||
height: bar.height
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
@@ -22,9 +22,9 @@ MouseArea {
|
||||
|
||||
Row {
|
||||
id: audioRow
|
||||
width: audioSourceText.width + audioSinkText.width + audioPercentageText.width + Config.spacing_fun(height)*2
|
||||
width: audioSourceText.width + audioSinkText.width + audioPercentageText.width + Config.bar_spacing_fun(height)*2
|
||||
height: parent.height
|
||||
spacing: Config.spacing_fun(height)/2
|
||||
spacing: Config.bar_spacing_fun(height)/2
|
||||
anchors.centerIn: parent
|
||||
|
||||
Text {
|
||||
@@ -35,7 +35,7 @@ MouseArea {
|
||||
font.pixelSize: Config.iconSize(bar.height)
|
||||
font.family: Config.font
|
||||
color: audioButton.containsMouse ? Colors.tertiary_fg : Colors.primary
|
||||
rightPadding: Config.spacing_fun(height)*1.5
|
||||
rightPadding: Config.bar_spacing_fun(height)*1.5
|
||||
}
|
||||
|
||||
Text {
|
||||
|
||||
@@ -5,7 +5,7 @@ import "../states/Audio"
|
||||
MouseArea {
|
||||
id: audioButton
|
||||
|
||||
width: Math.max(audioText.width + Config.spacing_fun(height)*2, height)
|
||||
width: Math.max(audioText.width + Config.bar_spacing_fun(height)*2, height)
|
||||
height: bar.height
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
|
||||
@@ -6,7 +6,7 @@ import "../states/Battery"
|
||||
|
||||
MouseArea {
|
||||
id: batteryButton
|
||||
width: expanded ? Math.max(expandedRow.width + Config.spacing_fun(height)*3, bar.height) : Math.max(batteryText.width + Config.spacing_fun(height)*2, bar.height)
|
||||
width: expanded ? Math.max(expandedRow.width + Config.bar_spacing_fun(height)*3, bar.height) : Math.max(batteryText.width + Config.bar_spacing_fun(height)*2, bar.height)
|
||||
height: bar.height
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
@@ -63,7 +63,7 @@ MouseArea {
|
||||
id: expandedRow
|
||||
visible: expanded
|
||||
anchors.centerIn: parent
|
||||
spacing: Config.spacing_fun(batteryButton.height)
|
||||
spacing: Config.bar_spacing_fun(batteryButton.height)
|
||||
|
||||
Text {
|
||||
id: batteryPercentageSymbol
|
||||
@@ -121,7 +121,7 @@ MouseArea {
|
||||
id: batteryPopup
|
||||
anchorItem: batteryButton
|
||||
anchorHovered: batteryButton.containsMouse
|
||||
spacingValue: Config.spacing_fun(batteryButton.height)
|
||||
spacingValue: Config.bar_spacing_fun(batteryButton.height)
|
||||
radiusValue: Config.radius_fun(batteryButton.height)
|
||||
|
||||
Column {
|
||||
|
||||
@@ -6,7 +6,7 @@ import "../states/Clock"
|
||||
|
||||
Rectangle { //workspace
|
||||
id: clockRect
|
||||
width: ClockState.expanded ? Math.max(dateText.width + timeText.width + Config.spacing_fun(height)*3, bar.height) : Math.max(timeText.width + Config.spacing_fun(height)*2, bar.height)
|
||||
width: ClockState.expanded ? Math.max(dateText.width + timeText.width + Config.bar_spacing_fun(height)*3, bar.height) : Math.max(timeText.width + Config.bar_spacing_fun(height)*2, bar.height)
|
||||
height: bar.height
|
||||
radius: Config.radius_fun(height)
|
||||
color: clockArea.containsMouse ? Colors.tertiaryContainer : Colors.primaryContainer
|
||||
@@ -61,7 +61,7 @@ Rectangle { //workspace
|
||||
id: clockPopup
|
||||
anchorItem: clockRect
|
||||
anchorHovered: clockArea.containsMouse
|
||||
spacingValue: Config.spacing_fun(clockRect.height)
|
||||
spacingValue: Config.bar_spacing_fun(clockRect.height)
|
||||
radiusValue: Config.radius_fun(clockRect.height)
|
||||
|
||||
Column {
|
||||
|
||||
@@ -7,7 +7,7 @@ import "../states/Idle"
|
||||
|
||||
MouseArea {
|
||||
id: idleButton
|
||||
width: Math.max(idleText.width + Config.spacing_fun(height)*2, height)
|
||||
width: Math.max(idleText.width + Config.bar_spacing_fun(height)*2, height)
|
||||
height: bar.height
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
|
||||
@@ -5,7 +5,7 @@ import "../states/Network"
|
||||
MouseArea {
|
||||
id: networkButton
|
||||
|
||||
width: Math.max(networkText.width + Config.spacing_fun(height)*2, height)
|
||||
width: Math.max(networkText.width + Config.bar_spacing_fun(height)*2, height)
|
||||
height: bar.height
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
@@ -37,7 +37,7 @@ MouseArea {
|
||||
id: clockPopup
|
||||
anchorItem: networkButton
|
||||
anchorHovered: networkButton.containsMouse
|
||||
spacingValue: Config.spacing_fun(networkButton.height)
|
||||
spacingValue: Config.bar_spacing_fun(networkButton.height)
|
||||
radiusValue: Config.radius_fun(networkButton.height)
|
||||
|
||||
Column {
|
||||
|
||||
@@ -13,7 +13,29 @@ MouseArea {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
|
||||
onClicked: {
|
||||
NotificationS.soundEnabled = !NotificationS.soundEnabled
|
||||
// NotificationS.soundEnabled = !NotificationS.soundEnabled
|
||||
console.log("[NotificationButton] Opening NotificationHistory")
|
||||
root.toggleNotificationHistory()
|
||||
}
|
||||
|
||||
|
||||
Item {
|
||||
anchors.top: parent.topBar
|
||||
anchors.right: parent.right
|
||||
anchors.topMargin: Config.spacing
|
||||
anchors.rightMargin: Config.spacing
|
||||
width: Config.screen_height_to_font_tiny(screen.height)
|
||||
height: Config.screen_height_to_font_tiny(screen.height)
|
||||
|
||||
visible: NotificationS.notificationNum > 0
|
||||
|
||||
Text{
|
||||
anchors.centerIn: parent
|
||||
text: NotificationS.notificationNum
|
||||
font.family: Config.font
|
||||
font.pixelSize: Config.screen_height_to_font_tiny(screen.height)
|
||||
color: Colors.secondaryContainer_fg
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
|
||||
@@ -4,7 +4,7 @@ import "../../../config"
|
||||
|
||||
MouseArea {
|
||||
id: powerButton
|
||||
width: Math.max(powerText.width + Config.spacing_fun(height), height)
|
||||
width: Math.max(powerText.width + Config.bar_spacing_fun(height), height)
|
||||
height: bar.height
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
|
||||
@@ -7,7 +7,7 @@ import "../../../config"
|
||||
|
||||
Row { // Workspace Row
|
||||
id: trayRow
|
||||
spacing: Config.small_spacing_fun(height)
|
||||
spacing: Config.bar_small_bar_spacing_fun(height)
|
||||
|
||||
Repeater {
|
||||
model: SystemTray.items
|
||||
@@ -19,8 +19,8 @@ Row { // Workspace Row
|
||||
|
||||
Rectangle { //trayItem
|
||||
id: trayItem
|
||||
width: iconImage.width + Config.spacing_fun(bar.height)
|
||||
height: iconImage.height + Config.spacing_fun(bar.height)
|
||||
width: iconImage.width + Config.bar_spacing_fun(bar.height)
|
||||
height: iconImage.height + Config.bar_spacing_fun(bar.height)
|
||||
radius: Config.radius_fun(trayRow.height)
|
||||
color: trayArea.containsMouse ? Colors.tertiaryContainer
|
||||
: modelData.active ? Colors.primaryContainer
|
||||
|
||||
@@ -7,7 +7,7 @@ import "../states/Apps"
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property real pad: Config.spacing_fun(bar.height) * 1.5
|
||||
property real pad: Config.bar_spacing_fun(bar.height) * 1.5
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
@@ -39,7 +39,7 @@ Item {
|
||||
Row {
|
||||
|
||||
id: contentRow
|
||||
spacing: Config.spacing_fun(bar.height) * 1.25
|
||||
spacing: Config.bar_spacing_fun(bar.height) * 1.25
|
||||
anchors.centerIn: parent
|
||||
|
||||
Text {
|
||||
|
||||
@@ -8,8 +8,8 @@ Rectangle {
|
||||
id: workspacesContainer
|
||||
required property HyprlandMonitor thisMonitor
|
||||
|
||||
height: bar.height - (Config.spacing_fun(bar.height) * 1.5)
|
||||
width: workspacesRow.width + (Config.spacing_fun(bar.height) * 2)
|
||||
height: bar.height - (Config.bar_spacing_fun(bar.height) * 1.5)
|
||||
width: workspacesRow.width + (Config.bar_spacing_fun(bar.height) * 2)
|
||||
|
||||
radius: height / 2
|
||||
|
||||
@@ -20,7 +20,7 @@ Rectangle {
|
||||
Row {
|
||||
id: workspacesRow
|
||||
anchors.centerIn: parent
|
||||
spacing: Config.spacing_fun(bar.height) / 2
|
||||
spacing: Config.bar_spacing_fun(bar.height) / 2
|
||||
|
||||
Repeater {
|
||||
model: Hyprland.workspaces
|
||||
@@ -30,9 +30,9 @@ Rectangle {
|
||||
id: wsItem
|
||||
property var workspaceData: modelData
|
||||
|
||||
width: Math.max(40, wsIconsRow.width==0 ? wsNum.width + 2*Config.spacing_fun(bar.height) : wsNum.width + wsIconsRow.width + 3*Config.spacing_fun(bar.height)+Config.spacing_fun(bar.height))
|
||||
width: Math.max(40, wsIconsRow.width==0 ? wsNum.width + 2*Config.bar_spacing_fun(bar.height) : wsNum.width + wsIconsRow.width + 3*Config.bar_spacing_fun(bar.height)+Config.bar_spacing_fun(bar.height))
|
||||
// width: {
|
||||
// var spacing = Config.spacing_fun(bar.height)
|
||||
// var spacing = Config.bar_spacing_fun(bar.height)
|
||||
// var cw = wsNum.width
|
||||
// if (wsIconsRow.children.length > 0) {
|
||||
// cw += spacing + wsIconsRow.width + spacing
|
||||
@@ -47,7 +47,7 @@ Rectangle {
|
||||
Rectangle {
|
||||
anchors.centerIn: parent
|
||||
width: parent.width
|
||||
height: parent.height - (Config.spacing_fun(bar.height) * 1.5)
|
||||
height: parent.height - (Config.bar_spacing_fun(bar.height) * 1.5)
|
||||
|
||||
radius: height / 2
|
||||
|
||||
@@ -79,9 +79,9 @@ Rectangle {
|
||||
|
||||
Row {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: wsIconsRow.width==0 ? (wsItem.width-wsNum.width)/2 : (wsItem.width-wsNum.width-wsIconsRow.width-Config.spacing_fun(bar.height))/2
|
||||
anchors.leftMargin: wsIconsRow.width==0 ? (wsItem.width-wsNum.width)/2 : (wsItem.width-wsNum.width-wsIconsRow.width-Config.bar_spacing_fun(bar.height))/2
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Config.spacing_fun(bar.height)
|
||||
spacing: Config.bar_spacing_fun(bar.height)
|
||||
|
||||
Text {
|
||||
id: wsNum
|
||||
@@ -97,7 +97,7 @@ Rectangle {
|
||||
|
||||
Row {
|
||||
id: wsIconsRow
|
||||
spacing: Config.spacing_fun(workspacesContainer.height)
|
||||
spacing: Config.bar_spacing_fun(workspacesContainer.height)
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
Repeater {
|
||||
|
||||
@@ -58,6 +58,7 @@ PanelWindow {
|
||||
delegate: NotificationBody {
|
||||
required property int index
|
||||
required property var notificationData
|
||||
implicitWidth: screen.width/7
|
||||
screen: notificationWindow.screen
|
||||
|
||||
notification: notificationData
|
||||
|
||||
@@ -7,16 +7,16 @@ import QtQuick.Controls
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
//TODO: urgency, expireTimeoutText, ...
|
||||
|
||||
required property var notification
|
||||
required property var screen
|
||||
property var urgency: (notification.urgency ?? notification.hints["urgency"]) != null ? (notification.urgency ?? notification.hints["urgency"]) + 1 : 0
|
||||
|
||||
property bool closing: false
|
||||
property int _hoveredActionCount: 0
|
||||
// When used in history overview we don't want auto-timeout or click-to-close
|
||||
property bool isHistory: false
|
||||
|
||||
property real duration: (
|
||||
property real duration: isHistory ? 0 : (
|
||||
notification.expireTimeout > 0 ? notification.expireTimeout*1000 :
|
||||
urgency ? urgency * 2000 :
|
||||
5000
|
||||
@@ -31,9 +31,11 @@ Rectangle {
|
||||
color: textBGColor
|
||||
border.width: Config.border_width
|
||||
border.color: textColor
|
||||
radius: isHistory ? Config.small_radius : 0
|
||||
clip: isHistory
|
||||
|
||||
property string textColor: urgency != 3 ? Colors.primary : Colors.tertiary
|
||||
property string textBGColor: urgency != 3 ? Qt.alpha(Colors.primaryContainer, 0.75) : Qt.alpha(Colors.tertiaryContainer, 0.75)
|
||||
property color textColor: urgency != 3 ? Colors.primary : Colors.tertiary
|
||||
property color textBGColor: urgency != 3 ? Qt.alpha(Colors.primaryContainer, 0.75) : Qt.alpha(Colors.tertiaryContainer, 0.75)
|
||||
|
||||
function closeNotification(dismiss){
|
||||
if (closing) {
|
||||
@@ -55,6 +57,8 @@ Rectangle {
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
enabled: !root.isHistory
|
||||
visible: !root.isHistory
|
||||
onClicked: {
|
||||
root.closeNotification(false)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,276 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import QtQuick.Controls
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Hyprland
|
||||
import Quickshell.Services.Notifications
|
||||
import "../../config"
|
||||
import "./notificationServer"
|
||||
|
||||
PanelWindow {
|
||||
id: root
|
||||
implicitWidth: screen.width/5
|
||||
implicitHeight: screen.height - Config.barHeight(screen.height)*2
|
||||
color: "transparent"
|
||||
visible: true
|
||||
focusable: true
|
||||
|
||||
anchors {
|
||||
top: true
|
||||
right: true
|
||||
}
|
||||
|
||||
property string textColor: Colors.primary
|
||||
property string textBGColor: Qt.alpha(Colors.primaryContainer, 0.75)
|
||||
property string bGColor: Qt.alpha(Colors.primaryContainer, 0.5)
|
||||
|
||||
property real bigFontSize: Config.screen_height_to_font_medium(screen.height)
|
||||
property real fontSize: Config.screen_height_to_font_small(screen.height)
|
||||
|
||||
property var expandedGroups: ({})
|
||||
|
||||
property var grouped: {
|
||||
const vals = NotificationS.trackedNotifications.values
|
||||
const len = vals.length
|
||||
if (len < 0) return []
|
||||
let map = {}
|
||||
for (let i = 0; i < vals.length; ++i) {
|
||||
const n = vals[i]
|
||||
const key = (n && n.appName && n.appName !== "") ? n.appName : "Unknown"
|
||||
if (!map[key]) map[key] = []
|
||||
map[key].push(n)
|
||||
}
|
||||
let result = []
|
||||
for (const k in map) result.push({ appName: k, notes: map[k] })
|
||||
result.sort((a,b)=>a.appName.localeCompare(b.appName))
|
||||
return result
|
||||
}
|
||||
|
||||
function toggleGroup(appName) {
|
||||
let copy = Object.assign({}, expandedGroups)
|
||||
copy[appName] = !(copy[appName] === true)
|
||||
expandedGroups = copy
|
||||
}
|
||||
function clearGroup(appName) {
|
||||
const vals = NotificationS.trackedNotifications.values.slice()
|
||||
for (let i=0;i<vals.length;++i){
|
||||
const n=vals[i]
|
||||
const key = (n && n.appName && n.appName !== "") ? n.appName : "Unknown"
|
||||
if (key===appName) { if (n.tracked) n.dismiss(); else if (n.close) n.close() }
|
||||
}
|
||||
}
|
||||
function clearAll() {
|
||||
const vals = NotificationS.trackedNotifications.values.slice()
|
||||
for (let i=0;i<vals.length;++i) if (vals[i].tracked) vals[i].dismiss()
|
||||
expandedGroups = ({})
|
||||
}
|
||||
|
||||
|
||||
FocusScope {
|
||||
id: nHistoryScope
|
||||
focus: true
|
||||
|
||||
Keys.onReleased: function(event) {
|
||||
if (event.key === Qt.Key_Escape) {
|
||||
console.log("Pressed Escape, closing JLearner")
|
||||
notifificationHistoryLoader.active = false
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: "lightblue"
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: background
|
||||
color: bGColor
|
||||
// opacity: 0.5
|
||||
anchors.fill: parent
|
||||
border.width: Config.border_width
|
||||
border.color: textColor
|
||||
radius: Config.screen_big_radius_fun(screen.height)
|
||||
|
||||
// Text {
|
||||
// anchors.centerIn: parent
|
||||
// font.family: Config.font
|
||||
// font.pixelSize: bigFontSize
|
||||
// color: textColor
|
||||
// wrapMode: Text.Wrap
|
||||
// text: NotificationS.trackedNotifications.values[0]
|
||||
// }
|
||||
|
||||
Component.onCompleted: {
|
||||
for (var notification in NotificationS.trackedNotifications.values) {
|
||||
console.log("[NotificationHistory]: " + notification.appName + " Notifications")
|
||||
}
|
||||
for (var i =0; i < NotificationS.notificationNum; i++) {
|
||||
console.log("[NotificationHistory]: " + NotificationS.trackedNotifications.values[i].appName + " Notifications")
|
||||
}
|
||||
}
|
||||
|
||||
Column{
|
||||
id: bgColumn
|
||||
anchors.fill: parent
|
||||
anchors.margins: Config.screen_spacing_fun(screen.height)
|
||||
spacing: Config.screen_spacing_fun(screen.height)
|
||||
|
||||
Rectangle {
|
||||
id: topBar
|
||||
width: parent.width
|
||||
height: bigFontSize*1.25
|
||||
color: textBGColor
|
||||
radius: Config.screen_big_radius_fun(screen.height)
|
||||
border.width: Config.border_width
|
||||
border.color: textColor
|
||||
|
||||
Row{
|
||||
id: backgroundLeft
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Config.screen_spacing_fun(screen.height)
|
||||
spacing: Config.screen_spacing_fun(screen.height)
|
||||
|
||||
Text{
|
||||
text: "Notifications:"
|
||||
font.family: Config.font
|
||||
font.pixelSize: bigFontSize
|
||||
color: textColor
|
||||
}
|
||||
}
|
||||
|
||||
Row{
|
||||
id: backgroundCenter
|
||||
anchors.centerIn: parent
|
||||
spacing: Config.screen_small_bar_spacing_fun(screen.height)
|
||||
|
||||
Text{
|
||||
text: NotificationS.soundEnabled ? "" : ""
|
||||
font.family: Config.font
|
||||
font.pixelSize: bigFontSize
|
||||
color: textColor
|
||||
}
|
||||
|
||||
Switch {
|
||||
id: notificationVolumeSwitch
|
||||
|
||||
implicitWidth: notificationVolumeSwitch.height*2
|
||||
implicitHeight: bigFontSize
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
checked: NotificationS.soundEnabled
|
||||
|
||||
indicator: Rectangle {
|
||||
implicitWidth: notificationVolumeSwitch.width
|
||||
implicitHeight: notificationVolumeSwitch.height
|
||||
radius: height / 2
|
||||
|
||||
color: notificationVolumeSwitch.checked ? Colors.secondary : Colors.secondaryContainer
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation { duration: 150 }
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: parent.height*0.8
|
||||
height: parent.height*0.8
|
||||
radius: width / 2
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
x: notificationVolumeSwitch.checked ? parent.width - width - 3 : 3
|
||||
|
||||
color: notificationVolumeSwitch.checked ? Colors.secondaryContainer : Colors.secondary
|
||||
|
||||
Behavior on x {
|
||||
NumberAnimation {
|
||||
duration: 180
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation { duration: 150 }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onCheckedChanged: {
|
||||
NotificationS.soundEnabled = notificationVolumeSwitch.checked
|
||||
console.log("NotificationS.soundEnabled:", NotificationS.soundEnabled)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row{
|
||||
id: backgroundRight
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Config.screen_spacing_fun(screen.height)
|
||||
spacing: Config.screen_spacing_fun(screen.height)
|
||||
|
||||
MouseArea {
|
||||
id: closeArea
|
||||
width: bigFontSize
|
||||
height: bigFontSize
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
Rectangle{
|
||||
anchors.fill: parent
|
||||
color: closeArea.containsMouse ? "red" : textBGColor
|
||||
radius: Config.screen_big_radius_fun(screen.height)
|
||||
border.width: Config.border_width
|
||||
border.color: closeArea.containsMouse ? "white" : textColor
|
||||
Text{
|
||||
text: ""
|
||||
anchors.centerIn: parent
|
||||
font.family: Config.font
|
||||
font.pixelSize: bigFontSize
|
||||
color: closeArea.containsMouse ? "white" : textColor
|
||||
}
|
||||
}
|
||||
onClicked: {
|
||||
closeNHistory()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: parent.height - topBar.height - bgColumn.spacing //- bgColumn.anchors.margins*2
|
||||
color: textBGColor
|
||||
radius: Config.screen_big_radius_fun(screen.height)
|
||||
border.width: Config.border_width
|
||||
border.color: textColor
|
||||
|
||||
Text {
|
||||
id: noNotificationText
|
||||
anchors.centerIn: parent
|
||||
visible: NotificationS.notificationNum == 0
|
||||
text: "No notifications"
|
||||
font.family: Config.font
|
||||
font.pixelSize: bigFontSize
|
||||
color: textColor
|
||||
}
|
||||
|
||||
Flickable {
|
||||
id: flick
|
||||
width: parent.width
|
||||
// height: Math.min(root.maxContentHeight, contentColumn.implicitHeight)
|
||||
contentWidth: width
|
||||
contentHeight: contentColumn.implicitHeight
|
||||
clip: true
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
flickableDirection: Flickable.VerticalFlick
|
||||
ScrollBar.vertical: ScrollBar { policy: ScrollBar.AsNeeded }
|
||||
Column {
|
||||
id: contentColumn
|
||||
width: flick.width
|
||||
spacing: Config.spacing
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
import Quickshell.Io
|
||||
import "../../config"
|
||||
import "./notificationServer"
|
||||
|
||||
|
||||
Item { // container, invisible
|
||||
id: nHistoryLoader
|
||||
|
||||
LazyLoader {
|
||||
id: notifificationHistoryLoader
|
||||
// active: true
|
||||
active: false
|
||||
NotificationHistory {
|
||||
id: nHistory
|
||||
|
||||
function closeNHistory() {
|
||||
nHistoryLoader.closeNHistory()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GlobalShortcut {
|
||||
name: "NotificationHistory"
|
||||
description: "Open Notification History"
|
||||
|
||||
onPressed: {
|
||||
console.log("Pressed Meta+Shift+N (Hyprland global shortcut)")
|
||||
notifificationHistoryLoader.active = !notifificationHistoryLoader.active
|
||||
}
|
||||
}
|
||||
|
||||
function openNHistory() {
|
||||
notifificationHistoryLoader.active = true
|
||||
}
|
||||
|
||||
function closeNHistory() {
|
||||
notifificationHistoryLoader.active = false
|
||||
}
|
||||
|
||||
function toggleNHistory() {
|
||||
notifificationHistoryLoader.active = !notifificationHistoryLoader.active
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
console.log("[NotificationHistoryLoader]:", NotificationS)
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,9 @@ Item {
|
||||
property var newestNotification: null
|
||||
property bool soundEnabled: true
|
||||
|
||||
property alias trackedNotifications: notificationServer.trackedNotifications
|
||||
property int notificationNum: trackedNotifications.values.length
|
||||
|
||||
signal notificationReceived(var notification)
|
||||
|
||||
function correctMonitor(screen) {
|
||||
@@ -55,7 +58,7 @@ Item {
|
||||
// return
|
||||
// }
|
||||
notification.tracked = true
|
||||
Config.debug == "Notification" && console.log(
|
||||
!notification.lastGeneration && Config.debug == "Notification" && console.log(
|
||||
"[NotificationServer] Notification received:",
|
||||
notification.appName, notification.id, notification.summary, notification.body
|
||||
)
|
||||
@@ -80,9 +83,9 @@ Item {
|
||||
repeat: false
|
||||
|
||||
onTriggered: {
|
||||
focusedMonitor = Hyprland.focusedMonitor
|
||||
notificationReceived(notification)
|
||||
if(!notification.lastGeneration && notificationServerState.soundEnabled){
|
||||
focusedMonitor = Hyprland.focusedMonitor
|
||||
notificationReceived(notification)
|
||||
notificationSound.play()
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@ ShellRoot {
|
||||
|
||||
// Notifications
|
||||
NotificationLoader {}
|
||||
NotificationHistoryLoader {
|
||||
id: nHistoryLoader
|
||||
}
|
||||
|
||||
//Wallpaper picker
|
||||
WallpaperPickerLoader {}
|
||||
@@ -41,6 +44,10 @@ ShellRoot {
|
||||
wlLoader.openWlogout()
|
||||
}
|
||||
|
||||
function toggleNotificationHistory() {
|
||||
nHistoryLoader.toggleNHistory()
|
||||
}
|
||||
|
||||
GlobalShortcut {
|
||||
name: "QsReload"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user