mirror of
https://github.com/belsabbagh/dotfiles.git
synced 2026-04-11 09:36:46 +00:00
quickshell and hyprland additions
This commit is contained in:
180
.config/quickshell/caelestia/modules/windowinfo/Buttons.qml
Normal file
180
.config/quickshell/caelestia/modules/windowinfo/Buttons.qml
Normal file
@@ -0,0 +1,180 @@
|
||||
import qs.components
|
||||
import qs.services
|
||||
import qs.config
|
||||
import Quickshell.Widgets
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
|
||||
required property var client
|
||||
property bool moveToWsExpanded
|
||||
|
||||
anchors.fill: parent
|
||||
spacing: Appearance.spacing.small
|
||||
|
||||
RowLayout {
|
||||
Layout.topMargin: Appearance.padding.large
|
||||
Layout.leftMargin: Appearance.padding.large
|
||||
Layout.rightMargin: Appearance.padding.large
|
||||
|
||||
spacing: Appearance.spacing.normal
|
||||
|
||||
StyledText {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Move to workspace")
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
StyledRect {
|
||||
color: Colours.palette.m3primary
|
||||
radius: Appearance.rounding.small
|
||||
|
||||
implicitWidth: moveToWsIcon.implicitWidth + Appearance.padding.small * 2
|
||||
implicitHeight: moveToWsIcon.implicitHeight + Appearance.padding.small
|
||||
|
||||
StateLayer {
|
||||
color: Colours.palette.m3onPrimary
|
||||
|
||||
function onClicked(): void {
|
||||
root.moveToWsExpanded = !root.moveToWsExpanded;
|
||||
}
|
||||
}
|
||||
|
||||
MaterialIcon {
|
||||
id: moveToWsIcon
|
||||
|
||||
anchors.centerIn: parent
|
||||
|
||||
animate: true
|
||||
text: root.moveToWsExpanded ? "expand_more" : "keyboard_arrow_right"
|
||||
color: Colours.palette.m3onPrimary
|
||||
font.pointSize: Appearance.font.size.large
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WrapperItem {
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: Appearance.padding.large * 2
|
||||
Layout.rightMargin: Appearance.padding.large * 2
|
||||
|
||||
Layout.preferredHeight: root.moveToWsExpanded ? implicitHeight : 0
|
||||
clip: true
|
||||
|
||||
topMargin: Appearance.spacing.normal
|
||||
bottomMargin: Appearance.spacing.normal
|
||||
|
||||
GridLayout {
|
||||
id: wsGrid
|
||||
|
||||
rowSpacing: Appearance.spacing.smaller
|
||||
columnSpacing: Appearance.spacing.normal
|
||||
columns: 5
|
||||
|
||||
Repeater {
|
||||
model: 10
|
||||
|
||||
Button {
|
||||
required property int index
|
||||
readonly property int wsId: Math.floor((Hypr.activeWsId - 1) / 10) * 10 + index + 1
|
||||
readonly property bool isCurrent: root.client?.workspace.id === wsId
|
||||
|
||||
color: isCurrent ? Colours.tPalette.m3surfaceContainerHighest : Colours.palette.m3tertiaryContainer
|
||||
onColor: isCurrent ? Colours.palette.m3onSurface : Colours.palette.m3onTertiaryContainer
|
||||
text: wsId
|
||||
disabled: isCurrent
|
||||
|
||||
function onClicked(): void {
|
||||
Hypr.dispatch(`movetoworkspace ${wsId},address:0x${root.client?.address}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on Layout.preferredHeight {
|
||||
Anim {}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: Appearance.padding.large
|
||||
Layout.rightMargin: Appearance.padding.large
|
||||
Layout.bottomMargin: Appearance.padding.large
|
||||
|
||||
spacing: root.client?.lastIpcObject.floating ? Appearance.spacing.normal : Appearance.spacing.small
|
||||
|
||||
Button {
|
||||
color: Colours.palette.m3secondaryContainer
|
||||
onColor: Colours.palette.m3onSecondaryContainer
|
||||
text: root.client?.lastIpcObject.floating ? qsTr("Tile") : qsTr("Float")
|
||||
|
||||
function onClicked(): void {
|
||||
Hypr.dispatch(`togglefloating address:0x${root.client?.address}`);
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
active: root.client?.lastIpcObject.floating
|
||||
Layout.fillWidth: active
|
||||
Layout.leftMargin: active ? 0 : -parent.spacing
|
||||
Layout.rightMargin: active ? 0 : -parent.spacing
|
||||
|
||||
sourceComponent: Button {
|
||||
color: Colours.palette.m3secondaryContainer
|
||||
onColor: Colours.palette.m3onSecondaryContainer
|
||||
text: root.client?.lastIpcObject.pinned ? qsTr("Unpin") : qsTr("Pin")
|
||||
|
||||
function onClicked(): void {
|
||||
Hypr.dispatch(`pin address:0x${root.client?.address}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
color: Colours.palette.m3errorContainer
|
||||
onColor: Colours.palette.m3onErrorContainer
|
||||
text: qsTr("Kill")
|
||||
|
||||
function onClicked(): void {
|
||||
Hypr.dispatch(`killwindow address:0x${root.client?.address}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
component Button: StyledRect {
|
||||
property color onColor: Colours.palette.m3onSurface
|
||||
property alias disabled: stateLayer.disabled
|
||||
property alias text: label.text
|
||||
|
||||
function onClicked(): void {
|
||||
}
|
||||
|
||||
radius: Appearance.rounding.small
|
||||
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: label.implicitHeight + Appearance.padding.small * 2
|
||||
|
||||
StateLayer {
|
||||
id: stateLayer
|
||||
|
||||
color: parent.onColor
|
||||
|
||||
function onClicked(): void {
|
||||
parent.onClicked();
|
||||
}
|
||||
}
|
||||
|
||||
StyledText {
|
||||
id: label
|
||||
|
||||
anchors.centerIn: parent
|
||||
|
||||
animate: true
|
||||
color: parent.onColor
|
||||
font.pointSize: Appearance.font.size.normal
|
||||
}
|
||||
}
|
||||
}
|
||||
164
.config/quickshell/caelestia/modules/windowinfo/Details.qml
Normal file
164
.config/quickshell/caelestia/modules/windowinfo/Details.qml
Normal file
@@ -0,0 +1,164 @@
|
||||
import qs.components
|
||||
import qs.services
|
||||
import qs.config
|
||||
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: root.client?.title ?? qsTr("No active client")
|
||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||
|
||||
font.pointSize: Appearance.font.size.large
|
||||
font.weight: 500
|
||||
}
|
||||
|
||||
Label {
|
||||
text: root.client?.lastIpcObject.class ?? qsTr("No active client")
|
||||
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(`0x${root.client?.address}` ?? "unknown")
|
||||
color: Colours.palette.m3primary
|
||||
}
|
||||
|
||||
Detail {
|
||||
icon: "location_searching"
|
||||
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(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(root.client?.workspace.name ?? -1).arg(root.client?.workspace.id ?? -1)
|
||||
color: Colours.palette.m3secondary
|
||||
}
|
||||
|
||||
Detail {
|
||||
icon: "desktop_windows"
|
||||
text: {
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
Detail {
|
||||
icon: "page_header"
|
||||
text: qsTr("Initial title: %1").arg(root.client?.lastIpcObject.initialTitle ?? "unknown")
|
||||
color: Colours.palette.m3tertiary
|
||||
}
|
||||
|
||||
Detail {
|
||||
icon: "category"
|
||||
text: qsTr("Initial class: %1").arg(root.client?.lastIpcObject.initialClass ?? "unknown")
|
||||
}
|
||||
|
||||
Detail {
|
||||
icon: "account_tree"
|
||||
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(root.client?.lastIpcObject.floating ? "yes" : "no")
|
||||
color: Colours.palette.m3secondary
|
||||
}
|
||||
|
||||
Detail {
|
||||
icon: "gradient"
|
||||
text: qsTr("Xwayland: %1").arg(root.client?.lastIpcObject.xwayland ? "yes" : "no")
|
||||
}
|
||||
|
||||
Detail {
|
||||
icon: "keep"
|
||||
text: qsTr("Pinned: %1").arg(root.client?.lastIpcObject.pinned ? "yes" : "no")
|
||||
color: Colours.palette.m3secondary
|
||||
}
|
||||
|
||||
Detail {
|
||||
icon: "fullscreen"
|
||||
text: {
|
||||
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");
|
||||
}
|
||||
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.smaller
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
96
.config/quickshell/caelestia/modules/windowinfo/Preview.qml
Normal file
96
.config/quickshell/caelestia/modules/windowinfo/Preview.qml
Normal file
@@ -0,0 +1,96 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import qs.components
|
||||
import qs.services
|
||||
import qs.config
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Hyprland
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
required property ShellScreen screen
|
||||
required property HyprlandToplevel client
|
||||
|
||||
Layout.preferredWidth: preview.implicitWidth + Appearance.padding.large * 2
|
||||
Layout.fillHeight: true
|
||||
|
||||
StyledClippingRect {
|
||||
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: Colours.tPalette.m3surfaceContainer
|
||||
radius: Appearance.rounding.small
|
||||
|
||||
Loader {
|
||||
anchors.centerIn: parent
|
||||
active: !root.client
|
||||
|
||||
sourceComponent: ColumnLayout {
|
||||
spacing: 0
|
||||
|
||||
MaterialIcon {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
text: "web_asset_off"
|
||||
color: Colours.palette.m3outline
|
||||
font.pointSize: Appearance.font.size.extraLarge * 3
|
||||
}
|
||||
|
||||
StyledText {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
text: qsTr("No active client")
|
||||
color: Colours.palette.m3outline
|
||||
font.pointSize: Appearance.font.size.extraLarge
|
||||
font.weight: 500
|
||||
}
|
||||
|
||||
StyledText {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
text: qsTr("Try switching to a window")
|
||||
color: Colours.palette.m3outline
|
||||
font.pointSize: Appearance.font.size.large
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScreencopyView {
|
||||
id: view
|
||||
|
||||
anchors.centerIn: parent
|
||||
|
||||
captureSource: root.client?.wayland ?? null
|
||||
live: true
|
||||
|
||||
constraintSize.width: root.client ? parent.height * Math.min(root.screen.width / root.screen.height, root.client?.lastIpcObject.size[0] / root.client?.lastIpcObject.size[1]) : parent.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 = 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.lastIpcObject.at[0]).arg(client.lastIpcObject.at[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
import qs.components
|
||||
import qs.services
|
||||
import qs.config
|
||||
import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
required property ShellScreen screen
|
||||
required property HyprlandToplevel client
|
||||
|
||||
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
|
||||
client: root.client
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
spacing: Appearance.spacing.normal
|
||||
|
||||
Layout.preferredWidth: Config.winfo.sizes.detailsWidth
|
||||
Layout.fillHeight: true
|
||||
|
||||
StyledRect {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
color: Colours.tPalette.m3surfaceContainer
|
||||
radius: Appearance.rounding.normal
|
||||
|
||||
Details {
|
||||
client: root.client
|
||||
}
|
||||
}
|
||||
|
||||
StyledRect {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: buttons.implicitHeight
|
||||
|
||||
color: Colours.tPalette.m3surfaceContainer
|
||||
radius: Appearance.rounding.normal
|
||||
|
||||
Buttons {
|
||||
id: buttons
|
||||
|
||||
client: root.client
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user