mirror of
https://github.com/tuxdotrs/tpanel.git
synced 2026-09-19 18:19:02 +05:30
style: format qml files
This commit is contained in:
@@ -5,29 +5,15 @@ import qs.ui
|
|||||||
import qs.services
|
import qs.services
|
||||||
|
|
||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
function widget(name: string): url {
|
function widget(name: string): url {
|
||||||
return `${Quickshell.shellPath("modules/bar")}/${name}.qml`;
|
return `${Quickshell.shellPath("modules/bar")}/${name}.qml`;
|
||||||
}
|
}
|
||||||
|
|
||||||
property var left: [
|
property var left: [root.widget("LauncherButton"), root.widget("PowerProfileWidget"), root.widget("HomeWidget"),]
|
||||||
root.widget("LauncherButton"),
|
|
||||||
root.widget("PowerProfileWidget"),
|
|
||||||
root.widget("HomeWidget"),
|
|
||||||
]
|
|
||||||
|
|
||||||
property var center: [
|
property var center: [root.widget("CavaVisualizer"), root.widget("Workspaces"), root.widget("CavaVisualizer"),]
|
||||||
root.widget("CavaVisualizer"),
|
|
||||||
root.widget("Workspaces"),
|
|
||||||
root.widget("CavaVisualizer"),
|
|
||||||
]
|
|
||||||
|
|
||||||
property var right: [
|
property var right: [root.widget("AudioWidget"), root.widget("BatteryIndicator"), root.widget("SystemTrayWidget"), root.widget("ClockWidget"), root.widget("GhostButton")]
|
||||||
root.widget("AudioWidget"),
|
|
||||||
root.widget("BatteryIndicator"),
|
|
||||||
root.widget("SystemTrayWidget"),
|
|
||||||
root.widget("ClockWidget"),
|
|
||||||
root.widget("GhostButton")
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,20 +5,17 @@ import qs.ui
|
|||||||
import qs.services
|
import qs.services
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
BarButton {
|
BarButton {
|
||||||
hoverHighlight: false
|
hoverHighlight: false
|
||||||
pointerCursor: false
|
pointerCursor: false
|
||||||
label: Audio.inputName
|
label: Audio.inputName
|
||||||
iconSource: Audio.inputIcon
|
iconSource: Audio.inputIcon
|
||||||
|
}
|
||||||
|
|
||||||
|
BarButton {
|
||||||
|
hoverHighlight: false
|
||||||
|
pointerCursor: false
|
||||||
|
label: Audio.outputName
|
||||||
|
iconSource: Audio.outputIcon
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BarButton {
|
|
||||||
hoverHighlight: false
|
|
||||||
pointerCursor: false
|
|
||||||
label: Audio.outputName
|
|
||||||
iconSource: Audio.outputIcon
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import qs.ui
|
|||||||
import qs.services
|
import qs.services
|
||||||
|
|
||||||
BarButton {
|
BarButton {
|
||||||
hoverHighlight: false
|
hoverHighlight: false
|
||||||
pointerCursor: false
|
pointerCursor: false
|
||||||
label: `${Battery.percentage}% ${Battery.energyRate}W`
|
label: `${Battery.percentage}% ${Battery.energyRate}W`
|
||||||
iconSource: Battery.icon
|
iconSource: Battery.icon
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,47 +5,47 @@ import qs.config
|
|||||||
import qs.services
|
import qs.services
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property int barCount: 14
|
property int barCount: 14
|
||||||
property real maxValue: 100
|
property real maxValue: 100
|
||||||
readonly property bool shouldVisualize: barCount > 0 && Cava.values.some(v => v >= 0.001)
|
readonly property bool shouldVisualize: barCount > 0 && Cava.values.some(v => v >= 0.001)
|
||||||
|
|
||||||
implicitWidth: 96
|
implicitWidth: 96
|
||||||
implicitHeight: 32
|
implicitHeight: 32
|
||||||
radius: Appearance.radius
|
radius: Appearance.radius
|
||||||
color: Appearance.colors.inActive
|
color: Appearance.colors.inActive
|
||||||
visible: shouldVisualize
|
visible: shouldVisualize
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: barRow
|
id: barRow
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: 8
|
anchors.margins: 8
|
||||||
spacing: 3
|
spacing: 3
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: root.barCount
|
model: root.barCount
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: bar
|
id: bar
|
||||||
|
|
||||||
required property int index
|
required property int index
|
||||||
readonly property real value: Cava.values[index] ?? 0
|
readonly property real value: Cava.values[index] ?? 0
|
||||||
|
|
||||||
width: (barRow.width - barRow.spacing * (root.barCount - 1)) / root.barCount
|
width: (barRow.width - barRow.spacing * (root.barCount - 1)) / root.barCount
|
||||||
height: Math.max(2, (bar.value / root.maxValue) * barRow.height)
|
height: Math.max(2, (bar.value / root.maxValue) * barRow.height)
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
radius: bar.width / 2
|
radius: bar.width / 2
|
||||||
color: Appearance.colors.accent
|
color: Appearance.colors.accent
|
||||||
antialiasing: true
|
antialiasing: true
|
||||||
|
|
||||||
Behavior on height {
|
Behavior on height {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: Appearance.duration
|
duration: Appearance.duration
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import qs.ui
|
|||||||
import qs.services
|
import qs.services
|
||||||
|
|
||||||
BarButton {
|
BarButton {
|
||||||
hoverHighlight: false
|
hoverHighlight: false
|
||||||
pointerCursor: false
|
pointerCursor: false
|
||||||
label: Time.time
|
label: Time.time
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,6 @@ import Quickshell
|
|||||||
import qs.ui
|
import qs.ui
|
||||||
|
|
||||||
BarButton {
|
BarButton {
|
||||||
iconOnly: true
|
iconOnly: true
|
||||||
iconSource: `${Quickshell.shellPath("assets")}/icons/ghost.svg`
|
iconSource: `${Quickshell.shellPath("assets")}/icons/ghost.svg`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import qs.ui
|
|||||||
import qs.services
|
import qs.services
|
||||||
|
|
||||||
BarButton {
|
BarButton {
|
||||||
hoverHighlight: false
|
hoverHighlight: false
|
||||||
pointerCursor: false
|
pointerCursor: false
|
||||||
label: Home.latency >= 0 ? `${Home.latency} ms` : "NA"
|
label: Home.latency >= 0 ? `${Home.latency} ms` : "NA"
|
||||||
iconSource: Home.icon
|
iconSource: Home.icon
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import Quickshell
|
|||||||
import qs.ui
|
import qs.ui
|
||||||
|
|
||||||
BarButton {
|
BarButton {
|
||||||
iconOnly: true
|
iconOnly: true
|
||||||
iconSource: `${Quickshell.shellPath("assets")}/icons/nix.svg`
|
iconSource: `${Quickshell.shellPath("assets")}/icons/nix.svg`
|
||||||
onClicked: Quickshell.execDetached(["vicinae", "toggle"])
|
onClicked: Quickshell.execDetached(["vicinae", "toggle"])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import qs.ui
|
|||||||
import qs.services
|
import qs.services
|
||||||
|
|
||||||
BarButton {
|
BarButton {
|
||||||
hoverHighlight: false
|
hoverHighlight: false
|
||||||
pointerCursor: false
|
pointerCursor: false
|
||||||
label: PowerProfile.name
|
label: PowerProfile.name
|
||||||
iconSource: PowerProfile.icon
|
iconSource: PowerProfile.icon
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,27 +6,27 @@ import qs.config
|
|||||||
import qs.ui
|
import qs.ui
|
||||||
|
|
||||||
BarButton {
|
BarButton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property int iconSize: 16
|
property int iconSize: 16
|
||||||
|
|
||||||
hoverHighlight: false
|
hoverHighlight: false
|
||||||
pointerCursor: false
|
pointerCursor: false
|
||||||
visible: SystemTray.items.values.length > 0
|
visible: SystemTray.items.values.length > 0
|
||||||
|
|
||||||
contentItem: Row {
|
contentItem: Row {
|
||||||
spacing: Appearance.spacing
|
spacing: Appearance.spacing
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: SystemTray.items.values
|
model: SystemTray.items.values
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
required property var modelData
|
required property var modelData
|
||||||
|
|
||||||
source: modelData.icon
|
source: modelData.icon
|
||||||
width: root.iconSize
|
width: root.iconSize
|
||||||
height: root.iconSize
|
height: root.iconSize
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,56 +5,56 @@ import Quickshell.Hyprland
|
|||||||
import qs.config
|
import qs.config
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property int count: 7
|
property int count: 7
|
||||||
|
|
||||||
spacing: Appearance.spacing
|
spacing: Appearance.spacing
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: root.count
|
model: root.count
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: pill
|
id: pill
|
||||||
|
|
||||||
required property int index
|
required property int index
|
||||||
property var ws: Hyprland.workspaces.values.find(w => w.id === pill.index + 1)
|
property var ws: Hyprland.workspaces.values.find(w => w.id === pill.index + 1)
|
||||||
property bool isActive: Hyprland.focusedWorkspace?.id === (pill.index + 1)
|
property bool isActive: Hyprland.focusedWorkspace?.id === (pill.index + 1)
|
||||||
|
|
||||||
radius: 1000
|
radius: 1000
|
||||||
implicitHeight: 15
|
implicitHeight: 15
|
||||||
implicitWidth: pill.isActive ? pill.implicitHeight * 2.3 : pill.implicitHeight
|
implicitWidth: pill.isActive ? pill.implicitHeight * 2.3 : pill.implicitHeight
|
||||||
color: {
|
color: {
|
||||||
if (handler.hovered)
|
if (handler.hovered)
|
||||||
return Appearance.colors.accent;
|
return Appearance.colors.accent;
|
||||||
if (pill.isActive || pill.ws)
|
if (pill.isActive || pill.ws)
|
||||||
return Appearance.colors.accent;
|
return Appearance.colors.accent;
|
||||||
return Appearance.colors.inActive;
|
return Appearance.colors.inActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: Hyprland.dispatch("workspace " + (pill.index + 1))
|
onClicked: Hyprland.dispatch("workspace " + (pill.index + 1))
|
||||||
}
|
}
|
||||||
|
|
||||||
HoverHandler {
|
HoverHandler {
|
||||||
id: handler
|
id: handler
|
||||||
}
|
}
|
||||||
|
|
||||||
Behavior on color {
|
Behavior on color {
|
||||||
ColorAnimation {
|
ColorAnimation {
|
||||||
duration: Appearance.duration
|
duration: Appearance.duration
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on implicitWidth {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.duration
|
||||||
|
easing.type: Easing.OutQuad
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on implicitWidth {
|
|
||||||
NumberAnimation {
|
|
||||||
duration: Appearance.duration
|
|
||||||
easing.type: Easing.OutQuad
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,111 +7,110 @@ import Quickshell.Services.Notifications
|
|||||||
import qs.config
|
import qs.config
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property Notification notif
|
property Notification notif
|
||||||
readonly property bool critical: notif?.urgency === NotificationUrgency.Critical
|
readonly property bool critical: notif?.urgency === NotificationUrgency.Critical
|
||||||
readonly property int timeoutDuration: {
|
readonly property int timeoutDuration: {
|
||||||
const seconds = Math.round((notif?.expireTimeout ?? 0) / 1000);
|
const seconds = Math.round((notif?.expireTimeout ?? 0) / 1000);
|
||||||
return seconds > 0 ? seconds : 5;
|
return seconds > 0 ? seconds : 5;
|
||||||
}
|
}
|
||||||
readonly property string iconName: {
|
readonly property string iconName: {
|
||||||
if (!notif)
|
if (!notif)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
const hints = notif.hints ?? {};
|
const hints = notif.hints ?? {};
|
||||||
const hinted = String(hints["image-path"] ?? hints["image_path"] ?? hints["icon_path"] ?? "");
|
const hinted = String(hints["image-path"] ?? hints["image_path"] ?? hints["icon_path"] ?? "");
|
||||||
return notif.appIcon || notif.desktopEntry || hinted;
|
return notif.appIcon || notif.desktopEntry || hinted;
|
||||||
}
|
}
|
||||||
readonly property url themedIconUrl: iconName !== "" ? Quickshell.iconPath(iconName, false) : ""
|
readonly property url themedIconUrl: iconName !== "" ? Quickshell.iconPath(iconName, false) : ""
|
||||||
readonly property url iconUrl: `${Quickshell.shellPath("assets")}/icons/notification.svg`
|
readonly property url iconUrl: `${Quickshell.shellPath("assets")}/icons/notification.svg`
|
||||||
|
|
||||||
implicitWidth: 360
|
implicitWidth: 360
|
||||||
implicitHeight: content.implicitHeight + Appearance.padding * 2
|
implicitHeight: content.implicitHeight + Appearance.padding * 2
|
||||||
radius: Appearance.radius
|
radius: Appearance.radius
|
||||||
color: Appearance.colors.background
|
color: Appearance.colors.background
|
||||||
border.width: critical ? 1 : 0
|
border.width: critical ? 1 : 0
|
||||||
border.color: Appearance.colors.accent
|
border.color: Appearance.colors.accent
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: countdown
|
id: countdown
|
||||||
|
|
||||||
interval: root.timeoutDuration * 1000
|
interval: root.timeoutDuration * 1000
|
||||||
repeat: false
|
repeat: false
|
||||||
running: !root.critical && !hovered.hovered && visible
|
running: !root.critical && !hovered.hovered && visible
|
||||||
onTriggered: root.notif.expire()
|
onTriggered: root.notif.expire()
|
||||||
}
|
|
||||||
|
|
||||||
HoverHandler {
|
|
||||||
id: hovered
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
id: content
|
|
||||||
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.margins: Appearance.padding
|
|
||||||
spacing: Appearance.spacing
|
|
||||||
|
|
||||||
Item {
|
|
||||||
width: 40
|
|
||||||
height: 40
|
|
||||||
Layout.alignment: Qt.AlignTop
|
|
||||||
|
|
||||||
Image {
|
|
||||||
anchors.fill: parent
|
|
||||||
source: root.iconUrl
|
|
||||||
fillMode: Image.PreserveAspectFit
|
|
||||||
smooth: true
|
|
||||||
}
|
|
||||||
|
|
||||||
Image {
|
|
||||||
anchors.fill: parent
|
|
||||||
source: root.themedIconUrl
|
|
||||||
visible: root.themedIconUrl !== "" && status === Image.Ready
|
|
||||||
fillMode: Image.PreserveAspectFit
|
|
||||||
smooth: true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
HoverHandler {
|
||||||
spacing: 2
|
id: hovered
|
||||||
Layout.fillWidth: true
|
}
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
|
RowLayout {
|
||||||
Text {
|
id: content
|
||||||
text: root.notif?.appName ?? ""
|
|
||||||
color: Appearance.colors.accent
|
anchors.left: parent.left
|
||||||
font.family: Appearance.font.family
|
anchors.right: parent.right
|
||||||
font.pointSize: Appearance.font.pointSize - 2
|
anchors.top: parent.top
|
||||||
elide: Text.ElideRight
|
anchors.margins: Appearance.padding
|
||||||
Layout.fillWidth: true
|
spacing: Appearance.spacing
|
||||||
}
|
|
||||||
Text {
|
Item {
|
||||||
text: root.notif?.summary ?? ""
|
width: 40
|
||||||
color: Appearance.colors.foreground
|
height: 40
|
||||||
font.family: Appearance.font.family
|
Layout.alignment: Qt.AlignTop
|
||||||
font.pointSize: Appearance.font.pointSize
|
|
||||||
font.weight: Font.DemiBold
|
Image {
|
||||||
elide: Text.ElideRight
|
anchors.fill: parent
|
||||||
Layout.fillWidth: true
|
source: root.iconUrl
|
||||||
}
|
fillMode: Image.PreserveAspectFit
|
||||||
Text {
|
smooth: true
|
||||||
text: root.notif?.body ?? ""
|
}
|
||||||
visible: text !== ""
|
|
||||||
color: Appearance.colors.foreground
|
Image {
|
||||||
opacity: 0.8
|
anchors.fill: parent
|
||||||
font.family: Appearance.font.family
|
source: root.themedIconUrl
|
||||||
font.pointSize: Appearance.font.pointSize - 1
|
visible: root.themedIconUrl !== "" && status === Image.Ready
|
||||||
wrapMode: Text.Wrap
|
fillMode: Image.PreserveAspectFit
|
||||||
maximumLineCount: 3
|
smooth: true
|
||||||
elide: Text.ElideRight
|
}
|
||||||
textFormat: Text.PlainText
|
}
|
||||||
Layout.fillWidth: true
|
|
||||||
}
|
ColumnLayout {
|
||||||
|
spacing: 2
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: root.notif?.appName ?? ""
|
||||||
|
color: Appearance.colors.accent
|
||||||
|
font.family: Appearance.font.family
|
||||||
|
font.pointSize: Appearance.font.pointSize - 2
|
||||||
|
elide: Text.ElideRight
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
text: root.notif?.summary ?? ""
|
||||||
|
color: Appearance.colors.foreground
|
||||||
|
font.family: Appearance.font.family
|
||||||
|
font.pointSize: Appearance.font.pointSize
|
||||||
|
font.weight: Font.DemiBold
|
||||||
|
elide: Text.ElideRight
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
text: root.notif?.body ?? ""
|
||||||
|
visible: text !== ""
|
||||||
|
color: Appearance.colors.foreground
|
||||||
|
opacity: 0.8
|
||||||
|
font.family: Appearance.font.family
|
||||||
|
font.pointSize: Appearance.font.pointSize - 1
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
maximumLineCount: 3
|
||||||
|
elide: Text.ElideRight
|
||||||
|
textFormat: Text.PlainText
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,22 +5,22 @@ import Quickshell
|
|||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
|
|
||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
readonly property string configPath: {
|
readonly property string configPath: {
|
||||||
const url = Quickshell.shellPath("assets/cava.conf").toString();
|
const url = Quickshell.shellPath("assets/cava.conf").toString();
|
||||||
return url.startsWith("file://") ? decodeURIComponent(url.substring(7)) : url;
|
return url.startsWith("file://") ? decodeURIComponent(url.substring(7)) : url;
|
||||||
}
|
}
|
||||||
property var values: []
|
property var values: []
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
running: true
|
running: true
|
||||||
command: ["cava", "-p", root.configPath]
|
command: ["cava", "-p", root.configPath]
|
||||||
|
|
||||||
stdout: SplitParser {
|
stdout: SplitParser {
|
||||||
onRead: line => {
|
onRead: line => {
|
||||||
root.values = line.split(";").map(Number).filter(v => !Number.isNaN(v));
|
root.values = line.split(";").map(Number).filter(v => !Number.isNaN(v));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,42 +5,42 @@ import QtQuick.Controls
|
|||||||
import qs.config
|
import qs.config
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property string label: ""
|
property string label: ""
|
||||||
property url iconSource: ""
|
property url iconSource: ""
|
||||||
property bool iconOnly: false
|
property bool iconOnly: false
|
||||||
property bool hoverHighlight: true
|
property bool hoverHighlight: true
|
||||||
property bool pointerCursor: true
|
property bool pointerCursor: true
|
||||||
|
|
||||||
padding: Appearance.padding
|
padding: Appearance.padding
|
||||||
display: iconOnly ? AbstractButton.IconOnly : AbstractButton.TextBesideIcon
|
display: iconOnly ? AbstractButton.IconOnly : AbstractButton.TextBesideIcon
|
||||||
|
|
||||||
text: label
|
text: label
|
||||||
font.family: Appearance.font.family
|
font.family: Appearance.font.family
|
||||||
font.pointSize: Appearance.font.pointSize
|
font.pointSize: Appearance.font.pointSize
|
||||||
palette.buttonText: Appearance.colors.foreground
|
palette.buttonText: Appearance.colors.foreground
|
||||||
icon.color: Appearance.colors.foreground
|
icon.color: Appearance.colors.foreground
|
||||||
icon.source: iconSource
|
icon.source: iconSource
|
||||||
|
|
||||||
HoverHandler {
|
HoverHandler {
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
enabled: root.pointerCursor
|
enabled: root.pointerCursor
|
||||||
}
|
|
||||||
|
|
||||||
background: Rectangle {
|
|
||||||
anchors.fill: parent
|
|
||||||
radius: Appearance.radius
|
|
||||||
color: {
|
|
||||||
if (!root.hoverHighlight)
|
|
||||||
return Appearance.colors.inActive;
|
|
||||||
return root.hovered ? Appearance.colors.inActive : Appearance.colors.background;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Behavior on color {
|
background: Rectangle {
|
||||||
ColorAnimation {
|
anchors.fill: parent
|
||||||
duration: Appearance.duration
|
radius: Appearance.radius
|
||||||
}
|
color: {
|
||||||
|
if (!root.hoverHighlight)
|
||||||
|
return Appearance.colors.inActive;
|
||||||
|
return root.hovered ? Appearance.colors.inActive : Appearance.colors.background;
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on color {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Appearance.duration
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import Quickshell
|
|||||||
import Quickshell.Wayland
|
import Quickshell.Wayland
|
||||||
|
|
||||||
PanelWindow {
|
PanelWindow {
|
||||||
property string name
|
property string name
|
||||||
|
|
||||||
implicitWidth: 0
|
implicitWidth: 0
|
||||||
implicitHeight: 0
|
implicitHeight: 0
|
||||||
WlrLayershell.namespace: `quickshell:${name}ExclusionZone`
|
WlrLayershell.namespace: `quickshell:${name}ExclusionZone`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,61 +6,61 @@ import Quickshell.Widgets
|
|||||||
import qs.config
|
import qs.config
|
||||||
|
|
||||||
WrapperItem {
|
WrapperItem {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property int corner
|
property int corner
|
||||||
property real radius: Appearance.radius
|
property real radius: Appearance.radius
|
||||||
property color color
|
property color color
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
switch (corner) {
|
switch (corner) {
|
||||||
case 0:
|
case 0:
|
||||||
anchors.left = parent.left;
|
anchors.left = parent.left;
|
||||||
anchors.top = parent.top;
|
anchors.top = parent.top;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
anchors.top = parent.top;
|
anchors.top = parent.top;
|
||||||
anchors.right = parent.right;
|
anchors.right = parent.right;
|
||||||
rotation = 90;
|
rotation = 90;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
anchors.right = parent.right;
|
anchors.right = parent.right;
|
||||||
anchors.bottom = parent.bottom;
|
anchors.bottom = parent.bottom;
|
||||||
rotation = 180;
|
rotation = 180;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
anchors.left = parent.left;
|
anchors.left = parent.left;
|
||||||
anchors.bottom = parent.bottom;
|
anchors.bottom = parent.bottom;
|
||||||
rotation = -90;
|
rotation = -90;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Shape {
|
Shape {
|
||||||
preferredRendererType: Shape.CurveRenderer
|
preferredRendererType: Shape.CurveRenderer
|
||||||
|
|
||||||
ShapePath {
|
ShapePath {
|
||||||
strokeWidth: 0
|
strokeWidth: 0
|
||||||
fillColor: root.color
|
fillColor: root.color
|
||||||
startX: root.radius
|
startX: root.radius
|
||||||
|
|
||||||
PathArc {
|
PathArc {
|
||||||
relativeX: -root.radius
|
relativeX: -root.radius
|
||||||
relativeY: root.radius
|
relativeY: root.radius
|
||||||
radiusX: root.radius
|
radiusX: root.radius
|
||||||
radiusY: radiusX
|
radiusY: radiusX
|
||||||
direction: PathArc.Counterclockwise
|
direction: PathArc.Counterclockwise
|
||||||
}
|
}
|
||||||
|
|
||||||
PathLine {
|
PathLine {
|
||||||
relativeX: 0
|
relativeX: 0
|
||||||
relativeY: -root.radius
|
relativeY: -root.radius
|
||||||
}
|
}
|
||||||
|
|
||||||
PathLine {
|
PathLine {
|
||||||
relativeX: root.radius
|
relativeX: root.radius
|
||||||
relativeY: 0
|
relativeY: 0
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
268
windows/Bar.qml
268
windows/Bar.qml
@@ -8,154 +8,154 @@ import qs.config
|
|||||||
import qs.ui
|
import qs.ui
|
||||||
|
|
||||||
PanelWindow {
|
PanelWindow {
|
||||||
id: window
|
id: window
|
||||||
|
|
||||||
property color barColor: Appearance.colors.background
|
property color barColor: Appearance.colors.background
|
||||||
|
|
||||||
color: "transparent"
|
|
||||||
exclusionMode: ExclusionMode.Ignore
|
|
||||||
mask: Region {
|
|
||||||
item: cornersArea
|
|
||||||
intersection: Intersection.Subtract
|
|
||||||
}
|
|
||||||
|
|
||||||
anchors {
|
|
||||||
left: true
|
|
||||||
top: true
|
|
||||||
right: true
|
|
||||||
bottom: true
|
|
||||||
}
|
|
||||||
|
|
||||||
component BarSection: Rectangle {
|
|
||||||
id: section
|
|
||||||
|
|
||||||
property var widgets: []
|
|
||||||
property int alignment: Qt.AlignLeft
|
|
||||||
|
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
implicitHeight: parent.height
|
exclusionMode: ExclusionMode.Ignore
|
||||||
Layout.fillWidth: true
|
mask: Region {
|
||||||
|
item: cornersArea
|
||||||
|
intersection: Intersection.Subtract
|
||||||
|
}
|
||||||
|
|
||||||
RowLayout {
|
anchors {
|
||||||
id: secRow
|
left: true
|
||||||
|
top: true
|
||||||
|
right: true
|
||||||
|
bottom: true
|
||||||
|
}
|
||||||
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
component BarSection: Rectangle {
|
||||||
x: section.alignment === Qt.AlignLeft ? 0 : section.alignment === Qt.AlignRight ? parent.width - width : (parent.width - width) / 2
|
id: section
|
||||||
spacing: Appearance.spacing
|
|
||||||
|
|
||||||
Repeater {
|
property var widgets: []
|
||||||
model: section.widgets
|
property int alignment: Qt.AlignLeft
|
||||||
|
|
||||||
Loader {
|
color: "transparent"
|
||||||
required property var modelData
|
implicitHeight: parent.height
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
source: modelData
|
RowLayout {
|
||||||
Layout.alignment: Qt.AlignVCenter
|
id: secRow
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
x: section.alignment === Qt.AlignLeft ? 0 : section.alignment === Qt.AlignRight ? parent.width - width : (parent.width - width) / 2
|
||||||
|
spacing: Appearance.spacing
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: section.widgets
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
required property var modelData
|
||||||
|
|
||||||
|
source: modelData
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Exclusions
|
// Exclusions
|
||||||
Scope {
|
Scope {
|
||||||
ExclusionZone {
|
ExclusionZone {
|
||||||
name: "left"
|
name: "left"
|
||||||
exclusiveZone: leftBar.implicitWidth
|
exclusiveZone: leftBar.implicitWidth
|
||||||
anchors.left: true
|
anchors.left: true
|
||||||
|
}
|
||||||
|
ExclusionZone {
|
||||||
|
name: "top"
|
||||||
|
exclusiveZone: topBar.implicitHeight
|
||||||
|
anchors.top: true
|
||||||
|
}
|
||||||
|
ExclusionZone {
|
||||||
|
name: "right"
|
||||||
|
exclusiveZone: rightBar.implicitWidth
|
||||||
|
anchors.right: true
|
||||||
|
}
|
||||||
|
ExclusionZone {
|
||||||
|
name: "bottom"
|
||||||
|
exclusiveZone: bottomBar.implicitHeight
|
||||||
|
anchors.bottom: true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ExclusionZone {
|
|
||||||
name: "top"
|
|
||||||
exclusiveZone: topBar.implicitHeight
|
|
||||||
anchors.top: true
|
|
||||||
}
|
|
||||||
ExclusionZone {
|
|
||||||
name: "right"
|
|
||||||
exclusiveZone: rightBar.implicitWidth
|
|
||||||
anchors.right: true
|
|
||||||
}
|
|
||||||
ExclusionZone {
|
|
||||||
name: "bottom"
|
|
||||||
exclusiveZone: bottomBar.implicitHeight
|
|
||||||
anchors.bottom: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Bars
|
// Bars
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: leftBar
|
id: leftBar
|
||||||
|
|
||||||
implicitWidth: 10
|
implicitWidth: 10
|
||||||
implicitHeight: QsWindow.window?.height ?? 0
|
implicitHeight: QsWindow.window?.height ?? 0
|
||||||
color: window.barColor
|
|
||||||
anchors.left: parent.left
|
|
||||||
}
|
|
||||||
Rectangle {
|
|
||||||
id: rightBar
|
|
||||||
|
|
||||||
implicitWidth: 10
|
|
||||||
implicitHeight: QsWindow.window?.height ?? 0
|
|
||||||
color: window.barColor
|
|
||||||
anchors.right: parent.right
|
|
||||||
}
|
|
||||||
Rectangle {
|
|
||||||
id: bottomBar
|
|
||||||
|
|
||||||
implicitWidth: QsWindow.window?.width ?? 0
|
|
||||||
implicitHeight: 10
|
|
||||||
color: window.barColor
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
}
|
|
||||||
Rectangle {
|
|
||||||
id: topBar
|
|
||||||
|
|
||||||
implicitWidth: QsWindow.window?.width ?? 0
|
|
||||||
implicitHeight: 50
|
|
||||||
color: window.barColor
|
|
||||||
anchors.top: parent.top
|
|
||||||
|
|
||||||
FlexboxLayout {
|
|
||||||
id: flexLayout
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: Appearance.margin
|
|
||||||
|
|
||||||
wrap: FlexboxLayout.Wrap
|
|
||||||
direction: FlexboxLayout.Row
|
|
||||||
justifyContent: FlexboxLayout.JustifySpaceBetween
|
|
||||||
|
|
||||||
BarSection {
|
|
||||||
widgets: BarLayout.left
|
|
||||||
alignment: Qt.AlignLeft
|
|
||||||
}
|
|
||||||
BarSection {
|
|
||||||
widgets: BarLayout.center
|
|
||||||
alignment: Qt.AlignHCenter
|
|
||||||
}
|
|
||||||
BarSection {
|
|
||||||
widgets: BarLayout.right
|
|
||||||
alignment: Qt.AlignRight
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: cornersArea
|
|
||||||
|
|
||||||
implicitWidth: QsWindow.window?.width - (leftBar.implicitWidth + rightBar.implicitWidth)
|
|
||||||
implicitHeight: QsWindow.window?.height - (topBar.implicitHeight + bottomBar.implicitHeight)
|
|
||||||
color: "transparent"
|
|
||||||
x: leftBar.implicitWidth
|
|
||||||
y: topBar.implicitHeight
|
|
||||||
|
|
||||||
Repeater {
|
|
||||||
model: 4
|
|
||||||
|
|
||||||
RoundedCorner {
|
|
||||||
required property int modelData
|
|
||||||
|
|
||||||
corner: modelData
|
|
||||||
color: window.barColor
|
color: window.barColor
|
||||||
}
|
anchors.left: parent.left
|
||||||
|
}
|
||||||
|
Rectangle {
|
||||||
|
id: rightBar
|
||||||
|
|
||||||
|
implicitWidth: 10
|
||||||
|
implicitHeight: QsWindow.window?.height ?? 0
|
||||||
|
color: window.barColor
|
||||||
|
anchors.right: parent.right
|
||||||
|
}
|
||||||
|
Rectangle {
|
||||||
|
id: bottomBar
|
||||||
|
|
||||||
|
implicitWidth: QsWindow.window?.width ?? 0
|
||||||
|
implicitHeight: 10
|
||||||
|
color: window.barColor
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
}
|
||||||
|
Rectangle {
|
||||||
|
id: topBar
|
||||||
|
|
||||||
|
implicitWidth: QsWindow.window?.width ?? 0
|
||||||
|
implicitHeight: 50
|
||||||
|
color: window.barColor
|
||||||
|
anchors.top: parent.top
|
||||||
|
|
||||||
|
FlexboxLayout {
|
||||||
|
id: flexLayout
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Appearance.margin
|
||||||
|
|
||||||
|
wrap: FlexboxLayout.Wrap
|
||||||
|
direction: FlexboxLayout.Row
|
||||||
|
justifyContent: FlexboxLayout.JustifySpaceBetween
|
||||||
|
|
||||||
|
BarSection {
|
||||||
|
widgets: BarLayout.left
|
||||||
|
alignment: Qt.AlignLeft
|
||||||
|
}
|
||||||
|
BarSection {
|
||||||
|
widgets: BarLayout.center
|
||||||
|
alignment: Qt.AlignHCenter
|
||||||
|
}
|
||||||
|
BarSection {
|
||||||
|
widgets: BarLayout.right
|
||||||
|
alignment: Qt.AlignRight
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: cornersArea
|
||||||
|
|
||||||
|
implicitWidth: QsWindow.window?.width - (leftBar.implicitWidth + rightBar.implicitWidth)
|
||||||
|
implicitHeight: QsWindow.window?.height - (topBar.implicitHeight + bottomBar.implicitHeight)
|
||||||
|
color: "transparent"
|
||||||
|
x: leftBar.implicitWidth
|
||||||
|
y: topBar.implicitHeight
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: 4
|
||||||
|
|
||||||
|
RoundedCorner {
|
||||||
|
required property int modelData
|
||||||
|
|
||||||
|
corner: modelData
|
||||||
|
color: window.barColor
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,48 +8,48 @@ import qs.services
|
|||||||
import "../modules/osd"
|
import "../modules/osd"
|
||||||
|
|
||||||
PanelWindow {
|
PanelWindow {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
readonly property int cardWidth: 420
|
readonly property int cardWidth: 420
|
||||||
|
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
exclusionMode: ExclusionMode.Ignore
|
exclusionMode: ExclusionMode.Ignore
|
||||||
visible: Notifications.popupCount > 0
|
visible: Notifications.popupCount > 0
|
||||||
implicitWidth: root.cardWidth
|
implicitWidth: root.cardWidth
|
||||||
implicitHeight: stack.implicitHeight
|
implicitHeight: stack.implicitHeight
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
top: true
|
top: true
|
||||||
right: true
|
right: true
|
||||||
}
|
}
|
||||||
margins {
|
margins {
|
||||||
top: 50 + Appearance.margin
|
top: 50 + Appearance.margin
|
||||||
right: 10 + Appearance.margin
|
right: 10 + Appearance.margin
|
||||||
}
|
}
|
||||||
|
|
||||||
mask: Region {
|
mask: Region {
|
||||||
item: stack
|
item: stack
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: stack
|
id: stack
|
||||||
|
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
spacing: Appearance.spacing
|
spacing: Appearance.spacing
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: [...Notifications.popups.values].reverse()
|
model: [...Notifications.popups.values].reverse()
|
||||||
|
|
||||||
NotificationCard {
|
NotificationCard {
|
||||||
id: card
|
id: card
|
||||||
|
|
||||||
required property var modelData
|
required property var modelData
|
||||||
|
|
||||||
notif: modelData
|
notif: modelData
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user