Add scaling to everything, edit SidePanel

This commit is contained in:
Ly-sec
2025-08-07 15:38:27 +02:00
parent 68d7add474
commit 0b49aff13d
52 changed files with 3135 additions and 3040 deletions
+99 -57
View File
@@ -17,6 +17,7 @@ Rectangle {
property string uptimeText: "--:--"
property bool panelVisible: false
property var settingsModal: null
function logout() {
if (WorkspaceManager.isNiri)
@@ -43,8 +44,8 @@ Rectangle {
uptimeProcess.running = true;
}
width: 440
height: 80
width: 440 * Theme.uiScale
height: 80 * Theme.uiScale
color: "transparent"
anchors.horizontalCenterOffset: -2
onPanelVisibleChanged: {
@@ -61,29 +62,29 @@ Rectangle {
anchors.fill: parent
color: Theme.surface
radius: 18
radius: 18 * Theme.uiScale
ColumnLayout {
anchors.fill: parent
anchors.margins: 18
spacing: 12
anchors.margins: 18 * Theme.uiScale
spacing: 12 * Theme.uiScale
RowLayout {
Layout.fillWidth: true
spacing: 12
spacing: 12 * Theme.uiScale
Rectangle {
width: 48
height: 48
radius: 24
width: 48 * Theme.uiScale
height: 48 * Theme.uiScale
radius: 24 * Theme.uiScale
color: Theme.accentPrimary
Rectangle {
anchors.fill: parent
color: "transparent"
radius: 24
radius: 24 * Theme.uiScale
border.color: Theme.accentPrimary
border.width: 2
border.width: 2 * Theme.uiScale
z: 2
}
@@ -93,13 +94,13 @@ Rectangle {
}
ColumnLayout {
spacing: 4
spacing: 4 * Theme.uiScale
Layout.fillWidth: true
Text {
text: Quickshell.env("USER")
font.family: Theme.fontFamily
font.pixelSize: 16
font.pixelSize: 16 * Theme.uiScale
font.bold: true
color: Theme.textPrimary
}
@@ -107,7 +108,7 @@ Rectangle {
Text {
text: "System Uptime: " + uptimeText
font.family: Theme.fontFamily
font.pixelSize: 12
font.pixelSize: 12 * Theme.uiScale
color: Theme.textSecondary
}
@@ -117,21 +118,62 @@ Rectangle {
Layout.fillWidth: true
}
Rectangle {
id: settingsButton
width: 32 * Theme.uiScale
height: 32 * Theme.uiScale
radius: 16 * Theme.uiScale
color: settingsButtonArea.containsMouse || settingsButtonArea.pressed ? Theme.accentPrimary : "transparent"
border.color: Theme.accentPrimary
border.width: 1 * Theme.uiScale
Text {
anchors.centerIn: parent
anchors.horizontalCenterOffset: -1
text: "settings"
font.family: "Material Symbols Outlined"
font.pixelSize: 16 * Theme.uiScale
color: settingsButtonArea.containsMouse || settingsButtonArea.pressed ? Theme.backgroundPrimary : Theme.accentPrimary
}
MouseArea {
id: settingsButtonArea
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
hoverEnabled: true
onClicked: {
if (typeof settingsModal !== 'undefined' && settingsModal && settingsModal.openSettings)
settingsModal.openSettings();
}
}
StyledTooltip {
id: settingsTooltip
text: "Settings"
targetItem: settingsButton
tooltipVisible: settingsButtonArea.containsMouse
}
}
Rectangle {
id: systemButton
width: 32
height: 32
radius: 16
width: 32 * Theme.uiScale
height: 32 * Theme.uiScale
radius: 16 * Theme.uiScale
color: systemButtonArea.containsMouse || systemButtonArea.pressed ? Theme.accentPrimary : "transparent"
border.color: Theme.accentPrimary
border.width: 1
border.width: 1 * Theme.uiScale
Text {
anchors.centerIn: parent
text: "power_settings_new"
font.family: "Material Symbols Outlined"
font.pixelSize: 16
font.pixelSize: 16 * Theme.uiScale
color: systemButtonArea.containsMouse || systemButtonArea.pressed ? Theme.backgroundPrimary : Theme.accentPrimary
}
@@ -169,18 +211,18 @@ Rectangle {
anchors.right: systemButton.right
Rectangle {
width: 160
height: 220
width: 160 * Theme.uiScale
height: 220 * Theme.uiScale
color: Theme.surface
radius: 8
radius: 8 * Theme.uiScale
border.color: Theme.outline
border.width: 1
border.width: 1 * Theme.uiScale
visible: true
z: 9999
anchors.top: parent.top
anchors.right: parent.right
anchors.rightMargin: 32
anchors.topMargin: systemButton.y + systemButton.height + 48
anchors.rightMargin: 32 * Theme.uiScale
anchors.topMargin: systemButton.y + systemButton.height + 48 * Theme.uiScale
// Prevent closing when clicking in the panel bg
MouseArea {
@@ -189,31 +231,31 @@ Rectangle {
ColumnLayout {
anchors.fill: parent
anchors.margins: 8
spacing: 4
anchors.margins: 8 * Theme.uiScale
spacing: 4 * Theme.uiScale
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 36
radius: 6
Layout.preferredHeight: 36 * Theme.uiScale
radius: 6 * Theme.uiScale
color: lockButtonArea.containsMouse ? Theme.accentPrimary : "transparent"
RowLayout {
anchors.fill: parent
anchors.margins: 12
spacing: 8
anchors.margins: 12 * Theme.uiScale
spacing: 8 * Theme.uiScale
Text {
text: "lock_outline"
font.family: "Material Symbols Outlined"
font.pixelSize: 16
font.pixelSize: 16 * Theme.uiScale
color: lockButtonArea.containsMouse ? Theme.onAccent : Theme.textPrimary
}
Text {
text: "Lock Screen"
font.family: Theme.fontFamily
font.pixelSize: 14
font.pixelSize: 14 * Theme.uiScale
color: lockButtonArea.containsMouse ? Theme.onAccent : Theme.textPrimary
Layout.fillWidth: true
}
@@ -236,25 +278,25 @@ Rectangle {
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 36
radius: 6
Layout.preferredHeight: 36 * Theme.uiScale
radius: 6 * Theme.uiScale
color: suspendButtonArea.containsMouse ? Theme.accentPrimary : "transparent"
RowLayout {
anchors.fill: parent
anchors.margins: 12
spacing: 8
anchors.margins: 12 * Theme.uiScale
spacing: 8 * Theme.uiScale
Text {
text: "bedtime"
font.family: "Material Symbols Outlined"
font.pixelSize: 16
font.pixelSize: 16 * Theme.uiScale
color: suspendButtonArea.containsMouse ? Theme.onAccent : Theme.textPrimary
}
Text {
text: "Suspend"
font.pixelSize: 14
font.pixelSize: 14 * Theme.uiScale
color: suspendButtonArea.containsMouse ? Theme.onAccent : Theme.textPrimary
Layout.fillWidth: true
}
@@ -277,26 +319,26 @@ Rectangle {
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 36
radius: 6
Layout.preferredHeight: 36 * Theme.uiScale
radius: 6 * Theme.uiScale
color: rebootButtonArea.containsMouse ? Theme.accentPrimary : "transparent"
RowLayout {
anchors.fill: parent
anchors.margins: 12
spacing: 8
anchors.margins: 12 * Theme.uiScale
spacing: 8 * Theme.uiScale
Text {
text: "refresh"
font.family: "Material Symbols Outlined"
font.pixelSize: 16
font.pixelSize: 16 * Theme.uiScale
color: rebootButtonArea.containsMouse ? Theme.onAccent : Theme.textPrimary
}
Text {
text: "Reboot"
font.family: Theme.fontFamily
font.pixelSize: 14
font.pixelSize: 14 * Theme.uiScale
color: rebootButtonArea.containsMouse ? Theme.onAccent : Theme.textPrimary
Layout.fillWidth: true
}
@@ -319,25 +361,25 @@ Rectangle {
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 36
radius: 6
Layout.preferredHeight: 36 * Theme.uiScale
radius: 6 * Theme.uiScale
color: logoutButtonArea.containsMouse ? Theme.accentPrimary : "transparent"
RowLayout {
anchors.fill: parent
anchors.margins: 12
spacing: 8
anchors.margins: 12 * Theme.uiScale
spacing: 8 * Theme.uiScale
Text {
text: "exit_to_app"
font.family: "Material Symbols Outlined"
font.pixelSize: 16
font.pixelSize: 16 * Theme.uiScale
color: logoutButtonArea.containsMouse ? Theme.onAccent : Theme.textPrimary
}
Text {
text: "Logout"
font.pixelSize: 14
font.pixelSize: 14 * Theme.uiScale
color: logoutButtonArea.containsMouse ? Theme.onAccent : Theme.textPrimary
Layout.fillWidth: true
}
@@ -360,25 +402,25 @@ Rectangle {
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 36
radius: 6
Layout.preferredHeight: 36 * Theme.uiScale
radius: 6 * Theme.uiScale
color: shutdownButtonArea.containsMouse ? Theme.accentPrimary : "transparent"
RowLayout {
anchors.fill: parent
anchors.margins: 12
spacing: 8
anchors.margins: 12 * Theme.uiScale
spacing: 8 * Theme.uiScale
Text {
text: "power_settings_new"
font.family: "Material Symbols Outlined"
font.pixelSize: 16
font.pixelSize: 16 * Theme.uiScale
color: shutdownButtonArea.containsMouse ? Theme.onAccent : Theme.textPrimary
}
Text {
text: "Shutdown"
font.pixelSize: 14
font.pixelSize: 14 * Theme.uiScale
color: shutdownButtonArea.containsMouse ? Theme.onAccent : Theme.textPrimary
Layout.fillWidth: true
}