forked from Shinonome/dots-hyprland
bar: make groups cleaner
This commit is contained in:
@@ -191,12 +191,10 @@ Scope {
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
spacing: ConfigOptions?.bar.borderless ? 4 : 8
|
spacing: ConfigOptions?.bar.borderless ? 4 : 8
|
||||||
|
|
||||||
RowLayout {
|
BarGroup {
|
||||||
id: leftCenterGroup
|
id: leftCenterGroup
|
||||||
Layout.preferredWidth: barRoot.centerSideModuleWidth
|
Layout.preferredWidth: barRoot.centerSideModuleWidth
|
||||||
spacing: 4
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
implicitWidth: 350
|
|
||||||
|
|
||||||
Resources {
|
Resources {
|
||||||
alwaysShowAllResources: barRoot.useShortenedForm === 2
|
alwaysShowAllResources: barRoot.useShortenedForm === 2
|
||||||
@@ -212,12 +210,15 @@ Scope {
|
|||||||
|
|
||||||
VerticalBarSeparator {visible: ConfigOptions?.bar.borderless}
|
VerticalBarSeparator {visible: ConfigOptions?.bar.borderless}
|
||||||
|
|
||||||
RowLayout {
|
BarGroup {
|
||||||
id: middleCenterGroup
|
id: middleCenterGroup
|
||||||
|
padding: workspacesWidget.widgetPadding
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
|
||||||
Workspaces {
|
Workspaces {
|
||||||
|
id: workspacesWidget
|
||||||
bar: barRoot
|
bar: barRoot
|
||||||
|
Layout.fillHeight: true
|
||||||
MouseArea { // Right-click to toggle overview
|
MouseArea { // Right-click to toggle overview
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
acceptedButtons: Qt.RightButton
|
acceptedButtons: Qt.RightButton
|
||||||
@@ -229,25 +230,23 @@ Scope {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VerticalBarSeparator {visible: ConfigOptions?.bar.borderless}
|
VerticalBarSeparator {visible: ConfigOptions?.bar.borderless}
|
||||||
|
|
||||||
RowLayout {
|
BarGroup {
|
||||||
id: rightCenterGroup
|
id: rightCenterGroup
|
||||||
Layout.preferredWidth: leftCenterGroup.width
|
Layout.preferredWidth: barRoot.centerSideModuleWidth
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
spacing: 4
|
|
||||||
|
|
||||||
ClockWidget {
|
ClockWidget {
|
||||||
showDate: barRoot.useShortenedForm < 2
|
showDate: (ConfigOptions.bar.verbose && barRoot.useShortenedForm < 2)
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
UtilButtons {
|
UtilButtons {
|
||||||
visible: barRoot.useShortenedForm === 0
|
visible: (ConfigOptions.bar.verbosebarRoot.useShortenedForm === 0)
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,7 +254,6 @@ Scope {
|
|||||||
visible: (barRoot.useShortenedForm < 2 && UPower.displayDevice.isLaptopBattery)
|
visible: (barRoot.useShortenedForm < 2 && UPower.displayDevice.isLaptopBattery)
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
import "root:/modules/common"
|
||||||
|
import "root:/modules/common/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
property real padding: 5
|
||||||
|
implicitHeight: 40
|
||||||
|
implicitWidth: rowLayout.implicitWidth + padding * 2
|
||||||
|
default property alias items: rowLayout.children
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: background
|
||||||
|
anchors {
|
||||||
|
fill: parent
|
||||||
|
topMargin: 4
|
||||||
|
bottomMargin: 4
|
||||||
|
}
|
||||||
|
color: ConfigOptions?.bar.borderless ? "transparent" : Appearance.colors.colLayer1
|
||||||
|
radius: Appearance.rounding.small
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
id: rowLayout
|
||||||
|
anchors {
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
leftMargin: root.padding
|
||||||
|
rightMargin: root.padding
|
||||||
|
}
|
||||||
|
spacing: 4
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ import Quickshell
|
|||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import Quickshell.Services.UPower
|
import Quickshell.Services.UPower
|
||||||
|
|
||||||
Rectangle {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
property bool borderless: ConfigOptions.bar.borderless
|
property bool borderless: ConfigOptions.bar.borderless
|
||||||
readonly property var chargeState: Battery.chargeState
|
readonly property var chargeState: Battery.chargeState
|
||||||
@@ -20,8 +20,6 @@ Rectangle {
|
|||||||
|
|
||||||
implicitWidth: rowLayout.implicitWidth + rowLayout.spacing * 2
|
implicitWidth: rowLayout.implicitWidth + rowLayout.spacing * 2
|
||||||
implicitHeight: 32
|
implicitHeight: 32
|
||||||
color: borderless ? "transparent" : Appearance.colors.colLayer1
|
|
||||||
radius: Appearance.rounding.small
|
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: rowLayout
|
id: rowLayout
|
||||||
|
|||||||
@@ -4,19 +4,17 @@ import "root:/services"
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
|
||||||
Rectangle {
|
Item {
|
||||||
|
id: root
|
||||||
property bool borderless: ConfigOptions.bar.borderless
|
property bool borderless: ConfigOptions.bar.borderless
|
||||||
property bool showDate: true
|
property bool showDate: ConfigOptions.bar.verbose
|
||||||
implicitWidth: rowLayout.implicitWidth + rowLayout.spacing * 6 // idk, text seems nicer w/ more padding
|
implicitWidth: rowLayout.implicitWidth
|
||||||
implicitHeight: 32
|
implicitHeight: 32
|
||||||
color: borderless ? "transparent" : Appearance.colors.colLayer1
|
|
||||||
radius: Appearance.rounding.small
|
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: rowLayout
|
id: rowLayout
|
||||||
|
|
||||||
spacing: 4
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
spacing: 4
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
font.pixelSize: Appearance.font.pixelSize.large
|
font.pixelSize: Appearance.font.pixelSize.large
|
||||||
@@ -25,14 +23,14 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
visible: showDate
|
visible: root.showDate
|
||||||
font.pixelSize: Appearance.font.pixelSize.small
|
font.pixelSize: Appearance.font.pixelSize.small
|
||||||
color: Appearance.colors.colOnLayer1
|
color: Appearance.colors.colOnLayer1
|
||||||
text: "•"
|
text: "•"
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
visible: showDate
|
visible: root.showDate
|
||||||
font.pixelSize: Appearance.font.pixelSize.small
|
font.pixelSize: Appearance.font.pixelSize.small
|
||||||
color: Appearance.colors.colOnLayer1
|
color: Appearance.colors.colOnLayer1
|
||||||
text: DateTime.date
|
text: DateTime.date
|
||||||
|
|||||||
@@ -42,14 +42,6 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle { // Background
|
|
||||||
anchors.centerIn: parent
|
|
||||||
width: parent.width
|
|
||||||
implicitHeight: 32
|
|
||||||
color: borderless ? "transparent" : Appearance.colors.colLayer1
|
|
||||||
radius: Appearance.rounding.small
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout { // Real content
|
RowLayout { // Real content
|
||||||
id: rowLayout
|
id: rowLayout
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ Item {
|
|||||||
required property double percentage
|
required property double percentage
|
||||||
property bool shown: true
|
property bool shown: true
|
||||||
clip: true
|
clip: true
|
||||||
|
visible: width > 0 && height > 0
|
||||||
implicitWidth: resourceRowLayout.x < 0 ? 0 : childrenRect.width
|
implicitWidth: resourceRowLayout.x < 0 ? 0 : childrenRect.width
|
||||||
implicitHeight: childrenRect.height
|
implicitHeight: childrenRect.height
|
||||||
|
|
||||||
|
|||||||
@@ -7,14 +7,12 @@ import Quickshell
|
|||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import Quickshell.Services.Mpris
|
import Quickshell.Services.Mpris
|
||||||
|
|
||||||
Rectangle {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
property bool borderless: ConfigOptions.bar.borderless
|
property bool borderless: ConfigOptions.bar.borderless
|
||||||
property bool alwaysShowAllResources: false
|
property bool alwaysShowAllResources: false
|
||||||
implicitWidth: rowLayout.implicitWidth + rowLayout.anchors.leftMargin + rowLayout.anchors.rightMargin
|
implicitWidth: rowLayout.implicitWidth + rowLayout.anchors.leftMargin + rowLayout.anchors.rightMargin
|
||||||
implicitHeight: 32
|
implicitHeight: 32
|
||||||
color: borderless ? "transparent" : Appearance.colors.colLayer1
|
|
||||||
radius: Appearance.rounding.small
|
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: rowLayout
|
id: rowLayout
|
||||||
|
|||||||
@@ -7,14 +7,10 @@ import Quickshell.Io
|
|||||||
import Quickshell.Hyprland
|
import Quickshell.Hyprland
|
||||||
import Quickshell.Services.Pipewire
|
import Quickshell.Services.Pipewire
|
||||||
|
|
||||||
Rectangle {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
property bool borderless: ConfigOptions.bar.borderless
|
property bool borderless: ConfigOptions.bar.borderless
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
implicitWidth: rowLayout.implicitWidth + rowLayout.spacing * 2
|
implicitWidth: rowLayout.implicitWidth + rowLayout.spacing * 2
|
||||||
implicitHeight: 32
|
|
||||||
color: borderless ? "transparent" : Appearance.colors.colLayer1
|
|
||||||
radius: Appearance.rounding.small
|
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: rowLayout
|
id: rowLayout
|
||||||
|
|||||||
@@ -47,20 +47,9 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Layout.fillHeight: true
|
|
||||||
implicitWidth: rowLayout.implicitWidth + rowLayout.spacing * 2
|
implicitWidth: rowLayout.implicitWidth + rowLayout.spacing * 2
|
||||||
implicitHeight: 40
|
implicitHeight: 40
|
||||||
|
|
||||||
// Background
|
|
||||||
Rectangle {
|
|
||||||
z: 0
|
|
||||||
anchors.centerIn: parent
|
|
||||||
implicitHeight: 32
|
|
||||||
implicitWidth: rowLayout.implicitWidth + widgetPadding * 2
|
|
||||||
radius: Appearance.rounding.small
|
|
||||||
color: borderless ? "transparent" : Appearance.colors.colLayer1
|
|
||||||
}
|
|
||||||
|
|
||||||
// Scroll to switch workspaces
|
// Scroll to switch workspaces
|
||||||
WheelHandler {
|
WheelHandler {
|
||||||
onWheel: (event) => {
|
onWheel: (event) => {
|
||||||
@@ -223,7 +212,7 @@ Item {
|
|||||||
) ? 0 : 1
|
) ? 0 : 1
|
||||||
visible: opacity > 0
|
visible: opacity > 0
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: workspaceButtonWidth * 0.15
|
width: workspaceButtonWidth * 0.18
|
||||||
height: width
|
height: width
|
||||||
radius: width / 2
|
radius: width / 2
|
||||||
color: (monitor.activeWorkspace?.id == button.workspaceValue) ?
|
color: (monitor.activeWorkspace?.id == button.workspaceValue) ?
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ Singleton {
|
|||||||
|
|
||||||
sizes: QtObject {
|
sizes: QtObject {
|
||||||
property real barHeight: 40
|
property real barHeight: 40
|
||||||
property real barCenterSideModuleWidth: 360
|
property real barCenterSideModuleWidth: ConfigOptions?.bar.verbose ? 360 : 140
|
||||||
property real barCenterSideModuleWidthShortened: 280
|
property real barCenterSideModuleWidthShortened: 280
|
||||||
property real barCenterSideModuleWidthHellaShortened: 190
|
property real barCenterSideModuleWidthHellaShortened: 190
|
||||||
property real barShortenScreenWidthThreshold: 1200 // Shorten if screen width is at most this value
|
property real barShortenScreenWidthThreshold: 1200 // Shorten if screen width is at most this value
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ Singleton {
|
|||||||
property bool borderless: false // true for no grouping of items
|
property bool borderless: false // true for no grouping of items
|
||||||
property string topLeftIcon: "spark" // Options: distro, spark
|
property string topLeftIcon: "spark" // Options: distro, spark
|
||||||
property bool showBackground: true
|
property bool showBackground: true
|
||||||
|
property bool verbose: true
|
||||||
property QtObject resources: QtObject {
|
property QtObject resources: QtObject {
|
||||||
property bool alwaysShowSwap: true
|
property bool alwaysShowSwap: true
|
||||||
property bool alwaysShowCpu: false
|
property bool alwaysShowCpu: false
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ Item {
|
|||||||
onTriggered: {
|
onTriggered: {
|
||||||
window.x = Math.round(Math.max((windowData?.at[0] - monitorData?.reserved[0]) * root.scale, 0) + xOffset)
|
window.x = Math.round(Math.max((windowData?.at[0] - monitorData?.reserved[0]) * root.scale, 0) + xOffset)
|
||||||
window.y = Math.round(Math.max((windowData?.at[1] - monitorData?.reserved[1]) * root.scale, 0) + yOffset)
|
window.y = Math.round(Math.max((windowData?.at[1] - monitorData?.reserved[1]) * root.scale, 0) + yOffset)
|
||||||
console.log(`[OverviewWindow] Updated position for window ${windowData?.address} to (${window.x}, ${window.y})`)
|
// console.log(`[OverviewWindow] Updated position for window ${windowData?.address} to (${window.x}, ${window.y})`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ Item {
|
|||||||
window.pressed = true
|
window.pressed = true
|
||||||
window.Drag.active = true
|
window.Drag.active = true
|
||||||
window.Drag.source = window
|
window.Drag.source = window
|
||||||
console.log(`[OverviewWindow] Dragging window ${windowData?.address} from position (${window.x}, ${window.y})`)
|
// console.log(`[OverviewWindow] Dragging window ${windowData?.address} from position (${window.x}, ${window.y})`)
|
||||||
}
|
}
|
||||||
onReleased: {
|
onReleased: {
|
||||||
const targetWorkspace = root.draggingTargetWorkspace
|
const targetWorkspace = root.draggingTargetWorkspace
|
||||||
|
|||||||
Reference in New Issue
Block a user