forked from Shinonome/dots-hyprland
rounding decorations
This commit is contained in:
@@ -8,8 +8,8 @@ import Quickshell
|
||||
Scope {
|
||||
id: bar
|
||||
|
||||
readonly property int barHeight: 40
|
||||
readonly property int sideCenterModuleWidth: 360
|
||||
readonly property int barHeight: Appearance.sizes.barHeight
|
||||
readonly property int barCenterSideModuleWidth: Appearance.sizes.barCenterSideModuleWidth
|
||||
|
||||
Variants {
|
||||
model: Quickshell.screens
|
||||
@@ -20,112 +20,12 @@ Scope {
|
||||
property var modelData
|
||||
|
||||
screen: modelData
|
||||
height: barHeight
|
||||
color: Appearance.colors.colLayer0
|
||||
|
||||
// Left section
|
||||
RowLayout {
|
||||
anchors.left: parent.left
|
||||
implicitHeight: barHeight
|
||||
|
||||
ActiveWindow {
|
||||
bar: barRoot
|
||||
}
|
||||
|
||||
// Scroll to change brightness
|
||||
WheelHandler {
|
||||
onWheel: (event) => {
|
||||
if (event.angleDelta.y < 0)
|
||||
Brightness.value = -1;
|
||||
else if (event.angleDelta.y > 0)
|
||||
Brightness.value = 1;
|
||||
}
|
||||
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Middle section
|
||||
RowLayout {
|
||||
anchors.centerIn: parent
|
||||
spacing: 8
|
||||
|
||||
RowLayout {
|
||||
Layout.preferredWidth: sideCenterModuleWidth
|
||||
spacing: 4
|
||||
Layout.fillHeight: true
|
||||
implicitWidth: 350
|
||||
|
||||
Resources {
|
||||
}
|
||||
|
||||
Media {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
spacing: 4
|
||||
|
||||
Workspaces {
|
||||
bar: barRoot
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.preferredWidth: sideCenterModuleWidth
|
||||
Layout.fillHeight: true
|
||||
spacing: 4
|
||||
|
||||
ClockWidget {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
UtilButtons {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
}
|
||||
|
||||
Battery {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Right section
|
||||
RowLayout {
|
||||
anchors.right: parent.right
|
||||
implicitHeight: barHeight
|
||||
spacing: 20
|
||||
|
||||
SysTray {
|
||||
bar: barRoot
|
||||
}
|
||||
|
||||
Item { // TODO make this wifi & bluetooth
|
||||
Layout.leftMargin: Appearance.rounding.screenRounding
|
||||
}
|
||||
|
||||
// Scroll to change volume
|
||||
WheelHandler {
|
||||
onWheel: (event) => {
|
||||
const currentVolume = Audio.sink?.audio.volume;
|
||||
const step = currentVolume < 0.1 ? 0.01 : 0.02 || 0.2;
|
||||
if (event.angleDelta.y < 0)
|
||||
Audio.sink.audio.volume -= step;
|
||||
else if (event.angleDelta.y > 0)
|
||||
Audio.sink.audio.volume += step;
|
||||
}
|
||||
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
|
||||
}
|
||||
|
||||
height: barHeight + Appearance.rounding.screenRounding
|
||||
exclusiveZone: barHeight
|
||||
mask: Region {
|
||||
item: barContent
|
||||
}
|
||||
color: "transparent"
|
||||
|
||||
anchors {
|
||||
top: true
|
||||
@@ -133,6 +33,141 @@ Scope {
|
||||
right: true
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: barContent
|
||||
anchors.right: parent.right
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
color: Appearance.colors.colLayer0
|
||||
height: barHeight
|
||||
// Left section
|
||||
RowLayout {
|
||||
anchors.left: parent.left
|
||||
implicitHeight: barHeight
|
||||
|
||||
ActiveWindow {
|
||||
bar: barRoot
|
||||
}
|
||||
|
||||
// Scroll to change brightness
|
||||
WheelHandler {
|
||||
onWheel: (event) => {
|
||||
if (event.angleDelta.y < 0)
|
||||
Brightness.value = -1;
|
||||
else if (event.angleDelta.y > 0)
|
||||
Brightness.value = 1;
|
||||
}
|
||||
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Middle section
|
||||
RowLayout {
|
||||
anchors.centerIn: parent
|
||||
spacing: 8
|
||||
|
||||
RowLayout {
|
||||
Layout.preferredWidth: barCenterSideModuleWidth
|
||||
spacing: 4
|
||||
Layout.fillHeight: true
|
||||
implicitWidth: 350
|
||||
|
||||
Resources {
|
||||
}
|
||||
|
||||
Media {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
spacing: 4
|
||||
|
||||
Workspaces {
|
||||
bar: barRoot
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.preferredWidth: barCenterSideModuleWidth
|
||||
Layout.fillHeight: true
|
||||
spacing: 4
|
||||
|
||||
ClockWidget {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
UtilButtons {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
}
|
||||
|
||||
Battery {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Right section
|
||||
RowLayout {
|
||||
anchors.right: parent.right
|
||||
implicitHeight: barHeight
|
||||
spacing: 20
|
||||
|
||||
SysTray {
|
||||
bar: barRoot
|
||||
}
|
||||
|
||||
Item { // TODO make this wifi & bluetooth
|
||||
Layout.leftMargin: Appearance.rounding.screenRounding
|
||||
}
|
||||
|
||||
// Scroll to change volume
|
||||
WheelHandler {
|
||||
onWheel: (event) => {
|
||||
const currentVolume = Audio.sink?.audio.volume;
|
||||
const step = currentVolume < 0.1 ? 0.01 : 0.02 || 0.2;
|
||||
if (event.angleDelta.y < 0)
|
||||
Audio.sink.audio.volume -= step;
|
||||
else if (event.angleDelta.y > 0)
|
||||
Audio.sink.audio.volume += step;
|
||||
}
|
||||
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Round decorators
|
||||
Item {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
height: Appearance.rounding.screenRounding
|
||||
|
||||
RoundCorner {
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
size: Appearance.rounding.screenRounding
|
||||
corner: cornerEnum.topLeft
|
||||
color: Appearance.colors.colLayer0
|
||||
}
|
||||
RoundCorner {
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
size: Appearance.rounding.screenRounding
|
||||
corner: cornerEnum.topRight
|
||||
color: Appearance.colors.colLayer0
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,14 +28,14 @@ Rectangle {
|
||||
Resource {
|
||||
iconName: "swap_horiz"
|
||||
percentage: ResourceUsage.swapUsedPercentage
|
||||
shown: ConfigOptions.bar.resources.alwaysShowSwap || (MprisController.activePlayer == null)
|
||||
shown: ConfigOptions.bar.resources.alwaysShowSwap || (MprisController.activePlayer?.trackTitle == null)
|
||||
Layout.leftMargin: shown ? 4 : 0
|
||||
}
|
||||
|
||||
Resource {
|
||||
iconName: "settings_slow_motion"
|
||||
percentage: ResourceUsage.cpuUsage
|
||||
shown: ConfigOptions.bar.resources.alwaysShowCpu || (MprisController.activePlayer == null)
|
||||
shown: ConfigOptions.bar.resources.alwaysShowCpu || !(MprisController.activePlayer?.trackTitle?.length > 0)
|
||||
Layout.leftMargin: shown ? 4 : 0
|
||||
}
|
||||
|
||||
|
||||
@@ -21,11 +21,9 @@ MouseArea {
|
||||
item.activate();
|
||||
break;
|
||||
case Qt.RightButton:
|
||||
if (item.hasMenu) {
|
||||
if (item.hasMenu)
|
||||
menu.open();
|
||||
}
|
||||
default:
|
||||
console.log("Buttonevent unhandled");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user