43 lines
1.3 KiB
QML
43 lines
1.3 KiB
QML
import QtQuick
|
|
import QtQuick.Layouts
|
|
import "../config"
|
|
import "../services"
|
|
|
|
// attwm's layout indicator: "[]=" master, "[M]" monocle, "|||" tabbed. Click
|
|
// cycles forward, right-click back -- dwm's bar binding.
|
|
//
|
|
// Layout is per output, so this shows the monitor the bar is on, not the
|
|
// focused one. Hidden entirely under any other window manager; the `&&` guards
|
|
// short-circuit before Attwm is touched, so the socket is never opened there.
|
|
MouseArea {
|
|
id: root
|
|
required property var screen
|
|
|
|
readonly property var output: Compositor.isAttwm
|
|
? Attwm.outputFor(screen ? screen.name : "")
|
|
: null
|
|
|
|
visible: Compositor.isAttwm && Attwm.connected && !!output
|
|
implicitWidth: pill.implicitWidth
|
|
implicitHeight: pill.implicitHeight
|
|
cursorShape: Qt.PointingHandCursor
|
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
|
|
|
onClicked: event => Attwm.send(event.button === Qt.RightButton
|
|
? "cycle-layout prev"
|
|
: "cycle-layout next")
|
|
|
|
Pill {
|
|
id: pill
|
|
anchors.fill: parent
|
|
|
|
Text {
|
|
text: root.output ? root.output.layout_symbol : ""
|
|
font.family: Theme.monoFont
|
|
font.pixelSize: Theme.fontSize
|
|
color: Theme.subtext
|
|
Layout.alignment: Qt.AlignVCenter
|
|
}
|
|
}
|
|
}
|