From 3527ca77bf402d74f9398777d2e8535e14e8b09f Mon Sep 17 00:00:00 2001 From: Emerson Coskey Date: Sun, 5 Oct 2025 22:46:43 -0700 Subject: [PATCH 1/2] add media ipc target --- Services/IPCService.qml | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/Services/IPCService.qml b/Services/IPCService.qml index 64b1225e..bd5f220b 100644 --- a/Services/IPCService.qml +++ b/Services/IPCService.qml @@ -166,4 +166,45 @@ Item { Settings.data.wallpaper.randomEnabled = true } } + + IpcHandler { + target: "media" + function playPause() { + MediaService.playPause() + } + + function play() { + MediaService.play() + } + + function pause() { + MediaService.pause() + } + + function next() { + MediaService.next() + } + + function previous() { + MediaService.previous() + } + + function seek(position: string) { + var positionVal = parseFloat(position) + if (Number.isNaN(positionVal)) { + Logger.warn("Media", "Argument to ipc call 'media seek' must be a number") + return + } + MediaService.seek(positionVal) + } + + function seekByRatio(position: string) { + var positionVal = parseFloat(position) + if (Number.isNaN(positionVal)) { + Logger.warn("Media", "Argument to ipc call 'media seekByRatio' must be a number") + return + } + MediaService.seekByRatio(positionVal) + } + } } From 4e8f2530159922c022134e15dd263b12e4915a6d Mon Sep 17 00:00:00 2001 From: Emerson Coskey Date: Tue, 7 Oct 2025 11:14:38 -0700 Subject: [PATCH 2/2] replace seek with seekRelative --- Services/IPCService.qml | 10 +++++----- Services/MediaService.qml | 8 ++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Services/IPCService.qml b/Services/IPCService.qml index bd5f220b..6b81b475 100644 --- a/Services/IPCService.qml +++ b/Services/IPCService.qml @@ -189,13 +189,13 @@ Item { MediaService.previous() } - function seek(position: string) { - var positionVal = parseFloat(position) - if (Number.isNaN(positionVal)) { - Logger.warn("Media", "Argument to ipc call 'media seek' must be a number") + function seekRelative(offset: string) { + var offsetVal = parseFloat(position) + if (Number.isNaN(offsetVal)) { + Logger.warn("Media", "Argument to ipc call 'media seekRelative' must be a number") return } - MediaService.seek(positionVal) + MediaService.seekRelative(offsetVal) } function seekByRatio(position: string) { diff --git a/Services/MediaService.qml b/Services/MediaService.qml index 0eae65ec..210a67dc 100644 --- a/Services/MediaService.qml +++ b/Services/MediaService.qml @@ -143,6 +143,14 @@ Singleton { } } + function seekRelative(offset) { + if (currentPlayer && currentPlayer.canSeek) { + var newPosition = currentPlayer.position + offset; + currentPlayer.position = newPosition; + currentPosition = newPosition; + } + } + // Seek to position based on ratio (0.0 to 1.0) function seekByRatio(ratio) { if (currentPlayer && currentPlayer.canSeek && currentPlayer.length > 0) {