Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
ximper-shell-notification-center
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
ximper-shell-notification-center
Commits
452c8604
Verified
Commit
452c8604
authored
Mar 27, 2026
by
Kirill Unitsaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpris: add progress bar position polling timer
parent
07832239
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
mpris_player.vala
src/controlCenter/widgets/mpris/mpris_player.vala
+30
-0
No files found.
src/controlCenter/widgets/mpris/mpris_player.vala
View file @
452c8604
...
...
@@ -34,6 +34,7 @@ namespace XimperShellNotificationCenter.Widgets.Mpris {
private
int64
track_length
=
0
;
private
bool
seeking
=
false
;
private
uint
position_timer_id
=
0
;
public
MprisSource
source
{
construct
;
get
;
}
...
...
@@ -163,6 +164,7 @@ namespace XimperShellNotificationCenter.Widgets.Mpris {
format_time
(
track_length
));
update_position
();
}
sync_playback_timer
();
}
private
async
void
seek_to
(
int64
position_us
)
{
...
...
@@ -195,7 +197,32 @@ namespace XimperShellNotificationCenter.Widgets.Mpris {
(
int
)
minutes
,
(
int
)
seconds
);
}
private
void
start_position_timer
()
{
stop_position_timer
();
position_timer_id
=
Timeout
.
add
(
1000
,
()
=>
{
update_position
();
return
Source
.
CONTINUE
;
});
}
private
void
stop_position_timer
()
{
if
(
position_timer_id
!=
0
)
{
Source
.
remove
(
position_timer_id
);
position_timer_id
=
0
;
}
}
private
void
sync_playback_timer
()
{
if
(
source
.
media_player
.
playback_status
==
"Playing"
&&
track_length
>
0
)
{
start_position_timer
();
}
else
{
stop_position_timer
();
}
}
public
void
before_destroy
()
{
stop_position_timer
();
source
.
properties_changed
.
disconnect
(
properties_changed
);
}
...
...
@@ -210,6 +237,9 @@ namespace XimperShellNotificationCenter.Widgets.Mpris {
update_desktop_entry
();
break
;
case
"PlaybackStatus"
:
update_button_play_pause
(
metadata
);
sync_playback_timer
();
break
;
case
"CanPause"
:
case
"CanPlay"
:
update_button_play_pause
(
metadata
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment