mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-06-09 13:12:08 +00:00
Brightness/VolumeWidget: fix visual issues (#875)
This commit is contained in:
@@ -23,6 +23,8 @@ Item {
|
||||
property color customBackgroundColor: Color.transparent
|
||||
property color customTextIconColor: Color.transparent
|
||||
|
||||
readonly property bool hiddenByForceClose: forceClose && !forceOpen
|
||||
|
||||
// Effective shown state (true if hovered/animated open or forced)
|
||||
readonly property bool revealed: !forceClose && (forceOpen || showPill)
|
||||
|
||||
@@ -66,8 +68,9 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
width: pillHeight + Math.max(0, pill.width - pillOverlap)
|
||||
height: pillHeight
|
||||
width: hiddenByForceClose ? 0 : pillHeight + Math.max(0, pill.width - pillOverlap)
|
||||
height: hiddenByForceClose ? 0 : pillHeight
|
||||
visible: !hiddenByForceClose
|
||||
|
||||
Connections {
|
||||
target: root
|
||||
|
||||
@@ -24,6 +24,8 @@ Item {
|
||||
property color customBackgroundColor: Color.transparent
|
||||
property color customTextIconColor: Color.transparent
|
||||
|
||||
readonly property bool hiddenByForceClose: forceClose && !forceOpen
|
||||
|
||||
signal shown
|
||||
signal hidden
|
||||
signal entered
|
||||
@@ -75,8 +77,9 @@ Item {
|
||||
}
|
||||
|
||||
// For vertical bars: width is just icon size, height includes pill space
|
||||
width: buttonSize
|
||||
height: revealed ? (buttonSize + maxPillHeight - pillOverlap) : buttonSize
|
||||
width: hiddenByForceClose ? 0 : buttonSize
|
||||
height: hiddenByForceClose ? 0 : (revealed ? (buttonSize + maxPillHeight - pillOverlap) : buttonSize)
|
||||
visible: !hiddenByForceClose
|
||||
|
||||
Connections {
|
||||
target: root
|
||||
|
||||
@@ -47,6 +47,8 @@ Item {
|
||||
function getIcon() {
|
||||
var monitor = getMonitor();
|
||||
var brightness = monitor ? monitor.brightness : 0;
|
||||
if (brightness <= 0.001)
|
||||
return "sun-off";
|
||||
return brightness <= 0.5 ? "brightness-low" : "brightness-high";
|
||||
}
|
||||
|
||||
|
||||
@@ -202,9 +202,14 @@ Singleton {
|
||||
function getOutputIcon() {
|
||||
if (muted)
|
||||
return "volume-mute";
|
||||
if (volume <= Number.EPSILON)
|
||||
|
||||
const maxVolume = Settings.data.audio.volumeOverdrive ? 1.5 : 1.0;
|
||||
const clampedVolume = Math.max(0, Math.min(volume, maxVolume));
|
||||
const displayPercent = Math.round(clampedVolume * 100);
|
||||
|
||||
if (displayPercent === 0)
|
||||
return "volume-zero";
|
||||
if (volume <= 0.5)
|
||||
if (clampedVolume <= 0.5)
|
||||
return "volume-low";
|
||||
return "volume-high";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user