Merge branch 'ii-qs' into ii-qs-patch-1

This commit is contained in:
_xB
2025-06-12 19:37:50 +03:00
committed by GitHub
6 changed files with 118 additions and 44 deletions
+57 -36
View File
@@ -5,6 +5,7 @@ import QtQuick.Layouts
import Quickshell
import Quickshell.Io
import Quickshell.Hyprland
import Quickshell.Services.Pipewire
Rectangle {
id: root
@@ -21,48 +22,68 @@ Rectangle {
spacing: 4
anchors.centerIn: parent
CircleUtilButton {
Layout.alignment: Qt.AlignVCenter
onClicked: Hyprland.dispatch("exec hyprshot --freeze --clipboard-only --mode region --silent")
MaterialSymbol {
horizontalAlignment: Qt.AlignHCenter
fill: 1
text: "screenshot_region"
iconSize: Appearance.font.pixelSize.large
color: Appearance.colors.colOnLayer2
Loader {
active: ConfigOptions.bar.utilButtons.showScreenSnip
visible: ConfigOptions.bar.utilButtons.showScreenSnip
sourceComponent: CircleUtilButton {
Layout.alignment: Qt.AlignVCenter
onClicked: Hyprland.dispatch("exec hyprshot --freeze --clipboard-only --mode region --silent")
MaterialSymbol {
horizontalAlignment: Qt.AlignHCenter
fill: 1
text: "screenshot_region"
iconSize: Appearance.font.pixelSize.large
color: Appearance.colors.colOnLayer2
}
}
}
// CircleUtilButton {
// Layout.alignment: Qt.AlignVCenter
// onClicked: Hyprland.dispatch("exec hyprpicker -a")
Loader {
active: ConfigOptions.bar.utilButtons.showColorPicker
visible: ConfigOptions.bar.utilButtons.showColorPicker
sourceComponent: CircleUtilButton {
Layout.alignment: Qt.AlignVCenter
onClicked: Hyprland.dispatch("exec hyprpicker -a")
MaterialSymbol {
horizontalAlignment: Qt.AlignHCenter
fill: 1
text: "colorize"
iconSize: Appearance.font.pixelSize.large
color: Appearance.colors.colOnLayer2
}
}
}
// MaterialSymbol {
// horizontalAlignment: Qt.AlignHCenter
// fill: 1
// text: "colorize"
// iconSize: Appearance.font.pixelSize.large
// color: Appearance.colors.colOnLayer2
// }
// }
CircleUtilButton {
Layout.alignment: Qt.AlignVCenter
onClicked: Hyprland.dispatch("global quickshell:oskToggle")
MaterialSymbol {
horizontalAlignment: Qt.AlignHCenter
fill: 0
text: "keyboard"
iconSize: Appearance.font.pixelSize.large
color: Appearance.colors.colOnLayer2
Loader {
active: ConfigOptions.bar.utilButtons.showKeyboardToggle
visible: ConfigOptions.bar.utilButtons.showKeyboardToggle
sourceComponent: CircleUtilButton {
Layout.alignment: Qt.AlignVCenter
onClicked: Hyprland.dispatch("global quickshell:oskToggle")
MaterialSymbol {
horizontalAlignment: Qt.AlignHCenter
fill: 0
text: "keyboard"
iconSize: Appearance.font.pixelSize.large
color: Appearance.colors.colOnLayer2
}
}
}
Loader {
active: ConfigOptions.bar.utilButtons.showMicToggle
visible: ConfigOptions.bar.utilButtons.showMicToggle
sourceComponent: CircleUtilButton {
Layout.alignment: Qt.AlignVCenter
onClicked: Hyprland.dispatch("exec wpctl set-mute @DEFAULT_SOURCE@ toggle")
MaterialSymbol {
horizontalAlignment: Qt.AlignHCenter
fill: 0
text: Pipewire.defaultAudioSource?.audio?.muted ? "mic_off" : "mic"
iconSize: Appearance.font.pixelSize.large
color: Appearance.colors.colOnLayer2
}
}
}
}
}
@@ -49,6 +49,12 @@ Singleton {
"HDMI-A-1",
"DP-1"
]
property QtObject utilButtons: QtObject {
property bool showScreenSnip: true
property bool showColorPicker: false
property bool showMicToggle: false
property bool showKeyboardToggle: true
}
property QtObject workspaces: QtObject {
property int shown: 10
property bool alwaysShowNumbers: false
@@ -18,6 +18,14 @@ ProgressBar {
property real valueBarGap: 4
property color highlightColor: Appearance?.colors.colPrimary ?? "#685496"
property color trackColor: Appearance?.m3colors.m3secondaryContainer ?? "#F1D3F9"
property bool sperm: false // If true, the progress bar will have a wavy fill effect
property real waveAmplitude: sperm ? 3 : 0
property real frequency: 8
property real spermFps: 60
Behavior on waveAmplitude {
animation: Appearance?.animation.elementMoveFast.numberAnimation.createObject(this)
}
Behavior on value {
animation: Appearance?.animation.elementMoveEnter.numberAnimation.createObject(this)
@@ -35,11 +43,49 @@ ProgressBar {
implicitWidth: parent.width
implicitHeight: parent.height
Rectangle { // Left progress fill
width: root.visualPosition * parent.width
height: parent.height
radius: Appearance?.rounding.full ?? 9999
color: root.highlightColor
Canvas {
id: wavyFill
anchors {
left: parent.left
right: parent.right
verticalCenter: parent.verticalCenter
}
height: parent.height * 6
onPaint: {
var ctx = getContext("2d");
ctx.clearRect(0, 0, width, height);
var progress = root.visualPosition;
var fillWidth = progress * width;
var amplitude = root.waveAmplitude
var frequency = root.frequency;
var phase = Date.now() / 400.0;
var centerY = height / 2;
ctx.strokeStyle = root.highlightColor;
ctx.lineWidth = parent.height;
ctx.lineCap = "round";
ctx.beginPath();
for (var x = ctx.lineWidth / 2; x <= fillWidth; x += 1) {
var waveY = centerY + amplitude * Math.sin(frequency * 2 * Math.PI * x / width + phase);
if (x === 0)
ctx.moveTo(x, waveY);
else
ctx.lineTo(x, waveY);
}
ctx.stroke();
}
Connections {
target: root
function onValueChanged() { wavyFill.requestPaint(); }
function onHighlightColorChanged() { wavyFill.requestPaint(); }
}
Timer {
interval: 1000 / root.spermFps
running: root.sperm
repeat: root.sperm
onTriggered: wavyFill.requestPaint()
}
}
Rectangle { // Right remaining part fill
anchors.right: parent.right
@@ -46,7 +46,7 @@ Canvas { // Visualizer
}
root.smoothPoints.push(sum / count);
}
if (!root.live) smoothedPoints.fill(0); // If not playing, show no points
if (!root.live) root.smoothPoints.fill(0); // If not playing, show no points
ctx.beginPath();
ctx.moveTo(0, h);
@@ -259,6 +259,7 @@ Item { // Player instance
highlightColor: blendedColors.colPrimary
trackColor: blendedColors.colSecondaryContainer
value: playerController.player?.position / playerController.player?.length
sperm: playerController.player?.isPlaying
}
}
TrackChangeButton {
@@ -59,7 +59,7 @@ Item {
Process {
id: translateProc
command: ["bash", "-c", `trans -no-theme`
command: ["bash", "-c", `trans -no-theme -no-bidi`
+ ` -source '${StringUtils.shellSingleQuoteEscape(root.sourceLanguage)}'`
+ ` -target '${StringUtils.shellSingleQuoteEscape(root.targetLanguage)}'`
+ ` -no-ansi '${StringUtils.shellSingleQuoteEscape(root.inputField.text.trim())}'`]
@@ -82,7 +82,7 @@ Item {
Process {
id: getLanguagesProc
command: ["trans", "-list-languages"]
command: ["trans", "-list-languages", "-no-bidi"]
property list<string> bufferList: ["auto"]
running: true
stdout: SplitParser {