summaryrefslogtreecommitdiff
path: root/modules/windowinfo
diff options
context:
space:
mode:
Diffstat (limited to 'modules/windowinfo')
-rw-r--r--modules/windowinfo/Details.qml158
-rw-r--r--modules/windowinfo/Preview.qml65
-rw-r--r--modules/windowinfo/WindowInfo.qml45
3 files changed, 268 insertions, 0 deletions
diff --git a/modules/windowinfo/Details.qml b/modules/windowinfo/Details.qml
new file mode 100644
index 0000000..1480f96
--- /dev/null
+++ b/modules/windowinfo/Details.qml
@@ -0,0 +1,158 @@
+import "root:/widgets"
+import "root:/services"
+import "root:/config"
+import Quickshell
+import QtQuick
+import QtQuick.Layouts
+
+ColumnLayout {
+ id: root
+
+ anchors.fill: parent
+ spacing: Appearance.spacing.small
+
+ Label {
+ Layout.topMargin: Appearance.padding.large * 2
+
+ text: Hyprland.activeClient.title
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+
+ font.pointSize: Appearance.font.size.large
+ font.weight: 500
+ }
+
+ Label {
+ text: Hyprland.activeClient.wmClass
+ color: Colours.palette.m3tertiary
+
+ font.pointSize: Appearance.font.size.larger
+ }
+
+ StyledRect {
+ Layout.fillWidth: true
+ Layout.preferredHeight: 1
+ Layout.leftMargin: Appearance.padding.large * 2
+ Layout.rightMargin: Appearance.padding.large * 2
+ Layout.topMargin: Appearance.spacing.normal
+ Layout.bottomMargin: Appearance.spacing.large
+
+ color: Colours.palette.m3secondary
+ }
+
+ Detail {
+ icon: "location_on"
+ text: qsTr("Address: %1").arg(Hyprland.activeClient.address)
+ color: Colours.palette.m3primary
+ }
+
+ Detail {
+ icon: "location_searching"
+ text: qsTr("Position: %1, %2").arg(Hyprland.activeClient.x).arg(Hyprland.activeClient.y)
+ }
+
+ Detail {
+ icon: "resize"
+ text: qsTr("Size: %1 x %2").arg(Hyprland.activeClient.width).arg(Hyprland.activeClient.height)
+ color: Colours.palette.m3tertiary
+ }
+
+ Detail {
+ icon: "workspaces"
+ text: qsTr("Workspace: %1 (%2)").arg(Hyprland.activeClient.workspace.name).arg(Hyprland.activeClient.workspace.id)
+ color: Colours.palette.m3secondary
+ }
+
+ Detail {
+ icon: "desktop_windows"
+ text: {
+ const mon = Hyprland.activeClient.monitor;
+ return qsTr("Monitor: %1 (%2) at %3, %4").arg(mon.name).arg(mon.id).arg(mon.x).arg(mon.y);
+ }
+ }
+
+ Detail {
+ icon: "page_header"
+ text: qsTr("Initial title: %1").arg(Hyprland.activeClient.initialTitle)
+ color: Colours.palette.m3tertiary
+ }
+
+ Detail {
+ icon: "category"
+ text: qsTr("Initial class: %1").arg(Hyprland.activeClient.initialClass)
+ }
+
+ Detail {
+ icon: "account_tree"
+ text: qsTr("Process id: %1").arg(Hyprland.activeClient.pid)
+ color: Colours.palette.m3primary
+ }
+
+ Detail {
+ icon: "picture_in_picture_center"
+ text: qsTr("Floating: %1").arg(Hyprland.activeClient.floating ? "yes" : "no")
+ color: Colours.palette.m3secondary
+ }
+
+ Detail {
+ icon: "gradient"
+ text: qsTr("Xwayland: %1").arg(Hyprland.activeClient.lastIpcObject.xwayland ? "yes" : "no")
+ }
+
+ Detail {
+ icon: "keep"
+ text: qsTr("Pinned: %1").arg(Hyprland.activeClient.pinned ? "yes" : "no")
+ color: Colours.palette.m3secondary
+ }
+
+ Detail {
+ icon: "fullscreen"
+ text: {
+ const fs = Hyprland.activeClient.fullscreen;
+ return qsTr("Fullscreen state: %1").arg(fs == 0 ? "off" : fs == 1 ? "maximised" : "on");
+ }
+ color: Colours.palette.m3tertiary
+ }
+
+ Item {
+ Layout.fillHeight: true
+ }
+
+ component Detail: RowLayout {
+ id: detail
+
+ required property string icon
+ required property string text
+ property alias color: icon.color
+
+ Layout.leftMargin: Appearance.padding.large
+ Layout.rightMargin: Appearance.padding.large
+ Layout.fillWidth: true
+
+ spacing: Appearance.spacing.normal
+
+ MaterialIcon {
+ id: icon
+
+ Layout.alignment: Qt.AlignVCenter
+ text: detail.icon
+ }
+
+ StyledText {
+ Layout.fillWidth: true
+ Layout.alignment: Qt.AlignVCenter
+
+ text: detail.text
+ elide: Text.ElideRight
+ font.pointSize: Appearance.font.size.normal
+ }
+ }
+
+ component Label: StyledText {
+ Layout.leftMargin: Appearance.padding.large
+ Layout.rightMargin: Appearance.padding.large
+ Layout.fillWidth: true
+ elide: Text.ElideRight
+ horizontalAlignment: Text.AlignHCenter
+ animate: true
+ }
+}
diff --git a/modules/windowinfo/Preview.qml b/modules/windowinfo/Preview.qml
new file mode 100644
index 0000000..26941db
--- /dev/null
+++ b/modules/windowinfo/Preview.qml
@@ -0,0 +1,65 @@
+pragma ComponentBehavior: Bound
+
+import "root:/widgets"
+import "root:/services"
+import "root:/config"
+import Quickshell
+import Quickshell.Io
+import Quickshell.Wayland
+import Quickshell.Widgets
+import QtQuick
+import QtQuick.Layouts
+
+Item {
+ id: root
+
+ required property ShellScreen screen
+
+ Layout.preferredWidth: preview.implicitWidth + Appearance.padding.large * 2
+ Layout.fillHeight: true
+
+ ClippingRectangle {
+ id: preview
+
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: parent.top
+ anchors.bottom: label.top
+ anchors.topMargin: Appearance.padding.large
+ anchors.bottomMargin: Appearance.spacing.normal
+
+ implicitWidth: view.implicitWidth
+
+ color: "transparent"
+ radius: Appearance.rounding.small
+
+ ScreencopyView {
+ id: view
+
+ anchors.centerIn: parent
+
+ captureSource: Hyprland.activeClient ? ToplevelManager.activeToplevel : null
+ live: true
+
+ constraintSize.width: parent.height * Math.min(screen.width / screen.height, Hyprland.activeClient.width / Hyprland.activeClient.height)
+ constraintSize.height: parent.height
+ }
+ }
+
+ StyledText {
+ id: label
+
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: Appearance.padding.large
+
+ animate: true
+ text: {
+ const client = Hyprland.activeClient;
+ if (!client)
+ return qsTr("No active client");
+
+ const mon = Hyprland.monitors.values[Hyprland.activeClient.lastIpcObject.monitor];
+ return qsTr("%1 on monitor %2 at %3, %4").arg(client.title).arg(mon.name).arg(client.x).arg(client.y);
+ }
+ }
+}
diff --git a/modules/windowinfo/WindowInfo.qml b/modules/windowinfo/WindowInfo.qml
new file mode 100644
index 0000000..9a5376a
--- /dev/null
+++ b/modules/windowinfo/WindowInfo.qml
@@ -0,0 +1,45 @@
+import "root:/widgets"
+import "root:/services"
+import "root:/config"
+import Quickshell
+import QtQuick
+import QtQuick.Layouts
+
+Item {
+ id: root
+
+ required property ShellScreen screen
+
+ implicitWidth: child.implicitWidth
+ implicitHeight: screen.height * Config.winfo.sizes.heightMult
+
+ RowLayout {
+ id: child
+
+ anchors.fill: parent
+ anchors.margins: Appearance.padding.large
+
+ spacing: Appearance.spacing.normal
+
+ Preview {
+ screen: root.screen
+ }
+
+ ColumnLayout {
+ spacing: Appearance.spacing.normal
+
+ Layout.preferredWidth: Config.winfo.sizes.detailsWidth
+ Layout.fillHeight: true
+
+ StyledRect {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+
+ color: Colours.palette.m3surfaceContainer
+ radius: Appearance.rounding.normal
+
+ Details {}
+ }
+ }
+ }
+}