mirror of
https://github.com/tomasriveral/nixos.git
synced 2026-08-12 10:30:44 +02:00
worked on QML and other minor details
This commit is contained in:
@@ -211,7 +211,6 @@
|
|||||||
# used for the framework 16 laptop
|
# used for the framework 16 laptop
|
||||||
framework-tool
|
framework-tool
|
||||||
framework-tool-tui
|
framework-tool-tui
|
||||||
|
|
||||||
krita # image edition
|
krita # image edition
|
||||||
yt-dlp# some youtube downloader
|
yt-dlp# some youtube downloader
|
||||||
vlc
|
vlc
|
||||||
@@ -223,6 +222,7 @@
|
|||||||
libsForQt5.qt5.qtgraphicaleffects
|
libsForQt5.qt5.qtgraphicaleffects
|
||||||
mprisence
|
mprisence
|
||||||
kdePackages.qt5compat
|
kdePackages.qt5compat
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
# fonts
|
# fonts
|
||||||
|
|||||||
@@ -77,6 +77,8 @@
|
|||||||
(pkgs.callPackage ../../modules/scripts/man.nix {})
|
(pkgs.callPackage ../../modules/scripts/man.nix {})
|
||||||
(pkgs.callPackage ../../modules/scripts/trimmer.nix {})
|
(pkgs.callPackage ../../modules/scripts/trimmer.nix {})
|
||||||
(pkgs.callPackage ../../modules/scripts/QSsysinfo.nix {})
|
(pkgs.callPackage ../../modules/scripts/QSsysinfo.nix {})
|
||||||
|
(pkgs.callPackage ../../modules/scripts/QSnotifycache.nix {})
|
||||||
|
(pkgs.callPackage ../../modules/scripts/QSnotifyhistory.nix {})
|
||||||
#pkgs
|
#pkgs
|
||||||
pkgs.gruvbox-gtk-theme
|
pkgs.gruvbox-gtk-theme
|
||||||
# # Adds the 'hello' command to your environment. It prints a friendly
|
# # Adds the 'hello' command to your environment. It prints a friendly
|
||||||
|
|||||||
@@ -202,6 +202,7 @@ in {
|
|||||||
"custom-mountkdrive"
|
"custom-mountkdrive"
|
||||||
"waybar"
|
"waybar"
|
||||||
"custom-gitnotify"
|
"custom-gitnotify"
|
||||||
|
"QS-notifycache" # builds the cache that will be used for the notification history
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
# login autostart
|
# login autostart
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# creates and maintains cache file for the notification history
|
||||||
|
{
|
||||||
|
writeShellApplication,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
writeShellApplication {
|
||||||
|
name = "QS-notifycache";
|
||||||
|
runtimeInputs = [
|
||||||
|
];
|
||||||
|
text = ''
|
||||||
|
CACHE="$HOME/.cache/notify_history"
|
||||||
|
# Create or erase existing cache
|
||||||
|
mkdir -p "$(dirname "$CACHE")"
|
||||||
|
: > "$CACHE" # truncate file
|
||||||
|
echo "Notification history initialized at $(date)" >> "$CACHE"
|
||||||
|
'';
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
writeShellApplication,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
writeShellApplication {
|
||||||
|
name = "QS-notifyhistory";
|
||||||
|
runtimeInputs = [
|
||||||
|
];
|
||||||
|
text = ''
|
||||||
|
app="$1"
|
||||||
|
title="$2"
|
||||||
|
body="$3"
|
||||||
|
date="$(date +%T)"
|
||||||
|
urgency="$4"
|
||||||
|
|
||||||
|
case "$urgency" in
|
||||||
|
0) urgency_text="low";;
|
||||||
|
1) urgency_text="normal";;
|
||||||
|
2) urgency_text="critical";;
|
||||||
|
*) urgency_text="unknown";;
|
||||||
|
esac
|
||||||
|
{
|
||||||
|
echo "$app"
|
||||||
|
echo "$title"
|
||||||
|
echo "$body"
|
||||||
|
echo "$date"
|
||||||
|
echo "$urgency_text"
|
||||||
|
|
||||||
|
} >> "$HOME/.cache/notify_history"
|
||||||
|
'';
|
||||||
|
}
|
||||||
@@ -47,7 +47,7 @@ for f in /sys/class/hwmon/hwmon*/fan*_input; do
|
|||||||
count=$((count + 1))
|
count=$((count + 1))
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fan=$(( sum / count / 1000 ))
|
fan=$(( sum / count ))
|
||||||
fan=$(printf "%4s" "$fan")
|
fan=$(printf "%4s" "$fan")
|
||||||
|
|
||||||
mem=$(free | awk '/Mem:/ {printf("%.0f",$3/$2*100)}')
|
mem=$(free | awk '/Mem:/ {printf("%.0f",$3/$2*100)}')
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ Item {
|
|||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: layout
|
id: layout
|
||||||
|
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
@@ -30,15 +29,23 @@ Item {
|
|||||||
smooth: false
|
smooth: false
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Item {
|
||||||
id: bannerRect
|
id: bannerRect
|
||||||
|
|
||||||
color: Theme.Colors.background
|
//color: "transparent" //Theme.Colors.background
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
implicitHeight: textColumn.height
|
implicitHeight: textColumn.implicitHeight
|
||||||
Layout.leftMargin: (width / trumpetTop.sourceSize.width) * 2 + 3
|
Layout.leftMargin: (width / trumpetTop.sourceSize.width) * 2 + 3
|
||||||
Layout.rightMargin: (width / trumpetTop.sourceSize.width) * 2 + 3
|
Layout.rightMargin: (width / trumpetTop.sourceSize.width) * 2 + 3
|
||||||
|
|
||||||
|
Image {
|
||||||
|
//anchors.right: parent.right
|
||||||
|
height: textColumn.height
|
||||||
|
width: textColumn.width
|
||||||
|
source: "../assets/wood.png"
|
||||||
|
smooth: false
|
||||||
|
//opacity: 0.4
|
||||||
|
}
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: textColumn
|
id: textColumn
|
||||||
|
|
||||||
@@ -69,7 +76,7 @@ Item {
|
|||||||
text: root.notif ? root.notif.summary + (root.notif.body ? "\n" : "") : ""
|
text: root.notif ? root.notif.summary + (root.notif.body ? "\n" : "") : ""
|
||||||
font.family: "BigBlueTermPlusNerdFont"
|
font.family: "BigBlueTermPlusNerdFont"
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
font.pointSize: 18
|
font.pointSize: 14
|
||||||
font.bold: true
|
font.bold: true
|
||||||
color: Theme.Colors.displayColor1
|
color: Theme.Colors.displayColor1
|
||||||
}
|
}
|
||||||
@@ -78,7 +85,9 @@ Item {
|
|||||||
text: root.notif ? root.notif.body : ""
|
text: root.notif ? root.notif.body : ""
|
||||||
font.family: "BigBlueTermPlusNerdFont"
|
font.family: "BigBlueTermPlusNerdFont"
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
font.pointSize: 14
|
Layout.maximumWidth: bannerRect.width
|
||||||
|
Layout.fillWidth: true
|
||||||
|
font.pointSize: 11
|
||||||
font.bold: false
|
font.bold: false
|
||||||
color: Theme.Colors.displayColor2
|
color: Theme.Colors.displayColor2
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
import "." as Notifs
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
PanelWindow {
|
||||||
|
id: window
|
||||||
|
visible: false
|
||||||
|
|
||||||
|
Notifs.NotificationCenterView {
|
||||||
|
id: notificationCenter
|
||||||
|
anchors.right: parent.right
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IpcHandler {
|
||||||
|
target: "notifications"
|
||||||
|
|
||||||
|
function toggle() {
|
||||||
|
window.visible = !window.visible
|
||||||
|
if (window.visible)
|
||||||
|
notificationCenter.reload()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: root
|
||||||
|
width: 1000
|
||||||
|
height: 800
|
||||||
|
color: "black"
|
||||||
|
visible: false
|
||||||
|
// Toggle the notification center visibility
|
||||||
|
function toggleNotificationCenter() {
|
||||||
|
root.visible = !root.visible
|
||||||
|
console.log("DEBUG: Toggled NotificationCenter. Visible =", root.visible)
|
||||||
|
if (root.visible) {
|
||||||
|
reload()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FileView for reading the notification cache
|
||||||
|
FileView {
|
||||||
|
id: historyFile
|
||||||
|
path: Quickshell.env("HOME") + "/.cache/notify_history"
|
||||||
|
blockLoading: true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reload notifications from the file
|
||||||
|
function reload() {
|
||||||
|
root.visible = true
|
||||||
|
/*var text = historyFile.text()
|
||||||
|
if (!text || text.length === 0) {
|
||||||
|
console.log("DEBUG: Notification file empty")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("DEBUG: Raw notification file content:\n" + text)
|
||||||
|
var lines = text.split("\n")
|
||||||
|
console.log("DEBUG: Total lines in file:", lines.length)
|
||||||
|
|
||||||
|
var i = 1
|
||||||
|
while (i < lines.length) {
|
||||||
|
var app = lines[i++] || ""
|
||||||
|
var title = lines[i++] || ""
|
||||||
|
var bodyLines = []
|
||||||
|
|
||||||
|
while (i < lines.length && !/^\d{2}:\d{2}:\d{2}$/.test(lines[i])) {
|
||||||
|
bodyLines.push(lines[i++])
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i >= lines.length) break
|
||||||
|
|
||||||
|
var time = lines[i++] || ""
|
||||||
|
var urgency = lines[i++] || "normal"
|
||||||
|
var body = bodyLines.join("\n")
|
||||||
|
|
||||||
|
console.log("DEBUG: Parsed notification:", app, title, body, time, urgency)
|
||||||
|
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
Component.onCompleted: {
|
||||||
|
console.log("DEBUG: NotificationCenterView component loaded")
|
||||||
|
reload()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
import "." as Notifs
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
property bool isOpen: false
|
||||||
|
|
||||||
|
IpcHandler {
|
||||||
|
target: "notifications"
|
||||||
|
|
||||||
|
function open() {
|
||||||
|
root.isOpen = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function close() {
|
||||||
|
root.isOpen = false
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggle() {
|
||||||
|
root.isOpen = !root.isOpen
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LazyLoader {
|
||||||
|
id: loader
|
||||||
|
active: root.isOpen
|
||||||
|
Notifs.NotificationCenterView {
|
||||||
|
id: notificationCenter
|
||||||
|
anchors.centerIn: parent
|
||||||
|
width: 1000
|
||||||
|
height: 800
|
||||||
|
visible: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
// Empty init function to ensure singleton is loaded
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: root
|
||||||
|
width: 1000
|
||||||
|
height: 800
|
||||||
|
color: "black"
|
||||||
|
|
||||||
|
// Use ListModel so Repeater updates automatically
|
||||||
|
ListModel {
|
||||||
|
id: notificationsModel
|
||||||
|
}
|
||||||
|
// Toggle the notification center visibility
|
||||||
|
function toggleNotificationCenter() {
|
||||||
|
root.visible = !root.visible
|
||||||
|
console.log("DEBUG: Toggled NotificationCenter. Visible =", root.visible)
|
||||||
|
if (root.visible) {
|
||||||
|
reload()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FileView for reading the notification cache
|
||||||
|
FileView {
|
||||||
|
id: historyFile
|
||||||
|
path: Quickshell.env("HOME") + "/.cache/notify_history"
|
||||||
|
blockLoading: true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reload notifications from the file
|
||||||
|
function reload() {
|
||||||
|
notificationsModel.clear()
|
||||||
|
var text = historyFile.text()
|
||||||
|
if (!text || text.length === 0) {
|
||||||
|
console.log("DEBUG: Notification file empty")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("DEBUG: Raw notification file content:\n" + text)
|
||||||
|
var lines = text.split("\n")
|
||||||
|
console.log("DEBUG: Total lines in file:", lines.length)
|
||||||
|
|
||||||
|
var i = 1
|
||||||
|
while (i < lines.length) {
|
||||||
|
var app = lines[i++] || ""
|
||||||
|
var title = lines[i++] || ""
|
||||||
|
var bodyLines = []
|
||||||
|
|
||||||
|
while (i < lines.length && !/^\d{2}:\d{2}:\d{2}$/.test(lines[i])) {
|
||||||
|
bodyLines.push(lines[i++])
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i >= lines.length) break
|
||||||
|
|
||||||
|
var time = lines[i++] || ""
|
||||||
|
var urgency = lines[i++] || "normal"
|
||||||
|
var body = bodyLines.join("\n")
|
||||||
|
|
||||||
|
console.log("DEBUG: Parsed notification:", app, title, body, time, urgency)
|
||||||
|
|
||||||
|
notificationsModel.insert(0, { app: app, title: title, body: body, time: time, urgency: urgency })
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("DEBUG: Total notifications loaded:", notificationsModel.count)
|
||||||
|
}
|
||||||
|
Component.onCompleted: {
|
||||||
|
console.log("DEBUG: NotificationCenter component completed")
|
||||||
|
reload()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Scrollable list of notifications
|
||||||
|
ScrollView {
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: list
|
||||||
|
width: parent.width
|
||||||
|
spacing: 8
|
||||||
|
Repeater {
|
||||||
|
model: notificationsModel
|
||||||
|
delegate: Rectangle {
|
||||||
|
width: list.width
|
||||||
|
height: columnContent.implicitHeight + 20
|
||||||
|
color: "transparent"
|
||||||
|
|
||||||
|
Image {
|
||||||
|
anchors.fill: parent
|
||||||
|
source: "../assets/wood.png"
|
||||||
|
fillMode: Image.Stretch
|
||||||
|
z: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: columnContent
|
||||||
|
width: parent.width
|
||||||
|
//anchors.fill: parent
|
||||||
|
anchors.margins: 10
|
||||||
|
z: 1
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: time + " | " + app
|
||||||
|
color: urgency === "critical" ? "red" : "white"
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: title
|
||||||
|
font.bold: true
|
||||||
|
color: urgency === "critical" ? "red" : "white"
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: body
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
color: urgency === "critical" ? "red" : "white"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,11 +2,14 @@ pragma ComponentBehavior: Bound
|
|||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
import Quickshell.Wayland
|
import Quickshell.Wayland
|
||||||
import Quickshell.Services.Notifications
|
import Quickshell.Services.Notifications
|
||||||
import "../theme" as Theme
|
import "../theme" as Theme
|
||||||
import "."
|
import "."
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PanelWindow {
|
PanelWindow {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
@@ -23,8 +26,13 @@ PanelWindow {
|
|||||||
bottom: true
|
bottom: true
|
||||||
right: true
|
right: true
|
||||||
}
|
}
|
||||||
|
Process {
|
||||||
|
id: notifLogger
|
||||||
|
}
|
||||||
NotificationServer {
|
NotificationServer {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
actionsSupported: true
|
actionsSupported: true
|
||||||
|
|
||||||
onNotification: notif => {
|
onNotification: notif => {
|
||||||
@@ -33,6 +41,9 @@ PanelWindow {
|
|||||||
if (notif) {
|
if (notif) {
|
||||||
notif.tracked = true;
|
notif.tracked = true;
|
||||||
root.notifs = [...root.notifs, notif];
|
root.notifs = [...root.notifs, notif];
|
||||||
|
|
||||||
|
notifLogger.command = ["QS-notifyhistory", notif.appName, notif.summary, notif.body, notif.urgency]
|
||||||
|
notifLogger.running = true // logs the notification for later
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,9 +17,10 @@ ShellRoot {
|
|||||||
bar: bar
|
bar: bar
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: () => {
|
Component.onCompleted: {
|
||||||
//Launcher.Controller.init();
|
//Launcher.Controller.init();
|
||||||
Screenshot.Controller.init();
|
Screenshot.Controller.init();
|
||||||
//Lock.Controller.init();
|
//Lock.Controller.init();
|
||||||
|
Notifs.NotificationCenter.init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,11 +24,7 @@ deadnix and aljandra to clean up the repo
|
|||||||
|
|
||||||
|
|
||||||
with quickshell:
|
with quickshell:
|
||||||
see all thoses waarnings and errors
|
|
||||||
set keybinds. for screenshot
|
|
||||||
fix screenshot (copy, write, etc.)
|
|
||||||
fix player control icons
|
fix player control icons
|
||||||
remove unnecessary stuff
|
|
||||||
give battery percentage
|
give battery percentage
|
||||||
maybe modify some of the images (like the notification body)
|
maybe modify some of the images (like the notification body)
|
||||||
do a full bar (no ugly empty space at top)
|
do a full bar (no ugly empty space at top)
|
||||||
|
|||||||
Reference in New Issue
Block a user