i3wsr 1.2.4

Change i3-wm workspace names based on its contents
docs.rs failed to build i3wsr-1.2.4
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: i3wsr-2.1.1

i3wsr - i3 workspace renamer

Build Status

i3wsr is a small program that uses I3's IPC Interface to change the name of a workspace based on its contents.

Details

The chosen name for a workspace is a composite of the WM_CLASS X11 window property for each window in a workspace. In action it would look something like this:

Installation

Rust, and Cargo is required, and i3wsr can be installed using cargo like so:

cargo install i3wsr

Or alternatively, you can build a release binary,

cargo build --release

Then place the built binary, located at target/release/i3wsr, somewhere on your $path.

Arch linux

If you're running Arch you can install either stable, or latest from AUR thanks to reddit user u/OniTux.

Usage

Just launch the program and it'll listen for events if you are running I3. Another option is to put something like this in your i3 config

# cargo
exec_always --no-startup-id $HOME/.cargo/bin/i3wsr
# AUR
exec_always --no-startup-id /usr/bin/i3wsr

Options

You can configure icons for the respective classes, a very basic preset for font-awesome is configured, to enable it use the option --icons awesome (requires font-awesome to be installed).

If you have icons and don't want the names to be displayed, you can use the --no-names flag.

For further customization, use the --config path_to_file.toml option. The toml file has to fields, icons to assign icons to classes, and aliases to assign alternative names to be displayed.

Example config can be found in assets/example_config.toml

[icons]
# font awesome
TelegramDesktop = ""
Firefox = ""
Alacritty = ""
Thunderbird = ""
# smile emoji
MyNiceProgram = "😛"

[aliases]
TelegramDesktop = "Telegram"
"Org.gnome.Nautilus" = "Nautilus"

[general]
separator = ""
default_icon = ""

For an overview of available options

$ i3wsr -h
i3wsr - i3 workspace renamer 1.2.0
Daniel Berg <mail@roosta.sh>

USAGE:
    i3wsr [FLAGS] [OPTIONS]

FLAGS:
    -h, --help        Prints help information
        --no-names    Set to no to display only icons (if available)
    -V, --version     Prints version information

OPTIONS:
    -c, --config <config>    Path to toml config file
        --icons <icons>      Sets icons to be used [possible values: awesome]

Configuration

This program depends on numbered workspaces, since we're constantly changing the workspace name. So your I3 configuration need to reflect this:

bindsym $mod+1 workspace number 1

If you're like me and don't necessarily bind your workspaces to only numbers, or you want to keep a part of the name constant you can do like this:

bindsym $mod+q workspace number 1:[Q]

This way the workspace would look something like this when it gets changed:

1:[Q] Emacs|Firefox

You can take this a bit further by using a bar that trims the workspace number and be left with only

[Q] Emacs|Firefox

Sway?

Check Pedro Scaff's port swaywsr.

Contributors

Test environment

To run the tests Xvfb needs to be installed and run:

Xvfb :99.0

This sets up a headless x server running on DISPLAY :99.0, then some apps needs to be run in this new server:

env DISPLAY=:99.0 gpick
env DISPLAY=:99.0 i3 -c /etc/i3/config

refer to .travis.yml for a CI example

Attribution

This program would not be possible without i3ipc-rs, a rust library for controlling i3-wm through its IPC interface and rust-xcb, a set of rust bindings and wrappers for XCB.