forked from Shinonome/dots-hyprland
overview: middle click to close
This commit is contained in:
@@ -18,6 +18,7 @@ Scope {
|
|||||||
PanelWindow {
|
PanelWindow {
|
||||||
id: root
|
id: root
|
||||||
property var modelData
|
property var modelData
|
||||||
|
property string searchingText: ""
|
||||||
screen: modelData
|
screen: modelData
|
||||||
visible: GlobalStates.overviewOpen
|
visible: GlobalStates.overviewOpen
|
||||||
|
|
||||||
@@ -70,7 +71,7 @@ Scope {
|
|||||||
|
|
||||||
Keys.onPressed: (event) => {
|
Keys.onPressed: (event) => {
|
||||||
if (event.key === Qt.Key_Escape) {
|
if (event.key === Qt.Key_Escape) {
|
||||||
sessionRoot.visible = false;
|
GlobalStates.overviewOpen = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +80,41 @@ Scope {
|
|||||||
width: 1 // Prevent Wayland protocol error
|
width: 1 // Prevent Wayland protocol error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TextField {
|
||||||
|
id: searchInput
|
||||||
|
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
padding: 15
|
||||||
|
color: activeFocus ? Appearance.m3colors.m3onSurface : Appearance.m3colors.m3onSurfaceVariant
|
||||||
|
selectedTextColor: Appearance.m3colors.m3onSurface
|
||||||
|
placeholderText: "Search, calculate or run"
|
||||||
|
placeholderTextColor: Appearance.m3colors.m3outline
|
||||||
|
focus: root.visible
|
||||||
|
|
||||||
|
onTextChanged: root.searchingText = text
|
||||||
|
Connections {
|
||||||
|
target: root
|
||||||
|
function onVisibleChanged() {
|
||||||
|
searchInput.selectAll()
|
||||||
|
root.searchingText = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
background: Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
radius: Appearance.rounding.normal
|
||||||
|
color: Appearance.colors.colLayer0
|
||||||
|
}
|
||||||
|
|
||||||
|
cursorDelegate: Rectangle {
|
||||||
|
width: 1
|
||||||
|
color: searchInput.activeFocus ? Appearance.m3colors.m3primary : "transparent"
|
||||||
|
radius: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
OverviewWidget {
|
OverviewWidget {
|
||||||
|
visible: (root.searchingText == "")
|
||||||
bar: root
|
bar: root
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,12 +92,10 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Repeater { // Window repeater
|
Repeater { // Window repeater
|
||||||
model: ScriptModel {
|
model: windowAddresses.filter((address) => {
|
||||||
values: windowAddresses.filter((address) => {
|
var win = windowByAddress[address]
|
||||||
var win = windowByAddress[address]
|
return (win?.workspace?.id === workspace.workspaceValue)
|
||||||
return (win?.workspace?.id === workspace.workspaceValue)
|
})
|
||||||
})
|
|
||||||
}
|
|
||||||
delegate: OverviewWindow {
|
delegate: OverviewWindow {
|
||||||
windowData: windowByAddress[modelData]
|
windowData: windowByAddress[modelData]
|
||||||
monitorData: root.monitorData
|
monitorData: root.monitorData
|
||||||
|
|||||||
@@ -80,12 +80,16 @@ Rectangle { // Window
|
|||||||
onExited: root.hovered = false
|
onExited: root.hovered = false
|
||||||
onPressed: root.pressed = true
|
onPressed: root.pressed = true
|
||||||
onReleased: root.pressed = false
|
onReleased: root.pressed = false
|
||||||
|
acceptedButtons: Qt.LeftButton | Qt.MiddleButton
|
||||||
onClicked: (event) => {
|
onClicked: (event) => {
|
||||||
if (windowData) {
|
if (!windowData) return;
|
||||||
|
|
||||||
|
if (event.button === Qt.LeftButton) {
|
||||||
closeOverview.running = true
|
closeOverview.running = true
|
||||||
Hyprland.dispatch(`keyword cursor:no_warps true`)
|
Hyprland.dispatch(`workspace ${windowData.workspace.id}`)
|
||||||
Hyprland.dispatch(`focuswindow address:${windowData.address}`)
|
event.accepted = true
|
||||||
Hyprland.dispatch(`keyword cursor:no_warps false`)
|
} else if (event.button === Qt.MiddleButton) {
|
||||||
|
Hyprland.dispatch(`closewindow address:${windowData.address}`)
|
||||||
event.accepted = true
|
event.accepted = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -275,6 +275,7 @@ Item {
|
|||||||
color: activeFocus ? Appearance.m3colors.m3onSurface : Appearance.m3colors.m3onSurfaceVariant
|
color: activeFocus ? Appearance.m3colors.m3onSurface : Appearance.m3colors.m3onSurfaceVariant
|
||||||
selectedTextColor: Appearance.m3colors.m3onSurface
|
selectedTextColor: Appearance.m3colors.m3onSurface
|
||||||
placeholderText: "Task description"
|
placeholderText: "Task description"
|
||||||
|
placeholderTextColor: Appearance.m3colors.m3outline
|
||||||
focus: root.showAddDialog
|
focus: root.showAddDialog
|
||||||
onAccepted: dialog.addTask()
|
onAccepted: dialog.addTask()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user