AutoFormatting

This commit is contained in:
quadbyte 2025-08-20 21:01:41 -04:00
parent 122e95955d
commit 11463e2be4
5 changed files with 81 additions and 78 deletions

View file

@ -45,12 +45,12 @@ Row {
} }
function getAppIcon() { function getAppIcon() {
const focusedWindow = CompositorService.getFocusedWindow(); const focusedWindow = CompositorService.getFocusedWindow()
if (!focusedWindow || !focusedWindow.appId) if (!focusedWindow || !focusedWindow.appId)
return ""; return ""
let icon = Quickshell.iconPath(DesktopEntries.byId(focusedWindow.appId).icon); let icon = Quickshell.iconPath(DesktopEntries.byId(focusedWindow.appId).icon)
return icon || ""; return icon || ""
} }
// A hidden text element to safely measure the full title width // A hidden text element to safely measure the full title width
@ -83,19 +83,19 @@ Row {
// Window icon // Window icon
Item { Item {
width: Style.fontSizeL * scaling * 1.2 width: Style.fontSizeL * scaling * 1.2
height: Style.fontSizeL * scaling * 1.2 height: Style.fontSizeL * scaling * 1.2
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
visible: getTitle() !== "" && Settings.data.bar.showActiveWindowIcon visible: getTitle() !== "" && Settings.data.bar.showActiveWindowIcon
IconImage { IconImage {
id: windowIcon id: windowIcon
anchors.fill: parent anchors.fill: parent
source: getAppIcon() source: getAppIcon()
asynchronous: true asynchronous: true
smooth: true smooth: true
visible: source !== "" visible: source !== ""
} }
} }
NText { NText {

View file

@ -44,7 +44,8 @@ Row {
Loader { Loader {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
active: Settings.data.audio.showMiniplayerCava && Settings.data.audio.visualizerType == "linear" && MediaService.isPlaying active: Settings.data.audio.showMiniplayerCava && Settings.data.audio.visualizerType == "linear"
&& MediaService.isPlaying
z: 0 z: 0
sourceComponent: LinearSpectrum { sourceComponent: LinearSpectrum {
@ -58,7 +59,8 @@ Row {
Loader { Loader {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
active: Settings.data.audio.showMiniplayerCava && Settings.data.audio.visualizerType == "mirrored" && MediaService.isPlaying active: Settings.data.audio.showMiniplayerCava && Settings.data.audio.visualizerType == "mirrored"
&& MediaService.isPlaying
z: 0 z: 0
sourceComponent: MirroredSpectrum { sourceComponent: MirroredSpectrum {
@ -73,7 +75,8 @@ Row {
Loader { Loader {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
active: Settings.data.audio.showMiniplayerCava && Settings.data.audio.visualizerType == "wave" && MediaService.isPlaying active: Settings.data.audio.showMiniplayerCava && Settings.data.audio.visualizerType == "wave"
&& MediaService.isPlaying
z: 0 z: 0
sourceComponent: WaveSpectrum { sourceComponent: WaveSpectrum {
@ -90,53 +93,53 @@ Row {
id: row id: row
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
spacing: Style.marginXS * scaling spacing: Style.marginXS * scaling
z: 1 // Above the visualizer z: 1 // Above the visualizer
NIcon { NIcon {
id: windowIcon id: windowIcon
text: MediaService.isPlaying ? "pause" : "play_arrow" text: MediaService.isPlaying ? "pause" : "play_arrow"
font.pointSize: Style.fontSizeL * scaling font.pointSize: Style.fontSizeL * scaling
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
visible: !Settings.data.audio.showMiniplayerAlbumArt && getTitle() !== "" && !trackArt.visible visible: !Settings.data.audio.showMiniplayerAlbumArt && getTitle() !== "" && !trackArt.visible
} }
Column { Column {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
visible: Settings.data.audio.showMiniplayerAlbumArt visible: Settings.data.audio.showMiniplayerAlbumArt
Rectangle { Rectangle {
width: 16 * scaling width: 16 * scaling
height: 16 * scaling height: 16 * scaling
radius: width * 0.5 radius: width * 0.5
color: Color.transparent color: Color.transparent
antialiasing: true antialiasing: true
clip: true clip: true
NImageRounded { NImageRounded {
id: trackArt id: trackArt
visible: MediaService.trackArtUrl.toString() !== "" visible: MediaService.trackArtUrl.toString() !== ""
anchors.fill: parent anchors.fill: parent
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.margins: scaling anchors.margins: scaling
imagePath: MediaService.trackArtUrl imagePath: MediaService.trackArtUrl
fallbackIcon: MediaService.isPlaying ? "pause" : "play_arrow" fallbackIcon: MediaService.isPlaying ? "pause" : "play_arrow"
borderWidth: 0 borderWidth: 0
border.color: Color.transparent border.color: Color.transparent
imageRadius: width imageRadius: width
antialiasing: true antialiasing: true
}
// Fallback icon when no album art available
NIcon {
id: windowIconFallback
text: MediaService.isPlaying ? "pause" : "play_arrow"
font.pointSize: Style.fontSizeL * scaling
verticalAlignment: Text.AlignVCenter
anchors.verticalCenter: parent.verticalCenter
visible: getTitle() !== "" && !trackArt.visible
}
} }
// Fallback icon when no album art available
NIcon {
id: windowIconFallback
text: MediaService.isPlaying ? "pause" : "play_arrow"
font.pointSize: Style.fontSizeL * scaling
verticalAlignment: Text.AlignVCenter
anchors.verticalCenter: parent.verticalCenter
visible: getTitle() !== "" && !trackArt.visible
}
}
} }
NText { NText {

View file

@ -159,7 +159,7 @@ Loader {
function getAppIcon(toplevel: Toplevel): string { function getAppIcon(toplevel: Toplevel): string {
if (!toplevel) if (!toplevel)
return "" return ""
let icon = Quickshell.iconPath(DesktopEntries.byId(toplevel.appId?.toLowerCase()).icon); let icon = Quickshell.iconPath(DesktopEntries.byId(toplevel.appId?.toLowerCase()).icon)
return icon || Quickshell.iconPath("application-x-executable", true) return icon || Quickshell.iconPath("application-x-executable", true)
} }

View file

@ -242,25 +242,24 @@ ColumnLayout {
// Miniplayer section // Miniplayer section
NToggle { NToggle {
label: "Show Album Art In Bar Media Player" label: "Show Album Art In Bar Media Player"
description: "Show the album art of the currently playing song next to the title." description: "Show the album art of the currently playing song next to the title."
checked: Settings.data.audio.showMiniplayerAlbumArt checked: Settings.data.audio.showMiniplayerAlbumArt
onToggled: checked => { onToggled: checked => {
Settings.data.audio.showMiniplayerAlbumArt = checked Settings.data.audio.showMiniplayerAlbumArt = checked
} }
} }
NToggle { NToggle {
label: "Show Audio Visualizer In Bar Media Player" label: "Show Audio Visualizer In Bar Media Player"
description: "Shows an audio visualizer in the background of the miniplayer." description: "Shows an audio visualizer in the background of the miniplayer."
checked: Settings.data.audio.showMiniplayerCava checked: Settings.data.audio.showMiniplayerCava
onToggled: checked => { onToggled: checked => {
Settings.data.audio.showMiniplayerCava = checked Settings.data.audio.showMiniplayerCava = checked
} }
} }
} }
// Divider // Divider
NDivider { NDivider {
Layout.fillWidth: true Layout.fillWidth: true

View file

@ -37,7 +37,8 @@ Singleton {
Process { Process {
id: process id: process
stdinEnabled: true stdinEnabled: true
running: (Settings.data.audio.visualizerType !== "none") && (PanelService.sidePanel.active || Settings.data.audio.showMiniplayerCava) running: (Settings.data.audio.visualizerType !== "none") && (PanelService.sidePanel.active
|| Settings.data.audio.showMiniplayerCava)
command: ["cava", "-p", "/dev/stdin"] command: ["cava", "-p", "/dev/stdin"]
onExited: { onExited: {
stdinEnabled = true stdinEnabled = true