filter out doubled devices
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
"add-new": "Add new",
|
||||
"add-to": "Add to",
|
||||
"alerts": "Alerts",
|
||||
"all": "All",
|
||||
"all-outputs": "All outputs",
|
||||
"all-workspaces": "All workspaces",
|
||||
"always-show-icon": "Always show icon",
|
||||
@@ -65,6 +66,7 @@
|
||||
"database": "Database",
|
||||
"delete-file": "Delete file",
|
||||
"delete-from-database": "Delete from database",
|
||||
"device": "Device",
|
||||
"dwl-tags": "Dwl tags",
|
||||
"edit-panel": "edit panel",
|
||||
"editing": "Editing",
|
||||
@@ -99,6 +101,7 @@
|
||||
"icons-size": "Icons size",
|
||||
"invert-slider": "Invert slider",
|
||||
"item-padding": "Item padding",
|
||||
"keyboard-layout": "Keyboard layout",
|
||||
"label": "Label",
|
||||
"label-css-name": "Label CSS name",
|
||||
"label-length": "Label length",
|
||||
|
@@ -4,6 +4,7 @@
|
||||
"add-new": "Dodaj nowy",
|
||||
"add-to": "Dodaj do",
|
||||
"alerts": "Ostrzeżenia",
|
||||
"all": "Wszystkie",
|
||||
"all-outputs": "Wszystkie wyjścia",
|
||||
"all-workspaces": "Wszyskie obszary robocze",
|
||||
"always-show-icon": "Zawsze pokazuj ikonę",
|
||||
@@ -65,6 +66,7 @@
|
||||
"database": "Baza danych",
|
||||
"delete-file": "Usuń plik",
|
||||
"delete-from-database": "Usuń z bazy",
|
||||
"device": "Urządzenie",
|
||||
"dwl-tags": "Tagi dwl",
|
||||
"edit-panel": "edytuj panel",
|
||||
"editing": "Edytujesz",
|
||||
@@ -99,6 +101,7 @@
|
||||
"icons-size": "Rozmiar ikon",
|
||||
"invert-slider": "Odwróć suwak",
|
||||
"item-padding": "Wypełnienie elementu",
|
||||
"keyboard-layout": "Układ klawiatury",
|
||||
"label": "Etykieta",
|
||||
"label-css-name": "Nazwa CSS etykiety",
|
||||
"label-length": "Długość etykiety",
|
||||
|
@@ -44,20 +44,19 @@ class KeyboardLayout(Gtk.EventBox):
|
||||
self.compositor = ""
|
||||
eprint("Neither sway nor Hyprland detected, this won't work")
|
||||
|
||||
self.device_name = None
|
||||
|
||||
if self.compositor:
|
||||
self.keyboards = self.list_keyboards()
|
||||
self.keyboard_names = []
|
||||
for k in self.keyboards:
|
||||
if self.compositor == "Hyprland":
|
||||
self.keyboard_names.append(k["name"])
|
||||
else:
|
||||
# On sway some devices may be listed twice, let's add them just once
|
||||
elif k.identifier not in self.keyboard_names:
|
||||
self.keyboard_names.append(k.identifier)
|
||||
print(f"keyboard_names = {self.keyboard_names}")
|
||||
# print(f"keyboard_names = {self.keyboard_names}")
|
||||
|
||||
self.kb_layouts = self.get_kb_layouts()
|
||||
print(f"kb_layouts = {self.kb_layouts}")
|
||||
# print(f"kb_layouts = {self.kb_layouts}")
|
||||
|
||||
check_key(settings, "keyboard-device-sway", "")
|
||||
check_key(settings, "keyboard-device-hyprland", "")
|
||||
@@ -69,10 +68,7 @@ class KeyboardLayout(Gtk.EventBox):
|
||||
check_key(settings, "icon-placement", "left")
|
||||
check_key(settings, "icon-size", 16)
|
||||
check_key(settings, "show-icon", True)
|
||||
if self.compositor == "Hyprland":
|
||||
check_key(settings, "tooltip-text", "LMB: Next layout, RMB: Menu")
|
||||
else:
|
||||
check_key(settings, "tooltip-text", "")
|
||||
check_key(settings, "tooltip-text", "LMB: Next layout, RMB: Menu")
|
||||
check_key(settings, "angle", 0.0)
|
||||
|
||||
self.label.set_angle(settings["angle"])
|
||||
@@ -168,8 +164,9 @@ class KeyboardLayout(Gtk.EventBox):
|
||||
if self.device_name:
|
||||
# apply to selected device, if any
|
||||
if self.compositor == "Hyprland":
|
||||
hyprctl(f"switchxkblayout {self.settings['device-name']} next")
|
||||
hyprctl(f"switchxkblayout {self.device_name} next")
|
||||
else:
|
||||
print(f'input "{self.device_name}" xkb_switch_layout next')
|
||||
self.i3.command(f'input "{self.device_name}" xkb_switch_layout next')
|
||||
else:
|
||||
# apply to all devices
|
||||
@@ -177,6 +174,7 @@ class KeyboardLayout(Gtk.EventBox):
|
||||
if self.compositor == "Hyprland":
|
||||
hyprctl(f"switchxkblayout {name} next")
|
||||
else:
|
||||
print(f'input "{name}" xkb_switch_layout next')
|
||||
self.i3.command(f'input "{name}" xkb_switch_layout next')
|
||||
|
||||
self.refresh()
|
||||
|
Reference in New Issue
Block a user