A few small fixes

This commit is contained in:
Ly-sec 2025-07-28 13:17:30 +02:00
parent a36bc33123
commit a15677aadf
8 changed files with 35 additions and 20 deletions

View file

@ -9,19 +9,21 @@ Item {
property var shell property var shell
property int volume: 0 property int volume: 0
// The total width will match the pill's width
width: pillIndicator.width width: pillIndicator.width
height: pillIndicator.height height: pillIndicator.height
PillIndicator { PillIndicator {
id: pillIndicator id: pillIndicator
icon: shell && shell.defaultAudioSink && shell.defaultAudioSink.audio && shell.defaultAudioSink.audio.muted ? "volume_off" : (volume === 0 ? "volume_off" : (volume < 30 ? "volume_down" : "volume_up")) icon: shell && shell.defaultAudioSink && shell.defaultAudioSink.audio && shell.defaultAudioSink.audio.muted
? "volume_off"
: (volume === 0 ? "volume_off" : (volume < 30 ? "volume_down" : "volume_up"))
text: volume + "%" text: volume + "%"
pillColor: Theme.surfaceVariant pillColor: Theme.surfaceVariant
iconCircleColor: Theme.accentPrimary iconCircleColor: Theme.accentPrimary
iconTextColor: Theme.backgroundPrimary iconTextColor: Theme.backgroundPrimary
textColor: Theme.textPrimary textColor: Theme.textPrimary
StyledTooltip { StyledTooltip {
id: volumeTooltip id: volumeTooltip
text: "Volume: " + volume + "%\nScroll up/down to change volume.\nLeft click to open the input/output selection." text: "Volume: " + volume + "%\nScroll up/down to change volume.\nLeft click to open the input/output selection."
@ -47,26 +49,31 @@ Item {
Connections { Connections {
target: shell ?? null target: shell ?? null
function onVolumeChanged() { function onVolumeChanged() {
if (shell && shell.volume !== volume) { if (shell) {
volume = shell.volume const clampedVolume = Math.max(0, Math.min(100, shell.volume));
pillIndicator.text = volume + "%" if (clampedVolume !== volume) {
pillIndicator.icon = shell && shell.defaultAudioSink && shell.defaultAudioSink.audio && shell.defaultAudioSink.audio.muted ? "volume_off" : (volume === 0 ? "volume_off" : (volume < 30 ? "volume_down" : "volume_up")) volume = clampedVolume;
pillIndicator.show() pillIndicator.text = volume + "%";
pillIndicator.icon = shell.defaultAudioSink && shell.defaultAudioSink.audio && shell.defaultAudioSink.audio.muted
? "volume_off"
: (volume === 0 ? "volume_off" : (volume < 30 ? "volume_down" : "volume_up"));
pillIndicator.show();
}
} }
} }
} }
Component.onCompleted: { Component.onCompleted: {
if (shell && shell.volume !== undefined) { if (shell && shell.volume !== undefined) {
volume = shell.volume volume = Math.max(0, Math.min(100, shell.volume));
pillIndicator.show() pillIndicator.show();
} }
} }
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
acceptedButtons: Qt.NoButton // Accept wheel events only acceptedButtons: Qt.NoButton
propagateComposedEvents: true propagateComposedEvents: true
onEntered: volumeDisplay.containsMouse = true onEntered: volumeDisplay.containsMouse = true
onExited: volumeDisplay.containsMouse = false onExited: volumeDisplay.containsMouse = false

View file

@ -322,7 +322,7 @@ WlSessionLock {
position: "bottomleft" position: "bottomleft"
size: 1.3 size: 1.3
fillColor: (Theme.backgroundPrimary !== undefined && Theme.backgroundPrimary !== null) ? Theme.backgroundPrimary : "#222" fillColor: (Theme.backgroundPrimary !== undefined && Theme.backgroundPrimary !== null) ? Theme.backgroundPrimary : "#222"
offsetX: screen.width / 2 + 31 offsetX: screen.width / 2 + 30
offsetY: 0 offsetY: 0
anchors.top: parent.top anchors.top: parent.top
//anchors.horizontalCenter: parent.horizontalCenter //anchors.horizontalCenter: parent.horizontalCenter
@ -335,7 +335,7 @@ WlSessionLock {
position: "bottomright" position: "bottomright"
size: 1.3 size: 1.3
fillColor: (Theme.backgroundPrimary !== undefined && Theme.backgroundPrimary !== null) ? Theme.backgroundPrimary : "#222" fillColor: (Theme.backgroundPrimary !== undefined && Theme.backgroundPrimary !== null) ? Theme.backgroundPrimary : "#222"
offsetX: - Screen.width / 2 - 31 offsetX: - Screen.width / 2 - 30
offsetY: 0 offsetY: 0
anchors.top: parent.top anchors.top: parent.top
//anchors.horizontalCenter: parent.horizontalCenter //anchors.horizontalCenter: parent.horizontalCenter

View file

@ -10,7 +10,7 @@ import qs.Components
PanelWindow { PanelWindow {
id: settingsModal id: settingsModal
implicitWidth: 480 implicitWidth: 480
implicitHeight: 800 implicitHeight: 780
visible: false visible: false
color: "transparent" color: "transparent"
anchors.top: true anchors.top: true

View file

@ -73,7 +73,7 @@ Item {
PanelWindow { PanelWindow {
id: bluetoothPanelModal id: bluetoothPanelModal
implicitWidth: 480 implicitWidth: 480
implicitHeight: 800 implicitHeight: 780
visible: false visible: false
color: "transparent" color: "transparent"
anchors.top: true anchors.top: true

View file

@ -373,6 +373,7 @@ PanelWithOverlay {
anchors.top: mainRectangle.top anchors.top: mainRectangle.top
offsetX: -447 + sidebarPopupRect.slideOffset offsetX: -447 + sidebarPopupRect.slideOffset
offsetY: 0 offsetY: 0
visible: Settings.settings.showCorners
Behavior on offsetX { Behavior on offsetX {
enabled: !sidebarPopupRect.isAnimating enabled: !sidebarPopupRect.isAnimating
@ -390,6 +391,7 @@ PanelWithOverlay {
fillColor: Theme.backgroundPrimary fillColor: Theme.backgroundPrimary
offsetX: 33 + sidebarPopupRect.slideOffset offsetX: 33 + sidebarPopupRect.slideOffset
offsetY: 46 offsetY: 46
visible: Settings.settings.showCorners
Behavior on offsetX { Behavior on offsetX {
enabled: !sidebarPopupRect.isAnimating enabled: !sidebarPopupRect.isAnimating

View file

@ -11,7 +11,7 @@ import qs.Services
PanelWindow { PanelWindow {
id: wallpaperPanelModal id: wallpaperPanelModal
implicitWidth: 480 implicitWidth: 480
implicitHeight: 800 implicitHeight: 780
visible: false visible: false
color: "transparent" color: "transparent"
anchors.top: true anchors.top: true

View file

@ -354,7 +354,7 @@ Item {
PanelWindow { PanelWindow {
id: wifiPanelModal id: wifiPanelModal
implicitWidth: 480 implicitWidth: 480
implicitHeight: 800 implicitHeight: 780
visible: false visible: false
color: "transparent" color: "transparent"
anchors.top: true anchors.top: true

View file

@ -21,10 +21,17 @@ Scope {
property var notificationHistoryWin: notificationHistoryWin property var notificationHistoryWin: notificationHistoryWin
property bool pendingReload: false property bool pendingReload: false
// Helper function to round value to nearest step
function roundToStep(value, step) {
return Math.round(value / step) * step;
}
function updateVolume(vol) { function updateVolume(vol) {
volume = vol; var clamped = Math.max(0, Math.min(100, vol));
var stepped = roundToStep(clamped, 5);
volume = stepped;
if (defaultAudioSink && defaultAudioSink.audio) { if (defaultAudioSink && defaultAudioSink.audio) {
defaultAudioSink.audio.volume = vol / 100; defaultAudioSink.audio.volume = stepped / 100;
} }
} }
@ -83,7 +90,6 @@ Scope {
barVisible: bar.visible barVisible: bar.visible
} }
// Notification History Window
NotificationHistory { NotificationHistory {
id: notificationHistoryWin id: notificationHistoryWin
} }