feat(ags): make closer work and change button class
This commit is contained in:
parent
aa8a848017
commit
30438dca07
4 changed files with 28 additions and 35 deletions
|
@ -1,6 +1,5 @@
|
|||
const { Box, Label } = ags.Widget;
|
||||
const { execAsync } = ags.Utils;
|
||||
const { openWindow, closeWindow } = ags.App;
|
||||
const { toggleWindow } = ags.App;
|
||||
const { DateTime } = imports.gi.GLib;
|
||||
|
||||
import { EventBox } from '../misc/cursorbox.js';
|
||||
|
@ -19,22 +18,16 @@ const ClockModule = ({
|
|||
],
|
||||
});
|
||||
|
||||
var calendarState = false;
|
||||
|
||||
export const Clock = EventBox({
|
||||
className: 'toggle-off',
|
||||
onPrimaryClickRelease: () => {
|
||||
if (calendarState) {
|
||||
Clock.toggleClassName('toggle-on', false);
|
||||
closeWindow('calendar');
|
||||
calendarState = false;
|
||||
}
|
||||
else {
|
||||
Clock.toggleClassName('toggle-on', true);
|
||||
openWindow('calendar');
|
||||
calendarState = true;
|
||||
}
|
||||
},
|
||||
onPrimaryClickRelease: () => toggleWindow('calendar'),
|
||||
connections: [
|
||||
[ags.App, (box, windowName, visible) => {
|
||||
if (windowName == 'calendar') {
|
||||
Clock.toggleClassName('toggle-on', visible);
|
||||
}
|
||||
}],
|
||||
],
|
||||
child: Box({
|
||||
child: ClockModule({}),
|
||||
}),
|
||||
|
|
|
@ -1,26 +1,20 @@
|
|||
const { Box, Label, Icon } = ags.Widget;
|
||||
const { openWindow, closeWindow } = ags.App;
|
||||
const { toggleWindow } = ags.App;
|
||||
const { Notifications } = ags.Service;
|
||||
|
||||
import { Separator } from '../misc/separator.js';
|
||||
import { EventBox } from '../misc/cursorbox.js';
|
||||
|
||||
var notifButtonState = false;
|
||||
|
||||
export const NotifButton = EventBox({
|
||||
className: 'toggle-off',
|
||||
onPrimaryClickRelease: () => {
|
||||
if (notifButtonState) {
|
||||
NotifButton.toggleClassName('toggle-on', false);
|
||||
closeWindow('notification-center');
|
||||
notifButtonState = false;
|
||||
}
|
||||
else {
|
||||
NotifButton.toggleClassName('toggle-on', true);
|
||||
openWindow('notification-center');
|
||||
notifButtonState = true;
|
||||
}
|
||||
},
|
||||
onPrimaryClickRelease: () => toggleWindow('notification-center'),
|
||||
connections: [
|
||||
[ags.App, (box, windowName, visible) => {
|
||||
if (windowName == 'notification-center') {
|
||||
NotifButton.toggleClassName('toggle-on', visible);
|
||||
}
|
||||
}],
|
||||
],
|
||||
child: Box({
|
||||
className: 'notif-panel',
|
||||
vertical: false,
|
||||
|
|
|
@ -1,13 +1,18 @@
|
|||
export const Closer = ags.Widget.Window({
|
||||
const { Window, EventBox } = ags.Widget;
|
||||
const { windows, closeWindow } = ags.App;
|
||||
|
||||
export const Closer = Window({
|
||||
name: 'closer',
|
||||
popup: true,
|
||||
layer: 'top',
|
||||
anchor: 'top bottom left right',
|
||||
|
||||
child: ags.Widget.EventBox({
|
||||
child: EventBox({
|
||||
onPrimaryClickRelease: () => {
|
||||
ags.App.closeWindow('powermenu');
|
||||
ags.App.closeWindow('closer');
|
||||
windows.forEach(w => {
|
||||
if (w.name != 'bar')
|
||||
closeWindow(w.name)
|
||||
});
|
||||
},
|
||||
}),
|
||||
});
|
||||
|
|
|
@ -6,6 +6,7 @@ const { Box, Icon, Label, Button } = ags.Widget;
|
|||
import { Draggable } from '../misc/drag.js';
|
||||
import { EventBox } from '../misc/cursorbox.js'
|
||||
|
||||
// TODO: launch app when click on icon
|
||||
const NotificationIcon = ({ appEntry, appIcon, image }) => {
|
||||
if (image) {
|
||||
return Box({
|
||||
|
|
Loading…
Reference in a new issue