qs: fix hyprland dispatchers

This commit is contained in:
end-4
2026-05-11 23:45:44 +02:00
parent 6c041b953a
commit 760c7034aa
10 changed files with 27 additions and 33 deletions
@@ -107,9 +107,9 @@ Item {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
onClicked: event => { onClicked: event => {
if (Appearance.m3colors.darkmode) { if (Appearance.m3colors.darkmode) {
Hyprland.dispatch(`exec ${Directories.wallpaperSwitchScriptPath} --mode light --noswitch`); Quickshell.execDetached(["bash", "-c", `${Directories.wallpaperSwitchScriptPath} --mode light --noswitch`])
} else { } else {
Hyprland.dispatch(`exec ${Directories.wallpaperSwitchScriptPath} --mode dark --noswitch`); Quickshell.execDetached(["bash", "-c", `${Directories.wallpaperSwitchScriptPath} --mode dark --noswitch`])
} }
} }
MaterialSymbol { MaterialSymbol {
@@ -88,9 +88,9 @@ Item {
WheelHandler { WheelHandler {
onWheel: (event) => { onWheel: (event) => {
if (event.angleDelta.y < 0) if (event.angleDelta.y < 0)
Hyprland.dispatch(`workspace r+1`); Hyprland.dispatch(`hl.dsp.focus({workspace = "r+1"})`);
else if (event.angleDelta.y > 0) else if (event.angleDelta.y > 0)
Hyprland.dispatch(`workspace r-1`); Hyprland.dispatch(`hl.dsp.focus({workspace = "r-1"})`);
} }
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
} }
@@ -100,7 +100,7 @@ Item {
acceptedButtons: Qt.BackButton acceptedButtons: Qt.BackButton
onPressed: (event) => { onPressed: (event) => {
if (event.button === Qt.BackButton) { if (event.button === Qt.BackButton) {
Hyprland.dispatch(`togglespecialworkspace`); Hyprland.dispatch(`hl.dsp.workspace.toggle_special("special")`);
} }
} }
} }
@@ -199,9 +199,9 @@ Item {
property int workspaceValue: workspaceGroup * root.workspacesShown + index + 1 property int workspaceValue: workspaceGroup * root.workspacesShown + index + 1
implicitHeight: vertical ? Appearance.sizes.verticalBarWidth : Appearance.sizes.barHeight implicitHeight: vertical ? Appearance.sizes.verticalBarWidth : Appearance.sizes.barHeight
implicitWidth: vertical ? Appearance.sizes.verticalBarWidth : Appearance.sizes.verticalBarWidth implicitWidth: vertical ? Appearance.sizes.verticalBarWidth : Appearance.sizes.verticalBarWidth
onPressed: Hyprland.dispatch(`workspace ${workspaceValue}`) onPressed: Hyprland.dispatch(`hl.dsp.focus({ workspace = ${workspaceValue}})`)
width: vertical ? undefined : workspaceButtonWidth width: vertical ? undefined : root.workspaceButtonWidth
height: vertical ? workspaceButtonWidth : undefined height: vertical ? root.workspaceButtonWidth : undefined
background: Item { background: Item {
id: workspaceButtonBackground id: workspaceButtonBackground
@@ -80,12 +80,6 @@ Scope {
Keys.onPressed: event => { Keys.onPressed: event => {
if (event.key === Qt.Key_Escape) { if (event.key === Qt.Key_Escape) {
GlobalStates.overviewOpen = false; GlobalStates.overviewOpen = false;
} else if (event.key === Qt.Key_Left) {
if (!panelWindow.searchingText)
Hyprland.dispatch("workspace r-1");
} else if (event.key === Qt.Key_Right) {
if (!panelWindow.searchingText)
Hyprland.dispatch("workspace r+1");
} }
} }
@@ -142,7 +142,7 @@ Item {
onPressed: { onPressed: {
if (root.draggingTargetWorkspace === -1) { if (root.draggingTargetWorkspace === -1) {
GlobalStates.overviewOpen = false GlobalStates.overviewOpen = false
Hyprland.dispatch(`workspace ${workspace.workspaceValue}`) Hyprland.dispatch(`hl.dsp.focus({ workspace = ${workspace.workspaceValue} })`)
} }
} }
} }
@@ -266,7 +266,7 @@ Item {
window.Drag.active = false window.Drag.active = false
root.draggingFromWorkspace = -1 root.draggingFromWorkspace = -1
if (targetWorkspace !== -1 && targetWorkspace !== windowData?.workspace.id) { if (targetWorkspace !== -1 && targetWorkspace !== windowData?.workspace.id) {
Hyprland.dispatch(`movetoworkspacesilent ${targetWorkspace}, address:${window.windowData?.address}`) Hyprland.dispatch(`hl.dsp.window.move({ workspace = ${targetWorkspace}, follow = false, window = "address:${window.windowData?.address}" })`)
updateWindowPosition.restart() updateWindowPosition.restart()
} }
else { else {
@@ -274,9 +274,9 @@ Item {
updateWindowPosition.restart() updateWindowPosition.restart()
return return
} }
const percentageX = Math.round((window.x - xOffset) / root.workspaceImplicitWidth * 100) const percentageX = (window.x - xOffset) / root.workspaceImplicitWidth
const percentageY = Math.round((window.y - yOffset) / root.workspaceImplicitHeight * 100) const percentageY = (window.y - yOffset) / root.workspaceImplicitHeight
Hyprland.dispatch(`movewindowpixel exact ${percentageX}% ${percentageY}%, address:${window.windowData?.address}`) Hyprland.dispatch(`hl.dsp.window.move({ x = "${percentageX * root.screen.width}", y = "${percentageY * root.screen.height}", window = "address:${window.windowData?.address}" })`)
} }
} }
onClicked: (event) => { onClicked: (event) => {
@@ -284,10 +284,10 @@ Item {
if (event.button === Qt.LeftButton) { if (event.button === Qt.LeftButton) {
GlobalStates.overviewOpen = false GlobalStates.overviewOpen = false
Hyprland.dispatch(`focuswindow address:${windowData.address}`) Hyprland.dispatch(`hl.dsp.focus({window = "address:${windowData.address}"})`)
event.accepted = true event.accepted = true
} else if (event.button === Qt.MiddleButton) { } else if (event.button === Qt.MiddleButton) {
Hyprland.dispatch(`closewindow address:${windowData.address}`) Hyprland.dispatch(`hl.dsp.window.close({window = "address:${windowData.address}"})`)
event.accepted = true event.accepted = true
} }
} }
@@ -147,9 +147,9 @@ Button {
buttonText: Translation.tr("Open file link") buttonText: Translation.tr("Open file link")
onClicked: { onClicked: {
root.showActions = false root.showActions = false
Hyprland.dispatch("keyword cursor:no_warps true") Hyprland.dispatch("hl.config({cursor = {no_warps = true}})")
Qt.openUrlExternally(root.imageData.file_url) Qt.openUrlExternally(root.imageData.file_url)
Hyprland.dispatch("keyword cursor:no_warps false") Hyprland.dispatch("hl.config({cursor = {no_warps = false}})")
} }
} }
MenuButton { MenuButton {
@@ -160,9 +160,9 @@ Button {
enabled: root.imageData.source && root.imageData.source.length > 0 enabled: root.imageData.source && root.imageData.source.length > 0
onClicked: { onClicked: {
root.showActions = false root.showActions = false
Hyprland.dispatch("keyword cursor:no_warps true") Hyprland.dispatch("hl.config({cursor = {no_warps = true}})")
Qt.openUrlExternally(root.imageData.source) Qt.openUrlExternally(root.imageData.source)
Hyprland.dispatch("keyword cursor:no_warps false") Hyprland.dispatch("hl.config({cursor = {no_warps = false}})")
} }
} }
MenuButton { MenuButton {
@@ -268,7 +268,7 @@ Item {
toggled: false toggled: false
buttonIcon: "restart_alt" buttonIcon: "restart_alt"
onClicked: { onClicked: {
Hyprland.dispatch("reload"); Quickshell.execDetached(["hyprctl", "reload"])
Quickshell.reload(true); Quickshell.reload(true);
} }
StyledToolTip { StyledToolTip {
@@ -186,7 +186,7 @@ Rectangle {
} else { } else {
root.draggingWindow = false; root.draggingWindow = false;
if (root.hoveredWorkspace !== null && root.hoveredWorkspace.workspace !== windowItem.hyprlandClient.workspace.id) { if (root.hoveredWorkspace !== null && root.hoveredWorkspace.workspace !== windowItem.hyprlandClient.workspace.id) {
Hyprland.dispatch(`movetoworkspacesilent ${root.hoveredWorkspace.workspace}, address:${windowItem.hyprlandClient.address}`); Hyprland.dispatch(`hl.dsp.window.move({ workspace = ${root.hoveredWorkspace.workspace}, follow = false, window = "address:${windowItem.hyprlandClient.address}" })`)
} else { } else {
windowItem.openedX = 0; windowItem.openedX = 0;
windowItem.openedY = 0; windowItem.openedY = 0;
@@ -292,7 +292,7 @@ Rectangle {
onClicked: { onClicked: {
GlobalStates.overviewOpen = false; GlobalStates.overviewOpen = false;
root.closed(); // Close immediately to avoid weird animations root.closed(); // Close immediately to avoid weird animations
Hyprland.dispatch(`workspace ${workspaceItem.workspace}`); Hyprland.dispatch(`hl.dsp.focus({workspace = ${workspaceItem.workspace}})`);
} }
} }
} }
@@ -62,14 +62,14 @@ WMouseAreaButton {
} }
function closeWindow() { function closeWindow() {
Hyprland.dispatch(`closewindow address:${root.hyprlandClient?.address}`); Hyprland.dispatch(`hl.dsp.window.close({window = "address:${root.hyprlandClient?.address}"})`)
} }
acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
onClicked: event => { onClicked: event => {
if (event.button === Qt.LeftButton) { if (event.button === Qt.LeftButton) {
GlobalStates.overviewOpen = false; GlobalStates.overviewOpen = false;
Hyprland.dispatch(`focuswindow address:${root.hyprlandClient?.address}`); Hyprland.dispatch(`hl.dsp.focus({window = "address:${root.hyprlandClient?.address}"})`)
GlobalStates.overviewOpen = false; GlobalStates.overviewOpen = false;
} else if (event.button === Qt.MiddleButton) { } else if (event.button === Qt.MiddleButton) {
root.closeWindow(); root.closeWindow();
@@ -143,7 +143,7 @@ WMouseAreaButton {
icon.name: isPinned ? "checkmark" : "empty" icon.name: isPinned ? "checkmark" : "empty"
text: Translation.tr("Show this window on all desktops") text: Translation.tr("Show this window on all desktops")
onTriggered: { onTriggered: {
Hyprland.dispatch(`pin address:${root.hyprlandClient?.address}`); Hyprland.dispatch(`hl.dsp.window.pin({window = "address:${root.hyprlandClient?.address}"})`);
} }
} }
Action { Action {
@@ -109,7 +109,7 @@ Singleton {
{ {
action: "wallpaper", action: "wallpaper",
execute: () => { execute: () => {
Hyprland.dispatch("global quickshell:wallpaperSelectorToggle") Hyprland.dispatch(`hl.dsp.global("quickshell:wallpaperSelectorToggle")`)
} }
}, },
{ {
@@ -12,8 +12,8 @@ float overlayOpacityForBrightness(float x) {
// float y = pow(x, 2.0) * 0.75; // float y = pow(x, 2.0) * 0.75;
// float y = (1.0 - exp(-x))*1.15; // float y = (1.0 - exp(-x))*1.15;
// float y = (1.0 - exp(-pow((x-0.15), 0.6)))*1.18; // float y = (1.0 - exp(-pow((x-0.15), 0.6)))*1.18;
float y = x*0.75;
float y = x*0.75;
return min(max(y, 0.001), 1.0); return min(max(y, 0.001), 1.0);
} }