Made the bar scaling relative and ia a config file
This commit is contained in:
@@ -3,12 +3,13 @@ import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
import Quickshell.Io
|
||||
import "../../../colors"
|
||||
import "../../../config"
|
||||
|
||||
Row { // Workspace Row
|
||||
id: workspacesRow
|
||||
|
||||
required property HyprlandMonitor thisMonitor
|
||||
spacing: 8
|
||||
spacing: Math.floor(bar.height/4)
|
||||
|
||||
// Get infos of Type Unknown
|
||||
// Repeater {
|
||||
@@ -31,16 +32,20 @@ Row { // Workspace Row
|
||||
active: modelData.monitor === thisMonitor
|
||||
sourceComponent: Rectangle { //workspace
|
||||
// visible: modelData.monitor === thisMonitor
|
||||
width: (workspaceNum.width + 16) < (workspaceNum.height + 8) ? workspaceNum.height + 8 : workspaceNum.width + 16
|
||||
height: workspaceNum.height + 8
|
||||
radius: 4
|
||||
color: workspaceButton.containsMouse ? Colors.tertiaryContainer
|
||||
: modelData.active ? Colors.primaryContainer
|
||||
: Colors.secondaryContainer
|
||||
border.color: workspaceButton.containsMouse ? Colors.tertiaryContainer_fg
|
||||
: modelData.active ? Colors.primaryContainer_fg
|
||||
: Colors.secondaryContainer_fg
|
||||
border.width: 2
|
||||
width: Math.max(workspaceNum.width + workspaceText.width+Config.spacing*2, bar.height)
|
||||
height: workspaceNum.height + Config.spacing
|
||||
radius: Config.small_radius
|
||||
color: (
|
||||
workspaceButton.containsMouse ? Colors.tertiaryContainer :
|
||||
modelData.active ? Colors.primaryContainer :
|
||||
Colors.secondaryContainer
|
||||
)
|
||||
border.color: (
|
||||
workspaceButton.containsMouse ? Colors.tertiaryContainer_fg :
|
||||
modelData.active ? Colors.primaryContainer_fg :
|
||||
Colors.secondaryContainer_fg
|
||||
)
|
||||
border.width: Config.border_width
|
||||
|
||||
MouseArea {
|
||||
id: workspaceButton
|
||||
@@ -48,23 +53,39 @@ Row { // Workspace Row
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
anchors.fill: parent
|
||||
onClicked: Hyprland.dispatch("workspace " + modelData.id)
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: "transparent"
|
||||
radius: 6
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
id: workspaceRow
|
||||
anchors.centerIn: parent
|
||||
spacing: Math.floor(bar.height/8)
|
||||
leftPadding: Math.floor(bar.height/4)
|
||||
|
||||
Text {
|
||||
id: workspaceNum
|
||||
text: modelData.id
|
||||
anchors.centerIn: parent
|
||||
color: workspaceButton.containsMouse ? Colors.tertiary
|
||||
: modelData.active ? Colors.primary
|
||||
: Colors.secondary
|
||||
font.pixelSize: 18
|
||||
font.family: "Inter, sans-serif"
|
||||
Text {
|
||||
id: workspaceNum
|
||||
text: modelData.id
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: workspaceButton.containsMouse ? Colors.tertiary
|
||||
: modelData.active ? Colors.primary
|
||||
: Colors.secondary
|
||||
|
||||
font.pixelSize: Config.medium_scaling(bar.height)*1.2
|
||||
font.family: Config.font
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
Text {
|
||||
id: workspaceText
|
||||
text: ""
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: workspaceButton.containsMouse ? Colors.tertiary
|
||||
: modelData.active ? Colors.primary
|
||||
: Colors.secondary
|
||||
|
||||
font.pixelSize: Config.medium_scaling(bar.height)
|
||||
font.family: Config.font
|
||||
font.letterSpacing: Math.floor(Config.medium_scaling(bar.height) * (2 / 3))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
@@ -74,14 +95,14 @@ Row { // Workspace Row
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
workspaceNum.text = this.text
|
||||
workspaceText.text = this.text
|
||||
// console.log("workspaceScript output:", this.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: 1000
|
||||
interval: Config.fast_reload_interval
|
||||
running: true
|
||||
repeat: true
|
||||
onTriggered: workspaceContent.running = true
|
||||
@@ -94,6 +115,6 @@ Row { // Workspace Row
|
||||
visible: Hyprland.workspaces.length === 0
|
||||
text: "No Workspaces"
|
||||
color: Colors.error
|
||||
font.pixelSize: 18
|
||||
font.pixelSize: Config.big_font_size(bar.height)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user