use more hyprland dispatch exec instead of a process for simple stuff

This commit is contained in:
end-4 2025-04-27 23:22:27 +02:00
parent 9b0d769598
commit ab9b17a188
6 changed files with 17 additions and 48 deletions

View file

@ -4,6 +4,7 @@ import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
import Quickshell.Hyprland
Rectangle { Rectangle {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
@ -12,18 +13,6 @@ Rectangle {
color: Appearance.colors.colLayer1 color: Appearance.colors.colLayer1
radius: Appearance.rounding.small radius: Appearance.rounding.small
Process {
id: screenSnip
command: ["grimblast", "copy", "area"]
}
Process {
id: pickColor
command: ["hyprpicker", "-a"]
}
RowLayout { RowLayout {
id: rowLayout id: rowLayout
@ -32,7 +21,7 @@ Rectangle {
SmallCircleButton { SmallCircleButton {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
onClicked: screenSnip.running = true onClicked: Hyprland.dispatch("exec grimblast copy area")
MaterialSymbol { MaterialSymbol {
anchors.centerIn: parent anchors.centerIn: parent
@ -45,7 +34,7 @@ Rectangle {
SmallCircleButton { SmallCircleButton {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
onClicked: pickColor.running = true onClicked: Hyprland.dispatch("exec hyprpicker -a")
MaterialSymbol { MaterialSymbol {
anchors.centerIn: parent anchors.centerIn: parent

View file

@ -24,11 +24,6 @@ Item {
Layout.fillWidth: true Layout.fillWidth: true
clip: !popup clip: !popup
Process {
id: copyNotificationBody
command: ["bash", "-c", `wl-copy "${notificationObject.body}"`]
}
implicitHeight: ready ? notificationColumnLayout.implicitHeight + notificationListSpacing : 0 implicitHeight: ready ? notificationColumnLayout.implicitHeight + notificationListSpacing : 0
Behavior on implicitHeight { Behavior on implicitHeight {
enabled: enableAnimation enabled: enableAnimation
@ -125,7 +120,7 @@ Item {
} }
onPressAndHold: (mouse) => { onPressAndHold: (mouse) => {
if (mouse.button === Qt.LeftButton) { if (mouse.button === Qt.LeftButton) {
copyNotificationBody.running = true Hyprland.dispatch(`exec wl-copy '${notificationObject.body}'`)
notificationSummaryText.text = `${notificationObject.summary} (copied)` notificationSummaryText.text = `${notificationObject.summary} (copied)`
} }
} }
@ -531,7 +526,7 @@ Item {
(contentItem.implicitWidth + leftPadding + rightPadding) (contentItem.implicitWidth + leftPadding + rightPadding)
onClicked: { onClicked: {
copyNotificationBody.running = true Hyprland.dispatch(`exec wl-copy '${notificationObject.body}'`)
copyIcon.text = "inventory" copyIcon.text = "inventory"
copyIconTimer.stop() copyIconTimer.stop()
copyIconTimer.start() copyIconTimer.start()

View file

@ -9,6 +9,7 @@ import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
import Quickshell.Hyprland
Item { // Wrapper Item { // Wrapper
id: root id: root
@ -85,16 +86,6 @@ Item { // Wrapper
} }
} }
Process {
id: copyText
property list<string> baseCommand: ["wl-copy"]
function copyTextToClipboard(text) {
copyText.running = false
copyText.command = baseCommand.concat(text)
copyText.running = true
}
}
Process { Process {
id: webSearch id: webSearch
property list<string> baseCommand: ["xdg-open"] property list<string> baseCommand: ["xdg-open"]
@ -338,7 +329,7 @@ Item { // Wrapper
fontType: "monospace", fontType: "monospace",
materialSymbol: 'calculate', materialSymbol: 'calculate',
execute: () => { execute: () => {
copyText.copyTextToClipboard(root.mathResult); Hyprland.dispatch(`exec wl-copy '${root.mathResult}'`)
} }
}); });
// Run command // Run command

View file

@ -1,29 +1,25 @@
import "root:/modules/common" import "root:/modules/common"
import "root:/modules/common/widgets" import "root:/modules/common/widgets"
import "../" import "../"
import Quickshell.Io
import Quickshell import Quickshell
import Quickshell.Io
import Quickshell.Hyprland
QuickToggleButton { QuickToggleButton {
property bool enabled: false property bool enabled: false
buttonIcon: "gamepad" buttonIcon: "gamepad"
toggled: enabled toggled: enabled
onClicked: { onClicked: {
enabled = !enabled enabled = !enabled
if (enabled) { if (enabled) {
gameModeOn.running = true // gameModeOn.running = true
Hyprland.dispatch(`exec hyprctl --batch "keyword animations:enabled 0; keyword decoration:shadow:enabled 0; keyword decoration:blur:enabled 0; keyword general:gaps_in 0; keyword general:gaps_out 0; keyword general:border_size 1; keyword decoration:rounding 0; keyword general:allow_tearing 1"`)
} else { } else {
gameModeOff.running = true Hyprland.dispatch("exec hyprctl reload")
} }
} }
Process {
id: gameModeOn
command: ['bash', '-c', `hyprctl --batch "keyword animations:enabled 0; keyword decoration:shadow:enabled 0; keyword decoration:blur:enabled 0; keyword general:gaps_in 0; keyword general:gaps_out 0; keyword general:border_size 1; keyword decoration:rounding 0; keyword general:allow_tearing 1"`]
}
Process {
id: gameModeOff
command: ['bash', '-c', `hyprctl reload`]
}
StyledToolTip { StyledToolTip {
content: qsTr("Game mode") content: qsTr("Game mode")
} }

View file

@ -1,7 +1,8 @@
import Quickshell
import Quickshell.Io
pragma Singleton pragma Singleton
pragma ComponentBehavior: Bound pragma ComponentBehavior: Bound
import Quickshell
import Quickshell.Io
import Quickshell.Hyprland
Singleton { Singleton {
id: root id: root
@ -88,5 +89,4 @@ Singleton {
root.increment = -1 root.increment = -1
} }
} }
} }

View file

@ -34,7 +34,6 @@ Singleton {
stdout: SplitParser { stdout: SplitParser {
onRead: data => { onRead: data => {
root.networkName = data root.networkName = data
// console.log("Network: " + data);
} }
} }
} }
@ -46,7 +45,6 @@ Singleton {
stdout: SplitParser { stdout: SplitParser {
onRead: data => { onRead: data => {
root.networkStrength = parseInt(data); root.networkStrength = parseInt(data);
// console.log("Network Strength: " + data);
} }
} }
} }