internal: windowinfo pass in client
So it can be used for clients other than the active one Also fix text below screencopyview
This commit is contained in:
parent
b264ae9888
commit
bed6f7c5d5
5 changed files with 43 additions and 32 deletions
|
|
@ -86,6 +86,7 @@ Item {
|
|||
|
||||
sourceComponent: WindowInfo {
|
||||
screen: root.screen
|
||||
client: Hyprland.activeToplevel
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import QtQuick.Layouts
|
|||
ColumnLayout {
|
||||
id: root
|
||||
|
||||
required property var client
|
||||
property bool moveToWsExpanded
|
||||
|
||||
anchors.fill: parent
|
||||
|
|
@ -78,7 +79,7 @@ ColumnLayout {
|
|||
Button {
|
||||
required property int index
|
||||
readonly property int wsId: Math.floor((Hyprland.activeWsId - 1) / 10) * 10 + index + 1
|
||||
readonly property bool isCurrent: Hyprland.activeToplevel?.workspace.id === wsId
|
||||
readonly property bool isCurrent: root.client?.workspace.id === wsId
|
||||
|
||||
color: isCurrent ? Colours.palette.m3surfaceContainerHighest : Colours.palette.m3tertiaryContainer
|
||||
onColor: isCurrent ? Colours.palette.m3onSurface : Colours.palette.m3onTertiaryContainer
|
||||
|
|
@ -86,7 +87,7 @@ ColumnLayout {
|
|||
disabled: isCurrent
|
||||
|
||||
function onClicked(): void {
|
||||
Hyprland.dispatch(`movetoworkspace ${wsId},address:0x${Hyprland.activeToplevel?.address}`);
|
||||
Hyprland.dispatch(`movetoworkspace ${wsId},address:0x${root.client?.address}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -107,20 +108,20 @@ ColumnLayout {
|
|||
Layout.rightMargin: Appearance.padding.large
|
||||
Layout.bottomMargin: Appearance.padding.large
|
||||
|
||||
spacing: Hyprland.activeToplevel?.lastIpcObject.floating ? Appearance.spacing.normal : Appearance.spacing.small
|
||||
spacing: root.client?.lastIpcObject.floating ? Appearance.spacing.normal : Appearance.spacing.small
|
||||
|
||||
Button {
|
||||
color: Colours.palette.m3secondaryContainer
|
||||
onColor: Colours.palette.m3onSecondaryContainer
|
||||
text: Hyprland.activeToplevel?.lastIpcObject.floating ? qsTr("Tile") : qsTr("Float")
|
||||
text: root.client?.lastIpcObject.floating ? qsTr("Tile") : qsTr("Float")
|
||||
|
||||
function onClicked(): void {
|
||||
Hyprland.dispatch(`togglefloating address:0x${Hyprland.activeToplevel?.address}`);
|
||||
Hyprland.dispatch(`togglefloating address:0x${root.client?.address}`);
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
active: Hyprland.activeToplevel?.lastIpcObject.floating
|
||||
active: root.client?.lastIpcObject.floating
|
||||
asynchronous: true
|
||||
Layout.fillWidth: active
|
||||
Layout.leftMargin: active ? 0 : -parent.spacing
|
||||
|
|
@ -129,10 +130,10 @@ ColumnLayout {
|
|||
sourceComponent: Button {
|
||||
color: Colours.palette.m3secondaryContainer
|
||||
onColor: Colours.palette.m3onSecondaryContainer
|
||||
text: Hyprland.activeToplevel?.lastIpcObject.pinned ? qsTr("Unpin") : qsTr("Pin")
|
||||
text: root.client?.lastIpcObject.pinned ? qsTr("Unpin") : qsTr("Pin")
|
||||
|
||||
function onClicked(): void {
|
||||
Hyprland.dispatch(`pin address:0x${Hyprland.activeToplevel?.address}`);
|
||||
Hyprland.dispatch(`pin address:0x${root.client?.address}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -143,7 +144,7 @@ ColumnLayout {
|
|||
text: qsTr("Kill")
|
||||
|
||||
function onClicked(): void {
|
||||
Hyprland.dispatch(`movetoworkspace ${wsId},address:0x${Hyprland.activeToplevel?.address}`);
|
||||
Hyprland.dispatch(`movetoworkspace ${wsId},address:0x${root.client?.address}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,22 @@
|
|||
import "root:/widgets"
|
||||
import "root:/services"
|
||||
import "root:/config"
|
||||
import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
|
||||
required property HyprlandToplevel client
|
||||
|
||||
anchors.fill: parent
|
||||
spacing: Appearance.spacing.small
|
||||
|
||||
Label {
|
||||
Layout.topMargin: Appearance.padding.large * 2
|
||||
|
||||
text: Hyprland.activeToplevel?.title ?? qsTr("No active client")
|
||||
text: root.client?.title ?? qsTr("No active client")
|
||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||
|
||||
font.pointSize: Appearance.font.size.large
|
||||
|
|
@ -22,7 +24,7 @@ ColumnLayout {
|
|||
}
|
||||
|
||||
Label {
|
||||
text: Hyprland.activeToplevel?.lastIpcObject.class ?? qsTr("No active client")
|
||||
text: root.client?.lastIpcObject.class ?? qsTr("No active client")
|
||||
color: Colours.palette.m3tertiary
|
||||
|
||||
font.pointSize: Appearance.font.size.larger
|
||||
|
|
@ -41,31 +43,31 @@ ColumnLayout {
|
|||
|
||||
Detail {
|
||||
icon: "location_on"
|
||||
text: qsTr("Address: %1").arg(`0x${Hyprland.activeToplevel?.address}` ?? "unknown")
|
||||
text: qsTr("Address: %1").arg(`0x${root.client?.address}` ?? "unknown")
|
||||
color: Colours.palette.m3primary
|
||||
}
|
||||
|
||||
Detail {
|
||||
icon: "location_searching"
|
||||
text: qsTr("Position: %1, %2").arg(Hyprland.activeToplevel?.lastIpcObject.at[0] ?? -1).arg(Hyprland.activeToplevel?.lastIpcObject.at[1] ?? -1)
|
||||
text: qsTr("Position: %1, %2").arg(root.client?.lastIpcObject.at[0] ?? -1).arg(root.client?.lastIpcObject.at[1] ?? -1)
|
||||
}
|
||||
|
||||
Detail {
|
||||
icon: "resize"
|
||||
text: qsTr("Size: %1 x %2").arg(Hyprland.activeToplevel?.lastIpcObject.size[0] ?? -1).arg(Hyprland.activeToplevel?.lastIpcObject.size[1] ?? -1)
|
||||
text: qsTr("Size: %1 x %2").arg(root.client?.lastIpcObject.size[0] ?? -1).arg(root.client?.lastIpcObject.size[1] ?? -1)
|
||||
color: Colours.palette.m3tertiary
|
||||
}
|
||||
|
||||
Detail {
|
||||
icon: "workspaces"
|
||||
text: qsTr("Workspace: %1 (%2)").arg(Hyprland.activeToplevel?.workspace.name ?? -1).arg(Hyprland.activeToplevel?.workspace.id ?? -1)
|
||||
text: qsTr("Workspace: %1 (%2)").arg(root.client?.workspace.name ?? -1).arg(root.client?.workspace.id ?? -1)
|
||||
color: Colours.palette.m3secondary
|
||||
}
|
||||
|
||||
Detail {
|
||||
icon: "desktop_windows"
|
||||
text: {
|
||||
const mon = Hyprland.activeToplevel?.monitor;
|
||||
const mon = root.client?.monitor;
|
||||
if (mon)
|
||||
return qsTr("Monitor: %1 (%2) at %3, %4").arg(mon.name).arg(mon.id).arg(mon.x).arg(mon.y);
|
||||
return qsTr("Monitor: unknown");
|
||||
|
|
@ -74,42 +76,42 @@ ColumnLayout {
|
|||
|
||||
Detail {
|
||||
icon: "page_header"
|
||||
text: qsTr("Initial title: %1").arg(Hyprland.activeToplevel?.lastIpcObject.initialTitle ?? "unknown")
|
||||
text: qsTr("Initial title: %1").arg(root.client?.lastIpcObject.initialTitle ?? "unknown")
|
||||
color: Colours.palette.m3tertiary
|
||||
}
|
||||
|
||||
Detail {
|
||||
icon: "category"
|
||||
text: qsTr("Initial class: %1").arg(Hyprland.activeToplevel?.lastIpcObject.initialClass ?? "unknown")
|
||||
text: qsTr("Initial class: %1").arg(root.client?.lastIpcObject.initialClass ?? "unknown")
|
||||
}
|
||||
|
||||
Detail {
|
||||
icon: "account_tree"
|
||||
text: qsTr("Process id: %1").arg(Hyprland.activeToplevel?.lastIpcObject.pid ?? -1)
|
||||
text: qsTr("Process id: %1").arg(root.client?.lastIpcObject.pid ?? -1)
|
||||
color: Colours.palette.m3primary
|
||||
}
|
||||
|
||||
Detail {
|
||||
icon: "picture_in_picture_center"
|
||||
text: qsTr("Floating: %1").arg(Hyprland.activeToplevel?.lastIpcObject.floating ? "yes" : "no")
|
||||
text: qsTr("Floating: %1").arg(root.client?.lastIpcObject.floating ? "yes" : "no")
|
||||
color: Colours.palette.m3secondary
|
||||
}
|
||||
|
||||
Detail {
|
||||
icon: "gradient"
|
||||
text: qsTr("Xwayland: %1").arg(Hyprland.activeToplevel?.lastIpcObject.xwayland ? "yes" : "no")
|
||||
text: qsTr("Xwayland: %1").arg(root.client?.lastIpcObject.xwayland ? "yes" : "no")
|
||||
}
|
||||
|
||||
Detail {
|
||||
icon: "keep"
|
||||
text: qsTr("Pinned: %1").arg(Hyprland.activeToplevel?.lastIpcObject.pinned ? "yes" : "no")
|
||||
text: qsTr("Pinned: %1").arg(root.client?.lastIpcObject.pinned ? "yes" : "no")
|
||||
color: Colours.palette.m3secondary
|
||||
}
|
||||
|
||||
Detail {
|
||||
icon: "fullscreen"
|
||||
text: {
|
||||
const fs = Hyprland.activeToplevel?.lastIpcObject.fullscreen;
|
||||
const fs = root.client?.lastIpcObject.fullscreen;
|
||||
if (fs)
|
||||
return qsTr("Fullscreen state: %1").arg(fs == 0 ? "off" : fs == 1 ? "maximised" : "on");
|
||||
return qsTr("Fullscreen state: unknown");
|
||||
|
|
|
|||
|
|
@ -4,9 +4,8 @@ import "root:/widgets"
|
|||
import "root:/services"
|
||||
import "root:/config"
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Widgets
|
||||
import Quickshell.Hyprland
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
|
|
@ -14,6 +13,7 @@ Item {
|
|||
id: root
|
||||
|
||||
required property ShellScreen screen
|
||||
required property HyprlandToplevel client
|
||||
|
||||
Layout.preferredWidth: preview.implicitWidth + Appearance.padding.large * 2
|
||||
Layout.fillHeight: true
|
||||
|
|
@ -34,7 +34,7 @@ Item {
|
|||
|
||||
Loader {
|
||||
anchors.centerIn: parent
|
||||
active: !Hyprland.activeToplevel
|
||||
active: !root.client
|
||||
asynchronous: true
|
||||
|
||||
sourceComponent: ColumnLayout {
|
||||
|
|
@ -69,10 +69,10 @@ Item {
|
|||
|
||||
anchors.centerIn: parent
|
||||
|
||||
captureSource: Hyprland.activeToplevel?.wayland ?? null
|
||||
captureSource: root.client?.wayland ?? null
|
||||
live: true
|
||||
|
||||
constraintSize.width: parent.height * Math.min(root.screen.width / root.screen.height, Hyprland.activeToplevel?.lastIpcObject.size[0] / Hyprland.activeToplevel?.lastIpcObject.size[1])
|
||||
constraintSize.width: parent.height * Math.min(root.screen.width / root.screen.height, root.client?.lastIpcObject.size[0] / root.client?.lastIpcObject.size[1])
|
||||
constraintSize.height: parent.height
|
||||
}
|
||||
}
|
||||
|
|
@ -86,12 +86,12 @@ Item {
|
|||
|
||||
animate: true
|
||||
text: {
|
||||
const client = Hyprland.activeToplevel;
|
||||
const client = root.client;
|
||||
if (!client)
|
||||
return qsTr("No active client");
|
||||
|
||||
const mon = client.monitor;
|
||||
return qsTr("%1 on monitor %2 at %3, %4").arg(client.title).arg(mon.name).arg(client.x).arg(client.y);
|
||||
return qsTr("%1 on monitor %2 at %3, %4").arg(client.title).arg(mon.name).arg(client.lastIpcObject.at[0]).arg(client.lastIpcObject.at[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import "root:/widgets"
|
|||
import "root:/services"
|
||||
import "root:/config"
|
||||
import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
|
|
@ -9,6 +10,7 @@ Item {
|
|||
id: root
|
||||
|
||||
required property ShellScreen screen
|
||||
required property HyprlandToplevel client
|
||||
|
||||
implicitWidth: child.implicitWidth
|
||||
implicitHeight: screen.height * Config.winfo.sizes.heightMult
|
||||
|
|
@ -23,6 +25,7 @@ Item {
|
|||
|
||||
Preview {
|
||||
screen: root.screen
|
||||
client: root.client
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
|
|
@ -38,7 +41,9 @@ Item {
|
|||
color: Colours.palette.m3surfaceContainer
|
||||
radius: Appearance.rounding.normal
|
||||
|
||||
Details {}
|
||||
Details {
|
||||
client: root.client
|
||||
}
|
||||
}
|
||||
|
||||
StyledRect {
|
||||
|
|
@ -50,6 +55,8 @@ Item {
|
|||
|
||||
Buttons {
|
||||
id: buttons
|
||||
|
||||
client: root.client
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue