i3status-rust icon indicating copy to clipboard operation
i3status-rust copied to clipboard

Regression: keyboard_layout block fails to get current layout from sway

Open heitorPB opened this issue 10 months ago • 2 comments

I updated my system yesterday and i3status-rust (0.33.2) now fails to get the keyboard layout from sway. I changed no config whatsoever.

This was previously working:

[[block]]
block = "keyboard_layout"
driver = "sway"
format = "$layout"
sway_kb_identifier = "1:1:AT_Translated_Set_2_keyboard"

[block.mappings]
"English (US, alt. intl.)" = "EN"
"Portuguese (Brazil, IBM/Lenovo ThinkPad)" = "PT"

But now I get this output:

$ i3status-rs ./config-main.toml
{"version": 1, "click_events": true}
[
[{"full_text":"|","color":"#A9A9A9FF","background":"#000000FF","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":" ","color":"#DC322FFF","background":"#000000FF","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"failed to get current input ","color":"#DC322FFF","background":"#000000FF","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
^C

Not sure how to troubleshoot this further, any ideas?

heitorPB avatar Feb 04 '25 13:02 heitorPB

Can you share the output of swaymsg -t get_inputs?

bim9262 avatar Feb 08 '25 04:02 bim9262

Sure:

❯ swaymsg -t get_inputs
Input device: Logitech Wireless Mouse MX Master 3
  Type: Mouse
  Identifier: 1133:45091:Logitech_Wireless_Mouse_MX_Master_3
  Product ID: 45091
  Vendor ID: 1133
  Libinput Send Events: enabled

Input device: Logitech Wireless Mouse MX Master 3
  Type: Keyboard
  Identifier: 1133:45091:Logitech_Wireless_Mouse_MX_Master_3
  Product ID: 45091
  Vendor ID: 1133
  Active Keyboard Layout: Portuguese (Brazil, IBM/Lenovo ThinkPad)
  Libinput Send Events: enabled

Input device: ThinkPad Extra Buttons
  Type: Keyboard
  Identifier: 6058:20564:ThinkPad_Extra_Buttons
  Product ID: 20564
  Vendor ID: 6058
  Active Keyboard Layout: Portuguese (Brazil, IBM/Lenovo ThinkPad)
  Libinput Send Events: enabled

Input device: TPPS/2 Elan TrackPoint
  Type: Mouse
  Identifier: 2:10:TPPS/2_Elan_TrackPoint
  Product ID: 10
  Vendor ID: 2
  Libinput Send Events: enabled

Input device: AT Translated Set 2 keyboard
  Type: Keyboard
  Identifier: 1:1:AT_Translated_Set_2_keyboard
  Product ID: 1
  Vendor ID: 1
  Active Keyboard Layout: Portuguese (Brazil, IBM/Lenovo ThinkPad)
  Libinput Send Events: enabled

Input device: ELAN067F:00 04F3:3209 Touchpad
  Type: Touchpad
  Identifier: 1267:12809:ELAN067F:00_04F3:3209_Touchpad
  Product ID: 12809
  Vendor ID: 1267
  Libinput Send Events: enabled

Input device: ELAN067F:00 04F3:3209 Mouse
  Type: Mouse
  Identifier: 1267:12809:ELAN067F:00_04F3:3209_Mouse
  Product ID: 12809
  Vendor ID: 1267
  Libinput Send Events: enabled

Input device: Kinesis Advantage2 Keyboard System Control
  Type: Keyboard
  Identifier: 10730:258:Kinesis_Advantage2_Keyboard_System_Control
  Product ID: 258
  Vendor ID: 10730
  Active Keyboard Layout: Portuguese (Brazil, IBM/Lenovo ThinkPad)
  Libinput Send Events: enabled

Input device: Kinesis Advantage2 Keyboard Consumer Control
  Type: Keyboard
  Identifier: 10730:258:Kinesis_Advantage2_Keyboard_Consumer_Control
  Product ID: 258
  Vendor ID: 10730
  Active Keyboard Layout: Portuguese (Brazil, IBM/Lenovo ThinkPad)
  Libinput Send Events: enabled

Input device: Kinesis Advantage2 Keyboard
  Type: Keyboard
  Identifier: 10730:258:Kinesis_Advantage2_Keyboard
  Product ID: 258
  Vendor ID: 10730
  Active Keyboard Layout: English (US, alt. intl.)
  Libinput Send Events: enabled

Input device: Kinesis Advantage2 Keyboard
  Type: Mouse
  Identifier: 10730:258:Kinesis_Advantage2_Keyboard
  Product ID: 258
  Vendor ID: 10730
  Libinput Send Events: enabled

Input device: Sleep Button
  Type: Keyboard
  Identifier: 0:3:Sleep_Button
  Product ID: 3
  Vendor ID: 0
  Active Keyboard Layout: Portuguese (Brazil, IBM/Lenovo ThinkPad)
  Libinput Send Events: enabled

Input device: Lid Switch
  Type: Switch
  Identifier: 0:5:Lid_Switch
  Product ID: 5
  Vendor ID: 0
  Libinput Send Events: enabled

Input device: Power Button
  Type: Keyboard
  Identifier: 0:1:Power_Button
  Product ID: 1
  Vendor ID: 0
  Active Keyboard Layout: Portuguese (Brazil, IBM/Lenovo ThinkPad)
  Libinput Send Events: enabled

Input device: Video Bus
  Type: Keyboard
  Identifier: 0:6:Video_Bus
  Product ID: 6
  Vendor ID: 0
  Active Keyboard Layout: Portuguese (Brazil, IBM/Lenovo ThinkPad)
  Libinput Send Events: enabled

Input device: Power Button
  Type: Keyboard
  Identifier: 0:1:Power_Button
  Product ID: 1
  Vendor ID: 0
  Active Keyboard Layout: Portuguese (Brazil, IBM/Lenovo ThinkPad)
  Libinput Send Events: enabled

The sway_kb_identifier is there with the correct value:

❯ swaymsg -t get_inputs | jq '.[] | select(.identifier == "1:1:AT_Translated_Set_2_keyboard")'
{
  "identifier": "1:1:AT_Translated_Set_2_keyboard",
  "name": "AT Translated Set 2 keyboard",
  "type": "keyboard",
  "repeat_delay": 600,
  "repeat_rate": 25,
  "xkb_layout_names": [
    "Portuguese (Brazil, IBM/Lenovo ThinkPad)",
    "English (US, alt. intl.)"
  ],
  "xkb_active_layout_index": 0,
  "xkb_active_layout_name": "Portuguese (Brazil, IBM/Lenovo ThinkPad)",
  "libinput": {
    "send_events": "enabled"
  },
  "vendor": 1,
  "product": 1
}

heitorPB avatar Feb 09 '25 16:02 heitorPB

I had the same problem, and it might have something to do with xdg-desktop-portal, because after toggling it in my home-manager the issue went gone

  xdg.portal = {
    enable = true;
    xdgOpenUsePortal = true;
    configPackages = [pkgs.sway];
    extraPortals = [
      pkgs.xdg-desktop-portal-wlr
      pkgs.xdg-desktop-portal-gtk
    ];
  };

mannerbund avatar Mar 03 '25 03:03 mannerbund

I updated my machine and the issue is gone now. Not sure what fixed it, but it is fixed.

I had the same problem, and it might have something to do with xdg-desktop-portal

I already had the gtk XDG portal, not sure it was it that caused the bug.

heitorPB avatar Mar 05 '25 17:03 heitorPB