add full proj
This commit is contained in:
54
widgets/Workspaces.qml
Normal file
54
widgets/Workspaces.qml
Normal file
@@ -0,0 +1,54 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.I3
|
||||
import "../config"
|
||||
|
||||
// Sway/i3 workspace switcher for a single monitor.
|
||||
Row {
|
||||
id: root
|
||||
required property var screen // ShellScreen this bar lives on
|
||||
spacing: Theme.gap
|
||||
|
||||
// Name of the i3/sway output this bar is on, used to filter workspaces.
|
||||
readonly property string monitorName: screen ? screen.name : ""
|
||||
|
||||
Repeater {
|
||||
model: I3.workspaces
|
||||
|
||||
Rectangle {
|
||||
id: chip
|
||||
required property var modelData
|
||||
// only show workspaces belonging to this monitor
|
||||
// I3Workspace.monitor is an I3Monitor object, so compare its name
|
||||
visible: modelData.monitor && modelData.monitor.name === root.monitorName
|
||||
width: visible ? Math.max(height, label.implicitWidth + 16) : 0
|
||||
height: Theme.barHeight - Theme.gap * 2
|
||||
radius: Theme.radius
|
||||
|
||||
readonly property bool isFocused: modelData.focused
|
||||
readonly property bool isUrgent: modelData.urgent
|
||||
|
||||
color: isUrgent ? Theme.red
|
||||
: isFocused ? Theme.blue
|
||||
: modelData.active ? Theme.surface1
|
||||
: Theme.surface0
|
||||
|
||||
Text {
|
||||
id: label
|
||||
anchors.centerIn: parent
|
||||
text: chip.modelData.name
|
||||
font.family: Theme.font
|
||||
font.pixelSize: Theme.fontSize
|
||||
font.bold: chip.isFocused || chip.isUrgent
|
||||
color: (chip.isFocused || chip.isUrgent) ? Theme.mantle : Theme.text
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: chip.modelData.activate()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user