forked from Shinonome/dots-hyprland
stuff
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import QtQuick
|
||||
import QtQuick.Shapes
|
||||
|
||||
/**
|
||||
* Draws a hexagon when width == height.
|
||||
* Otherwise the hexagon is extended
|
||||
*/
|
||||
Item {
|
||||
id: root
|
||||
property real radius: Math.min(width, height) / 2
|
||||
property real cornerRounding: radius * 0.5
|
||||
property color color: "#b7eb34"
|
||||
property real borderWidth: cornerRounding
|
||||
property color borderColor: color
|
||||
|
||||
Shape {
|
||||
id: hexShape
|
||||
anchors.fill: parent
|
||||
preferredRendererType: Shape.CurveRenderer
|
||||
|
||||
ShapePath {
|
||||
id: hexPath
|
||||
fillColor: root.color
|
||||
strokeColor: root.borderColor
|
||||
strokeWidth: root.borderWidth
|
||||
capStyle: ShapePath.RoundCap
|
||||
joinStyle: ShapePath.RoundJoin
|
||||
|
||||
property real r: root.radius
|
||||
property real r60: r * Math.sqrt(3) / 2
|
||||
property real r30: r / 2
|
||||
property real cr: root.cornerRounding
|
||||
property real cr60: cr * Math.sqrt(3) / 2
|
||||
property real cr30: cr / 2
|
||||
property real lineWidthAdjustment: strokeWidth / 2
|
||||
property real lineWidthAdjustment60: lineWidthAdjustment * Math.sqrt(3) / 2
|
||||
property real lineWidthAdjustment30: lineWidthAdjustment / 2
|
||||
|
||||
startX: hexPath.r; startY: lineWidthAdjustment;
|
||||
PathLine { x: hexPath.r + hexPath.r60 - hexPath.lineWidthAdjustment60; y: hexShape.height / 2 - hexPath.r30 + hexPath.lineWidthAdjustment30 }
|
||||
PathLine { x: hexPath.r + hexPath.r60 - hexPath.lineWidthAdjustment60; y: hexShape.height / 2 + hexPath.r30 - hexPath.lineWidthAdjustment30 }
|
||||
PathLine { x: hexPath.r; y: hexShape.height - hexPath.lineWidthAdjustment }
|
||||
PathLine { x: hexPath.r - hexPath.r60 + hexPath.lineWidthAdjustment60; y: hexShape.height - hexPath.r30 - hexPath.lineWidthAdjustment30 }
|
||||
PathLine { x: hexPath.r - hexPath.r60 + hexPath.lineWidthAdjustment60; y: hexPath.r30 + hexPath.lineWidthAdjustment30 }
|
||||
// Close the path
|
||||
PathLine { x: hexPath.r; y: hexPath.lineWidthAdjustment }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import qs.singletons
|
||||
import QtQuick
|
||||
|
||||
Text {
|
||||
id: root
|
||||
property real iconSize: Appearance?.font.pixelSize.small ?? 16
|
||||
property real fill: 0
|
||||
property real truncatedFill: Math.round(fill * 100) / 100 // Reduce memory consumption spikes from constant font remapping
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
renderType: Text.NativeRendering
|
||||
font {
|
||||
hintingPreference: Font.PreferFullHinting
|
||||
family: Appearance?.font.family.iconMaterial ?? "Material Symbols Outlined"
|
||||
pixelSize: iconSize
|
||||
weight: Font.Normal + (Font.DemiBold - Font.Normal) * fill
|
||||
variableAxes: {
|
||||
"FILL": truncatedFill,
|
||||
// "wght": font.weight,
|
||||
// "GRAD": 0,
|
||||
"opsz": iconSize,
|
||||
}
|
||||
}
|
||||
color: Appearance.m3colors.m3onBackground
|
||||
|
||||
// Behavior on fill {
|
||||
// NumberAnimation {
|
||||
// duration: Appearance?.animation.elementMoveFast.duration ?? 200
|
||||
// easing.type: Appearance?.animation.elementMoveFast.type ?? Easing.BezierSpline
|
||||
// easing.bezierCurve: Appearance?.animation.elementMoveFast.bezierCurve ?? [0.34, 0.80, 0.34, 1.00, 1, 1]
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
import QtQuick
|
||||
|
||||
/**
|
||||
* Draws an octagon when width == height.
|
||||
* Otherwise it's a rectangle "rounded" with two edges each corner (like 1/4 of an octagon)
|
||||
*/
|
||||
Item {
|
||||
id: root
|
||||
property real radius: Math.min(width, height) / 2
|
||||
property color color: "#b7eb34"
|
||||
|
||||
onWidthChanged: polyRect.requestPaint()
|
||||
onHeightChanged: polyRect.requestPaint()
|
||||
onRadiusChanged: polyRect.requestPaint()
|
||||
onColorChanged: polyRect.requestPaint()
|
||||
|
||||
Canvas {
|
||||
id: polyRect
|
||||
anchors.fill: parent
|
||||
|
||||
onPaint: {
|
||||
var ctx = getContext("2d");
|
||||
ctx.clearRect(0, 0, width, height);
|
||||
|
||||
var r = root.radius;
|
||||
var r45 = r * Math.SQRT2 / 2;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(r, 0);
|
||||
ctx.lineTo(width - r, 0);
|
||||
ctx.lineTo(width - r + r45, r - r45);
|
||||
ctx.lineTo(width, r);
|
||||
ctx.lineTo(width, height - r);
|
||||
ctx.lineTo(width - r + r45, height - r + r45);
|
||||
ctx.lineTo(width - r, height);
|
||||
ctx.lineTo(r, height);
|
||||
ctx.lineTo(r - r45, height - r + r45);
|
||||
ctx.lineTo(0, height - r);
|
||||
ctx.lineTo(0, r);
|
||||
ctx.lineTo(r - r45, r - r45);
|
||||
ctx.closePath();
|
||||
|
||||
ctx.fillStyle = root.color;
|
||||
ctx.fill();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import qs.singletons
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
Text {
|
||||
renderType: Text.NativeRendering
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
font {
|
||||
hintingPreference: Font.PreferFullHinting
|
||||
family: Appearance?.font.family.main ?? "sans-serif"
|
||||
pixelSize: Appearance?.font.pixelSize.small ?? 15
|
||||
}
|
||||
color: Appearance?.colors.on_background ?? "black"
|
||||
linkColor: Appearance?.colors.primary ?? "blue"
|
||||
}
|
||||
Reference in New Issue
Block a user