mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 23:09:26 -05:00
overview: middle click to close
This commit is contained in:
@@ -18,6 +18,7 @@ Scope {
|
||||
PanelWindow {
|
||||
id: root
|
||||
property var modelData
|
||||
property string searchingText: ""
|
||||
screen: modelData
|
||||
visible: GlobalStates.overviewOpen
|
||||
|
||||
@@ -70,7 +71,7 @@ Scope {
|
||||
|
||||
Keys.onPressed: (event) => {
|
||||
if (event.key === Qt.Key_Escape) {
|
||||
sessionRoot.visible = false;
|
||||
GlobalStates.overviewOpen = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +80,41 @@ Scope {
|
||||
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 {
|
||||
visible: (root.searchingText == "")
|
||||
bar: root
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,12 +92,10 @@ Item {
|
||||
}
|
||||
|
||||
Repeater { // Window repeater
|
||||
model: ScriptModel {
|
||||
values: windowAddresses.filter((address) => {
|
||||
var win = windowByAddress[address]
|
||||
return (win?.workspace?.id === workspace.workspaceValue)
|
||||
})
|
||||
}
|
||||
model: windowAddresses.filter((address) => {
|
||||
var win = windowByAddress[address]
|
||||
return (win?.workspace?.id === workspace.workspaceValue)
|
||||
})
|
||||
delegate: OverviewWindow {
|
||||
windowData: windowByAddress[modelData]
|
||||
monitorData: root.monitorData
|
||||
|
||||
@@ -80,12 +80,16 @@ Rectangle { // Window
|
||||
onExited: root.hovered = false
|
||||
onPressed: root.pressed = true
|
||||
onReleased: root.pressed = false
|
||||
acceptedButtons: Qt.LeftButton | Qt.MiddleButton
|
||||
onClicked: (event) => {
|
||||
if (windowData) {
|
||||
if (!windowData) return;
|
||||
|
||||
if (event.button === Qt.LeftButton) {
|
||||
closeOverview.running = true
|
||||
Hyprland.dispatch(`keyword cursor:no_warps true`)
|
||||
Hyprland.dispatch(`focuswindow address:${windowData.address}`)
|
||||
Hyprland.dispatch(`keyword cursor:no_warps false`)
|
||||
Hyprland.dispatch(`workspace ${windowData.workspace.id}`)
|
||||
event.accepted = true
|
||||
} else if (event.button === Qt.MiddleButton) {
|
||||
Hyprland.dispatch(`closewindow address:${windowData.address}`)
|
||||
event.accepted = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,6 +275,7 @@ Item {
|
||||
color: activeFocus ? Appearance.m3colors.m3onSurface : Appearance.m3colors.m3onSurfaceVariant
|
||||
selectedTextColor: Appearance.m3colors.m3onSurface
|
||||
placeholderText: "Task description"
|
||||
placeholderTextColor: Appearance.m3colors.m3outline
|
||||
focus: root.showAddDialog
|
||||
onAccepted: dialog.addTask()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user