15 Commits
Author SHA1 Message Date
zach 47c842941f screenshot tools baked-in: drawing uses optimized qcanvaspainter, direct to clipboard, eliminate forking to swappy
C++ / fmt (pull_request) Successful in 7s
JS/TS / lint (pull_request) Successful in 21s
JS/TS / fmt (pull_request) Successful in 20s
Python / lint (pull_request) Successful in 31s
Python / fmt (pull_request) Successful in 33s
Python / typecheck (pull_request) Failing after 1m4s
Python / test (pull_request) Successful in 1m7s
C++ / build (pull_request) Successful in 1m48s
Rust / fmt (pull_request) Successful in 37s
Rust / build (pull_request) Successful in 1m42s
Python / buildcheck (pull_request) Successful in 2m33s
Rust / clippy (pull_request) Successful in 1m32s
C++ / clang-tidy (pull_request) Successful in 3m35s
2026-08-10 12:02:34 +02:00
zach 93c6ac251e Merge pull request 'pr and issue templates + typecheck ci python' (#138) from 135-issue-pr-templates into main
Reviewed-on: #138
Reviewed-by: zach <zach@brohn.se>
2026-07-10 18:19:23 +02:00
zach 1af6bf33ff Merge branch 'main' into 135-issue-pr-templates
C++ / fmt (pull_request) Successful in 4s
JS/TS / fmt (pull_request) Successful in 17s
JS/TS / lint (pull_request) Successful in 22s
Python / lint (pull_request) Successful in 31s
Python / fmt (pull_request) Successful in 34s
Python / test (pull_request) Successful in 59s
Python / typecheck (pull_request) Failing after 59s
C++ / build (pull_request) Successful in 2m4s
Rust / fmt (pull_request) Successful in 1m0s
Rust / build (pull_request) Successful in 1m53s
Python / buildcheck (pull_request) Successful in 2m41s
Rust / clippy (pull_request) Successful in 2m31s
C++ / clang-tidy (pull_request) Successful in 6m12s
2026-07-10 15:21:24 +02:00
zach 5eaebacbab remove unrelated directory 2026-07-10 15:00:02 +02:00
AramJonghu 4cb30647a9 hotfix(bugreport): adding optional input field; which init system?
C++ / fmt (pull_request) Successful in 4s
JS/TS / fmt (pull_request) Successful in 14s
JS/TS / lint (pull_request) Successful in 15s
Python / lint (pull_request) Successful in 32s
Python / fmt (pull_request) Successful in 35s
Python / test (pull_request) Successful in 1m8s
Python / typecheck (pull_request) Failing after 1m10s
C++ / build (pull_request) Successful in 1m41s
Rust / build (pull_request) Successful in 1m44s
Rust / fmt (pull_request) Successful in 1m5s
Python / buildcheck (pull_request) Successful in 2m39s
Rust / clippy (pull_request) Successful in 2m3s
C++ / clang-tidy (pull_request) Successful in 3m42s
2026-07-10 12:07:27 +02:00
AramJonghu b3820ce1e0 Merge branch 'main' into 135-issue-pr-templates
C++ / fmt (pull_request) Successful in 5s
JS/TS / fmt (pull_request) Successful in 15s
JS/TS / lint (pull_request) Successful in 17s
Python / fmt (pull_request) Successful in 35s
Python / lint (pull_request) Successful in 32s
Python / typecheck (pull_request) Failing after 55s
Python / test (pull_request) Successful in 1m1s
C++ / build (pull_request) Successful in 1m53s
Rust / fmt (pull_request) Successful in 1m13s
Rust / build (pull_request) Successful in 1m48s
Python / buildcheck (pull_request) Successful in 2m43s
Rust / clippy (pull_request) Successful in 2m9s
C++ / clang-tidy (pull_request) Successful in 3m48s
2026-07-10 11:58:35 +02:00
zach d1e3897d02 fix: logo colors 2026-07-10 11:44:01 +02:00
zach 46e24f8543 add initial logo to about page + assets and readme 2026-07-10 11:32:09 +02:00
AramJonghu 1ff7c36723 Merge branch 'main' into 135-issue-pr-templates
C++ / fmt (pull_request) Successful in 11s
JS/TS / fmt (pull_request) Successful in 17s
JS/TS / lint (pull_request) Successful in 17s
Python / fmt (pull_request) Successful in 30s
Python / lint (pull_request) Successful in 32s
Python / test (pull_request) Successful in 57s
Python / typecheck (pull_request) Failing after 52s
C++ / build (pull_request) Successful in 3m4s
Rust / fmt (pull_request) Successful in 1m1s
Rust / build (pull_request) Successful in 1m49s
Python / buildcheck (pull_request) Successful in 2m34s
Rust / clippy (pull_request) Successful in 1m41s
C++ / clang-tidy (pull_request) Successful in 4m41s
2026-07-10 01:32:39 +02:00
AramJonghu f75fef3f55 chore(template): checklist adjustment
C++ / fmt (pull_request) Successful in 8s
JS/TS / fmt (pull_request) Successful in 14s
JS/TS / lint (pull_request) Successful in 22s
Python / lint (pull_request) Successful in 32s
Python / fmt (pull_request) Successful in 35s
Python / test (pull_request) Successful in 1m4s
Python / typecheck (pull_request) Failing after 1m3s
C++ / build (pull_request) Successful in 1m55s
Rust / build (pull_request) Successful in 1m54s
Rust / fmt (pull_request) Successful in 1m16s
Python / buildcheck (pull_request) Successful in 2m46s
Rust / clippy (pull_request) Successful in 2m40s
C++ / clang-tidy (pull_request) Successful in 5m36s
2026-07-10 01:16:21 +02:00
AramJonghu 246ee67fb3 update(typecheck): added typecheck in workflow and pyproject
C++ / fmt (pull_request) Successful in 5s
JS/TS / fmt (pull_request) Successful in 16s
JS/TS / lint (pull_request) Successful in 17s
Python / fmt (pull_request) Successful in 34s
Python / lint (pull_request) Successful in 31s
Python / test (pull_request) Successful in 59s
Python / typecheck (pull_request) Failing after 53s
C++ / build (pull_request) Successful in 1m56s
Rust / fmt (pull_request) Successful in 1m18s
Rust / build (pull_request) Successful in 1m50s
Rust / clippy (pull_request) Successful in 2m7s
Python / buildcheck (pull_request) Successful in 2m42s
C++ / clang-tidy (pull_request) Successful in 3m49s
2026-07-10 01:09:08 +02:00
AramJonghu 5b5f38a48d feat(templates): Added template yaml files 2026-07-10 01:09:01 +02:00
zach 1266166676 fix: text input field bounds 2026-07-09 14:20:06 +02:00
AramJonghu 8d4b910e23 Merge branch 'main' into 135-issue-pr-templates
C++ / fmt (pull_request) Successful in 9s
JS/TS / fmt (pull_request) Successful in 16s
JS/TS / lint (pull_request) Successful in 20s
Python / fmt (pull_request) Successful in 31s
Python / lint (pull_request) Successful in 29s
Python / test (pull_request) Successful in 1m0s
C++ / build (pull_request) Successful in 3m25s
Rust / fmt (pull_request) Successful in 1m12s
Python / buildcheck (pull_request) Successful in 2m51s
Rust / build (pull_request) Successful in 2m14s
Rust / clippy (pull_request) Successful in 1m52s
C++ / clang-tidy (pull_request) Successful in 6m7s
2026-07-08 22:14:09 +02:00
AramJonghu 5e78b3b492 init(new branch): New branch
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 13s
Python / lint-format (pull_request) Successful in 23s
Python / test (pull_request) Successful in 1m3s
Lint & Format (Rust) / lint-format (pull_request) Successful in 2m36s
C++ / build (pull_request) Successful in 6m21s
2026-07-04 04:54:28 +02:00
22 changed files with 1130 additions and 420 deletions
+108
View File
@@ -0,0 +1,108 @@
name: Bug Report
about: Something broke
title: "bug: "
labels:
- bug
body:
- type: textarea
id: description
attributes:
label: What happened
placeholder: Describe the bug
validations:
required: true
- type: textarea
id: expected
attributes:
label: What should happen
placeholder: Expected behavior
validations:
required: true
- type: textarea
id: steps
attributes:
label: Steps to reproduce
placeholder: |
1.
2.
3.
render: shell
validations:
required: true
- type: dropdown
id: os
attributes:
label: OS
options:
- NixOS
- Arch
- Debian / Ubuntu
- Fedora
- Alpine
- Artix
- Gentoo
- Other
validations:
required: false
- type: input
id: other-os
attributes:
label: Other OS (if "Other" above)
placeholder: e.g. Void, Gentoo, FreeBSD
validations:
required: false
- type: dropdown
id: init
attributes:
label: Init system
description: Relevant for UWSM configuration
options:
- systemd
- non-systemd (openrc / runit / s6 / ...)
validations:
required: false
- type: input
id: other-init
attributes:
label: Other init system (if "non-systemd" above)
placeholder: e.g. openrc, runit, s6, dinit
validations:
required: false
- type: input
id: qt-version
attributes:
label: Qt version
placeholder: 6.11.1
validations:
required: false
- type: input
id: commit
attributes:
label: Branch / commit
placeholder: main / abc1234
validations:
required: false
- type: textarea
id: logs
attributes:
label: Logs / backtrace / screenshots
render: shell
validations:
required: false
- type: textarea
id: workaround
attributes:
label: Found a workaround?
validations:
required: false
+51
View File
@@ -0,0 +1,51 @@
name: Feature Request
about: Idea or improvement
title: "feat: "
labels:
- enhancement
body:
- type: textarea
id: problem
attributes:
label: What's missing / annoying
placeholder: The use case or pain point
validations:
required: true
- type: textarea
id: solution
attributes:
label: How should it work
placeholder: Describe the desired behavior
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: Other approaches considered
validations:
required: false
- type: dropdown
id: scope
attributes:
label: Area
options:
- Core / Daemon
- UI / Components
- Plugin system
- CMake / Build
- CI / Tooling
- Documentation
- Other
validations:
required: false
- type: textarea
id: context
attributes:
label: Mockups / references / notes
validations:
required: false
+59
View File
@@ -0,0 +1,59 @@
name: Pull Request
about: Submit changes
title: ""
labels: []
body:
- type: textarea
id: description
attributes:
label: What & why
placeholder: Describe the change and motivation
validations:
required: true
- type: input
id: issue
attributes:
label: Related issue
placeholder: "#123"
validations:
required: false
- type: dropdown
id: type
attributes:
label: Type
options:
- Bug fix
- New feature
- Refactor / style
- CI / build / tooling
- Documentation
validations:
required: true
- type: checkboxes
id: tested
attributes:
label: Tested
options:
- label: Build succeeds
- label: Existing tests pass
- label: Manually verified
- type: textarea
id: breaking
attributes:
label: Breaking changes?
placeholder: API/ABI breakage? Migration path?
- type: checkboxes
id: checklist
attributes:
label: Checklist
options:
- label: CI passes (format, lint, typecheck)
- label: Clean commits
- label: No new warnings
- label: Docs updated if needed
+23
View File
@@ -81,6 +81,29 @@ jobs:
cd cli
python -m pytest tests/ -v
typecheck:
runs-on: alpine
container: node:26-alpine
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install tools
run: |
apk add --no-cache \
git \
python3 \
py3-pip
python3 -m venv .venv
. .venv/bin/activate
pip install --no-cache-dir basedpyright
- name: Type check
run: |
. .venv/bin/activate
basedpyright
buildcheck:
runs-on: alpine
container: node:26-alpine
+1
View File
@@ -15,3 +15,4 @@ dist/
**/target/
**/test-plugins/
**/Charts/
network-dev/
+1 -1
View File
@@ -35,7 +35,7 @@ CustomRect {
readonly property color onColor: !enabled ? disabledOnColor : internalChecked ? activeOnColor : inactiveOnColor
property real padding
readonly property alias pressed: stateLayer.pressed
property real pressedRadius: Appearance.rounding.small
property real pressedRadius: Appearance.rounding.smallest
readonly property alias radiusAnim: radiusAnim
property bool radiusMorph: true
property alias shapeMorph: stateLayer.shapeMorph
+35 -30
View File
@@ -21,8 +21,6 @@ TextFieldBase {
property bool isError
property string leadingIcon
readonly property int leadingOffset: leadingIcon ? leadingIconLoader.width + leadingIconLoader.anchors.leftMargin : 0
readonly property real outlineGap: placeholder.width * root.smallFontScale + Appearance.spacing.extraSmall * 2
property real outlineGapScale: activeFocus || text ? 1 : 0
property int radius: Appearance.rounding.small
readonly property real smallFontScale: smallFontSize / font.pointSize
property int smallFontSize: Appearance.font.size.small
@@ -57,11 +55,6 @@ TextFieldBase {
onClicked: root.focus = true
}
}
Behavior on outlineGapScale {
Anim {
type: Anim.DefaultEffects
}
}
onEditingFinished: {
if (!valid)
@@ -103,7 +96,7 @@ TextFieldBase {
when: root.type === CustomTextField.Outlined && (root.activeFocus || root.text)
PropertyChanges {
placeholder.anchors.leftMargin: -(1 - root.smallFontScale) * placeholder.width / 2 + root.horizontalPadding + -Appearance.spacing.extraSmall
placeholder.anchors.leftMargin: -(1 - root.smallFontScale) * placeholder.width / 2 + root.horizontalPadding
placeholder.scale: root.smallFontScale
}
@@ -136,7 +129,7 @@ TextFieldBase {
AnchorAnim {
duration: Appearance.anim.durations.expressiveEffects
easing: Appearance.anim.curves.expressiveDefaultEffects
easing.bezierCurve: Appearance.anim.curves.expressiveEffects
}
}
}
@@ -146,12 +139,11 @@ TextFieldBase {
active: root.leadingIcon
anchors.left: parent.left
anchors.leftMargin: Appearance.padding.larger
anchors.leftMargin: Appearance.padding.normal
anchors.verticalCenter: parent.verticalCenter
sourceComponent: MaterialIcon {
color: DynamicColors.palette.m3onSurfaceVariant
font.pointSize: Appearance.font.size.large
text: root.leadingIcon
}
}
@@ -161,12 +153,11 @@ TextFieldBase {
active: root.trailingIcon
anchors.right: parent.right
anchors.rightMargin: Appearance.padding.larger
anchors.rightMargin: Appearance.padding.normal
anchors.verticalCenter: parent.verticalCenter
sourceComponent: MaterialIcon {
color: DynamicColors.palette.m3onSurfaceVariant
font.pointSize: Appearance.font.size.large
text: root.trailingIcon
}
}
@@ -201,12 +192,24 @@ TextFieldBase {
preferredRendererType: Shape.CurveRenderer
ShapePath {
id: path
readonly property real inset: strokeWidth / 2
readonly property real outlineGap: placeholder.width * root.smallFontScale + Appearance.spacing.small * 2
property real outlineGapScale: root.activeFocus || root.text ? 1 : 0
capStyle: ShapePath.RoundCap
fillColor: "transparent"
startX: root.horizontalPadding - root.clampedRadius + root.outlineGap * (1 - root.outlineGapScale) / 2 + root.outlineGap * root.outlineGapScale
startX: path.inset + root.horizontalPadding - root.clampedRadius + path.outlineGap * (1 - path.outlineGapScale) / 2 + path.outlineGap * path.outlineGapScale
startY: path.inset
strokeColor: root.isError ? DynamicColors.palette.m3error : (root.activeFocus ? DynamicColors.palette.m3primary : DynamicColors.palette.m3outline)
strokeWidth: root.activeFocus ? 2 : 1
Behavior on outlineGapScale {
Anim {
type: Anim.DefaultEffects
}
}
Behavior on strokeColor {
CAnim {
}
@@ -217,54 +220,56 @@ TextFieldBase {
}
PathLine {
x: bg.width - root.clampedRadius
x: bg.width - path.inset - root.clampedRadius
y: path.inset
}
PathArc {
radiusX: root.clampedRadius
radiusY: root.clampedRadius
x: bg.width
y: root.clampedRadius
x: bg.width - path.inset
y: path.inset + root.clampedRadius
}
PathLine {
x: bg.width
y: bg.height - root.clampedRadius
x: bg.width - path.inset
y: bg.height - path.inset - root.clampedRadius
}
PathArc {
radiusX: root.clampedRadius
radiusY: root.clampedRadius
x: bg.width - root.clampedRadius
y: bg.height
x: bg.width - path.inset - root.clampedRadius
y: bg.height - path.inset
}
PathLine {
x: root.clampedRadius
y: bg.height
x: path.inset + root.clampedRadius
y: bg.height - path.inset
}
PathArc {
radiusX: root.clampedRadius
radiusY: root.clampedRadius
x: 0
y: bg.height - root.clampedRadius
x: path.inset
y: bg.height - path.inset - root.clampedRadius
}
PathLine {
x: 0
y: root.clampedRadius
x: path.inset
y: path.inset + root.clampedRadius
}
PathArc {
radiusX: root.clampedRadius
radiusY: root.clampedRadius
x: root.clampedRadius
y: 0
x: path.inset + root.clampedRadius
y: path.inset
}
PathLine {
x: root.horizontalPadding - root.clampedRadius + root.outlineGap * (1 - root.outlineGapScale) / 2
x: path.inset + root.horizontalPadding - root.clampedRadius / 2 + path.outlineGap * (1 - path.outlineGapScale) / 2
y: path.inset
}
}
}
Regular → Executable
+153 -63
View File
@@ -7,9 +7,9 @@ import QtQuick
import QtQuick.Effects
import qs.Components
import qs.Config
import qs.Helpers
import qs.Helpers.Picker
MouseArea {
Item {
id: root
property list<var> clients: {
@@ -29,9 +29,11 @@ MouseArea {
readonly property int cornerRadius: Hypr.options.decoration.rounding
property real ex: screen.width
property real ey: screen.height
property color inkColor: "#ff3b30"
required property LazyLoader loader
property string mode: "select"
property bool onClient
property real realBorderWidth: onClient ? (Hypr.options.general.border_size ?? 1) : 2
property real realBorderWidth: 2
property real realRounding: onClient ? (Hypr.options.decoration.rounding ?? 0) : 0
property real rsx: Math.min(sx, ex)
property real rsy: Math.min(sy, ey)
@@ -48,6 +50,12 @@ MouseArea {
property real sw: Math.abs(sx - ex)
property real sx: 0
property real sy: 0
property string tool: "move"
function cancel(): void {
annotations.clearAll();
closeAnim.start();
}
function checkClientRects(x: real, y: real): void {
for (const client of clients) {
@@ -71,24 +79,48 @@ MouseArea {
}
}
function save(): void {
const tmpfile = Qt.resolvedUrl(`/tmp/zshell-picker-${Quickshell.processId}-${Date.now()}.png`);
function enterEditMode(): void {
mode = "edit";
tool = "move";
}
function save(copyToClipboard: bool): void {
const rounding = root.cornerRadius > 0;
const shadow_blur = root.shadowRange / root.shadowRenderPower;
const r = Math.floor(root.shadowColor.r * 256);
const g = Math.floor(root.shadowColor.g * 256);
const b = Math.floor(root.shadowColor.b * 256);
const a = Math.floor(root.shadowColor.a * 256);
const tmpfile = Qt.resolvedUrl(`/tmp/zshell-picker-${Quickshell.processId}-${Date.now()}.png`);
const args = Config.screenshot.mode === "auto" ? ["--rounding", `${rounding}`, "--radius", root.cornerRadius, "--shadow", root.shadowEnabled, "--shadow-blur", `${shadow_blur}`, "--shadow-color", `${r},${g},${b},${a}`, "--shadow-offset-x", root.shadowOffset[0], "--shadow-offset-y", root.shadowOffset[1]] : [];
const cmd = Config.screenshot.enable_pp ? ["zshell-img-tools", "--scale", root.scaleRatio, ...args, "--image"] : ["swappy", "-f"];
ZShellIo.saveItem(screencopy, tmpfile, Qt.rect(Math.ceil(rsx), Math.ceil(rsy), Math.floor(sw), Math.floor(sh)), path => Quickshell.execDetached([...cmd, path]));
const postCmd = Config.screenshot.enable_pp ? ["zshell-img-tools", "--scale", root.scaleRatio, ...args, "--image"] : null;
overlay.visible = border.visible = false;
handles.visible = false;
toolbar.visible = false;
ZShellIo.saveItem(captureLayer, tmpfile, Qt.rect(Math.ceil(rsx), Math.ceil(rsy), Math.floor(sw), Math.floor(sh)), path => {
const finalize = finalPath => {
if (copyToClipboard) {
Quickshell.execDetached(["sh", "-c", `wl-copy --type image/png < '${finalPath.replace(/'/g, `'\\''`)}'`]);
} else {
const dest = `${Quickshell.env("HOME")}/Pictures/Screenshots/zshell-${Date.now()}.png`;
Quickshell.execDetached(["sh", "-c", `mkdir -p "$(dirname '${dest}')" && cp '${path.replace(/'/g, `'\\''`)}' '${dest}'`]);
}
};
if (postCmd) {
Quickshell.execDetached(postCmd.concat([path]));
finalize(path);
} else {
finalize(path);
}
});
closeAnim.start();
}
anchors.fill: parent
cursorShape: Qt.CrossCursor
focus: true
hoverEnabled: true
opacity: 0
Behavior on opacity {
@@ -97,25 +129,25 @@ MouseArea {
}
}
Behavior on rsx {
enabled: !root.pressed
enabled: !selectArea.pressed && root.mode === "select"
ExAnim {
}
}
Behavior on rsy {
enabled: !root.pressed
enabled: !selectArea.pressed && root.mode === "select"
ExAnim {
}
}
Behavior on sh {
enabled: !root.pressed
enabled: !selectArea.pressed && root.mode === "select"
ExAnim {
}
}
Behavior on sw {
enabled: !root.pressed
enabled: !selectArea.pressed && root.mode === "select"
ExAnim {
}
@@ -123,8 +155,7 @@ MouseArea {
Component.onCompleted: {
Hypr.extras.refreshOptions();
if (loader.freeze)
clients = clients;
screencopy.active = true;
opacity = 1;
@@ -144,48 +175,40 @@ MouseArea {
ey = screen.height / 2 + 100;
}
}
Keys.onEscapePressed: closeAnim.start()
onClientsChanged: checkClientRects(mouseX, mouseY)
onPositionChanged: event => {
const x = event.x;
const y = event.y;
Keys.onEscapePressed: root.mode === "edit" ? cancel() : closeAnim.start()
onClientsChanged: {
if (root.mode === "select")
checkClientRects(selectArea.mouseX, selectArea.mouseY);
}
if (pressed) {
onClient = false;
sx = ssx;
sy = ssy;
ex = x;
ey = y;
} else if (!saveTimer.running) {
checkClientRects(x, y);
MouseArea {
id: selectArea
anchors.fill: parent
cursorShape: Qt.CrossCursor
enabled: root.mode === "select"
hoverEnabled: true
visible: root.mode === "select"
onPositionChanged: event => {
const x = event.x;
const y = event.y;
if (pressed) {
root.onClient = false;
root.sx = root.ssx;
root.sy = root.ssy;
root.ex = x;
root.ey = y;
} else {
root.checkClientRects(x, y);
}
}
}
onPressed: event => {
ssx = event.x;
ssy = event.y;
}
onReleased: {
if (closeAnim.running)
return;
if (root.loader.freeze) {
saveTimer.start();
} else {
overlay.visible = border.visible = false;
screencopy.visible = false;
screencopy.active = true;
saveTimer.start();
onPressed: event => {
root.ssx = event.x;
root.ssy = event.y;
}
}
Timer {
id: saveTimer
interval: 25
repeat: false
running: false
onTriggered: root.save()
onReleased: root.enterEditMode()
}
SequentialAnimation {
@@ -231,16 +254,38 @@ MouseArea {
}
}
Loader {
id: screencopy
Item {
id: captureLayer
active: root.loader.freeze
anchors.fill: parent
asynchronous: true
sourceComponent: ScreencopyView {
captureSource: root.screen
paintCursor: false
Loader {
id: screencopy
active: false
anchors.fill: parent
asynchronous: true
sourceComponent: ScreencopyView {
captureSource: root.screen
paintCursor: false
}
}
AnnotationCanvas {
id: annotations
anchors.fill: parent
inkColor: root.inkColor
layer.enabled: true
tool: root.mode === "edit" && root.tool !== "move" ? root.tool : "none"
layer.effect: MultiEffect {
maskEnabled: true
maskSource: selectionWrapper
maskSpreadAtMin: 1
maskThresholdMin: 0.5
}
}
}
@@ -252,7 +297,7 @@ MouseArea {
layer.enabled: true
opacity: 0.3
radius: root.realRounding
visible: screencopy.item.hasContent || !root.loader.freeze
visible: screencopy.item?.hasContent ?? false
layer.effect: MultiEffect {
maskEnabled: true
@@ -290,7 +335,7 @@ MouseArea {
implicitHeight: selectionRect.implicitHeight + root.realBorderWidth * 2
implicitWidth: selectionRect.implicitWidth + root.realBorderWidth * 2
radius: root.realRounding > 0 ? root.realRounding + root.realBorderWidth : 0
visible: screencopy.item.hasContent || !root.loader.freeze
visible: screencopy.item?.hasContent ?? false
x: selectionRect.x - root.realBorderWidth
y: selectionRect.y - root.realBorderWidth
@@ -300,6 +345,51 @@ MouseArea {
}
}
SelectionHandles {
id: handles
selH: root.sh
selW: root.sw
selX: root.rsx
selY: root.rsy
visible: root.mode === "edit" && root.tool === "move"
onBoundsChanged: (x, y, w, h) => {
root.sx = x;
root.sy = y;
root.ex = x + w;
root.ey = y + h;
}
onMoveBy: (dx, dy) => {
const w = root.sw, h = root.sh;
let nx = root.rsx + dx, ny = root.rsy + dy;
nx = Math.max(0, Math.min(nx, root.screen.width - w));
ny = Math.max(0, Math.min(ny, root.screen.height - h));
root.sx = nx;
root.sy = ny;
root.ex = nx + w;
root.ey = ny + h;
}
}
AnnotationToolbar {
id: toolbar
inkColor: root.inkColor
tool: root.tool
visible: root.mode === "edit"
x: Math.max(8, Math.min(root.rsx + root.sw / 2 - width / 2, root.screen.width - width - 8))
y: (root.rsy + root.sh + height + Appearance.padding.normal <= root.screen.height) ? root.rsy + root.sh + Appearance.padding.normal : (root.rsy - height - Appearance.padding.normal <= 0) ? root.rsy + root.sh - height - Appearance.padding.normal : root.rsy - height - Appearance.padding.normal
onCancelRequested: root.cancel()
onClearRequested: annotations.clearAll()
onColorSelected: c => root.inkColor = c
onCopyRequested: root.save(true)
onSaveRequested: root.save(false)
onToolSelected: t => root.tool = t
onUndoRequested: annotations.undo()
}
component ExAnim: Anim {
duration: MaterialEasing.expressiveEffectsTime
easing.bezierCurve: MaterialEasing.expressiveEffects
+143
View File
@@ -0,0 +1,143 @@
pragma ComponentBehavior: Bound
import QtQuick
import ZShell.Internal
Item {
id: root
property color inkColor: "#ff3b30"
property real inkWidth: 4
property string tool: "none"
signal changed
function clearAll() {
committedCanvas.clear();
previewCanvas.clear();
changed();
}
function sampleShape(tool, x1, y1, x2, y2) {
const pts = [];
switch (tool) {
case "line":
pts.push([x1, y1], [x2, y2]);
break;
case "arrow":
{
const angle = Math.atan2(y2 - y1, x2 - x1);
const headLen = 14 + root.inkWidth * 2;
pts.push([x1, y1], [x2, y2]);
pts.push([x2 - headLen * Math.cos(angle - Math.PI / 6), y2 - headLen * Math.sin(angle - Math.PI / 6)]);
pts.push([x2, y2]);
pts.push([x2 - headLen * Math.cos(angle + Math.PI / 6), y2 - headLen * Math.sin(angle + Math.PI / 6)]);
break;
}
case "rect":
pts.push([x1, y1], [x2, y1], [x2, y2], [x1, y2], [x1, y1]);
break;
case "ellipse":
{
const cx = (x1 + x2) / 2, cy = (y1 + y2) / 2;
const rx = Math.abs(x2 - x1) / 2, ry = Math.abs(y2 - y1) / 2;
const perimeter = Math.PI * (3 * (rx + ry) - Math.sqrt((3 * rx + ry) * (rx + 3 * ry)));
const steps = Math.max(48, Math.min(256, Math.ceil(perimeter / 4)));
for (let i = 0; i <= steps; i++) {
const a = (i / steps) * Math.PI * 2;
pts.push([cx + rx * Math.cos(a), cy + ry * Math.sin(a)]);
}
break;
}
}
return pts;
}
function undo() {
committedCanvas.undoLastGroup();
changed();
}
anchors.fill: parent
StrokeCanvas {
id: committedCanvas
anchors.fill: parent
penColor: root.inkColor
penWidth: root.inkWidth
}
StrokeCanvas {
id: previewCanvas
anchors.fill: parent
penColor: root.inkColor
penWidth: root.inkWidth
}
PointHandler {
id: drawHandler
property real startX
property real startY
property bool started: false
acceptedButtons: Qt.LeftButton | Qt.RightButton
enabled: root.tool !== "none"
onActiveChanged: {
if (active)
return;
if (root.tool === "pen") {
committedCanvas.endStroke();
} else if (started) {
const pts = root.sampleShape(root.tool, startX, startY, point.position.x, point.position.y);
if (pts.length > 0) {
committedCanvas.beginStroke(pts[0][0], pts[0][1], true);
for (let i = 1; i < pts.length; i++)
committedCanvas.appendPoint(pts[i][0], pts[i][1]);
committedCanvas.endStroke();
}
previewCanvas.clear();
}
started = false;
root.changed();
}
onPointChanged: {
if (!active)
return;
if (point.pressedButtons & Qt.RightButton) {
root.clearAll();
return;
}
const x = point.position.x;
const y = point.position.y;
if (root.tool === "pen") {
if (!started) {
started = true;
committedCanvas.beginStroke(x, y);
return;
}
committedCanvas.appendPoint(x, y);
return;
}
if (!started) {
started = true;
startX = point.pressPosition.x;
startY = point.pressPosition.y;
}
const pts = root.sampleShape(root.tool, startX, startY, x, y);
if (pts.length > 0) {
previewCanvas.beginStroke(pts[0][0], pts[0][1], true);
for (let i = 1; i < pts.length; i++)
previewCanvas.appendPoint(pts[i][0], pts[i][1]);
}
}
}
}
+184
View File
@@ -0,0 +1,184 @@
pragma ComponentBehavior: Bound
import ZShell.Components
import QtQuick
import QtQuick.Layouts
import qs.Components
import qs.Config
CustomRect {
id: root
readonly property var colorPalette: ["#ff3b30", "#ff9500", "#ffcc00", "#34c759", "#0a84ff", "#af52de", "#ffffff", "#000000"]
property color inkColor: "#ff3b30"
property string tool: "move"
readonly property var toolList: [
{
id: "move",
glyph: "arrows_output"
},
{
id: "pen",
glyph: "draw"
},
{
id: "line",
glyph: "diagonal_line"
},
{
id: "arrow",
glyph: "arrow_outward"
},
{
id: "rect",
glyph: "rectangle"
},
{
id: "ellipse",
glyph: "circle"
}
]
signal cancelRequested
signal clearRequested
signal colorSelected(color c)
signal copyRequested
signal saveRequested
signal toolSelected(string tool)
signal undoRequested
color: DynamicColors.palette.m3surface
height: row.implicitHeight + Appearance.padding.normal * 2
radius: Appearance.rounding.full
width: row.implicitWidth + Appearance.padding.normal * 2
RowLayout {
id: row
anchors.centerIn: parent
spacing: 6
ButtonRow {
id: toolRow
spacing: Appearance.spacing.extraSmall
Repeater {
model: root.toolList
delegate: IconButton {
id: tool
required property var modelData
color: root.tool === modelData.id ? "#3584e4" : "transparent"
icon: tool.modelData.glyph
inactiveColor: root.tool === modelData.id ? DynamicColors.palette.m3primary : "transparent"
inactiveOnColor: root.tool === modelData.id ? DynamicColors.palette.m3onPrimary : DynamicColors.palette.m3onSurface
isRound: true
shapeMorph: true
shapeMorphExpansion: shapeMorph && pressed ? 12 : 0
onClicked: root.toolSelected(tool.modelData.id)
}
}
}
CustomRect {
Layout.fillHeight: true
Layout.preferredWidth: 1
color: DynamicColors.palette.m3outlineVariant
}
ButtonRow {
spacing: Appearance.spacing.extraSmall
Repeater {
model: root.colorPalette
delegate: IconButton {
readonly property real buttonSize: toolRow.implicitHeight - Appearance.padding.normal
required property color modelData
fillWidth: false
font.pointSize: 0
icon: ""
implicitHeight: buttonSize
implicitWidth: buttonSize
inactiveColor: modelData
inactiveOnColor: DynamicColors.on(modelData)
isRound: true
shapeMorph: true
shapeMorphExpansion: pressed ? 12 : 0
onClicked: root.colorSelected(modelData)
}
}
}
CustomRect {
Layout.fillHeight: true
Layout.preferredWidth: 1
color: DynamicColors.palette.m3outlineVariant
}
ButtonRow {
spacing: Appearance.spacing.extraSmall
IconButton {
icon: "undo"
inactiveColor: "transparent"
inactiveOnColor: DynamicColors.palette.m3onSurface
isRound: true
shapeMorph: true
shapeMorphExpansion: pressed ? 12 : 0
onClicked: root.undoRequested()
}
IconButton {
icon: "delete_history"
inactiveColor: "transparent"
inactiveOnColor: DynamicColors.palette.m3onSurface
isRound: true
shapeMorph: true
shapeMorphExpansion: pressed ? 12 : 0
onClicked: root.clearRequested()
}
IconButton {
icon: "content_copy"
inactiveColor: "transparent"
inactiveOnColor: DynamicColors.palette.m3onSurface
isRound: true
shapeMorph: true
shapeMorphExpansion: pressed ? 12 : 0
onClicked: root.copyRequested()
}
IconButton {
icon: "delete_forever"
inactiveColor: "transparent"
inactiveOnColor: DynamicColors.palette.m3onSurface
isRound: true
shapeMorph: true
shapeMorphExpansion: pressed ? 12 : 0
onClicked: root.cancelRequested()
}
IconButton {
icon: "check"
inactiveColor: "transparent"
inactiveOnColor: DynamicColors.palette.m3onSurface
isRound: true
shapeMorph: true
shapeMorphExpansion: pressed ? 12 : 0
onClicked: root.saveRequested()
}
}
}
}
+183
View File
@@ -0,0 +1,183 @@
pragma ComponentBehavior: Bound
import QtQuick
Item {
id: root
property color handleBorder: "#3584e4"
property color handleFill: "white"
property real hs: 12
property real minSize: 24
required property real selH
required property real selW
required property real selX
required property real selY
signal boundsChanged(x: real, y: real, w: real, h: real)
signal dragFinished
signal moveBy(dx: real, dy: real)
height: selH
width: selW
x: selX
y: selY
DragHandler {
id: moveHandler
property real accumX: 0
property real accumY: 0
target: null
onActiveChanged: {
accumX = 0;
accumY = 0;
if (!active)
root.dragFinished();
}
onTranslationChanged: {
const t = moveHandler.translation;
root.moveBy(t.x - accumX, t.y - accumY);
accumX = t.x;
accumY = t.y;
}
}
Handle {
edge: "tl"
x: -root.hs / 2
y: -root.hs / 2
}
Handle {
edge: "t"
x: root.width / 2 - root.hs / 2
y: -root.hs / 2
}
Handle {
edge: "tr"
x: root.width - root.hs / 2
y: -root.hs / 2
}
Handle {
edge: "r"
x: root.width - root.hs / 2
y: root.height / 2 - root.hs / 2
}
Handle {
edge: "br"
x: root.width - root.hs / 2
y: root.height - root.hs / 2
}
Handle {
edge: "b"
x: root.width / 2 - root.hs / 2
y: root.height - root.hs / 2
}
Handle {
edge: "bl"
x: -root.hs / 2
y: root.height - root.hs / 2
}
Handle {
edge: "l"
x: -root.hs / 2
y: root.height / 2 - root.hs / 2
}
component Handle: Rectangle {
id: handle
required property string edge
border.color: root.handleBorder
border.width: 2
color: root.handleFill
height: root.hs
radius: root.hs / 2
width: root.hs
z: 10
HoverHandler {
cursorShape: {
switch (handle.edge) {
case "tl":
case "br":
return Qt.SizeFDiagCursor;
case "tr":
case "bl":
return Qt.SizeBDiagCursor;
case "t":
case "b":
return Qt.SizeVerCursor;
default:
return Qt.SizeHorCursor;
}
}
}
DragHandler {
id: dh
property real startH
property real startW
property real startX
property real startY
grabPermissions: PointerHandler.CanTakeOverFromAnything | PointerHandler.TakeOverForbidden
target: null
onActiveChanged: {
if (active) {
startX = root.x;
startY = root.y;
startW = root.width;
startH = root.height;
} else {
root.dragFinished();
}
}
onTranslationChanged: {
const delta = dh.translation;
const e = handle.edge;
let nx = startX, ny = startY, nw = startW, nh = startH;
if (e.includes("l")) {
nx = startX + delta.x;
nw = startW - delta.x;
}
if (e.includes("r")) {
nw = startW + delta.x;
}
if (e.includes("t")) {
ny = startY + delta.y;
nh = startH - delta.y;
}
if (e.includes("b")) {
nh = startH + delta.y;
}
if (nw < root.minSize) {
if (e.includes("l"))
nx = startX + startW - root.minSize;
nw = root.minSize;
}
if (nh < root.minSize) {
if (e.includes("t"))
ny = startY + startH - root.minSize;
nh = root.minSize;
}
root.boundsChanged(nx, ny, nw, nh);
}
}
}
}
+49
View File
@@ -0,0 +1,49 @@
import QtQuick
import QtQuick.Shapes
import qs.Config
import qs.Components
Item {
id: root
readonly property real designHeight: 80.419373
readonly property real designWidth: 98.057144
implicitHeight: designHeight
implicitWidth: designWidth
Shape {
id: shape
anchors.centerIn: parent
height: root.designHeight
preferredRendererType: Shape.CurveRenderer
scale: Math.min(root.implicitHeight / height, root.implicitWidth / width)
width: root.designWidth
ShapePath {
strokeColor: "transparent"
fillGradient: LinearGradient {
x1: 0
x2: shape.width
y1: 0
y2: shape.height
GradientStop {
color: DynamicColors.palette.m3primary
position: 0.0
}
GradientStop {
color: DynamicColors.palette.m3tertiary
position: 1.0
}
}
PathSvg {
path: "m 51.981821,0.026059 c -1.39501,-0.04986 -2.77607,-0.02697 -4.1305,0.05839 -9.029544,0.569111 -16.873893,3.910515 -19.747638,6.917924 -4.597996,4.811856 -9.516732,6.095236 -9.516732,6.095236 -4.063345,1.817811 -10.372493,1.390096 -10.372493,1.390096 -1.283162,6.736594 -5.560032,10.051544 -7.377844,12.724804 -1.817812,2.67325 -0.106971,4.38371 -0.106971,4.38371 7.805897,9.40985 5.132504,15.93288 5.132504,15.93288 3.421763,5.13265 5.132503,8.87491 5.132503,8.87491 0.855441,17.21575 24.059513,19.14095 24.059513,19.14095 8.019764,4.38413 21.813738,6.09496 33.041398,3.95635 11.22766,-2.1386 22.13426,-8.66133 25.44909,-12.40389 3.31484,-3.74255 4.70506,-4.70528 4.4912,-7.80625 -0.21386,-3.10098 -8.34057,-6.73654 -8.34057,-6.73654 4.70492,-26.73253 -10.5857,-43.627569 -25.12819,-49.829514 -4.09007,-1.744297 -8.40025,-2.549484 -12.58527,-2.69906 z m 0.0522,6.437333 c 2.11073,-0.04742 4.33196,0.144541 6.65179,0.645956 18.55865,4.011316 31.22355,22.883281 24.70082,47.477201 0,0 0.42763,1.06939 6.62957,4.38423 0,0 -6.09519,11.86918 -29.40596,14.97015 0,0 -16.039134,2.13849 -27.908379,-8.55452 0,0 -4.491338,2.24573 -10.372493,0.53485 0,0 6.094988,-3.3149 4.063317,-8.44755 -2.031672,-5.13264 -10.051071,-6.84383 -11.441162,-7.69927 -1.390091,-0.85544 -2.673221,-2.24534 -2.673221,-2.24534 0,0 8.12664,-1.49702 9.516731,-8.23361 1.390092,-6.7366 -2.994298,-11.01376 -4.812109,-12.29692 -1.817812,-1.28317 -3.421899,-2.5665 -4.491199,-4.59816 0,0 6.415801,-1.069 9.623702,-3.31453 0,0 2.566413,-0.42817 2.994133,9.83712 0,0 3.40241,0.98386 2.780192,-10.05106 0,0 9.369134,-12.076644 24.144268,-12.408547 z m 1.44952,11.296987 c -7.539424,-0.42396 -14.807124,3.94504 -19.819474,11.69747 -8.019756,12.40389 -4.597866,33.04123 15.505004,39.45703 20.10286,6.41581 34.21755,-8.76794 34.21755,-8.76794 0,0 -6.20221,-5.34688 -7.5923,-16.14682 -1.39009,-10.79994 -8.87492,-19.99568 -8.87492,-19.99568 -4.29057,-4.00988 -8.91222,-5.98969 -13.43587,-6.24406 z m 0.43874,3.91759 c 5.90958,0.2395 10.57783,4.70548 11.60704,7.352 1.49702,3.84948 2.88726,10.26522 -3.74241,13.58005 1e-5,-1.81781 1.06895,-2.13837 -0.96273,-4.91856 1.81781,-1.17623 2.99392,-3.10096 1.06918,-5.45342 -1.71088,0.53465 -0.85529,1.38993 -3.7424,-0.42788 -2.88711,-1.81781 -0.85514,-3.10083 -3.31453,-5.1325 0,0 -1.06951,-0.42772 -1.92495,0 -0.85544,0.42772 0.96245,2.88717 -2.56625,4.27726 -3.528694,1.39009 -2.673344,-0.21375 -2.994134,-2.45928 0,0 -4.49095,4.27695 -1.06919,10.37197 3.421764,6.09501 9.730474,-0.10662 7.805734,-1.92443 -1.92474,-1.81782 -2.13858,-2.1386 -4.06332,-1.39009 0,0 0.21415,-3.7426 4.91908,-1.49707 4.70492,2.24553 3.84939,13.90048 -5.77432,12.61732 -9.623714,-1.28316 -13.366163,-15.07666 -3.849384,-22.13405 2.973994,-2.20543 5.916404,-2.97018 8.602584,-2.86132 z m -44.322368,1.76475 c 0.177759,-0.002 0.290475,0.19502 0.325562,0.66869 0.21386,2.88712 7.806121,5.98809 7.485331,12.40389 -0.32079,6.41581 -6.309176,5.77433 -6.309176,5.77433 0.962372,-5.34651 -7.591784,-13.36663 -7.591784,-13.36663 2.592219,-0.26816 5.184343,-5.46781 6.090067,-5.48028 z m 60.847968,11.36158 c 0,0 3.10099,17.10864 5.56039,18.81952 0,0 -4.7046,-3.20747 -7.37785,-1.60352 -2.67325,1.60395 -2.67322,5.23955 -2.67322,6.84351 0,0 -3.31509,-4.27761 -7.5923,-2.4598 -4.2772,1.81781 -11.013604,-2.13842 -11.869044,-5.02553 0,0 9.623444,2.45961 14.435294,-3.52847 0,0 8.98208,-0.85568 9.51673,-13.04571 z"
}
}
}
}
+8
View File
@@ -44,6 +44,14 @@ PageBase {
spacing: Appearance.spacing.small
width: parent.width - Appearance.padding.largeIncreased * 2
Logo {
Layout.alignment: Qt.AlignHCenter
Layout.preferredHeight: implicitHeight
Layout.preferredWidth: implicitWidth
implicitHeight: designHeight * 2
implicitWidth: designWidth * 2
}
CustomText {
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: Appearance.spacing.small
+1
View File
@@ -14,6 +14,7 @@ struct Stroke {
qreal width;
int groupId = -1;
bool isSinglePoint = false;
bool isPolyline = false;
};
}; // namespace ZShell::internal
+31 -4
View File
@@ -25,7 +25,8 @@ static bool shouldAddPoint(
return QPointF::dotProduct(delta, delta) >= minDistance * minDistance;
}
static QCanvasPath buildStrokePath(const QVector<QPointF>& points, qreal width) {
static QCanvasPath buildStrokePath(
const QVector<QPointF>& points, qreal width, bool polyline) {
QCanvasPath path;
if (points.size() == 1) {
@@ -33,6 +34,13 @@ static QCanvasPath buildStrokePath(const QVector<QPointF>& points, qreal width)
return path;
}
if (polyline) {
path.moveTo(points[0]);
for (int i = 1; i < points.size(); i++)
path.lineTo(points[i]);
return path;
}
auto catmullToBezier = [](const QPointF& p0,
const QPointF& p1,
const QPointF& p2,
@@ -61,6 +69,16 @@ static QCanvasPath buildStrokePath(const QVector<QPointF>& points, qreal width)
return path;
}
void StrokeCanvasItem::undoLastGroup() {
if (m_strokes.isEmpty()) return;
const int lastGroup = m_strokes.last().groupId;
for (int i = m_strokes.size() - 1;
i >= 0 && m_strokes[i].groupId == lastGroup;
--i)
m_strokes.remove(i);
update();
}
void StrokeCanvasItem::setPenColor(const QColor& color) {
if (m_penColor == color) return;
@@ -121,13 +139,14 @@ void StrokeCanvasItem::setPenWidth(qreal width) {
emit penWidthChanged();
}
void StrokeCanvasItem::beginStroke(qreal x, qreal y) {
void StrokeCanvasItem::beginStroke(qreal x, qreal y, bool polyline) {
m_isDrawing = true;
m_currentStroke.points.clear();
m_currentStroke.points.append({x, y});
m_currentStroke.color = m_penColor;
m_currentStroke.width = m_penWidth;
m_currentStroke.isPolyline = polyline;
update();
}
@@ -135,6 +154,12 @@ void StrokeCanvasItem::beginStroke(qreal x, qreal y) {
void StrokeCanvasItem::appendPoint(qreal x, qreal y) {
const QPointF incoming{x, y};
if (m_currentStroke.isPolyline) {
m_currentStroke.points.append(incoming);
update();
return;
}
if (!shouldAddPoint(m_currentStroke.points, incoming, 2.0)) return;
QPointF smoothed;
@@ -166,8 +191,10 @@ void StrokeCanvasItem::endStroke() {
if (m_currentStroke.points.isEmpty()) return;
m_currentStroke.isSinglePoint = (m_currentStroke.points.size() == 1);
m_currentStroke.path =
buildStrokePath(m_currentStroke.points, m_currentStroke.width);
m_currentStroke.path = buildStrokePath(
m_currentStroke.points,
m_currentStroke.width,
m_currentStroke.isPolyline);
m_currentStroke.groupId = m_nextGroupId++;
m_currentStroke.points.clear();
m_strokes.append(m_currentStroke);
+2 -1
View File
@@ -39,6 +39,7 @@ class StrokeCanvasItem : public QCanvasPainterItem {
Q_INVOKABLE void showHover(qreal x, qreal y);
Q_INVOKABLE void hideHover();
Q_INVOKABLE void undoLastGroup();
[[nodiscard]] QColor penColor() const { return m_penColor; }
[[nodiscard]] qreal penWidth() const { return m_penWidth; }
@@ -48,7 +49,7 @@ class StrokeCanvasItem : public QCanvasPainterItem {
Q_INVOKABLE void clear();
Q_INVOKABLE void beginStroke(qreal x, qreal y);
Q_INVOKABLE void beginStroke(qreal x, qreal y, bool polyline = false);
Q_INVOKABLE void appendPoint(qreal x, qreal y);
Q_INVOKABLE void endStroke();
@@ -8,7 +8,8 @@ static void drawStroke(
QCanvasPainter* painter,
const QVector<QPointF>& points,
const QColor& color,
qreal width) {
qreal width,
bool polyline) {
if (points.isEmpty()) return;
painter->setStrokeStyle(color);
@@ -17,6 +18,15 @@ static void drawStroke(
painter->setLineCap(QCanvasPainter::LineCap::Round);
painter->setLineJoin(QCanvasPainter::LineJoin::Round);
if (polyline) {
painter->beginPath();
painter->moveTo(points[0]);
for (int i = 1; i < points.size(); i++)
painter->lineTo(points[i]);
painter->stroke();
return;
}
if (points.size() == 1) {
painter->beginPath();
painter->circle(points.front(), width * 0.5);
@@ -180,7 +190,8 @@ void StrokeCanvasRenderer::paint(QCanvasPainter* painter) {
painter,
m_currentStroke.points,
m_currentStroke.color,
m_currentStroke.width);
m_currentStroke.width,
m_currentStroke.isPolyline);
if (m_hoverVisible)
drawHoverCursor(
+13 -9
View File
@@ -1,5 +1,5 @@
<div align="center">
<img src="/images/shell.png" alt="ZShell screenshot">
<img src="./assets/logo.svg" alt="ZShell logo" width="480">
</div>
# ZShell
@@ -8,6 +8,10 @@ ZShell is a Hyprland-focused desktop shell built with Quickshell + Qt6/QML.
It includes a configurable top bar, launcher, notifications daemon + sidebar, wallpaper and dynamic color pipeline, lock screen, OSD widgets, dashboard, dock, desktop icons, and a separate greetd-compatible greeter.
<div align="center">
<img src="/images/shell.png" alt="ZShell screenshot">
</div>
## Highlights
- Multi-window shell layout driven by `Drawers/Windows.qml` and panel/interactions wrappers
@@ -218,14 +222,14 @@ Action-driven flows (`>` prefix by default) include calculator, wallpaper picker
### `shell` — daemon management
| Command | Description |
|---------|-------------|
| `start` | Start the shell daemon (pass `--no-daemon` to run in foreground) |
| `kill` | Kill the running shell daemon |
| `restart` | Kill then restart the daemon |
| `lock` | Lock the session via IPC |
| `show` | Show the shell window via IPC |
| `log` | Print daemon logs |
| Command | Description |
| --------- | ---------------------------------------------------------------- |
| `start` | Start the shell daemon (pass `--no-daemon` to run in foreground) |
| `kill` | Kill the running shell daemon |
| `restart` | Kill then restart the daemon |
| `lock` | Lock the session via IPC |
| `show` | Show the shell window via IPC |
| `log` | Print daemon logs |
### `scheme` — color scheme generation
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

+68
View File
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="370.60901"
height="370.60901"
viewBox="0 0 98.056968 98.056968"
version="1.1"
id="svg1"
xml:space="preserve"
inkscape:export-filename="logo.svg"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="px"
showborder="false"><inkscape:page
x="0"
y="0"
width="98.056969"
height="98.056969"
id="page2"
margin="0"
bleed="0" /></sodipodi:namedview><defs
id="defs1"><style
id="theme-style">
.grad-stop-1 { stop-color: #9898ff; stop-opacity: 1; }
.grad-stop-2 { stop-color: #ff9ac3; stop-opacity: 1; }
@media (prefers-color-scheme: light) {
.grad-stop-1 { stop-color: #000080; stop-opacity: 1; }
.grad-stop-2 { stop-color: #800037; stop-opacity: 1; }
}
</style><linearGradient
id="linearGradient7"
inkscape:collect="always"><stop
class="grad-stop-1"
offset="0.00635612"
id="stop7" /><stop
class="grad-stop-2"
offset="1"
id="stop8" /></linearGradient><linearGradient
inkscape:collect="always"
xlink:href="#linearGradient7"
id="linearGradient8"
x1="52.200813"
y1="75.440575"
x2="150.25795"
y2="155.85995"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-8.4478442e-5,8.8187943)" /></defs><g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-52.200813,-75.440577)"><path
id="path2"
style="fill:url(#linearGradient8);stroke-width:0.264583"
d="m 104.18255,84.28543 c -1.39501,-0.04986 -2.77607,-0.02697 -4.1305,0.05839 -9.029544,0.569111 -16.873893,3.910515 -19.747638,6.917924 -4.597996,4.811856 -9.516732,6.095236 -9.516732,6.095236 -4.063345,1.817811 -10.372493,1.390096 -10.372493,1.390096 -1.283162,6.736594 -5.560032,10.051544 -7.377844,12.724804 -1.817812,2.67325 -0.106971,4.38371 -0.106971,4.38371 7.805897,9.40985 5.132504,15.93288 5.132504,15.93288 3.421763,5.13265 5.132503,8.87491 5.132503,8.87491 0.855441,17.21575 24.059513,19.14095 24.059513,19.14095 8.019764,4.38413 21.813738,6.09496 33.041398,3.95635 11.22766,-2.1386 22.13426,-8.66133 25.44909,-12.40389 3.31484,-3.74255 4.70506,-4.70528 4.4912,-7.80625 -0.21386,-3.10098 -8.34057,-6.73654 -8.34057,-6.73654 4.70492,-26.73253 -10.5857,-43.627569 -25.12819,-49.829514 -4.09007,-1.744297 -8.40025,-2.549484 -12.58527,-2.69906 z m 0.0522,6.437333 c 2.11073,-0.04742 4.33196,0.144541 6.65179,0.645956 18.55865,4.011316 31.22355,22.883281 24.70082,47.477201 0,0 0.42763,1.06939 6.62957,4.38423 0,0 -6.09519,11.86918 -29.40596,14.97015 0,0 -16.039134,2.13849 -27.908379,-8.55452 0,0 -4.491338,2.24573 -10.372493,0.53485 0,0 6.094988,-3.3149 4.063317,-8.44755 -2.031672,-5.13264 -10.051071,-6.84383 -11.441162,-7.69927 -1.390091,-0.85544 -2.673221,-2.24534 -2.673221,-2.24534 0,0 8.12664,-1.49702 9.516731,-8.23361 1.390092,-6.7366 -2.994298,-11.01376 -4.812109,-12.29692 -1.817812,-1.28317 -3.421899,-2.5665 -4.491199,-4.59816 0,0 6.415801,-1.069 9.623702,-3.31453 0,0 2.566413,-0.42817 2.994133,9.83712 0,0 3.40241,0.98386 2.780192,-10.05106 0,0 9.369134,-12.076644 24.144268,-12.408547 z m 1.44952,11.296987 c -7.539424,-0.42396 -14.807124,3.94504 -19.819474,11.69747 -8.019756,12.40389 -4.597866,33.04123 15.505004,39.45703 20.10286,6.41581 34.21755,-8.76794 34.21755,-8.76794 0,0 -6.20221,-5.34688 -7.5923,-16.14682 -1.39009,-10.79994 -8.87492,-19.99568 -8.87492,-19.99568 -4.29057,-4.00988 -8.91222,-5.98969 -13.43587,-6.24406 z m 0.43874,3.91759 c 5.90958,0.2395 10.57783,4.70548 11.60704,7.352 1.49702,3.84948 2.88726,10.26522 -3.74241,13.58005 1e-5,-1.81781 1.06895,-2.13837 -0.96273,-4.91856 1.81781,-1.17623 2.99392,-3.10096 1.06918,-5.45342 -1.71088,0.53465 -0.85529,1.38993 -3.7424,-0.42788 -2.88711,-1.81781 -0.85514,-3.10083 -3.31453,-5.1325 0,0 -1.06951,-0.42772 -1.92495,0 -0.85544,0.42772 0.96245,2.88717 -2.56625,4.27726 -3.528694,1.39009 -2.673344,-0.21375 -2.994134,-2.45928 0,0 -4.49095,4.27695 -1.06919,10.37197 3.421764,6.09501 9.730474,-0.10662 7.805734,-1.92443 -1.92474,-1.81782 -2.13858,-2.1386 -4.06332,-1.39009 0,0 0.21415,-3.7426 4.91908,-1.49707 4.70492,2.24553 3.84939,13.90048 -5.77432,12.61732 -9.623714,-1.28316 -13.366163,-15.07666 -3.849384,-22.13405 2.973994,-2.20543 5.916404,-2.97018 8.602584,-2.86132 z m -44.322368,1.76475 c 0.177759,-0.002 0.290475,0.19502 0.325562,0.66869 0.21386,2.88712 7.806121,5.98809 7.485331,12.40389 -0.32079,6.41581 -6.309176,5.77433 -6.309176,5.77433 0.962372,-5.34651 -7.591784,-13.36663 -7.591784,-13.36663 2.592219,-0.26816 5.184343,-5.46781 6.090067,-5.48028 z m 60.847968,11.36158 c 0,0 3.10099,17.10864 5.56039,18.81952 0,0 -4.7046,-3.20747 -7.37785,-1.60352 -2.67325,1.60395 -2.67322,5.23955 -2.67322,6.84351 0,0 -3.31509,-4.27761 -7.5923,-2.4598 -4.2772,1.81781 -11.013604,-2.13842 -11.869044,-5.02553 0,0 9.623444,2.45961 14.435294,-3.52847 0,0 8.98208,-0.85568 9.51673,-13.04571 z" /></g></svg>

After

Width:  |  Height:  |  Size: 5.5 KiB

-310
View File
@@ -1,310 +0,0 @@
#!/bin/bash
# =============================================================================
# wifi-sim.sh — Virtual WiFi environment for development & testing
#
# Creates 3 dummy networks using mac80211_hwsim + hostapd:
# - FreeWifi (open, strong signal, ch 1)
# - OfficeNetwork (open, medium signal, ch 6)
# - HomeNetwork (WPA2, weak signal, ch 11)
#
# Usage:
# sudo ./wifi-sim.sh start
# sudo ./wifi-sim.sh stop
# sudo ./wifi-sim.sh status
# =============================================================================
set -euo pipefail
# --- User configuration ------------------------------------------------------
SSID_STRONG="FreeWifi" # Open network, strong signal
SSID_MEDIUM="OfficeNetwork" # Open network, medium signal
SSID_SECURE="HomeNetwork" # WPA2 network, weak signal
WIFI_PASSWORD="testpassword123"
# TX power levels in mBm (millibel-milliwatts). Higher = stronger signal.
# These affect the RSSI reported to scanning clients.
TXPOWER_STRONG=3000 # 30 dBm
TXPOWER_MEDIUM=1500 # 15 dBm
TXPOWER_WEAK=100 # 1 dBm
RUN_DIR="/tmp/wifi-sim"
# --- Helpers -----------------------------------------------------------------
die() {
echo "ERROR: $*" >&2
exit 1
}
info() { echo "[*] $*"; }
ok() { echo "[+] $*"; }
require_cmds() {
local missing=()
for cmd in "$@"; do
command -v "$cmd" &>/dev/null || missing+=("$cmd")
done
if [[ ${#missing[@]} -gt 0 ]]; then
die "Missing required tools: ${missing[*]}
Install with: sudo apt install hostapd wpasupplicant iw"
fi
}
get_phy_for_iface() {
iw dev "$1" info | awk '/wiphy/{print "phy"$2}'
}
# --- Start -------------------------------------------------------------------
cmd_start() {
[[ $EUID -ne 0 ]] && die "Please run as root: sudo $0 start"
require_cmds hostapd iw ip
if [[ -d "$RUN_DIR" && -f "$RUN_DIR/interfaces" ]]; then
die "wifi-sim appears to already be running. Run 'sudo $0 stop' first."
fi
mkdir -p "$RUN_DIR"
# Snapshot existing wlan interfaces so we can identify the new ones
info "Snapshotting existing interfaces..."
BEFORE=($(iw dev 2>/dev/null | awk '/Interface/{print $2}' | grep -v '^hwsim' || true))
# Load the kernel module with 4 radios (3 APs + 1 client)
info "Loading mac80211_hwsim (4 radios)..."
if lsmod | grep -q mac80211_hwsim; then
die "mac80211_hwsim is already loaded. Run 'sudo $0 stop' or 'sudo rmmod mac80211_hwsim' first."
fi
modprobe mac80211_hwsim radios=4
sleep 1 # Give the kernel a moment to register all interfaces
# Find the interfaces created by our modprobe
AFTER=($(iw dev 2>/dev/null | awk '/Interface/{print $2}' | grep -v '^hwsim'))
NEW_IFACES=()
for iface in "${AFTER[@]}"; do
[[ ! " ${BEFORE[*]:-} " =~ " $iface " ]] && NEW_IFACES+=("$iface")
done
if [[ ${#NEW_IFACES[@]} -lt 4 ]]; then
rmmod mac80211_hwsim 2>/dev/null || true
die "Expected 4 new wlan interfaces, found ${#NEW_IFACES[@]}. Check 'dmesg' for errors."
fi
AP1="${NEW_IFACES[0]}" # Will host SSID_STRONG
AP2="${NEW_IFACES[1]}" # Will host SSID_MEDIUM
AP3="${NEW_IFACES[2]}" # Will host SSID_SECURE
CLIENT="${NEW_IFACES[3]}" # Client-side interface for your code to use
info "Interfaces assigned: AP1=$AP1 AP2=$AP2 AP3=$AP3 Client=$CLIENT"
echo "$AP1 $AP2 $AP3 $CLIENT" >"$RUN_DIR/interfaces"
# Prevent NetworkManager from fighting us over these interfaces
if command -v nmcli &>/dev/null && nmcli general status &>/dev/null 2>&1; then
info "Marking interfaces as unmanaged in NetworkManager..."
for iface in "$AP1" "$AP2" "$AP3"; do
nmcli device set "$iface" managed no 2>/dev/null || true
done
nmcli device set "$CLIENT" managed yes
fi
# Set TX power on each physical radio to simulate signal strength differences.
# mac80211_hwsim factors TX power into the RSSI reported to scanning clients.
# Note: for precise RSSI control, consider 'wmediumd' (a wireless medium daemon).
info "Setting TX power levels for signal strength simulation..."
PHY1=$(get_phy_for_iface "$AP1")
PHY2=$(get_phy_for_iface "$AP2")
PHY3=$(get_phy_for_iface "$AP3")
iw phy "$PHY1" set txpower fixed $TXPOWER_STRONG
iw phy "$PHY2" set txpower fixed $TXPOWER_MEDIUM
iw phy "$PHY3" set txpower fixed $TXPOWER_WEAK
# --- hostapd config: AP1 (open, strong, channel 1) -----------------------
cat >"$RUN_DIR/ap1.conf" <<EOF
interface=$AP1
driver=nl80211
ssid=$SSID_STRONG
hw_mode=g
channel=1
auth_algs=1
wmm_enabled=0
ignore_broadcast_ssid=0
EOF
# --- hostapd config: AP2 (open, medium, channel 6) -----------------------
cat >"$RUN_DIR/ap2.conf" <<EOF
interface=$AP2
driver=nl80211
ssid=$SSID_MEDIUM
hw_mode=g
channel=6
auth_algs=1
wmm_enabled=0
ignore_broadcast_ssid=0
EOF
# --- hostapd config: AP3 (WPA2, weak, channel 11) ------------------------
cat >"$RUN_DIR/ap3.conf" <<EOF
interface=$AP3
driver=nl80211
ssid=$SSID_SECURE
hw_mode=g
channel=11
auth_algs=1
wpa=2
wpa_passphrase=$WIFI_PASSWORD
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
wmm_enabled=0
ignore_broadcast_ssid=0
EOF
# Start a hostapd instance for each AP
info "Starting hostapd instances..."
hostapd -B -P "$RUN_DIR/ap1.pid" "$RUN_DIR/ap1.conf" \
>"$RUN_DIR/ap1.log" 2>&1 ||
{
cat "$RUN_DIR/ap1.log"
die "hostapd failed for AP1. See log above."
}
hostapd -B -P "$RUN_DIR/ap2.pid" "$RUN_DIR/ap2.conf" \
>"$RUN_DIR/ap2.log" 2>&1 ||
{
cat "$RUN_DIR/ap2.log"
die "hostapd failed for AP2. See log above."
}
hostapd -B -P "$RUN_DIR/ap3.pid" "$RUN_DIR/ap3.conf" \
>"$RUN_DIR/ap3.log" 2>&1 ||
{
cat "$RUN_DIR/ap3.log"
die "hostapd failed for AP3. See log above."
}
# Bring up the client interface so it's ready to scan/connect
ip link set "$CLIENT" up
# --- Summary -------------------------------------------------------------
ok "Virtual WiFi environment is up!"
echo ""
echo " Networks:"
echo " ┌──────────────────┬──────────┬────────┬─────────────┐"
echo " │ SSID │ Security │ Signal │ Interface │"
echo " ├──────────────────┼──────────┼────────┼─────────────┤"
printf " │ %-16s │ %-8s │ %-6s │ %-11s │\n" "$SSID_STRONG" "Open" "Strong" "$AP1"
printf " │ %-16s │ %-8s │ %-6s │ %-11s │\n" "$SSID_MEDIUM" "Open" "Medium" "$AP2"
printf " │ %-16s │ %-8s │ %-6s │ %-11s │\n" "$SSID_SECURE" "WPA2" "Weak" "$AP3"
echo " └──────────────────┴──────────┴────────┴─────────────┘"
echo ""
echo " WPA2 password : $WIFI_PASSWORD"
echo " Client iface : $CLIENT (use this in your code)"
echo ""
echo " Useful commands:"
echo " Scan for networks : sudo iw dev $CLIENT scan | grep -E 'SSID|signal'"
echo " Connect (open) : sudo iw dev $CLIENT connect \"$SSID_STRONG\""
echo " Connect (WPA2) : sudo wpa_supplicant -Dnl80211 -i$CLIENT \\"
echo " -c <(wpa_passphrase \"$SSID_SECURE\" \"$WIFI_PASSWORD\")"
echo " Stop simulation : sudo $0 stop"
echo ""
echo " Logs: $RUN_DIR/ap{1,2,3}.log"
}
# --- Stop --------------------------------------------------------------------
cmd_stop() {
[[ $EUID -ne 0 ]] && die "Please run as root: sudo $0 stop"
info "Stopping virtual WiFi environment..."
local had_something=false
# Kill hostapd processes via PID files
for ap in ap1 ap2 ap3; do
PID_FILE="$RUN_DIR/$ap.pid"
if [[ -f "$PID_FILE" ]]; then
PID=$(cat "$PID_FILE")
if kill "$PID" 2>/dev/null; then
info "Stopped hostapd for $ap (PID $PID)"
fi
rm -f "$PID_FILE"
had_something=true
fi
done
# Re-enable NetworkManager management for these interfaces
if [[ -f "$RUN_DIR/interfaces" ]]; then
read -r AP1 AP2 AP3 CLIENT <"$RUN_DIR/interfaces"
if command -v nmcli &>/dev/null; then
for iface in "$AP1" "$AP2" "$AP3" "$CLIENT"; do
nmcli device set "$iface" managed yes 2>/dev/null || true
done
fi
fi
# Unload the kernel module (also destroys all virtual interfaces)
if lsmod | grep -q mac80211_hwsim; then
info "Unloading mac80211_hwsim..."
rmmod mac80211_hwsim && had_something=true
fi
# Clean up runtime directory
rm -rf "$RUN_DIR"
if $had_something; then
ok "Virtual WiFi environment stopped."
else
echo "Nothing was running."
fi
}
# --- Status ------------------------------------------------------------------
cmd_status() {
if [[ ! -f "$RUN_DIR/interfaces" ]]; then
echo "wifi-sim is not running."
return
fi
read -r AP1 AP2 AP3 CLIENT <"$RUN_DIR/interfaces"
echo "wifi-sim is running."
echo ""
echo " Interfaces:"
for iface in "$AP1" "$AP2" "$AP3" "$CLIENT"; do
STATE=$(ip link show "$iface" 2>/dev/null | awk '/state/{print $9}' || echo "unknown")
CHANNEL=$(iw dev "$iface" info 2>/dev/null | awk '/channel/{print $2}' || echo "?")
printf " %-10s state=%-4s channel=%s\n" "$iface" "$STATE" "$CHANNEL"
done
echo ""
echo " Processes:"
for ap in ap1 ap2 ap3; do
PID_FILE="$RUN_DIR/$ap.pid"
if [[ -f "$PID_FILE" ]]; then
PID=$(cat "$PID_FILE")
if kill -0 "$PID" 2>/dev/null; then
echo " hostapd ($ap) PID=$PID running"
else
echo " hostapd ($ap) PID=$PID DEAD (check $RUN_DIR/$ap.log)"
fi
fi
done
}
# --- Entry point -------------------------------------------------------------
case "${1:-help}" in
start) cmd_start ;;
stop) cmd_stop ;;
status) cmd_status ;;
*)
echo "Usage: sudo $0 {start|stop|status}"
echo ""
echo " start Load mac80211_hwsim and bring up 3 virtual APs"
echo " stop Tear down all virtual interfaces and unload module"
echo " status Show current state of interfaces and processes"
echo ""
echo "Networks created on start:"
printf " %-16s open, strong signal\n" "$SSID_STRONG"
printf " %-16s open, medium signal\n" "$SSID_MEDIUM"
printf " %-16s WPA2, weak signal (password: $WIFI_PASSWORD)\n" "$SSID_SECURE"
;;
esac
+4
View File
@@ -54,6 +54,10 @@ select = [
"RUF",
]
[tool.basedpyright]
typeCheckingMode = "basic"
include = ["cli/src"]
[tool.pytest.ini_options]
testpaths = ["cli/tests"]
pythonpath = ["cli/src"]