feat(ags): make logic behind tablet mode toggle
This commit is contained in:
parent
23e50efee0
commit
ba200fb9b7
3 changed files with 57 additions and 4 deletions
config/ags/js/bar
|
@ -5,7 +5,7 @@ import { CurrentWindow } from './current-window.js';
|
|||
import { Workspaces } from './workspaces.js';
|
||||
import { OskToggle } from './osk-toggle.js';
|
||||
import { Heart } from './heart.js';
|
||||
import { TabletToggle } from './tablet-toggle.js';
|
||||
import { TabletToggle } from './tablet-toggle.js';
|
||||
|
||||
export const Bar = Window({
|
||||
name: 'left-bar',
|
||||
|
|
|
@ -1,12 +1,27 @@
|
|||
const { Box, Label } = ags.Widget;
|
||||
const { subprocess } = ags.Utils;
|
||||
|
||||
import { EventBox } from '../common.js';
|
||||
|
||||
export const TabletToggle = EventBox({
|
||||
className: 'toggle-off',
|
||||
onPrimaryClickRelease: '',
|
||||
child: ags.Widget.Box({
|
||||
onPrimaryClickRelease: function() {
|
||||
subprocess(
|
||||
['bash', '-c', '/home/matt/.nix/config/ags/bin/tablet-toggle.sh toggle'],
|
||||
(output) => {
|
||||
print(output)
|
||||
if (output == 'Tablet') {
|
||||
TabletToggle.toggleClassName('toggle-on', true);
|
||||
} else {
|
||||
TabletToggle.toggleClassName('toggle-on', false);
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Box({
|
||||
className: 'tablet-toggle',
|
||||
vertical: false,
|
||||
child: ags.Widget.Label({
|
||||
child: Label({
|
||||
label: " ",
|
||||
}),
|
||||
}),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue