fix blobs dirty tracking #87
@@ -7,4 +7,8 @@ JsonObject {
|
||||
property real alignX: 0.5
|
||||
property real alignY: 0.5
|
||||
property real zoom: 1.0
|
||||
property real sourceClipX: 0
|
||||
property real sourceClipY: 0
|
||||
property real sourceClipW: 0
|
||||
property real sourceClipH: 0
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ JsonObject {
|
||||
property Popouts popouts: Popouts {
|
||||
}
|
||||
property int rounding: 8
|
||||
property int smoothing: 32
|
||||
|
||||
component Popouts: JsonObject {
|
||||
property bool activeWindow: true
|
||||
|
||||
@@ -83,6 +83,10 @@ Singleton {
|
||||
wallFadeDuration: background.wallFadeDuration,
|
||||
enabled: background.enabled,
|
||||
alignX: background.alignX,
|
||||
sourceClipX: background.sourceClipX,
|
||||
sourceClipY: background.sourceClipY,
|
||||
sourceClipW: background.sourceClipW,
|
||||
sourceClipH: background.sourceClipH,
|
||||
alignY: background.alignY,
|
||||
zoom: background.zoom
|
||||
};
|
||||
@@ -94,6 +98,7 @@ Singleton {
|
||||
hideWhenNotif: barConfig.hideWhenNotif,
|
||||
rounding: barConfig.rounding,
|
||||
border: barConfig.border,
|
||||
smoothing: barConfig.smoothing,
|
||||
height: barConfig.height,
|
||||
popouts: {
|
||||
tray: barConfig.popouts.tray,
|
||||
@@ -236,6 +241,7 @@ Singleton {
|
||||
return {
|
||||
recolorLogo: lock.recolorLogo,
|
||||
enableFprint: lock.enableFprint,
|
||||
showNotifContent: lock.showNotifContent,
|
||||
maxFprintTries: lock.maxFprintTries,
|
||||
blurAmount: lock.blurAmount,
|
||||
sizes: {
|
||||
|
||||
@@ -5,6 +5,7 @@ JsonObject {
|
||||
property bool enableFprint: true
|
||||
property int maxFprintTries: 3
|
||||
property bool recolorLogo: false
|
||||
property bool showNotifContent: false
|
||||
property Sizes sizes: Sizes {
|
||||
}
|
||||
|
||||
|
||||
+23
-174
@@ -3,184 +3,33 @@ import QtQuick
|
||||
Canvas {
|
||||
id: root
|
||||
|
||||
property rect dirtyRect: Qt.rect(0, 0, 0, 0)
|
||||
property bool frameQueued: false
|
||||
property bool fullRepaintPending: true
|
||||
property point lastPoint: Qt.point(0, 0)
|
||||
property real minPointDistance: 2.0
|
||||
property color penColor: "white"
|
||||
property real penWidth: 4
|
||||
property var pendingSegments: []
|
||||
property bool strokeActive: false
|
||||
property var strokes: []
|
||||
property var points: []
|
||||
|
||||
function appendPoint(x, y) {
|
||||
if (!strokeActive || strokes.length === 0)
|
||||
function clear(): void {
|
||||
var ctx = getContext('2d');
|
||||
root.points = [];
|
||||
ctx.reset();
|
||||
root.requestPaint();
|
||||
}
|
||||
|
||||
renderStrategy: Canvas.Cooperative
|
||||
|
||||
onPaint: {
|
||||
if (points.length < 2)
|
||||
return;
|
||||
const dx = x - lastPoint.x;
|
||||
const dy = y - lastPoint.y;
|
||||
|
||||
if ((dx * dx + dy * dy) < (minPointDistance * minPointDistance))
|
||||
return;
|
||||
const x1 = lastPoint.x;
|
||||
const y1 = lastPoint.y;
|
||||
const x2 = x;
|
||||
const y2 = y;
|
||||
|
||||
strokes[strokes.length - 1].push(Qt.point(x2, y2));
|
||||
|
||||
pendingSegments.push({
|
||||
dot: false,
|
||||
x1: x1,
|
||||
y1: y1,
|
||||
x2: x2,
|
||||
y2: y2
|
||||
});
|
||||
|
||||
lastPoint = Qt.point(x2, y2);
|
||||
queueDirty(segmentDirtyRect(x1, y1, x2, y2));
|
||||
}
|
||||
|
||||
function beginStroke(x, y) {
|
||||
const p = Qt.point(x, y);
|
||||
strokes.push([p]);
|
||||
lastPoint = p;
|
||||
strokeActive = true;
|
||||
|
||||
pendingSegments.push({
|
||||
dot: true,
|
||||
x: x,
|
||||
y: y
|
||||
});
|
||||
|
||||
queueDirty(pointDirtyRect(x, y));
|
||||
}
|
||||
|
||||
function clear() {
|
||||
strokes = [];
|
||||
pendingSegments = [];
|
||||
dirtyRect = Qt.rect(0, 0, 0, 0);
|
||||
fullRepaintPending = true;
|
||||
markDirty(Qt.rect(0, 0, width, height));
|
||||
}
|
||||
|
||||
function drawDot(ctx, x, y) {
|
||||
ctx.beginPath();
|
||||
ctx.arc(x, y, penWidth / 2, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
}
|
||||
|
||||
function drawSegment(ctx, x1, y1, x2, y2) {
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(x1, y1);
|
||||
ctx.lineTo(x2, y2);
|
||||
ctx.stroke();
|
||||
}
|
||||
|
||||
function endStroke() {
|
||||
strokeActive = false;
|
||||
}
|
||||
|
||||
function pointDirtyRect(x, y) {
|
||||
const pad = penWidth + 2;
|
||||
return Qt.rect(x - pad, y - pad, pad * 2, pad * 2);
|
||||
}
|
||||
|
||||
function queueDirty(r) {
|
||||
dirtyRect = unionRects(dirtyRect, r);
|
||||
|
||||
if (frameQueued)
|
||||
return;
|
||||
frameQueued = true;
|
||||
|
||||
requestAnimationFrame(function () {
|
||||
frameQueued = false;
|
||||
|
||||
if (dirtyRect.width > 0 && dirtyRect.height > 0) {
|
||||
markDirty(dirtyRect);
|
||||
dirtyRect = Qt.rect(0, 0, 0, 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function replayAll(ctx) {
|
||||
ctx.clearRect(0, 0, width, height);
|
||||
|
||||
for (const stroke of strokes) {
|
||||
if (!stroke || stroke.length === 0)
|
||||
continue;
|
||||
if (stroke.length === 1) {
|
||||
const p = stroke[0];
|
||||
drawDot(ctx, p.x, p.y);
|
||||
continue;
|
||||
}
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(stroke[0].x, stroke[0].y);
|
||||
for (let i = 1; i < stroke.length; ++i)
|
||||
ctx.lineTo(stroke[i].x, stroke[i].y);
|
||||
ctx.stroke();
|
||||
}
|
||||
}
|
||||
|
||||
function requestFullRepaint() {
|
||||
fullRepaintPending = true;
|
||||
markDirty(Qt.rect(0, 0, width, height));
|
||||
}
|
||||
|
||||
function segmentDirtyRect(x1, y1, x2, y2) {
|
||||
const pad = penWidth + 2;
|
||||
const left = Math.min(x1, x2) - pad;
|
||||
const top = Math.min(y1, y2) - pad;
|
||||
const right = Math.max(x1, x2) + pad;
|
||||
const bottom = Math.max(y1, y2) + pad;
|
||||
return Qt.rect(left, top, right - left, bottom - top);
|
||||
}
|
||||
|
||||
function unionRects(a, b) {
|
||||
if (a.width <= 0 || a.height <= 0)
|
||||
return b;
|
||||
if (b.width <= 0 || b.height <= 0)
|
||||
return a;
|
||||
|
||||
const left = Math.min(a.x, b.x);
|
||||
const top = Math.min(a.y, b.y);
|
||||
const right = Math.max(a.x + a.width, b.x + b.width);
|
||||
const bottom = Math.max(a.y + a.height, b.y + b.height);
|
||||
|
||||
return Qt.rect(left, top, right - left, bottom - top);
|
||||
}
|
||||
|
||||
anchors.fill: parent
|
||||
contextType: "2d"
|
||||
renderStrategy: Canvas.Threaded
|
||||
renderTarget: Canvas.Image
|
||||
|
||||
onHeightChanged: requestFullRepaint()
|
||||
onPaint: region => {
|
||||
const ctx = getContext("2d");
|
||||
|
||||
var ctx = root.getContext('2d');
|
||||
ctx.save();
|
||||
ctx.lineWidth = root.penWidth;
|
||||
ctx.strokeStyle = root.penColor;
|
||||
ctx.lineCap = "round";
|
||||
ctx.lineJoin = "round";
|
||||
ctx.lineWidth = penWidth;
|
||||
ctx.strokeStyle = penColor;
|
||||
ctx.fillStyle = penColor;
|
||||
|
||||
if (fullRepaintPending) {
|
||||
fullRepaintPending = false;
|
||||
replayAll(ctx);
|
||||
pendingSegments = [];
|
||||
return;
|
||||
}
|
||||
|
||||
for (const seg of pendingSegments) {
|
||||
if (seg.dot)
|
||||
drawDot(ctx, seg.x, seg.y);
|
||||
else
|
||||
drawSegment(ctx, seg.x1, seg.y1, seg.x2, seg.y2);
|
||||
}
|
||||
|
||||
pendingSegments = [];
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(points[0].x, points[0].y);
|
||||
for (var i = 1; i < points.length; i++)
|
||||
ctx.lineTo(points[i].x, points[i].y);
|
||||
ctx.stroke();
|
||||
points = points.slice(points.length - 2);
|
||||
ctx.restore();
|
||||
}
|
||||
onWidthChanged: requestFullRepaint()
|
||||
}
|
||||
|
||||
@@ -30,8 +30,10 @@ CustomMouseArea {
|
||||
const x = event.x;
|
||||
const y = event.y;
|
||||
|
||||
if (event.buttons & Qt.LeftButton)
|
||||
root.drawing.appendPoint(x, y);
|
||||
if (root.visibilities.isDrawing && (event.buttons & Qt.LeftButton)) {
|
||||
root.drawing.points.push(Qt.point(x, y));
|
||||
root.drawing.requestPaint();
|
||||
}
|
||||
|
||||
if (root.inLeftPanel(root.popout, x, y)) {
|
||||
root.z = -2;
|
||||
@@ -44,7 +46,8 @@ CustomMouseArea {
|
||||
|
||||
if (root.visibilities.isDrawing && (event.buttons & Qt.LeftButton)) {
|
||||
root.panels.drawing.expanded = false;
|
||||
root.drawing.beginStroke(x, y);
|
||||
root.drawing.points.push(Qt.point(x, y));
|
||||
root.drawing.requestPaint();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -52,7 +55,6 @@ CustomMouseArea {
|
||||
root.drawing.clear();
|
||||
}
|
||||
onReleased: {
|
||||
if (root.visibilities.isDrawing)
|
||||
root.drawing.endStroke();
|
||||
root.drawing.points = [];
|
||||
}
|
||||
}
|
||||
|
||||
+18
-18
@@ -78,7 +78,7 @@ CustomMouseArea {
|
||||
const dragY = y - dragStart.y;
|
||||
|
||||
if (root.visibilities.isDrawing && !root.inLeftPanel(root.panels.drawing, x, y)) {
|
||||
root.input.z = 2;
|
||||
// root.input.z = 2;
|
||||
root.panels.drawing.expanded = false;
|
||||
}
|
||||
|
||||
@@ -96,25 +96,25 @@ CustomMouseArea {
|
||||
if (dragY < -10)
|
||||
visibilities.dock = true;
|
||||
|
||||
if (panels.sidebar.width === 0) {
|
||||
const showOsd = inRightPanel(panels.osdWrapper, x, y);
|
||||
if (panels.sidebar.width === 0) {
|
||||
const showOsd = inRightPanel(panels.osdWrapper, x, y);
|
||||
|
||||
if (showOsd) {
|
||||
osdShortcutActive = false;
|
||||
root.panels.osd.hovered = true;
|
||||
}
|
||||
} else {
|
||||
const outOfSidebar = x < width - panels.sidebar.width;
|
||||
const showOsd = outOfSidebar && inRightPanel(panels.osdWrapper, x, y);
|
||||
|
||||
if (!osdShortcutActive) {
|
||||
visibilities.osd = showOsd;
|
||||
root.panels.osd.hovered = showOsd;
|
||||
} else if (showOsd) {
|
||||
osdShortcutActive = false;
|
||||
root.panels.osd.hovered = true;
|
||||
}
|
||||
if (showOsd) {
|
||||
osdShortcutActive = false;
|
||||
root.panels.osd.hovered = true;
|
||||
}
|
||||
} else {
|
||||
const outOfSidebar = x < width - panels.sidebar.width;
|
||||
const showOsd = outOfSidebar && inRightPanel(panels.osdWrapper, x, y);
|
||||
|
||||
if (!osdShortcutActive) {
|
||||
visibilities.osd = showOsd;
|
||||
root.panels.osd.hovered = showOsd;
|
||||
} else if (showOsd) {
|
||||
osdShortcutActive = false;
|
||||
root.panels.osd.hovered = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (Config.dock.enable && !Config.dock.hoverToReveal && !visibilities.dock && !visibilities.launcher && inBottomPanel(panels.dock, x, y))
|
||||
visibilities.dock = true;
|
||||
|
||||
+17
-6
@@ -34,6 +34,7 @@ Item {
|
||||
readonly property alias resourcesWrapper: resourcesWrapper
|
||||
required property ShellScreen screen
|
||||
readonly property alias settings: settings
|
||||
readonly property alias settingsWrapper: settingsWrapper
|
||||
readonly property alias sidebar: sidebar
|
||||
readonly property alias toasts: toasts
|
||||
readonly property alias utilities: utilities
|
||||
@@ -176,15 +177,25 @@ Item {
|
||||
visibilities: root.visibilities
|
||||
}
|
||||
|
||||
Settings.Wrapper {
|
||||
id: settings
|
||||
Item {
|
||||
id: settingsWrapper
|
||||
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: parent.top
|
||||
// anchors.centerIn: parent
|
||||
panels: root
|
||||
screen: root.screen
|
||||
visibilities: root.visibilities
|
||||
clip: true
|
||||
implicitHeight: settings.implicitHeight * (1 - settings.offsetScale)
|
||||
implicitWidth: settings.implicitWidth
|
||||
|
||||
Settings.Wrapper {
|
||||
id: settings
|
||||
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: parent.top
|
||||
// anchors.centerIn: parent
|
||||
panels: root
|
||||
screen: root.screen
|
||||
visibilities: root.visibilities
|
||||
}
|
||||
}
|
||||
|
||||
Dock.Wrapper {
|
||||
|
||||
+30
-17
@@ -158,6 +158,7 @@ Variants {
|
||||
id: blobGroup
|
||||
|
||||
color: DynamicColors.palette.m3surface
|
||||
smoothing: Config.barConfig.smoothing
|
||||
|
||||
Behavior on color {
|
||||
CAnim {
|
||||
@@ -179,28 +180,34 @@ Variants {
|
||||
PanelBg {
|
||||
id: dashBg
|
||||
|
||||
deformAmount: 0.08 * Config.appearance.deform.scale
|
||||
implicitHeight: panels.dashboard.height
|
||||
property real extraHeight: 0.2
|
||||
|
||||
deformAmount: 0.08
|
||||
implicitHeight: panels.dashboard.height * (1 + extraHeight)
|
||||
implicitWidth: panels.dashboard.width
|
||||
panel: panels.dashboard
|
||||
panel: panels.dashboardWrapper
|
||||
radius: Appearance.rounding.normal
|
||||
x: panels.dashboardWrapper.x + panels.dashboard.x + Config.barConfig.border
|
||||
y: panels.dashboardWrapper.y + panels.dashboard.y + bar.implicitHeight
|
||||
y: panels.dashboardWrapper.y + panels.dashboard.y + bar.implicitHeight - panels.dashboard.height * extraHeight
|
||||
}
|
||||
|
||||
PanelBg {
|
||||
id: launcherBg
|
||||
|
||||
deformAmount: 0.08 * Config.appearance.deform.scale
|
||||
property real extraHeight: 0.2
|
||||
|
||||
deformAmount: 0.08
|
||||
implicitHeight: panels.launcher.height * (1 + extraHeight)
|
||||
panel: panels.launcher
|
||||
radius: Appearance.rounding.smallest + 5
|
||||
y: panels.launcher.y + bar.implicitHeight
|
||||
}
|
||||
|
||||
PanelBg {
|
||||
id: sidebarBg
|
||||
|
||||
bottomLeftRadius: 0
|
||||
deformAmount: 0.08 * Config.appearance.deform.scale
|
||||
deformAmount: 0.08
|
||||
exclude: panels.sidebar.offsetScale > 0.08 ? [] : [utilsBg]
|
||||
implicitHeight: panel.height * (1 / rawDeformMatrix.m22) + 2
|
||||
panel: panels.sidebar
|
||||
@@ -209,10 +216,10 @@ Variants {
|
||||
PanelBg {
|
||||
id: osdBg
|
||||
|
||||
deformAmount: 0.1 * Config.appearance.deform.scale
|
||||
deformAmount: 0.1
|
||||
implicitHeight: panels.osd.height
|
||||
implicitWidth: panels.osd.width
|
||||
panel: panels.osd
|
||||
panel: panels.osdWrapper
|
||||
radius: 20
|
||||
x: panels.osdWrapper.x + panels.osd.x + Config.barConfig.border
|
||||
y: panels.osdWrapper.y + panels.osd.y + bar.implicitHeight
|
||||
@@ -227,7 +234,7 @@ Variants {
|
||||
PanelBg {
|
||||
id: utilsBg
|
||||
|
||||
deformAmount: panels.sidebar.visible ? (0.1 * Config.appearance.deform.scale) : (0.1 * Config.appearance.deform.scale)
|
||||
deformAmount: panels.sidebar.visible ? (0.1) : (0.1)
|
||||
exclude: panels.sidebar.offsetScale > 0.08 ? [] : [sidebarBg]
|
||||
panel: panels.utilities
|
||||
topLeftRadius: 0
|
||||
@@ -238,10 +245,10 @@ Variants {
|
||||
|
||||
property real extraHeight: panels.popouts.isDetached ? 0 : 0.2
|
||||
|
||||
deformAmount: panels.popouts.isDetached ? 0.05 * Config.appearance.deform.scale : panels.popouts.hasCurrent ? 0.15 * Config.appearance.deform.scale : 0.1 * Config.appearance.deform.scale
|
||||
deformAmount: panels.popouts.isDetached ? 0.05 : panels.popouts.hasCurrent ? 0.15 : 0.1
|
||||
implicitHeight: panels.popouts.height * (1 + extraHeight)
|
||||
implicitWidth: panels.popouts.width
|
||||
panel: panels.popouts
|
||||
panel: panels.popoutsWrapper
|
||||
radius: (panels.popouts.currentName.startsWith("audio") || panels.popouts.currentName.startsWith("updates")) ? Appearance.rounding.normal : 20 * Appearance.rounding.scale
|
||||
x: panels.popoutsWrapper.x + panels.popouts.x + Config.barConfig.border
|
||||
y: panels.popoutsWrapper.y + panels.popouts.y + bar.implicitHeight - panels.popouts.height * extraHeight
|
||||
@@ -255,10 +262,10 @@ Variants {
|
||||
PanelBg {
|
||||
id: resourcesBg
|
||||
|
||||
deformAmount: 0.08 * Config.appearance.deform.scale
|
||||
deformAmount: 0.08
|
||||
implicitHeight: panels.resources.height
|
||||
implicitWidth: panels.resources.width
|
||||
panel: panels.resources
|
||||
panel: panels.resourcesWrapper
|
||||
radius: Appearance.rounding.normal
|
||||
x: panels.resourcesWrapper.x + panels.resources.x + Config.barConfig.border
|
||||
y: panels.resourcesWrapper.y + panels.resources.y + bar.implicitHeight
|
||||
@@ -267,17 +274,23 @@ Variants {
|
||||
PanelBg {
|
||||
id: settingsBg
|
||||
|
||||
deformAmount: 0.08 * Config.appearance.deform.scale
|
||||
property real extraHeight: 0.2
|
||||
|
||||
deformAmount: 0.08
|
||||
implicitHeight: panels.settings.height * (1 + extraHeight)
|
||||
implicitWidth: panels.settings.width
|
||||
panel: panels.settings
|
||||
radius: Appearance.rounding.large
|
||||
topLeftRadius: Appearance.rounding.large + Appearance.padding.smaller
|
||||
topRightRadius: Appearance.rounding.large + Appearance.padding.smaller
|
||||
x: panels.settingsWrapper.x + panels.settings.x + Config.barConfig.border
|
||||
y: panels.settingsWrapper.y + panels.settings.y + bar.implicitHeight - panels.settings.height * extraHeight
|
||||
}
|
||||
|
||||
PanelBg {
|
||||
id: dockBg
|
||||
|
||||
deformAmount: 0.08 * Config.appearance.deform.scale
|
||||
deformAmount: 0.08
|
||||
panel: panels.dock
|
||||
radius: Appearance.rounding.normal
|
||||
}
|
||||
@@ -285,7 +298,7 @@ Variants {
|
||||
PanelBg {
|
||||
id: drawingBg
|
||||
|
||||
deformAmount: 0.08 * Config.appearance.deform.scale
|
||||
deformAmount: 0.08
|
||||
panel: panels.drawing
|
||||
radius: Appearance.rounding.normal
|
||||
}
|
||||
@@ -380,7 +393,7 @@ Variants {
|
||||
property real deformAmount: 0.15
|
||||
required property Item panel
|
||||
|
||||
deformScale: deformAmount / 10000
|
||||
deformScale: (deformAmount * Config.appearance.deform.scale) / 10000
|
||||
group: blobGroup
|
||||
implicitHeight: panel.height
|
||||
implicitWidth: panel.width
|
||||
|
||||
@@ -346,7 +346,6 @@ Singleton {
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
console.log("this is running");
|
||||
if (root.gpuType === "GENERIC") {
|
||||
const percs = text.trim().split("\n");
|
||||
const sum = percs.reduce((acc, d) => acc + parseInt(d, 10), 0);
|
||||
|
||||
+20
-44
@@ -7,23 +7,30 @@ import QtQuick
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
// The list of users that can log in graphically
|
||||
// Each user object has: username, uid, home, shell, gecos (full name), face (avatar path)
|
||||
readonly property string defaultUserFile: "/etc/zshell-greeter/default-user"
|
||||
property int selectedIndex: 0
|
||||
readonly property var selectedUser: selectedIndex >= 0 && selectedIndex < users.length ? users[selectedIndex] : null
|
||||
readonly property string selectedUsername: selectedUser ? selectedUser.username : ""
|
||||
property var users: []
|
||||
|
||||
// The currently selected user index
|
||||
property int selectedIndex: 0
|
||||
function saveDefaultUser(): void {
|
||||
if (selectedUser) {
|
||||
defaultUserStorage.setText(selectedUser.username);
|
||||
}
|
||||
}
|
||||
|
||||
// The currently selected user object (or null if none)
|
||||
readonly property var selectedUser: selectedIndex >= 0 && selectedIndex < users.length ? users[selectedIndex] : null
|
||||
function selectNext(): void {
|
||||
if (users.length === 0)
|
||||
return;
|
||||
selectedIndex = (selectedIndex + 1) % users.length;
|
||||
}
|
||||
|
||||
// Convenience property for the selected username
|
||||
readonly property string selectedUsername: selectedUser ? selectedUser.username : ""
|
||||
function selectPrevious(): void {
|
||||
if (users.length === 0)
|
||||
return;
|
||||
selectedIndex = (selectedIndex - 1 + users.length) % users.length;
|
||||
}
|
||||
|
||||
// Path to store the default user preference
|
||||
readonly property string defaultUserFile: "/etc/zshell-greeter/default-user"
|
||||
|
||||
// Select a user by username
|
||||
function selectUser(username: string): bool {
|
||||
for (let i = 0; i < users.length; i++) {
|
||||
if (users[i].username === username) {
|
||||
@@ -34,28 +41,6 @@ Singleton {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Select the next user in the list (wraps around)
|
||||
function selectNext(): void {
|
||||
if (users.length === 0)
|
||||
return;
|
||||
selectedIndex = (selectedIndex + 1) % users.length;
|
||||
}
|
||||
|
||||
// Select the previous user in the list (wraps around)
|
||||
function selectPrevious(): void {
|
||||
if (users.length === 0)
|
||||
return;
|
||||
selectedIndex = (selectedIndex - 1 + users.length) % users.length;
|
||||
}
|
||||
|
||||
// Save the current user as the default for next login
|
||||
function saveDefaultUser(): void {
|
||||
if (selectedUser) {
|
||||
defaultUserStorage.setText(selectedUser.username);
|
||||
}
|
||||
}
|
||||
|
||||
// Process to fetch the list of graphical users
|
||||
Process {
|
||||
id: userLister
|
||||
|
||||
@@ -67,13 +52,10 @@ Singleton {
|
||||
try {
|
||||
root.users = JSON.parse(text);
|
||||
|
||||
// If we have users and no selection yet, try to select the default user
|
||||
if (root.users.length > 0) {
|
||||
// Try to load the default user
|
||||
if (defaultUserStorage.loaded) {
|
||||
const defaultUsername = defaultUserStorage.text().trim();
|
||||
if (defaultUsername && !root.selectUser(defaultUsername)) {
|
||||
// Default user not found, select first user
|
||||
root.selectedIndex = 0;
|
||||
}
|
||||
} else {
|
||||
@@ -87,15 +69,14 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
// FileView for persisting the default user
|
||||
FileView {
|
||||
id: defaultUserStorage
|
||||
|
||||
path: root.defaultUserFile
|
||||
preload: true
|
||||
|
||||
onLoadFailed: {}
|
||||
onLoaded: {
|
||||
// If users are already loaded, try to select the default user
|
||||
if (root.users.length > 0) {
|
||||
const defaultUsername = text().trim();
|
||||
if (defaultUsername) {
|
||||
@@ -103,10 +84,5 @@ Singleton {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onLoadFailed: {
|
||||
// File doesn't exist yet, that's fine - we'll create it on first save
|
||||
console.log("No default user file found, will use first user");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ Searcher {
|
||||
property string actualCurrent: WallpaperPath.currentWallpaperPath
|
||||
readonly property string current: showPreview ? previewPath : actualCurrent
|
||||
property string previewPath
|
||||
property bool recentlyChanged
|
||||
property bool showPreview: false
|
||||
|
||||
function preview(path: string): void {
|
||||
|
||||
+25
-77
@@ -12,90 +12,29 @@ Item {
|
||||
|
||||
required property Canvas drawing
|
||||
property bool expanded: true
|
||||
property real offsetScale: shouldBeActive ? 0 : 1
|
||||
required property ShellScreen screen
|
||||
readonly property bool shouldBeActive: visibilities.isDrawing
|
||||
required property var visibilities
|
||||
|
||||
anchors.leftMargin: (-implicitWidth - 5) * offsetScale
|
||||
implicitHeight: content.implicitHeight
|
||||
implicitWidth: 0
|
||||
visible: width > 0
|
||||
implicitWidth: root.expanded ? content.implicitWidth : icon.implicitWidth
|
||||
opacity: 1 - offsetScale
|
||||
visible: offsetScale < 1
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "hidden"
|
||||
when: !root.shouldBeActive
|
||||
|
||||
PropertyChanges {
|
||||
root.implicitWidth: 0
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
icon.opacity: 0
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
content.opacity: 0
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "collapsed"
|
||||
when: root.shouldBeActive && !root.expanded
|
||||
|
||||
PropertyChanges {
|
||||
root.implicitWidth: icon.implicitWidth
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
icon.opacity: 1
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
content.opacity: 0
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "visible"
|
||||
when: root.shouldBeActive && root.expanded
|
||||
|
||||
PropertyChanges {
|
||||
root.implicitWidth: content.implicitWidth
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
icon.opacity: 0
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
content.opacity: 1
|
||||
}
|
||||
Behavior on implicitWidth {
|
||||
Anim {
|
||||
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
||||
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
|
||||
}
|
||||
]
|
||||
transitions: [
|
||||
Transition {
|
||||
from: "*"
|
||||
to: "*"
|
||||
|
||||
ParallelAnimation {
|
||||
Anim {
|
||||
easing.bezierCurve: MaterialEasing.expressiveEffects
|
||||
property: "implicitWidth"
|
||||
target: root
|
||||
}
|
||||
|
||||
Anim {
|
||||
duration: Appearance.anim.durations.small
|
||||
property: "opacity"
|
||||
target: icon
|
||||
}
|
||||
|
||||
Anim {
|
||||
duration: Appearance.anim.durations.small
|
||||
property: "opacity"
|
||||
target: content
|
||||
}
|
||||
}
|
||||
}
|
||||
Behavior on offsetScale {
|
||||
Anim {
|
||||
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
||||
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
if (!visible)
|
||||
@@ -109,8 +48,12 @@ Item {
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
height: content.contentItem.height
|
||||
opacity: 1
|
||||
opacity: root.expanded ? 0 : 1
|
||||
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
sourceComponent: MaterialIcon {
|
||||
font.pointSize: Appearance.font.size.larger
|
||||
text: "arrow_forward_ios"
|
||||
@@ -122,7 +65,12 @@ Item {
|
||||
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
opacity: root.expanded ? 1 : 0
|
||||
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
sourceComponent: Content {
|
||||
drawing: root.drawing
|
||||
visibilities: root.visibilities
|
||||
|
||||
@@ -13,7 +13,6 @@ Searcher {
|
||||
|
||||
function launch(entry: DesktopEntry): void {
|
||||
appDb.incrementFrequency(entry.id);
|
||||
console.log(root.command);
|
||||
|
||||
if (entry.runInTerminal)
|
||||
Quickshell.execDetached({
|
||||
|
||||
@@ -284,6 +284,8 @@ CustomRect {
|
||||
Layout.fillWidth: true
|
||||
color: root.urgency === "critical" ? DynamicColors.palette.m3onSecondaryContainer : DynamicColors.palette.m3onSurface
|
||||
text: {
|
||||
if (!Config.lock.showNotifContent)
|
||||
return "Unlock to view";
|
||||
const summary = modelData.summary.replace(/\n/g, " ");
|
||||
const body = modelData.body.replace(/\n/g, " ");
|
||||
const color = root.urgency === "critical" ? DynamicColors.palette.m3secondary : DynamicColors.palette.m3outline;
|
||||
|
||||
@@ -29,13 +29,13 @@ SettingsPage {
|
||||
step: 50
|
||||
}
|
||||
|
||||
// Separator {
|
||||
// }
|
||||
//
|
||||
// WallpaperCropper {
|
||||
// Layout.fillWidth: true
|
||||
// Layout.preferredHeight: 300
|
||||
// }
|
||||
Separator {
|
||||
}
|
||||
|
||||
WallpaperCropper {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 600
|
||||
}
|
||||
}
|
||||
|
||||
SettingsSection {
|
||||
|
||||
@@ -19,8 +19,8 @@ SettingsPage {
|
||||
}
|
||||
|
||||
SettingSpinBox {
|
||||
name: "Height"
|
||||
min: 1
|
||||
name: "Height"
|
||||
object: Config.barConfig
|
||||
setting: "height"
|
||||
}
|
||||
@@ -29,8 +29,8 @@ SettingsPage {
|
||||
}
|
||||
|
||||
SettingSpinBox {
|
||||
name: "Rounding"
|
||||
min: 0
|
||||
name: "Rounding"
|
||||
object: Config.barConfig
|
||||
setting: "rounding"
|
||||
}
|
||||
@@ -39,11 +39,21 @@ SettingsPage {
|
||||
}
|
||||
|
||||
SettingSpinBox {
|
||||
name: "Border"
|
||||
min: 0
|
||||
name: "Border"
|
||||
object: Config.barConfig
|
||||
setting: "border"
|
||||
}
|
||||
|
||||
Separator {
|
||||
}
|
||||
|
||||
SettingSpinBox {
|
||||
min: 0
|
||||
name: "Smoothing"
|
||||
object: Config.barConfig
|
||||
setting: "smoothing"
|
||||
}
|
||||
}
|
||||
|
||||
SettingsSection {
|
||||
@@ -145,8 +155,8 @@ SettingsPage {
|
||||
}
|
||||
|
||||
SettingSpinBox {
|
||||
name: "Dock height"
|
||||
min: 1
|
||||
name: "Dock height"
|
||||
object: Config.dock
|
||||
setting: "height"
|
||||
}
|
||||
@@ -173,8 +183,8 @@ SettingsPage {
|
||||
}
|
||||
|
||||
SettingStringList {
|
||||
name: "Pinned apps"
|
||||
addLabel: qsTr("Add pinned app")
|
||||
name: "Pinned apps"
|
||||
object: Config.dock
|
||||
setting: "pinnedApps"
|
||||
}
|
||||
@@ -183,8 +193,8 @@ SettingsPage {
|
||||
}
|
||||
|
||||
SettingStringList {
|
||||
name: "Ignored app regexes"
|
||||
addLabel: qsTr("Add ignored regex")
|
||||
name: "Ignored app regexes"
|
||||
object: Config.dock
|
||||
setting: "ignoredAppRegexes"
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@ SettingsPage {
|
||||
}
|
||||
|
||||
SettingSpinBox {
|
||||
name: "Max fingerprint tries"
|
||||
min: 1
|
||||
name: "Max fingerprint tries"
|
||||
object: Config.lock
|
||||
setting: "maxFprintTries"
|
||||
step: 1
|
||||
@@ -41,9 +41,18 @@ SettingsPage {
|
||||
Separator {
|
||||
}
|
||||
|
||||
SettingSwitch {
|
||||
name: "Show notification details"
|
||||
object: Config.lock
|
||||
setting: "showNotifContent"
|
||||
}
|
||||
|
||||
Separator {
|
||||
}
|
||||
|
||||
SettingSpinBox {
|
||||
name: "Blur amount"
|
||||
min: 0
|
||||
name: "Blur amount"
|
||||
object: Config.lock
|
||||
setting: "blurAmount"
|
||||
step: 1
|
||||
@@ -53,9 +62,9 @@ SettingsPage {
|
||||
}
|
||||
|
||||
SettingSpinBox {
|
||||
name: "Height multiplier"
|
||||
max: 2
|
||||
min: 0.1
|
||||
name: "Height multiplier"
|
||||
object: Config.lock.sizes
|
||||
setting: "heightMult"
|
||||
step: 0.05
|
||||
@@ -65,9 +74,9 @@ SettingsPage {
|
||||
}
|
||||
|
||||
SettingSpinBox {
|
||||
name: "Aspect ratio"
|
||||
max: 4
|
||||
min: 0.5
|
||||
name: "Aspect ratio"
|
||||
object: Config.lock.sizes
|
||||
setting: "ratio"
|
||||
step: 0.05
|
||||
@@ -77,8 +86,8 @@ SettingsPage {
|
||||
}
|
||||
|
||||
SettingSpinBox {
|
||||
name: "Center width"
|
||||
min: 100
|
||||
name: "Center width"
|
||||
object: Config.lock.sizes
|
||||
setting: "centerWidth"
|
||||
step: 10
|
||||
|
||||
@@ -6,97 +6,109 @@ import qs.Config
|
||||
import qs.Components
|
||||
import qs.Helpers
|
||||
|
||||
ColumnLayout {
|
||||
Item {
|
||||
id: root
|
||||
|
||||
spacing: 15
|
||||
width: Math.min(parent ? parent.width : 600, 600)
|
||||
Image {
|
||||
id: imageView
|
||||
|
||||
Rectangle {
|
||||
id: previewContainer
|
||||
property real displayH: paintedHeight
|
||||
property real displayW: paintedWidth
|
||||
property real displayX: (width - paintedWidth) * 0.5
|
||||
property real displayY: (height - paintedHeight) * 0.5
|
||||
property real scaleX: sourceW / displayW
|
||||
property real scaleY: sourceH / displayH
|
||||
property real sourceH: Quickshell.screens[0].height
|
||||
property real sourceW: Quickshell.screens[0].width
|
||||
|
||||
anchors.fill: parent
|
||||
fillMode: Image.PreserveAspectFit
|
||||
smooth: true
|
||||
source: Wallpapers.current
|
||||
}
|
||||
|
||||
Item {
|
||||
id: overlay
|
||||
|
||||
Layout.fillHeight: true
|
||||
Layout.preferredWidth: height * (Quickshell.screens.length > 0 ? (Quickshell.screens[0].height / Math.max(1, Quickshell.screens[0].width)) : 16 / 9)
|
||||
clip: true
|
||||
color: DynamicColors.palette.m3surfaceContainer
|
||||
radius: Config.appearance.rounding.scale * 10
|
||||
height: imageView.displayH
|
||||
width: imageView.displayW
|
||||
x: imageView.displayX
|
||||
y: imageView.displayY
|
||||
|
||||
Image {
|
||||
id: img
|
||||
CustomRect {
|
||||
id: cropRect
|
||||
|
||||
property real aspectRatio: Quickshell.screens[0].width / Quickshell.screens[0].height
|
||||
readonly property rect sourceRect: Qt.rect(x * imageView.scaleX, y * imageView.scaleY, width * imageView.scaleX, height * imageView.scaleY)
|
||||
property real zoom: Config.background.zoom
|
||||
|
||||
function clampToBounds() {
|
||||
x = Math.max(0, Math.min(x, overlay.width - width));
|
||||
|
||||
y = Math.max(0, Math.min(y, overlay.height - height));
|
||||
}
|
||||
|
||||
border.color: DynamicColors.palette.m3primary
|
||||
border.width: 2
|
||||
color: DynamicColors.tPalette.m3primary
|
||||
height: width / aspectRatio
|
||||
radius: Appearance.rounding.small
|
||||
visible: imageView.status === Image.Ready
|
||||
width: Math.min(overlay.width / zoom, overlay.height * aspectRatio / zoom)
|
||||
x: Config.background.sourceClipX / imageView.scaleX
|
||||
y: Config.background.sourceClipY / imageView.scaleY
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
function updateCrop(mouseX, mouseY) {
|
||||
let nx = mouseX - cropRect.width * 0.5;
|
||||
let ny = mouseY - cropRect.height * 0.5;
|
||||
|
||||
nx = Math.max(0, Math.min(nx, overlay.width - cropRect.width));
|
||||
|
||||
ny = Math.max(0, Math.min(ny, overlay.height - cropRect.height));
|
||||
|
||||
cropRect.x = nx;
|
||||
cropRect.y = ny;
|
||||
}
|
||||
|
||||
anchors.fill: parent
|
||||
asynchronous: true
|
||||
fillMode: Image.PreserveAspectFit
|
||||
source: Wallpapers.current
|
||||
hoverEnabled: true
|
||||
preventStealing: true
|
||||
|
||||
Rectangle {
|
||||
id: cropRect
|
||||
onPositionChanged: mouse => {
|
||||
if (pressed)
|
||||
updateCrop(mouse.x, mouse.y);
|
||||
}
|
||||
onPressed: mouse => {
|
||||
updateCrop(mouse.x, mouse.y);
|
||||
}
|
||||
onReleased: {
|
||||
Wallpapers.recentlyChanged = false;
|
||||
Config.background.sourceClipX = cropRect.sourceRect.x;
|
||||
Config.background.sourceClipY = cropRect.sourceRect.y;
|
||||
Config.background.sourceClipW = cropRect.sourceRect.width;
|
||||
Config.background.sourceClipH = cropRect.sourceRect.height;
|
||||
Config.save();
|
||||
}
|
||||
onWheel: wheel => {
|
||||
let oldCenterX = cropRect.x + cropRect.width * 0.5;
|
||||
let oldCenterY = cropRect.y + cropRect.height * 0.5;
|
||||
|
||||
property real cropHeight: (imageAspect > screenAspect ? paintedHeight : paintedWidth / screenAspect) / Config.background.zoom
|
||||
property real cropWidth: (imageAspect > screenAspect ? paintedHeight * screenAspect : paintedWidth) / Config.background.zoom
|
||||
property real imageAspect: Math.max(1, paintedWidth) / Math.max(1, paintedHeight)
|
||||
property real paintedHeight: img.paintedHeight > 0 ? img.paintedHeight : img.height
|
||||
property real paintedWidth: img.paintedWidth > 0 ? img.paintedWidth : img.width
|
||||
property real paintedX: (img.width - paintedWidth) / 2
|
||||
property real paintedY: (img.height - paintedHeight) / 2
|
||||
property real screenAspect: Quickshell.screens.length > 0 ? (Quickshell.screens[0].width / Math.max(1, Quickshell.screens[0].height)) : 16 / 9
|
||||
if (wheel.angleDelta.y > 0)
|
||||
cropRect.zoom *= 1.1;
|
||||
else
|
||||
cropRect.zoom /= 1.1;
|
||||
|
||||
border.color: DynamicColors.palette.m3primary
|
||||
border.width: 2
|
||||
color: Qt.alpha(DynamicColors.palette.m3primaryContainer, 0.3)
|
||||
height: cropHeight
|
||||
width: cropWidth
|
||||
x: paintedX + (paintedWidth - width) * Config.background.alignX
|
||||
y: paintedY + (paintedHeight - height) * Config.background.alignY
|
||||
cropRect.zoom = Math.max(1.0, Math.min(cropRect.zoom, 10.0));
|
||||
Config.background.zoom = cropRect.zoom;
|
||||
|
||||
DragHandler {
|
||||
target: null
|
||||
cropRect.x = oldCenterX - cropRect.width * 0.5;
|
||||
cropRect.y = oldCenterY - cropRect.height * 0.5;
|
||||
|
||||
onActiveTranslationChanged: {
|
||||
if (active) {
|
||||
let newX = cropRect.x - cropRect.paintedX + translation.x;
|
||||
let newY = cropRect.y - cropRect.paintedY + translation.y;
|
||||
|
||||
let rangeX = cropRect.paintedWidth - cropRect.width;
|
||||
let rangeY = cropRect.paintedHeight - cropRect.height;
|
||||
|
||||
if (rangeX > 0) {
|
||||
let valX = newX / rangeX;
|
||||
Config.background.alignX = Math.max(0.0, Math.min(1.0, valX));
|
||||
Config.save();
|
||||
}
|
||||
|
||||
if (rangeY > 0) {
|
||||
let valY = newY / rangeY;
|
||||
Config.background.alignY = Math.max(0.0, Math.min(1.0, valY));
|
||||
Config.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PinchHandler {
|
||||
maximumScale: 5.0
|
||||
minimumScale: 1.0
|
||||
target: null
|
||||
|
||||
onActiveScaleChanged: {
|
||||
if (active) {
|
||||
let newZoom = Config.background.zoom * (1 / (1 + (activeScale - 1) * 0.1));
|
||||
Config.background.zoom = Math.max(1.0, Math.min(newZoom, 5.0));
|
||||
}
|
||||
}
|
||||
}
|
||||
cropRect.clampToBounds();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SettingSpinBox {
|
||||
max: 5.0
|
||||
min: 1.0
|
||||
name: "Zoom"
|
||||
object: Config.background
|
||||
setting: "zoom"
|
||||
step: 0.1
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,7 @@ import QtQuick.Controls
|
||||
import qs.Components
|
||||
import qs.Config
|
||||
import "../../scripts/fuzzysort.js" as Fuzzy
|
||||
import "./SettingsIndex.mjs" as SettingsIndex
|
||||
import "../../scripts/SettingsIndex.mjs" as SettingsIndex
|
||||
|
||||
Item {
|
||||
id: root
|
||||
@@ -53,11 +53,10 @@ Item {
|
||||
|
||||
Shortcut {
|
||||
sequence: "/"
|
||||
|
||||
onActivated: searchField.forceActiveFocus()
|
||||
}
|
||||
|
||||
Component.onCompleted: console.log(root.height)
|
||||
|
||||
ListModel {
|
||||
id: resultsModel
|
||||
}
|
||||
|
||||
@@ -7,45 +7,24 @@ import qs.Helpers
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property real offsetScale: shouldBeActive ? 0 : 1
|
||||
required property var panels
|
||||
required property ShellScreen screen
|
||||
readonly property bool shouldBeActive: visibilities.settings
|
||||
required property PersistentProperties visibilities
|
||||
|
||||
implicitHeight: 0
|
||||
anchors.topMargin: (-implicitHeight - 5) * offsetScale
|
||||
implicitHeight: content.implicitHeight
|
||||
implicitWidth: content.implicitWidth
|
||||
visible: height > 0
|
||||
opacity: 1 - offsetScale
|
||||
visible: offsetScale < 1
|
||||
|
||||
states: State {
|
||||
name: "visible"
|
||||
when: root.visibilities.settings
|
||||
|
||||
PropertyChanges {
|
||||
root.implicitHeight: content.implicitHeight
|
||||
Behavior on offsetScale {
|
||||
Anim {
|
||||
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
||||
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
|
||||
}
|
||||
}
|
||||
transitions: [
|
||||
Transition {
|
||||
from: ""
|
||||
to: "visible"
|
||||
|
||||
Anim {
|
||||
duration: MaterialEasing.expressiveEffectsTime
|
||||
easing.bezierCurve: MaterialEasing.expressiveEffects
|
||||
property: "implicitHeight"
|
||||
target: root
|
||||
}
|
||||
},
|
||||
Transition {
|
||||
from: "visible"
|
||||
to: ""
|
||||
|
||||
Anim {
|
||||
easing.bezierCurve: MaterialEasing.expressiveEffects
|
||||
property: "implicitHeight"
|
||||
target: root
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
CustomClippingRect {
|
||||
anchors.fill: parent
|
||||
|
||||
@@ -19,7 +19,6 @@ Scope {
|
||||
if (!root.launcherInterrupted && !root.hasFullscreen) {
|
||||
const visibilities = Visibilities.getForActive();
|
||||
visibilities.launcher = !visibilities.launcher;
|
||||
console.log(root.launcherInterrupted);
|
||||
}
|
||||
root.launcherInterrupted = false;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import qs.Components
|
||||
import qs.Helpers
|
||||
import qs.Config
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property Image current: one
|
||||
property string source: Wallpapers.current
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
Component.onCompleted: {
|
||||
if (source)
|
||||
Qt.callLater(() => one.update());
|
||||
}
|
||||
onSourceChanged: {
|
||||
if (!source) {
|
||||
current = null;
|
||||
} else if (current === one) {
|
||||
two.update();
|
||||
} else {
|
||||
one.update();
|
||||
}
|
||||
}
|
||||
|
||||
Img {
|
||||
id: one
|
||||
}
|
||||
|
||||
Img {
|
||||
id: two
|
||||
}
|
||||
|
||||
component Img: Image {
|
||||
id: img
|
||||
|
||||
function update(): void {
|
||||
if (source === root.source) {
|
||||
root.current = this;
|
||||
} else {
|
||||
source = root.source;
|
||||
}
|
||||
}
|
||||
|
||||
anchors.fill: parent
|
||||
asynchronous: true
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
opacity: 0
|
||||
retainWhileLoading: true
|
||||
scale: Wallpapers.showPreview ? 1 : 0.8
|
||||
sourceClipRect: Qt.rect(Config.background.sourceClipX, Config.background.sourceClipY, Config.background.sourceClipW, Config.background.sourceClipH)
|
||||
|
||||
states: State {
|
||||
name: "visible"
|
||||
when: root.current === img
|
||||
|
||||
PropertyChanges {
|
||||
img.opacity: 1
|
||||
img.scale: 1
|
||||
}
|
||||
}
|
||||
transitions: Transition {
|
||||
Anim {
|
||||
duration: Config.background.wallFadeDuration
|
||||
properties: "opacity,scale"
|
||||
target: img
|
||||
}
|
||||
}
|
||||
|
||||
onStatusChanged: {
|
||||
if (status === Image.Ready) {
|
||||
root.current = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
import qs.Components
|
||||
import qs.Helpers
|
||||
@@ -8,79 +9,34 @@ import qs.Config
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property Image current: one
|
||||
required property ShellScreen screen
|
||||
property string source: Wallpapers.current
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
Component.onCompleted: {
|
||||
if (source)
|
||||
Qt.callLater(() => one.update());
|
||||
}
|
||||
onSourceChanged: {
|
||||
if (!source) {
|
||||
current = null;
|
||||
} else if (current === one) {
|
||||
two.update();
|
||||
} else {
|
||||
one.update();
|
||||
}
|
||||
}
|
||||
|
||||
Img {
|
||||
id: one
|
||||
}
|
||||
|
||||
Img {
|
||||
id: two
|
||||
}
|
||||
|
||||
component Img: CachingImage {
|
||||
Image {
|
||||
id: img
|
||||
|
||||
property real imageRatio: Math.max(1, sourceSize.width) / Math.max(1, sourceSize.height)
|
||||
property bool isValid: sourceSize.width > 0 && sourceSize.height > 0 && root.width > 0 && root.height > 0
|
||||
property real windowRatio: root.width / Math.max(1, root.height)
|
||||
|
||||
function update(): void {
|
||||
if (path === root.source) {
|
||||
root.current = this;
|
||||
} else {
|
||||
path = root.source;
|
||||
}
|
||||
}
|
||||
|
||||
anchors.fill: undefined
|
||||
anchors.fill: parent
|
||||
asynchronous: true
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
height: isValid ? (imageRatio > windowRatio ? root.height : root.width / imageRatio) * Config.background.zoom : root.height
|
||||
opacity: 0
|
||||
scale: Wallpapers.showPreview ? 1 : 0.8
|
||||
width: isValid ? (imageRatio > windowRatio ? root.height * imageRatio : root.width) * Config.background.zoom : root.width
|
||||
x: isValid ? (root.width - width) * Config.background.alignX : 0
|
||||
y: isValid ? (root.height - height) * Config.background.alignY : 0
|
||||
opacity: 1
|
||||
retainWhileLoading: true
|
||||
source: root.source
|
||||
sourceClipRect: Wallpapers.recentlyChanged ? null : Qt.rect(Config.background.sourceClipX, Config.background.sourceClipY, Config.background.sourceClipW, Config.background.sourceClipH)
|
||||
sourceSize.height: root.screen.height
|
||||
sourceSize.width: root.screen.width
|
||||
|
||||
states: State {
|
||||
name: "visible"
|
||||
when: root.current === img
|
||||
|
||||
PropertyChanges {
|
||||
img.opacity: 1
|
||||
img.scale: 1
|
||||
}
|
||||
}
|
||||
transitions: Transition {
|
||||
Anim {
|
||||
duration: Config.background.wallFadeDuration
|
||||
properties: "opacity,scale"
|
||||
target: img
|
||||
}
|
||||
}
|
||||
|
||||
onStatusChanged: {
|
||||
if (status === Image.Ready) {
|
||||
root.current = this;
|
||||
onSourceChanged: {
|
||||
if (Wallpapers.recentlyChanged) {
|
||||
Config.background.sourceClipH = 0;
|
||||
Config.background.sourceClipW = 0;
|
||||
Config.background.sourceClipY = 0;
|
||||
Config.background.sourceClipX = 0;
|
||||
Config.background.zoom = 1.0;
|
||||
Config.save();
|
||||
}
|
||||
Wallpapers.recentlyChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ Loader {
|
||||
}
|
||||
|
||||
WallBackground {
|
||||
screen: root.screen
|
||||
}
|
||||
|
||||
Loader {
|
||||
|
||||
@@ -12,6 +12,7 @@ qml_module(ZShell-blobs
|
||||
|
||||
qt_add_shaders(ZShell-blobs "blob_shaders"
|
||||
BATCHABLE OPTIMIZED NOHLSL NOMSL
|
||||
GLSL "300es,330"
|
||||
PREFIX "/"
|
||||
FILES
|
||||
shaders/blob.frag
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
#include <cstring>
|
||||
|
||||
static_assert(sizeof(decltype(BlobRectData::excludeMask)) == sizeof(float),
|
||||
"BlobMaterial packs excludeMask into a float slot via memcpy");
|
||||
|
||||
QSGMaterialType* BlobMaterial::type() const {
|
||||
static QSGMaterialType s_type;
|
||||
return &s_type;
|
||||
@@ -82,8 +85,11 @@ bool BlobMaterialShader::updateUniformData(RenderState& state, QSGMaterial* newM
|
||||
for (int i = 0; i < count; ++i) {
|
||||
const auto& r = mat->m_rects[i];
|
||||
const int base = 160 + i * 80;
|
||||
// Pack excludeMask into props.x via bit-cast (read in shader with floatBitsToInt)
|
||||
float maskAsFloat;
|
||||
memcpy(&maskAsFloat, &r.excludeMask, sizeof(float));
|
||||
const float d0[4] = { r.cx, r.cy, r.hw, r.hh };
|
||||
const float d1[4] = { 0.0f, r.offsetX, r.offsetY, r.minEig };
|
||||
const float d1[4] = { maskAsFloat, r.offsetX, r.offsetY, r.minEig };
|
||||
const float d3[4] = { r.screenHalfX, r.screenHalfY, 0.0f, 0.0f };
|
||||
memcpy(buf->data() + base, d0, 16);
|
||||
memcpy(buf->data() + base + 16, d1, 16);
|
||||
|
||||
@@ -14,6 +14,9 @@ struct BlobRectData {
|
||||
float screenHalfX = 0, screenHalfY = 0;
|
||||
// Effective per-corner radii (tr, br, bl, tl), pre-computed on CPU
|
||||
float radius[4] = { 0, 0, 0, 0 };
|
||||
// Bitmask of indices in this rect's m_cachedRects that mutually exclude (or are excluded by) this rect.
|
||||
// Used by the shader to skip smin between excluded pairs.
|
||||
int excludeMask = 0;
|
||||
};
|
||||
|
||||
class BlobMaterial : public QSGMaterial {
|
||||
|
||||
@@ -72,11 +72,17 @@ void BlobShape::geometryChange(const QRectF& newGeometry, const QRectF& oldGeome
|
||||
// Accumulate sub-pixel drift so slow movements don't desync the shader
|
||||
m_pendingDx += static_cast<float>(newGeometry.x() - oldGeometry.x());
|
||||
m_pendingDy += static_cast<float>(newGeometry.y() - oldGeometry.y());
|
||||
const auto dw = std::abs(newGeometry.width() - oldGeometry.width());
|
||||
const auto dh = std::abs(newGeometry.height() - oldGeometry.height());
|
||||
if (std::abs(m_pendingDx) > 0.5f || std::abs(m_pendingDy) > 0.5f || dw > 0.5 || dh > 0.5) {
|
||||
// Accumulate size delta across multiple frames so incremental size
|
||||
// changes that are each below the threshold still trigger a dirty
|
||||
// mark once their accumulated delta exceeds it.
|
||||
m_pendingDw += static_cast<float>(newGeometry.width() - oldGeometry.width());
|
||||
m_pendingDh += static_cast<float>(newGeometry.height() - oldGeometry.height());
|
||||
if (std::abs(m_pendingDx) > 0.5f || std::abs(m_pendingDy) > 0.5f ||
|
||||
std::abs(m_pendingDw) > 0.5f || std::abs(m_pendingDh) > 0.5f) {
|
||||
m_pendingDx = 0;
|
||||
m_pendingDy = 0;
|
||||
m_pendingDw = 0;
|
||||
m_pendingDh = 0;
|
||||
m_group->markShapeDirty(this);
|
||||
}
|
||||
}
|
||||
@@ -149,6 +155,10 @@ void BlobShape::updatePolish() {
|
||||
const QRectF myPadded(static_cast<double>(m_cachedPaddedX), static_cast<double>(m_cachedPaddedY),
|
||||
static_cast<double>(m_cachedPaddedW), static_cast<double>(m_cachedPaddedH));
|
||||
|
||||
// Track shape pointers parallel to m_cachedRects for pairwise exclusion lookups
|
||||
QVector<BlobShape*> rectShapes;
|
||||
rectShapes.reserve(m_group->shapes().size());
|
||||
|
||||
for (BlobShape* other : m_group->shapes()) {
|
||||
if (other->isInvertedRect())
|
||||
continue;
|
||||
@@ -210,12 +220,29 @@ void BlobShape::updatePolish() {
|
||||
r.screenHalfY = std::abs(b) * r.hw + std::abs(d) * r.hh;
|
||||
|
||||
m_cachedRects.append(r);
|
||||
rectShapes.append(other);
|
||||
}
|
||||
}
|
||||
|
||||
if (isInvertedRect())
|
||||
m_cachedMyIndex = -1;
|
||||
|
||||
// Compute pairwise exclude masks. Bit j in entry i is set iff rect i excludes rect j
|
||||
// or rect j excludes rect i. The shader uses this to avoid smin between excluded pairs.
|
||||
const auto cachedCount = m_cachedRects.size();
|
||||
for (qsizetype i = 0; i < cachedCount; ++i) {
|
||||
int mask = 0;
|
||||
BlobShape* si = rectShapes[i];
|
||||
for (qsizetype j = 0; j < cachedCount; ++j) {
|
||||
if (j == i)
|
||||
continue;
|
||||
BlobShape* sj = rectShapes[j];
|
||||
if (si->isExcluded(sj) || sj->isExcluded(si))
|
||||
mask |= (1 << j);
|
||||
}
|
||||
m_cachedRects[i].excludeMask = mask;
|
||||
}
|
||||
|
||||
// Cache inverted rect data
|
||||
m_cachedHasInverted = false;
|
||||
m_cachedInvertedRadius = 0;
|
||||
@@ -270,6 +297,7 @@ void BlobShape::updatePolish() {
|
||||
const auto rectCount = m_cachedRects.size();
|
||||
for (qsizetype i = 0; i < rectCount; ++i) {
|
||||
auto& ri = m_cachedRects[i];
|
||||
const int riExcludeMask = ri.excludeMask;
|
||||
float fTr = 1.0f, fBr = 1.0f, fBl = 1.0f, fTl = 1.0f;
|
||||
|
||||
const float cTrX = ri.cx + ri.hw, cTrY = ri.cy - ri.hh;
|
||||
@@ -280,6 +308,8 @@ void BlobShape::updatePolish() {
|
||||
for (qsizetype j = 0; j < rectCount; ++j) {
|
||||
if (j == i)
|
||||
continue;
|
||||
if (riExcludeMask & (1 << j))
|
||||
continue;
|
||||
const auto& rj = m_cachedRects[j];
|
||||
fTr = std::min(fTr, cpuSmoothstep(0.0f, smoothFactor, cpuSdBox(cTrX, cTrY, rj.cx, rj.cy, rj.hw, rj.hh)));
|
||||
fBr = std::min(fBr, cpuSmoothstep(0.0f, smoothFactor, cpuSdBox(cBrX, cBrY, rj.cx, rj.cy, rj.hw, rj.hh)));
|
||||
|
||||
@@ -84,8 +84,10 @@ QRectF m_localPaddedRect;
|
||||
QVector<BlobRectData> m_cachedRects;
|
||||
int m_cachedMyIndex = -2;
|
||||
float m_pendingDx = 0;
|
||||
float m_pendingDy = 0;
|
||||
bool m_cachedHasInverted = false;
|
||||
float m_pendingDy = 0;
|
||||
float m_pendingDw = 0;
|
||||
float m_pendingDh = 0;
|
||||
bool m_cachedHasInverted = false;
|
||||
float m_cachedInvertedRadius = 0;
|
||||
float m_cachedInvertedOuter[4] = {};
|
||||
float m_cachedInvertedInner[4] = {};
|
||||
|
||||
@@ -63,13 +63,17 @@ float smaxSharpA(float a, float b, float k) {
|
||||
void main() {
|
||||
vec2 pixel = vec2(paddedX, paddedY) + qt_TexCoord0 * vec2(paddedW, paddedH);
|
||||
|
||||
float mergedSdf = 1e10;
|
||||
// Phase 1: compute per-rect SDF, track owner. We can't smin yet because
|
||||
// excluded pairs need to skip the smooth blend, which requires pairwise pass
|
||||
// below.
|
||||
float dArr[16];
|
||||
int owner = -2;
|
||||
float minDist = 1e10;
|
||||
|
||||
for (int i = 0; i < rectCount; i++) {
|
||||
vec4 rect = rectData[i * 5]; // cx, cy, hw, hh
|
||||
vec4 props = rectData[i * 5 + 1]; // radius, offsetX, offsetY, minEig
|
||||
vec4 rect = rectData[i * 5]; // cx, cy, hw, hh
|
||||
vec4 props =
|
||||
rectData[i * 5 + 1]; // excludeMask(int bits), offsetX, offsetY, minEig
|
||||
vec4 invDm = rectData[i * 5 + 2]; // inverse deform matrix
|
||||
vec4 sh = rectData[i * 5 + 3]; // screenHalfX, screenHalfY, 0, 0
|
||||
vec4 radii =
|
||||
@@ -81,8 +85,10 @@ void main() {
|
||||
// AABB early-out: skip rects far from this pixel
|
||||
vec2 extent = sh.xy + vec2(smoothFactor * 1.5);
|
||||
if (abs(pixel.x - center.x) > extent.x ||
|
||||
abs(pixel.y - center.y) > extent.y)
|
||||
abs(pixel.y - center.y) > extent.y) {
|
||||
dArr[i] = 1e10;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Apply pre-computed inverse deformation to the evaluation point
|
||||
mat2 invDeform = mat2(invDm.xy, invDm.zw);
|
||||
@@ -138,13 +144,38 @@ void main() {
|
||||
d *= scale;
|
||||
}
|
||||
|
||||
mergedSdf = smin(mergedSdf, d, smoothFactor);
|
||||
dArr[i] = d;
|
||||
if (d < smoothFactor && d < minDist) {
|
||||
minDist = d;
|
||||
owner = i;
|
||||
}
|
||||
}
|
||||
|
||||
// Phase 2: hard-min baseline over all rects.
|
||||
float mergedSdf = 1e10;
|
||||
for (int i = 0; i < rectCount; i++) {
|
||||
mergedSdf = min(mergedSdf, dArr[i]);
|
||||
}
|
||||
|
||||
// Phase 3: pair-wise smin contributions, skipping excluded pairs. Pair smin
|
||||
// <= min, so taking the min over all non-excluded pair smins gives the
|
||||
// smoothly-merged SDF.
|
||||
for (int i = 0; i < rectCount; i++) {
|
||||
if (dArr[i] >= 1e9)
|
||||
continue;
|
||||
int excludeMask = floatBitsToInt(rectData[i * 5 + 1].x);
|
||||
for (int j = i + 1; j < rectCount; j++) {
|
||||
if (dArr[j] >= 1e9)
|
||||
continue;
|
||||
if ((excludeMask & (1 << j)) != 0)
|
||||
continue;
|
||||
// smin only deviates from min within smoothFactor
|
||||
if (abs(dArr[i] - dArr[j]) >= smoothFactor)
|
||||
continue;
|
||||
mergedSdf = min(mergedSdf, smin(dArr[i], dArr[j], smoothFactor));
|
||||
}
|
||||
}
|
||||
|
||||
if (hasInverted != 0) {
|
||||
float dOuter = sdBox(pixel, invertedOuter.xy, invertedOuter.zw) - 1.0;
|
||||
float dInner =
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user