feat(ags): add wip keyboard layout widget
This commit is contained in:
parent
cec3f73b4d
commit
708f9fff49
2 changed files with 35 additions and 0 deletions
30
config/ags/js/bar/keyboard-layout.js
Normal file
30
config/ags/js/bar/keyboard-layout.js
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
import { Hyprland, Utils, Widget } from '../../imports.js';
|
||||||
|
const { Label, Box, Icon } = Widget;
|
||||||
|
|
||||||
|
const DEFAULT_KB = "at-translated-set-2-keyboard";
|
||||||
|
|
||||||
|
export default Box({
|
||||||
|
className: 'toggle-off',
|
||||||
|
children: [
|
||||||
|
Icon({
|
||||||
|
icon: 'input-keyboard-symbolic',
|
||||||
|
style: 'margin-right: 4px;',
|
||||||
|
}),
|
||||||
|
Label({
|
||||||
|
connections: [[Hyprland, (self, _n, layout) => {
|
||||||
|
if (!layout) {
|
||||||
|
let obj = Utils.exec('hyprctl devices -j')
|
||||||
|
let keyboards = JSON.parse(obj)['keyboards'];
|
||||||
|
let kb = keyboards.find(val => val.name === DEFAULT_KB);
|
||||||
|
|
||||||
|
layout = kb['active_keymap'];
|
||||||
|
|
||||||
|
self.label = layout;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
self.label = layout;
|
||||||
|
}
|
||||||
|
}, 'keyboard-layout']],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
});
|
|
@ -14,6 +14,7 @@ import { BatteryIndicator } from './battery.js';
|
||||||
import { Brightness } from './brightness.js';
|
import { Brightness } from './brightness.js';
|
||||||
import { AudioIndicator } from './audio.js';
|
import { AudioIndicator } from './audio.js';
|
||||||
import { Revealer } from './fullscreen.js';
|
import { Revealer } from './fullscreen.js';
|
||||||
|
//import KeyboardLayout from './keyboard-layout.js';
|
||||||
|
|
||||||
|
|
||||||
export const Bar = Window({
|
export const Bar = Window({
|
||||||
|
@ -68,6 +69,10 @@ export const Bar = Window({
|
||||||
|
|
||||||
Separator(12),
|
Separator(12),
|
||||||
|
|
||||||
|
//KeyboardLayout,
|
||||||
|
|
||||||
|
//Separator(12),
|
||||||
|
|
||||||
Clock,
|
Clock,
|
||||||
|
|
||||||
Separator(12),
|
Separator(12),
|
||||||
|
|
Loading…
Reference in a new issue