Regenerated
This commit is contained in:
+343
-354
File diff suppressed because it is too large
Load Diff
+11
-22
@@ -2653,7 +2653,6 @@ ShellRoot {
|
|||||||
readonly property color lavender: "#b4befe"
|
readonly property color lavender: "#b4befe"
|
||||||
}
|
}
|
||||||
|
|
||||||
// State
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: media
|
id: media
|
||||||
property string artist: ""
|
property string artist: ""
|
||||||
@@ -2666,12 +2665,10 @@ ShellRoot {
|
|||||||
property real progress: 0.0
|
property real progress: 0.0
|
||||||
property real duration: 0.0
|
property real duration: 0.0
|
||||||
property real position: 0.0
|
property real position: 0.0
|
||||||
// 0 = no shuffle, 1 = shuffle
|
|
||||||
property int shuffleMode: 0
|
property int shuffleMode: 0
|
||||||
readonly property bool isSpotify: player.indexOf("spotify") !== -1
|
readonly property bool isSpotify: player.indexOf("spotify") !== -1
|
||||||
}
|
}
|
||||||
|
|
||||||
// Poll playerctl every second
|
|
||||||
Timer {
|
Timer {
|
||||||
interval: 1000
|
interval: 1000
|
||||||
running: true
|
running: true
|
||||||
@@ -2690,7 +2687,6 @@ ShellRoot {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detect active player — prefers spotify
|
|
||||||
Process {
|
Process {
|
||||||
id: playerProc
|
id: playerProc
|
||||||
command: ["playerctl", "-l"]
|
command: ["playerctl", "-l"]
|
||||||
@@ -2754,14 +2750,12 @@ ShellRoot {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read shuffle state from playerctl
|
|
||||||
Process {
|
Process {
|
||||||
id: shuffleProc
|
id: shuffleProc
|
||||||
command: ["playerctl", "--player=" + media.player, "shuffle"]
|
command: ["playerctl", "--player=" + media.player, "shuffle"]
|
||||||
stdout: StdioCollector {
|
stdout: StdioCollector {
|
||||||
onStreamFinished: {
|
onStreamFinished: {
|
||||||
if (media.shuffleMode !== 2)
|
media.shuffleMode = (text.trim() === "On") ? 1 : 0
|
||||||
media.shuffleMode = (text.trim() === "On") ? 1 : 0
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2778,21 +2772,18 @@ ShellRoot {
|
|||||||
shuffleOnProc.running = true
|
shuffleOnProc.running = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Focus / open the active player app
|
// Focus spotify — uses exact lowercase class as reported by hyprctl
|
||||||
Process {
|
Process {
|
||||||
id: focusProc
|
id: focusSpotifyProc
|
||||||
command: ["bash", "-c",
|
command: ["hyprctl", "dispatch", "focuswindow", "class:^(spotify)$"]
|
||||||
media.isSpotify
|
|
||||||
? "hyprctl dispatch focuswindow class:^(Spotify)$ 2>/dev/null || spotify &"
|
|
||||||
: "hyprctl dispatch focuswindow class:^(" + media.player.split('.')[0] + ")$ 2>/dev/null || " + media.player.split('.')[0].toLowerCase() + " &"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function focusPlayer() {
|
function focusPlayer() {
|
||||||
focusProc.running = true
|
if (media.isSpotify) {
|
||||||
|
focusSpotifyProc.running = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Playback controls
|
|
||||||
Process { id: prevProc; command: ["playerctl", "previous"] }
|
Process { id: prevProc; command: ["playerctl", "previous"] }
|
||||||
Process { id: playProc; command: ["playerctl", "play-pause"] }
|
Process { id: playProc; command: ["playerctl", "play-pause"] }
|
||||||
Process { id: nextProc; command: ["playerctl", "next"] }
|
Process { id: nextProc; command: ["playerctl", "next"] }
|
||||||
@@ -2802,8 +2793,7 @@ ShellRoot {
|
|||||||
title: "quickshell-media"
|
title: "quickshell-media"
|
||||||
visible: true
|
visible: true
|
||||||
implicitWidth: 300
|
implicitWidth: 300
|
||||||
implicitHeight: 440
|
implicitHeight: 420
|
||||||
property bool isFocused: Window.active
|
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
Shortcut {
|
Shortcut {
|
||||||
@@ -2811,13 +2801,13 @@ ShellRoot {
|
|||||||
onActivated: Qt.quit()
|
onActivated: Qt.quit()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gradient border — hidden when window has focus
|
// Gradient border — hidden when app has focus
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: -2
|
anchors.margins: -2
|
||||||
radius: 18
|
radius: 18
|
||||||
z: -1
|
z: -1
|
||||||
opacity: root.isFocused ? 0 : 1
|
opacity: Qt.application.active ? 0 : 1
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
NumberAnimation { duration: 150 }
|
NumberAnimation { duration: 150 }
|
||||||
}
|
}
|
||||||
@@ -2970,8 +2960,7 @@ ShellRoot {
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: ""
|
text: ""
|
||||||
font.pixelSize: 18
|
font.pixelSize: 18
|
||||||
color: media.shuffleMode === 0 ? colors.surface2
|
color: media.shuffleMode === 0 ? colors.surface2 : colors.blue
|
||||||
: colors.blue
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ ShellRoot {
|
|||||||
readonly property color lavender: "#b4befe"
|
readonly property color lavender: "#b4befe"
|
||||||
}
|
}
|
||||||
|
|
||||||
// State
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: media
|
id: media
|
||||||
property string artist: ""
|
property string artist: ""
|
||||||
@@ -37,12 +36,10 @@ ShellRoot {
|
|||||||
property real progress: 0.0
|
property real progress: 0.0
|
||||||
property real duration: 0.0
|
property real duration: 0.0
|
||||||
property real position: 0.0
|
property real position: 0.0
|
||||||
// 0 = no shuffle, 1 = shuffle
|
|
||||||
property int shuffleMode: 0
|
property int shuffleMode: 0
|
||||||
readonly property bool isSpotify: player.indexOf("spotify") !== -1
|
readonly property bool isSpotify: player.indexOf("spotify") !== -1
|
||||||
}
|
}
|
||||||
|
|
||||||
// Poll playerctl every second
|
|
||||||
Timer {
|
Timer {
|
||||||
interval: 1000
|
interval: 1000
|
||||||
running: true
|
running: true
|
||||||
@@ -61,7 +58,6 @@ ShellRoot {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detect active player — prefers spotify
|
|
||||||
Process {
|
Process {
|
||||||
id: playerProc
|
id: playerProc
|
||||||
command: ["playerctl", "-l"]
|
command: ["playerctl", "-l"]
|
||||||
@@ -125,14 +121,12 @@ ShellRoot {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read shuffle state from playerctl
|
|
||||||
Process {
|
Process {
|
||||||
id: shuffleProc
|
id: shuffleProc
|
||||||
command: ["playerctl", "--player=" + media.player, "shuffle"]
|
command: ["playerctl", "--player=" + media.player, "shuffle"]
|
||||||
stdout: StdioCollector {
|
stdout: StdioCollector {
|
||||||
onStreamFinished: {
|
onStreamFinished: {
|
||||||
if (media.shuffleMode !== 2)
|
media.shuffleMode = (text.trim() === "On") ? 1 : 0
|
||||||
media.shuffleMode = (text.trim() === "On") ? 1 : 0
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -149,21 +143,18 @@ ShellRoot {
|
|||||||
shuffleOnProc.running = true
|
shuffleOnProc.running = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Focus / open the active player app
|
// Focus spotify — uses exact lowercase class as reported by hyprctl
|
||||||
Process {
|
Process {
|
||||||
id: focusProc
|
id: focusSpotifyProc
|
||||||
command: ["bash", "-c",
|
command: ["hyprctl", "dispatch", "focuswindow", "class:^(spotify)$"]
|
||||||
media.isSpotify
|
|
||||||
? "hyprctl dispatch focuswindow class:^(Spotify)$ 2>/dev/null || spotify &"
|
|
||||||
: "hyprctl dispatch focuswindow class:^(" + media.player.split('.')[0] + ")$ 2>/dev/null || " + media.player.split('.')[0].toLowerCase() + " &"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function focusPlayer() {
|
function focusPlayer() {
|
||||||
focusProc.running = true
|
if (media.isSpotify) {
|
||||||
|
focusSpotifyProc.running = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Playback controls
|
|
||||||
Process { id: prevProc; command: ["playerctl", "previous"] }
|
Process { id: prevProc; command: ["playerctl", "previous"] }
|
||||||
Process { id: playProc; command: ["playerctl", "play-pause"] }
|
Process { id: playProc; command: ["playerctl", "play-pause"] }
|
||||||
Process { id: nextProc; command: ["playerctl", "next"] }
|
Process { id: nextProc; command: ["playerctl", "next"] }
|
||||||
@@ -173,8 +164,7 @@ ShellRoot {
|
|||||||
title: "quickshell-media"
|
title: "quickshell-media"
|
||||||
visible: true
|
visible: true
|
||||||
implicitWidth: 300
|
implicitWidth: 300
|
||||||
implicitHeight: 440
|
implicitHeight: 420
|
||||||
property bool isFocused: Window.active
|
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
Shortcut {
|
Shortcut {
|
||||||
@@ -182,13 +172,13 @@ ShellRoot {
|
|||||||
onActivated: Qt.quit()
|
onActivated: Qt.quit()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gradient border — hidden when window has focus
|
// Gradient border — hidden when app has focus
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: -2
|
anchors.margins: -2
|
||||||
radius: 18
|
radius: 18
|
||||||
z: -1
|
z: -1
|
||||||
opacity: root.isFocused ? 0 : 1
|
opacity: Qt.application.active ? 0 : 1
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
NumberAnimation { duration: 150 }
|
NumberAnimation { duration: 150 }
|
||||||
}
|
}
|
||||||
@@ -341,8 +331,7 @@ ShellRoot {
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: ""
|
text: ""
|
||||||
font.pixelSize: 18
|
font.pixelSize: 18
|
||||||
color: media.shuffleMode === 0 ? colors.surface2
|
color: media.shuffleMode === 0 ? colors.surface2 : colors.blue
|
||||||
: colors.blue
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
|||||||
Reference in New Issue
Block a user