feat(ags): add notif button
This commit is contained in:
parent
d19e251440
commit
ce236f8750
7 changed files with 208 additions and 1 deletions
config/ags/js/bar
|
@ -7,6 +7,7 @@ import { OskToggle } from './osk-toggle.js';
|
|||
import { Heart } from './heart.js';
|
||||
import { TabletToggle } from './tablet-toggle.js';
|
||||
import { QsToggle } from './quick-settings.js';
|
||||
import { NotifButton } from './notif-button.js';
|
||||
|
||||
export const Bar = Window({
|
||||
name: 'left-bar',
|
||||
|
@ -51,6 +52,10 @@ export const Bar = Window({
|
|||
Box({
|
||||
halign: 'end',
|
||||
children: [
|
||||
NotifButton,
|
||||
|
||||
Separator(12),
|
||||
|
||||
QsToggle,
|
||||
],
|
||||
}),
|
||||
|
|
45
config/ags/js/bar/notif-button.js
Normal file
45
config/ags/js/bar/notif-button.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
const { Box, Label } = ags.Widget;
|
||||
const { subprocess } = ags.Utils;
|
||||
import { EventBox } from '../common.js';
|
||||
const deflisten = subprocess;
|
||||
|
||||
deflisten(
|
||||
['bash', '-c', '/home/matt/.nix/config/ags/bin/notif.sh icon'],
|
||||
(output) => {
|
||||
NotifButton.child.children[0].label = ' ' + output;
|
||||
},
|
||||
);
|
||||
deflisten(
|
||||
['bash', '-c', '/home/matt/.nix/config/ags/bin/notif-toggle.sh state'],
|
||||
(output) => {
|
||||
print(output)
|
||||
if (output == 'On') {
|
||||
NotifButton.toggleClassName('toggle-on', false);
|
||||
} else {
|
||||
NotifButton.toggleClassName('toggle-on', true);
|
||||
}
|
||||
},
|
||||
);
|
||||
export const NotifButton = EventBox({
|
||||
className: 'toggle-off',
|
||||
onPrimaryClickRelease: function() {
|
||||
subprocess(
|
||||
['bash', '-c', '/home/matt/.nix/config/ags/bin/notif-toggle.sh toggle'],
|
||||
(output) => {
|
||||
print(output)
|
||||
if (output == 'On') {
|
||||
NotifButton.toggleClassName('toggle-on', true);
|
||||
} else {
|
||||
NotifButton.toggleClassName('toggle-on', false);
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Box({
|
||||
className: 'notif-panel',
|
||||
vertical: false,
|
||||
child: Label({
|
||||
label: "",
|
||||
}),
|
||||
}),
|
||||
});
|
39
config/ags/js/bar/quick-settings.js
Normal file
39
config/ags/js/bar/quick-settings.js
Normal file
|
@ -0,0 +1,39 @@
|
|||
const { Box, Label } = ags.Widget;
|
||||
const { subprocess } = ags.Utils;
|
||||
import { EventBox } from '../common.js';
|
||||
const deflisten = subprocess;
|
||||
|
||||
deflisten(
|
||||
['bash', '-c', '/home/matt/.nix/config/ags/bin/qs-toggle.sh state'],
|
||||
(output) => {
|
||||
print(output)
|
||||
if (output == 'On') {
|
||||
QsToggle.toggleClassName('toggle-on', false);
|
||||
} else {
|
||||
QsToggle.toggleClassName('toggle-on', true);
|
||||
}
|
||||
},
|
||||
);
|
||||
export const QsToggle = EventBox({
|
||||
className: 'toggle-off',
|
||||
onPrimaryClickRelease: function() {
|
||||
subprocess(
|
||||
['bash', '-c', '/home/matt/.nix/config/ags/bin/qs-toggle.sh toggle'],
|
||||
(output) => {
|
||||
print(output)
|
||||
if (output == 'On') {
|
||||
QsToggle.toggleClassName('toggle-on', true);
|
||||
} else {
|
||||
QsToggle.toggleClassName('toggle-on', false);
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Box({
|
||||
className: 'quick-settings-toggle',
|
||||
vertical: false,
|
||||
child: Label({
|
||||
label: " ",
|
||||
}),
|
||||
}),
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue