1

Does i3 have the ability to run a script whenever one leaves a workspace? I ask because I would like a certain keyboard layout in emacs (including hyper) and a different one outside of emacs (including mode switch). I have a small keyboard.

Toothrot
  • 3,255
  • 3
  • 24
  • 47
  • I don't think so, but if you only switch workspaces via keyboard shortcuts, you could remap those to a script that switches the workspace *and* changes the keyboard layout. – Wieland Jan 11 '17 at 13:07

2 Answers2

0

I3 doesn't appear to have this feature, but you can do this independently from the window manager. Kbdd can switch the keyboard layout on a window switch, and works with most window managers including i3. You do need to be running D-Bus.

A remaining difficulty is that kbdd remembers settings per window but has no built-in ability to select the layout for a window when that window is created. I think you can use for_window to run exec when a window is created and call dbus-send to let kbdd know which layout to use. This email thread suggests hooking directly on the IPC; I don't know how you'd do that.

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
0

There is no ready-to-use feature built into i3 to do that. But you can use the i3 IPC interface to watch for workspace events and then run the appropriate command.

There is a (probably incomplete) list of libraries for a number of different programming languages at the end of the documentation.

Adaephon
  • 4,356
  • 1
  • 25
  • 28