19 lines
586 B
Python
19 lines
586 B
Python
from ignis.widgets import Widget
|
|
from ignis.services.hyprland import HyprlandService
|
|
|
|
hyprland = HyprlandService.get_default()
|
|
|
|
|
|
class KeyboardLayout(Widget.Button):
|
|
def __init__(self):
|
|
super().__init__(
|
|
css_classes=["kb-layout", "unset"],
|
|
on_click=lambda x: hyprland.main_keyboard.switch_layout("1"),
|
|
visible=hyprland.is_available,
|
|
child=Widget.Label(
|
|
label=hyprland.main_keyboard.bind(
|
|
"active_keymap", transform=lambda value: value[:2].lower()
|
|
)
|
|
),
|
|
)
|