Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b8da4c9

Browse files
committedMar 20, 2025
fix: re-enable moving media controls
1 parent c6bb62a commit b8da4c9

File tree

3 files changed

+60
-70
lines changed

3 files changed

+60
-70
lines changed
 

‎extension.ts

+16-23
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const DateMenu = Main.panel.statusArea.dateMenu;
3737
const QuickSettings = Main.panel.statusArea.quickSettings;
3838

3939
const CalendarMessageList = DateMenu._messageList;
40-
const MediaSection_DateMenu = CalendarMessageList._messageView._mediaSource;
40+
const MessageView_DateMenu = CalendarMessageList._messageView;
4141

4242
const SystemItem = QuickSettings._system._systemItem;
4343
// _volumeOutput is always defined here because `./libs/widgets.js` wait on it
@@ -198,10 +198,11 @@ export default class QSAP extends Extension {
198198
this._move_slider(index, OutputVolumeSlider);
199199
} else if (widget === 'input-volume-slider' && move_input_volume_slider) {
200200
this._move_slider(index, this.InputVolumeSlider);
201-
} else if (false && widget === 'mpris-controllers' && create_mpris_controllers && this.settings.get_boolean("mpris-controllers-are-moved")) {
202-
this._move_media_controls(index);
203-
} else if (widget === 'mpris-controllers' && create_mpris_controllers && !this.settings.get_boolean("mpris-controllers-are-moved")) {
201+
} else if (widget === 'mpris-controllers' && create_mpris_controllers) {
204202
this._create_media_controls(index);
203+
if (this.settings.get_boolean("mpris-controllers-are-moved")) {
204+
this._remove_base_media_controls();
205+
}
205206
} else if (widget === 'applications-volume-sliders' && create_applications_volume_sliders) {
206207
this._create_app_mixer(index, this.settings.get_boolean("group-applications-volume-sliders"), this.settings.get_string("applications-volume-sliders-filter-mode"), this.settings.get_strv("applications-volume-sliders-filters"));
207208
} else if (widget === "perdevice-volume-sliders" && create_perdevice_volume_sliders) {
@@ -256,12 +257,9 @@ export default class QSAP extends Extension {
256257
this._panel.removeItem(this._media_section);
257258
this._media_section = null;
258259
}
259-
if (MediaSection_DateMenu._qsap_moved) {
260-
this._panel.removeItem(MediaSection_DateMenu);
261-
CalendarMessageList._sectionList.insert_child_at_index(MediaSection_DateMenu, 0);
262-
MediaSection_DateMenu.remove_style_class_name('QSAP-media-section');
263-
MediaSection_DateMenu.remove_style_class_name('QSAP-media-section-optional');
264-
delete MediaSection_DateMenu._qsap_moved;
260+
if (MessageView_DateMenu._qsap_media_removed) {
261+
MessageView_DateMenu._setupMpris();
262+
delete MessageView_DateMenu._qsap_media_removed;
265263
}
266264

267265
this._master_volumes.reverse();
@@ -294,19 +292,6 @@ export default class QSAP extends Extension {
294292
this._master_volumes.push([slider, old_index]);
295293
}
296294

297-
_move_media_controls(index: number) {
298-
CalendarMessageList._sectionList.remove_child(MediaSection_DateMenu);
299-
300-
this._panel.addItem(MediaSection_DateMenu, 2);
301-
this._panel._grid.set_child_at_index(MediaSection_DateMenu, index);
302-
303-
MediaSection_DateMenu._qsap_moved = true;
304-
MediaSection_DateMenu.add_style_class_name('QSAP-media-section');
305-
if (!this.settings.get_boolean('ignore-css')) {
306-
MediaSection_DateMenu.add_style_class_name('QSAP-media-section-optional');
307-
}
308-
}
309-
310295
_create_media_controls(index: number) {
311296
this._media_section = new MprisList();
312297
this._media_section.add_style_class_name('QSAP-media-section');
@@ -318,6 +303,14 @@ export default class QSAP extends Extension {
318303
this._panel._grid.set_child_at_index(this._media_section, index);
319304
}
320305

306+
_remove_base_media_controls() {
307+
MessageView_DateMenu._mediaSource.disconnectObject(MessageView_DateMenu);
308+
for (const player of MessageView_DateMenu._mediaSource.players) {
309+
MessageView_DateMenu._removePlayer(player);
310+
}
311+
MessageView_DateMenu._qsap_media_removed = true;
312+
}
313+
321314
_create_app_mixer(index: number, type, filter_mode, filters) {
322315
if (type === "combined") {
323316
this._applications_mixer_combined = new ApplicationsMixerToggle(this.settings, filter_mode, filters);

‎po/example.pot

+42-44
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PACKAGE VERSION\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2025-03-18 10:51+0000\n"
11+
"POT-Creation-Date: 2025-03-20 08:24+0000\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,7 +17,7 @@ msgstr ""
1717
"Content-Type: text/plain; charset=CHARSET\n"
1818
"Content-Transfer-Encoding: 8bit\n"
1919

20-
#: dist/extension.js:402
20+
#: dist/extension.js:396
2121
msgid "Reset all applications to default output"
2222
msgstr ""
2323

@@ -109,179 +109,177 @@ msgstr ""
109109
#: dist/prefs.js:76
110110
msgid ""
111111
"Move the media controls from the notifications panel instead of creating a "
112-
"new one\n"
113-
"<span color=\"red\" weight=\"bold\">Disabled in gnome 48 until it works "
114-
"again</span>"
112+
"new one"
115113
msgstr ""
116114

117-
#: dist/prefs.js:81
115+
#: dist/prefs.js:80
118116
msgid "Put the sliders in submenu"
119117
msgstr ""
120118

121-
#: dist/prefs.js:82
119+
#: dist/prefs.js:81
122120
msgid ""
123121
"<span color=\"darkorange\" weight=\"bold\">This will disable the ability to "
124122
"change the output device per application</span>"
125123
msgstr ""
126124

127-
#: dist/prefs.js:86
125+
#: dist/prefs.js:85
128126
msgid "Elements order"
129127
msgstr ""
130128

131-
#: dist/prefs.js:87
129+
#: dist/prefs.js:86
132130
msgid "Reorder elements in the new panel"
133131
msgstr ""
134132

135-
#: dist/prefs.js:91
133+
#: dist/prefs.js:90
136134
msgid "Profile switcher"
137135
msgstr ""
138136

139-
#: dist/prefs.js:92
137+
#: dist/prefs.js:91
140138
msgid "Allows you to quickly change the audio profile of the current device"
141139
msgstr ""
142140

143-
#: dist/prefs.js:97
141+
#: dist/prefs.js:96
144142
msgid "Speaker / Headphone volume slider"
145143
msgstr ""
146144

147-
#: dist/prefs.js:100
145+
#: dist/prefs.js:99
148146
msgid "Per-device volume sliders"
149147
msgstr ""
150148

151-
#: dist/prefs.js:103
149+
#: dist/prefs.js:102
152150
msgid "Audio balance slider"
153151
msgstr ""
154152

155-
#: dist/prefs.js:106
153+
#: dist/prefs.js:105
156154
msgid "Microphone volume slider"
157155
msgstr ""
158156

159-
#: dist/prefs.js:109
157+
#: dist/prefs.js:108
160158
msgid "Media controls"
161159
msgstr ""
162160

163-
#: dist/prefs.js:113
161+
#: dist/prefs.js:112
164162
msgid "Applications mixer"
165163
msgstr ""
166164

167-
#: dist/prefs.js:119
165+
#: dist/prefs.js:118
168166
msgid "The same sliders you can find in pavucontrol or in the sound settings"
169167
msgstr ""
170168

171-
#: dist/prefs.js:121
169+
#: dist/prefs.js:120
172170
msgid ""
173171
"<span color=\"darkorange\" weight=\"bold\"><tt>pactl</tt> was not found, you "
174172
"won't be able to change the output device per application</span>"
175173
msgstr ""
176174

177-
#: dist/prefs.js:126
175+
#: dist/prefs.js:125
178176
msgid ""
179177
"This slider allows you to change the balance of the current audio output"
180178
msgstr ""
181179

182-
#: dist/prefs.js:131
180+
#: dist/prefs.js:130
183181
msgid ""
184182
"<span color=\"red\" weight=\"bold\">This feature needs <tt>pactl</tt></span>"
185183
msgstr ""
186184

187-
#: dist/prefs.js:149
185+
#: dist/prefs.js:148
188186
msgid "Per-device sliders filtering"
189187
msgstr ""
190188

191-
#: dist/prefs.js:150
189+
#: dist/prefs.js:149
192190
msgid ""
193191
"Allows you to filter the per-device volume sliders. The content of the "
194192
"filters are <b>regexes</b> and are applied to the device's display name and "
195193
"pulseaudio name."
196194
msgstr ""
197195

198-
#: dist/prefs.js:151
196+
#: dist/prefs.js:150
199197
msgid "Device name"
200198
msgstr ""
201199

202-
#: dist/prefs.js:155
200+
#: dist/prefs.js:154
203201
msgid "Application mixer filtering"
204202
msgstr ""
205203

206-
#: dist/prefs.js:156
204+
#: dist/prefs.js:155
207205
msgid ""
208206
"Allows you to filter the applications that show up in the application mixer "
209207
"<b>using regexes</b>"
210208
msgstr ""
211209

212-
#: dist/prefs.js:157
210+
#: dist/prefs.js:156
213211
msgid "Application name"
214212
msgstr ""
215213

216-
#: dist/prefs.js:171
214+
#: dist/prefs.js:170
217215
msgid "LibPanel settings"
218216
msgstr ""
219217

220-
#: dist/prefs.js:172
218+
#: dist/prefs.js:171
221219
msgid ""
222220
"These settings are not specific to this extension, they apply to every panel"
223221
msgstr ""
224222

225-
#: dist/prefs.js:175
223+
#: dist/prefs.js:174
226224
msgid "Single-column mode"
227225
msgstr ""
228226

229-
#: dist/prefs.js:176
227+
#: dist/prefs.js:175
230228
msgid ""
231229
"Only one column of panels will be allowed. Also prevents the panel from "
232230
"being put at the left/right of the screen by libpanel."
233231
msgstr ""
234232

235-
#: dist/prefs.js:179
233+
#: dist/prefs.js:178
236234
msgid "Panel alignment"
237235
msgstr ""
238236

239-
#: dist/prefs.js:181
237+
#: dist/prefs.js:180
240238
msgid "Left"
241239
msgstr ""
242240

243-
#: dist/prefs.js:182
241+
#: dist/prefs.js:181
244242
msgid "Right"
245243
msgstr ""
246244

247-
#: dist/prefs.js:186
245+
#: dist/prefs.js:185
248246
msgid "Padding"
249247
msgstr ""
250248

251-
#: dist/prefs.js:187
249+
#: dist/prefs.js:186
252250
msgid "Use this to override the default padding of the panels"
253251
msgstr ""
254252

255-
#: dist/prefs.js:190
253+
#: dist/prefs.js:189
256254
msgid "Row spacing"
257255
msgstr ""
258256

259-
#: dist/prefs.js:191
257+
#: dist/prefs.js:190
260258
msgid "Use this to override the default row spacing of the panels"
261259
msgstr ""
262260

263-
#: dist/prefs.js:194
261+
#: dist/prefs.js:193
264262
msgid "Column spacing"
265263
msgstr ""
266264

267-
#: dist/prefs.js:195
265+
#: dist/prefs.js:194
268266
msgid "Use this to override the default column spacing of the panels"
269267
msgstr ""
270268

271-
#: dist/prefs.js:280
269+
#: dist/prefs.js:279
272270
msgid "Filtering mode"
273271
msgstr ""
274272

275-
#: dist/prefs.js:281
273+
#: dist/prefs.js:280
276274
msgid ""
277275
"On blocklist mode, matching elements are removed from the list. On allowlist "
278276
"mode, only matching elements will be shown"
279277
msgstr ""
280278

281-
#: dist/prefs.js:283
279+
#: dist/prefs.js:282
282280
msgid "Blocklist"
283281
msgstr ""
284282

285-
#: dist/prefs.js:284
283+
#: dist/prefs.js:283
286284
msgid "Allowlist"
287285
msgstr ""

‎prefs.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,12 @@ export default class QSAPPreferences extends ExtensionPreferences {
100100
);
101101

102102
const mpris_controllers_group = new ListBox(settings);
103-
const switch_ = mpris_controllers_group.add_switch("mpris-controllers-are-moved",
103+
mpris_controllers_group.add_switch("mpris-controllers-are-moved",
104104
{
105105
title: _("Move media controls"),
106-
subtitle: _(`Move the media controls from the notifications panel instead of creating a new one\n<span color="red" weight="bold">Disabled in gnome 48 until it works again</span>`)
106+
subtitle: _(`Move the media controls from the notifications panel instead of creating a new one`)
107107
}
108108
);
109-
switch_.set_sensitive(false);
110109

111110
const applications_volume_sliders_group = new ListBox(settings);
112111
applications_volume_sliders_group.add_switch("group-applications-volume-sliders",

0 commit comments

Comments
 (0)
Please sign in to comment.