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
f0268d71
Unverified
Commit
f0268d71
authored
Jul 10, 2025
by
Aidan Epstein
Committed by
GitHub
Jul 10, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add loop-carousel option to mpris. (#570)
parent
d93d60e4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
6 deletions
+30
-6
swaync.5.scd
man/swaync.5.scd
+7
-1
config.json.in
src/config.json.in
+2
-1
configSchema.json
src/configSchema.json
+5
-0
mpris.vala
src/controlCenter/widgets/mpris/mpris.vala
+16
-4
No files found.
man/swaync.5.scd
View file @
f0268d71
...
@@ -354,6 +354,11 @@ config file to be able to detect config errors
...
@@ -354,6 +354,11 @@ config file to be able to detect config errors
hidden, always visible, or only visible ++
hidden, always visible, or only visible ++
when a valid album art is provided. ++
when a valid album art is provided. ++
enum: ["right", "left"] ++
enum: ["right", "left"] ++
loop-carousel: ++
type: bool ++
optional: true ++
default: false ++
description: Whether to loop through the mpris carousel. ++
description: A widget that displays multiple music players. ++
description: A widget that displays multiple music players. ++
*menubar*++
*menubar*++
type: object ++
type: object ++
...
@@ -615,7 +620,8 @@ config file to be able to detect config errors
...
@@ -615,7 +620,8 @@ config file to be able to detect config errors
"mpris": {
"mpris": {
"blacklist": ["playerctld"],
"blacklist": ["playerctld"],
"autohide": true,
"autohide": true,
"show-album-art": "always"
"show-album-art": "always",
"loop-carousel": false
},
},
"menubar": {
"menubar": {
"menu#power": {
"menu#power": {
...
...
src/config.json.in
View file @
f0268d71
...
@@ -75,7 +75,8 @@
...
@@ -75,7 +75,8 @@
"mpris": {
"mpris": {
"blacklist": [],
"blacklist": [],
"autohide": false,
"autohide": false,
"show-album-art": "always"
"show-album-art": "always",
"loop-carousel": false
},
},
"buttons-grid": {
"buttons-grid": {
"actions": [
"actions": [
...
...
src/configSchema.json
View file @
f0268d71
...
@@ -421,6 +421,11 @@
...
@@ -421,6 +421,11 @@
"description"
:
"Whether or not the album art should be hidden, always visible, or only visible when a valid album art is provided."
,
"description"
:
"Whether or not the album art should be hidden, always visible, or only visible when a valid album art is provided."
,
"default"
:
"always"
,
"default"
:
"always"
,
"enum"
:
[
"always"
,
"when-available"
,
"never"
]
"enum"
:
[
"always"
,
"when-available"
,
"never"
]
},
"loop-carousel"
:
{
"type"
:
"boolean"
,
"description"
:
"Whether to loop through the mpris carousel."
,
"default"
:
"false"
}
}
}
}
},
},
...
...
src/controlCenter/widgets/mpris/mpris.vala
View file @
f0268d71
...
@@ -21,6 +21,7 @@ namespace SwayNotificationCenter.Widgets.Mpris {
...
@@ -21,6 +21,7 @@ namespace SwayNotificationCenter.Widgets.Mpris {
AlbumArtState
show_album_art
;
AlbumArtState
show_album_art
;
bool
autohide
;
bool
autohide
;
string
[]
blacklist
;
string
[]
blacklist
;
bool
loop_carousel
;
}
}
public
class
Mpris
:
BaseWidget
{
public
class
Mpris
:
BaseWidget
{
...
@@ -48,6 +49,7 @@ namespace SwayNotificationCenter.Widgets.Mpris {
...
@@ -48,6 +49,7 @@ namespace SwayNotificationCenter.Widgets.Mpris {
image_size
=
-
1
,
image_size
=
-
1
,
show_album_art
=
AlbumArtState
.
ALWAYS
,
show_album_art
=
AlbumArtState
.
ALWAYS
,
autohide
=
false
,
autohide
=
false
,
loop_carousel
=
false
,
};
};
public
Mpris
(
string
suffix
,
SwayncDaemon
swaync_daemon
,
NotiDaemon
noti_daemon
)
{
public
Mpris
(
string
suffix
,
SwayncDaemon
swaync_daemon
,
NotiDaemon
noti_daemon
)
{
...
@@ -82,8 +84,8 @@ namespace SwayNotificationCenter.Widgets.Mpris {
...
@@ -82,8 +84,8 @@ namespace SwayNotificationCenter.Widgets.Mpris {
button_next
.
sensitive
=
false
;
button_next
.
sensitive
=
false
;
return
;
return
;
}
}
button_prev
.
sensitive
=
index
>
0
;
button_prev
.
sensitive
=
(
index
>
0
)
||
mpris_config
.
loop_carousel
;
button_next
.
sensitive
=
index
<
carousel
.
n_pages
-
1
;
button_next
.
sensitive
=
(
index
<
carousel
.
n_pages
-
1
)
||
mpris_config
.
loop_carousel
;
});
});
carousel_box
.
append
(
button_prev
);
carousel_box
.
append
(
button_prev
);
...
@@ -128,6 +130,11 @@ namespace SwayNotificationCenter.Widgets.Mpris {
...
@@ -128,6 +130,11 @@ namespace SwayNotificationCenter.Widgets.Mpris {
bool
autohide_found
;
bool
autohide_found
;
bool
?
autohide
=
get_prop
<
bool
>
(
config
,
"autohide"
,
out
autohide_found
);
bool
?
autohide
=
get_prop
<
bool
>
(
config
,
"autohide"
,
out
autohide_found
);
if
(
autohide_found
)
mpris_config
.
autohide
=
autohide
;
if
(
autohide_found
)
mpris_config
.
autohide
=
autohide
;
// Get loop
bool
loop_carousel_found
;
bool
?
loop_carousel
=
get_prop
<
bool
>
(
config
,
"loop-carousel"
,
out
loop_carousel_found
);
if
(
loop_carousel_found
)
mpris_config
.
loop_carousel
=
loop_carousel
;
}
}
hide
();
hide
();
...
@@ -253,8 +260,13 @@ namespace SwayNotificationCenter.Widgets.Mpris {
...
@@ -253,8 +260,13 @@ namespace SwayNotificationCenter.Widgets.Mpris {
private
void
change_carousel_position
(
int
delta
)
{
private
void
change_carousel_position
(
int
delta
)
{
uint
children_length
=
carousel
.
n_pages
;
uint
children_length
=
carousel
.
n_pages
;
if
(
children_length
==
0
)
return
;
if
(
children_length
==
0
)
return
;
uint
position
=
((
uint
)
carousel
.
position
+
delta
)
uint
position
;
.
clamp
(
0
,
(
children_length
-
1
));
if
(
mpris_config
.
loop_carousel
)
{
position
=
((
uint
)
carousel
.
position
+
delta
)
%
children_length
;
}
else
{
position
=
((
uint
)
carousel
.
position
+
delta
)
.
clamp
(
0
,
(
children_length
-
1
));
}
carousel
.
scroll_to
(
carousel
.
get_nth_page
(
position
),
true
);
carousel
.
scroll_to
(
carousel
.
get_nth_page
(
position
),
true
);
}
}
...
...
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