#window #i3 #focus #last #sway #version #ipc

app i3-focus-last

Focus last window on i3

9 releases

0.5.4 Aug 9, 2022
0.5.3 Feb 22, 2022
0.5.2 Mar 3, 2021
0.5.1 Dec 6, 2020
0.2.2 Nov 23, 2018

#596 in GUI

24 downloads per month

MIT license

14KB
373 lines

i3-focus-last

Another implementation of this classic (and useful) example of i3 ipc use.

Works on reasonable versions of i3 and sway >= 1.2.

Done in rust:

  • for fun!
  • it's compiled, so we won't suffer from the overhead of starting a new interpreter for each client (the python version I used was sluggish at times, for this reason)

Usage

Add this line to your i3 or Sway configuration:

exec_always i3-focus-last server

Then, add a binding to execute i3-focus-last:

bindsym $mod+Tab exec i3-focus-last

Menu mode

i3-focus-last can be used with rofi to display a window switcher menu in which the entries are sorted by focus order.

To launch it, just run i3-focus-last menu when the server is running (or bind it to some key combination).

It can also shows icons corresponding to the window class or app_id. This mapping can be customized by modifying ~/.config/i3-focus-last/icons.json. For example:

{
  "Alacritty": "terminal",
  "firefox": "firefox",
  "Chromium": "chromium"
}

The values in the dictionary should be names of icons in /usr/share/icons/**.

Dependencies

~0.8–1.7MB
~36K SLoC