GithubLinkedIn

I3 finder

nodeJS

2015-01-29

I3 finder is a program made for the I3 Window Manager . It gives you dmenu access to your windows tags and workspaces. You can

  • focus and move windows, tags and workspaces.

  • jump back to previous window configuration, like 'alt tab'.

I made it because I didn't see anything available that provided a unified interface for tags, windows, and workspaces. And I need a keyboard driven fuzzy search for just about everything.

Installation

It's a node js script, and it's on npm and github , and you can install it via

1    npm install -g i3-finder
2

You also need dmenu installed and on your path.

Usage

Here are the command line options

1    $ i3finder --help
2    Usage: i3finder [options]
3
4    Options:
5       -d, --dmenu             The dmenu command and arguments
6       -w, --workspacePrefix   Workspace displayname prefix [workspace: ]
7       -s, --showScratch       Show scratch workspace in list
8       -t, --dontTrackState    Dont bother saving current state
9       -i, --i3msg             Command to execute when using msg action.
10       -a, --action            Action to perform.  [focus]
11

Focusing and Moving windows

To move a window use

1    i3finder -a move
2

then select from the list. That window, tag, or workspace will all be moved to your current position.

To focus a window use

1    i3finder
2

Moving back to previous focus / state tracking

To move back to the previous window state use

1    i3finder -action back
2

But be warned, I3finder only knows about the window configurations because it saves them before making changes. If I3finder doesn't make the change, then it's unaware of the states.

This can be useful, since normally I only want to save jumps, rather then every directional movement. But you can also ask i3finder to msg i3 directly, and it will keep track of changes. You do this through the msg action

1    #msg i3 with 'workspace 1' which will focus workspace 1.
2    i3finder -action msg -i 'workspace 1'
3    #Back will now go back to the window configuration before focusing workspace 1
4

Example configuration

Here's a simplified version of my configuration

1
2    # mod p brings up a list of windows/workspaces/tags to focus
3    bindsym $mod+p exec i3finder
4
5    # mod g brings up a list of windows/workspaces/tags to move to the current area
6    bindsym $mod+g exec i3finder -a move
7
8    # mod b triggers the back manuever
9    bindsym $mod+b exec i3finder -a back
10
11    # change focus on vim style keys, without the finder
12    # that way little motions dont mess up our history
13    bindsym $mod+h focus left
14    bindsym $mod+j focus down
15    bindsym $mod+k focus up
16    bindsym $mod+l focus right
17
18    # bind mod [num] to change to a workspace, but use msg parameter
19    # so that these motions are added to our history.
20    bindsym $mod+1 exec i3finder -a msg -i 'workspace 1'
21    bindsym $mod+2 exec i3finder -a msg -i 'workspace 2'
22    bindsym $mod+3 exec i3finder -a msg -i 'workspace 3'
23    bindsym $mod+4 exec i3finder -a msg -i 'workspace 4'
24    bindsym $mod+5 exec i3finder -a msg -i 'workspace 5'
25    bindsym $mod+6 exec i3finder -a msg -i 'workspace 6'
26    bindsym $mod+7 exec i3finder -a msg -i 'workspace 7'
27    bindsym $mod+8 exec i3finder -a msg -i 'workspace 8'
28    bindsym $mod+9 exec i3finder -a msg -i 'workspace 9'
29    bindsym $mod+0 exec i3finder -a msg -i 'workspace 10'
30

Alternative launchers

I3 finder uses dmenu by default, but you can utilize any application launcher that you wish. You can specify the command used to show selections via the dmenu parameter.

Implementation

It calls the i3-msg CLI, queries the current i3 tree, and then forms a list of selections. It pipes those selections to dmenu. Then based on your selection uses i3-msg CLI again to manipulate your windows. Other then some writing/reading of json to track state, That's about it.