2023-11-07 23:06:56 -05:00
|
|
|
import App from 'resource:///com/github/Aylur/ags/app.js';
|
2023-10-31 08:32:40 -04:00
|
|
|
import Mpris from 'resource:///com/github/Aylur/ags/service/mpris.js';
|
2023-11-07 23:06:56 -05:00
|
|
|
import { Icon, ToggleButton } from 'resource:///com/github/Aylur/ags/widget.js';
|
2023-10-18 11:53:49 -04:00
|
|
|
|
2023-10-31 08:32:40 -04:00
|
|
|
import EventBox from '../misc/cursorbox.js';
|
2023-10-18 11:53:49 -04:00
|
|
|
|
2023-11-06 21:41:30 -05:00
|
|
|
|
2023-11-07 23:06:56 -05:00
|
|
|
export default () => EventBox({
|
|
|
|
child: ToggleButton({
|
|
|
|
setup: self => {
|
|
|
|
// Open at startup if there are players
|
|
|
|
const id = Mpris.connect('changed', () => {
|
|
|
|
self.set_active(Mpris.players.length > 0);
|
|
|
|
Mpris.disconnect(id);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
connections: [['toggled', self => {
|
|
|
|
const rev = self.get_parent().get_parent().get_parent().children[1];
|
|
|
|
|
|
|
|
if (self.get_active()) {
|
|
|
|
self.get_children()[0]
|
|
|
|
.setCss('-gtk-icon-transform: rotate(0deg);');
|
|
|
|
rev.revealChild = true;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
self.get_children()[0]
|
|
|
|
.setCss('-gtk-icon-transform: rotate(180deg);');
|
|
|
|
rev.revealChild = false;
|
|
|
|
}
|
|
|
|
}]],
|
|
|
|
|
|
|
|
child: Icon({
|
|
|
|
icon: App.configDir + '/icons/down-large.svg',
|
|
|
|
className: 'arrow',
|
|
|
|
css: '-gtk-icon-transform: rotate(180deg);',
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
});
|