Finalized the Notification Center backend

This commit is contained in:
Tomas Rivera
2026-03-15 19:35:00 +01:00
parent d67367e4df
commit e31c2aff63
5 changed files with 77 additions and 71 deletions
+1 -1
View File
@@ -21,7 +21,7 @@
../../modules/home-manager/neovim.nix # dont use nixvim. broken ../../modules/home-manager/neovim.nix # dont use nixvim. broken
#../../modules/home-manager/neovim2.nix # ./neovim2.nix uses vim plug instead of the nix repository as with ./neovim.nix see the begining of neovim2 for an explanation #../../modules/home-manager/neovim2.nix # ./neovim2.nix uses vim plug instead of the nix repository as with ./neovim.nix see the begining of neovim2 for an explanation
../../modules/home-manager/rclone.nix ../../modules/home-manager/rclone.nix
../../modules/home-manager/waybar.nix #../../modules/home-manager/waybar.nix
../../modules/home-manager/quickshell.nix # used for widgets, waybar and notifications ../../modules/home-manager/quickshell.nix # used for widgets, waybar and notifications
#../../modules/home-manager/oh-my-posh.nix # zsh customizer #../../modules/home-manager/oh-my-posh.nix # zsh customizer
../../modules/home-manager/oh-my-zsh.nix # another zsh customizer ../../modules/home-manager/oh-my-zsh.nix # another zsh customizer
+3 -2
View File
@@ -129,7 +129,7 @@ in {
"$mod, F, exec, $browser" "$mod, F, exec, $browser"
"$mod+Shift, A, exec, rofi -show drun" "$mod+Shift, A, exec, rofi -show drun"
"$mod, Q, exec, custom-dontkillsteam" "$mod, Q, exec, custom-dontkillsteam"
"Ctrl+Alt, W, exec, pkill waybar || waybar" #"Ctrl+Alt, W, exec, pkill waybar || waybar"
"$mod, L, exec, swaylock -eFLK -i ${wallpaper}" "$mod, L, exec, swaylock -eFLK -i ${wallpaper}"
#"$mod, F11, exec, hyprshot -m window" #"$mod, F11, exec, hyprshot -m window"
#", F11, exec, hyprshot -m output" #", F11, exec, hyprshot -m output"
@@ -145,6 +145,7 @@ in {
"Ctrl+$mod, 4, exec, sleep 1 && kitty -o font_size=5 -e btm --theme gruvbox --disable-click --disable_advanced_kill --enable_cache_memory -g -R -T " "Ctrl+$mod, 4, exec, sleep 1 && kitty -o font_size=5 -e btm --theme gruvbox --disable-click --disable_advanced_kill --enable_cache_memory -g -R -T "
"Ctrl+$mod, 4, exec, sleep 1 && kitty -o font_size=1 -e sh -c 'cmatrix -br'" "Ctrl+$mod, 4, exec, sleep 1 && kitty -o font_size=1 -e sh -c 'cmatrix -br'"
#"Ctrl+Alt, 1, exec, swaync-client -t" # pos 4 1 notification center #"Ctrl+Alt, 1, exec, swaync-client -t" # pos 4 1 notification center
"Ctrl+Alt, 1, exec, qs ipc call notifications toggle"
"Ctrl+$mod, 3, exec, pavucontrol" # pos 1 2 audiocontrol "Ctrl+$mod, 3, exec, pavucontrol" # pos 1 2 audiocontrol
"Ctrl+$mod, 5, exec, gnome-characters" # pos 2 2 special chars "Ctrl+$mod, 5, exec, gnome-characters" # pos 2 2 special chars
"Ctrl+Alt, 8, exec, hyprpicker | tee >(wl-copy) | cliphist store" # pos 3 2 colorpicker "Ctrl+Alt, 8, exec, hyprpicker | tee >(wl-copy) | cliphist store" # pos 3 2 colorpicker
@@ -200,7 +201,7 @@ in {
"swww-daemon" "swww-daemon"
"sleep 1 && custom-wallpaper" "sleep 1 && custom-wallpaper"
"custom-mountkdrive" "custom-mountkdrive"
"waybar" #"waybar"
"custom-gitnotify" "custom-gitnotify"
"QS-notifycache" # builds the cache that will be used for the notification history "QS-notifycache" # builds the cache that will be used for the notification history
@@ -5,6 +5,7 @@ import QtQuick
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
import "." as Notifs import "." as Notifs
import "../theme" as Theme
Singleton { Singleton {
id: root id: root
@@ -16,15 +17,15 @@ Singleton {
implicitHeight: notificationCenter.height implicitHeight: notificationCenter.height
anchors.right: notificationCenter.right anchors.right: notificationCenter.right
anchors.top: notificationCenter.top anchors.top: notificationCenter.top
color: Theme.Colors.notificationCenterColor1 // needs to be set. Do not delete
Notifs.NotificationCenterView { Notifs.NotificationCenterView {
id: notificationCenter id: notificationCenter
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
//width: 500 color: Theme.Colors.notificationCenterColor2
//anchors.verticalCenter: parent.verticalCenter }
}
} }
IpcHandler { IpcHandler {
@@ -35,5 +36,9 @@ Singleton {
if (window.visible) if (window.visible)
notificationCenter.reload() notificationCenter.reload()
} }
}
function init() {
// empty function to define first reference to singleton. Do not delete. It will break.
} }
} }
@@ -12,7 +12,7 @@ Rectangle {
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
color: Theme.Colors.notificationCenterColor1 color: Theme.Colors.notificationCenterColor1
visible: false visible: true
ListModel { ListModel {
id: notificationsModel id: notificationsModel
@@ -30,7 +30,14 @@ Rectangle {
blockLoading: true blockLoading: true
} }
Process {
id: clearProcess
command: ["QS-notifycache"]
onExited: reload()
}
function reload() { function reload() {
historyFile.reload()
notificationsModel.clear() notificationsModel.clear()
var text = historyFile.text() var text = historyFile.text()
@@ -57,7 +64,8 @@ Rectangle {
var urgency = lines[i++] || "normal" var urgency = lines[i++] || "normal"
var body = bodyLines.join("\n") var body = bodyLines.join("\n")
notificationsModel.append({ // insert at beginning to invert order
notificationsModel.insert(0, {
app: app, app: app,
title: title, title: title,
body: body, body: body,
@@ -68,76 +76,65 @@ Rectangle {
} }
Component.onCompleted: reload() Component.onCompleted: reload()
ListView {
id: listView
anchors.fill: parent
model: notificationsModel
spacing: 10
clip: true
Component.onCompleted: { ColumnLayout {
console.log("DISPLAY DEBUG: ListView created") anchors.fill: parent
console.log("DISPLAY DEBUG: Model count =", notificationsModel.count) spacing: 8
console.log("DISPLAY DEBUG: View width =", width, "height =", height)
}
onCountChanged: { Button {
console.log("DISPLAY DEBUG: ListView count changed ->", count) text: "Clear"
} Layout.fillWidth: true
onClicked: {
delegate: Rectangle { clearProcess.running = true
width: ListView.view.width }
color: "transparent"
border.color: "transparent"
border.width: 1
radius: 4
Component.onCompleted: {
console.log("DISPLAY DEBUG: Delegate created")
console.log("DISPLAY DEBUG: app =", app)
console.log("DISPLAY DEBUG: title =", title)
console.log("DISPLAY DEBUG: body =", body)
console.log("DISPLAY DEBUG: delegate width =", width)
console.log("DISPLAY DEBUG: delegate height=", height)
} }
Column { ListView {
id: columnContent id: listView
//anchors.fill: parent Layout.fillWidth: true
anchors.margins: 8 Layout.fillHeight: true
spacing: 4 model: notificationsModel
spacing: 10
clip: true
Text { delegate: Rectangle {
text: time + " | " + app width: ListView.width
color: "black" color: Theme.Colors.notificationCenterColor1
width: ListView.view.width - 16 border.color: Theme.Colors.notificationCenterColor3
Component.onCompleted: { border.width: 1
console.log("DISPLAY DEBUG: time/app text created:", text) radius: 4
} visible: true
}
Text { Column {
text: title id: columnContent
color: "black" anchors.fill: parent
font.bold: true anchors.margins: 8
wrapMode: Text.Wrap spacing: 4
width: ListView.view.width - 16
Component.onCompleted: {
console.log("DISPLAY DEBUG: title text created:", text)
}
}
Text { Text {
text: body text: time
color: "black" color: Theme.Colors.notificationCenterColor4
wrapMode: Text.Wrap width: ListView.width - 16
width: ListView.view.width - 16 }
Component.onCompleted: {
console.log("DISPLAY DEBUG: body text created:", text) Text {
text: title
color: Theme.Colors.notificationCenterColor4
font.bold: true
wrapMode: Text.Wrap
width: ListView.width - 16
}
Text {
text: body
color: Theme.Colors.notificationCenterColor4
wrapMode: Text.Wrap
width: ListView.width - 16
}
} }
height: 100 + columnContent.implicitHeight
} }
} }
height: 100 + columnContent.implicitHeight // necessary gives the height for the delegate
} }
}
} }
+4 -1
View File
@@ -78,5 +78,8 @@ QtObject {
readonly property color notifsOverlayColor1: transparent // original color: "transparent" readonly property color notifsOverlayColor1: transparent // original color: "transparent"
readonly property color screenshotOverlayColor1: "#44000000" // original color: "#44000000" readonly property color screenshotOverlayColor1: "#44000000" // original color: "#44000000"
readonly property color screenshotOverlayColor2: woodBrown // original color: "#824524" readonly property color screenshotOverlayColor2: woodBrown // original color: "#824524"
readonly property color notificationCenterColor1: "black" readonly property color notificationCenterColor1: transparent // multiple things need to be set to transparent
readonly property color notificationCenterColor2: "#A79770" // main bg color
readonly property color notificationCenterColor3: "#A85D15" // notification border color (does not work)
readonly property color notificationCenterColor4: black // text
} }