all repos — quickshell @ 23cfe45d0da045aa3443b9bfcc4a25569bc2538d

A desert-witch desktop shell

bar/modules/Workspaces.qml.old (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
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
import QtQuick
import QtQuick.Controls.Basic
import QtQuick.Layouts
import Quickshell
import Quickshell.I3
import Quickshell.Widgets
import "../classes" as Class
import "../../"

RowLayout {
  spacing: 2*(Size.scale*2.5)
  id: workspaces_module
  property var ws_focused: I3.focusedWorkspace?.number
  Repeater {
    id: workspace_instance
    model: I3.workspaces.values
    Button {
      padding: 0
      MouseArea{
        id: ws_button
        hoverEnabled: true
        anchors.fill: parent
        cursorShape: Qt.PointingHandCursor
        onClicked: I3.dispatch(`workspace number `+ modelData.number);
     }
      background: Rectangle {
        id: workspace_instance_rect
        width: Resources.barsize.topbar
        height: Resources.barsize.topbar
        anchors.centerIn: parent
        color:
          (modelData.name == ws_focused)
          ? Resources.palette.orange
          : ws_button.containsMouse
          ? Resources.palette.altbg
          : Resources.palette.bg

      }
      contentItem: Text {
        id: wsLabel
        property var ws_special: (modelData.number > 10)
        anchors.centerIn: parent
        horizontalAlignment: Text.AlignHCenter
        verticalAlignment: Text.AlignVCenter
        text: ({
          "10": Icons.workspaces.writing,
          "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:
          (ws_special)
          ? font_icon.name
          : font_proggy.name
        font.pixelSize:
          (ws_special)
          ? Resources.fontsize.workspace_icon
          : Resources.fontsize.topbar_text
        renderType: Text.NativeRendering
      }
    }
  }
}