bar/modules/Workspaces.qml (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
import Quickshell
import QtQuick
import Quickshell.I3
import QtQuick.Controls.Basic
import QtQuick.Layouts
import "../classes" as Class
import "../../"
RowLayout {
spacing: 0
id: workspaces
property var ws_focused: I3.focusedWorkspace?.number
Repeater {
model: I3.workspaces.values
Button {
padding: 2
onClicked: I3.dispatch(`workspace number `+modelData.number);
background: Rectangle {
implicitWidth: 6
implicitHeight: 8
color: (modelData.name == ws_focused) ? Resources.palette.orange : Resources.palette.bg
}
contentItem: Text {
id: wsLabel
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: ({
"11": Icons.workspaces.download,
"12": Icons.workspaces.volume_mixer
})[modelData.name] ?? modelData.name
color: (modelData.name == ws_focused) ? Resources.palette.bg : Resources.palette.fg
font.family: (modelData.name == "11"|| modelData.name == "12") ? font_icon.name : font_proggy.name
font.pixelSize: (modelData.name == "11"|| modelData.name == "12") ? Resources.fontsize.topbar_icon : Resources.fontsize.topbar_text
renderType: Text.NativeRendering
}
}
}
}
|