Skip to content

Commit

Permalink
docs: update readme and example config
Browse files Browse the repository at this point in the history
- Add display property option
- Rewrite some explanations using new paradigme.
- Update badge
- Add new demo values to example config
  • Loading branch information
roosta committed Nov 11, 2023
1 parent 2e1d4a7 commit 37c4858
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 17 deletions.
51 changes: 34 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
i3wsr - i3 workspace renamer
======
[![Build Status](https://app.travis-ci.com/roosta/i3wsr.svg?branch=main)](https://app.travis-ci.com/roosta/i3wsr)

[![Test Status](https://github.com/roosta/i3wsr/actions/workflows/test.yml/badge.svg?branch=develop)](https://github.com/roosta/i3wsr/actions)
[![Crates.io](https://img.shields.io/crates/v/i3wsr)](https://crates.io/crates/i3wsr)

`i3wsr` is a small program that uses [I3's](https://i3wm.org/) [IPC Interface](https://i3wm.org/docs/ipc.html)
to change the name of a workspace based on its contents.

# TOC
## Table of content

- [i3wsr - i3 workspace renamer](#i3wsr---i3-workspace-renamer)
- [TOC](#toc)
- [Table of content](#table-of-content)
- [Details](#details)
- [Requirements](#requirements)
- [Installation](#installation)
Expand All @@ -19,13 +19,15 @@ to change the name of a workspace based on its contents.
- [Keeping part of the workspace name](#keeping-part-of-the-workspace-name)
- [Configuration / options](#configuration--options)
- [Aliases](#aliases)
- [WM Property](#wm-property)
- [Display property](#display-property)
- [Aliases based on property](#aliases-based-on-property)
- [Class](#class)
- [Instance](#instance)
- [Name](#name)
- [Icons](#icons)
- [Separator](#separator)
- [Default icon](#default-icon)
- [Empty label](#empty-label)
- [No icon names](#no-icon-names)
- [No names](#no-names)
- [Remove duplicates](#remove-duplicates)
Expand All @@ -34,7 +36,6 @@ to change the name of a workspace based on its contents.
- [Testing](#testing)
- [Attribution](#attribution)


## Details

The chosen name for a workspace is a composite of the `WM_CLASS` X11 window
Expand Down Expand Up @@ -78,7 +79,7 @@ exec_always --no-startup-id $HOME/.cargo/bin/i3wsr
exec_always --no-startup-id /usr/bin/i3wsr
```

## i3-configuration
## i3 configuration

This program depends on numbered workspaces, since we're constantly changing the
workspace name. So your I3 configuration need to reflect this:
Expand Down Expand Up @@ -125,8 +126,11 @@ Example config can be found in

### Aliases

Sometimes a WM property can be overly verbose, so its possible to match a
class name with an alias:

Sometimes a class, instance or name can be overly verbose, use aliases that
match to window properties to create simpler names instead of showing the full
property


```toml
[aliases.class]
Expand All @@ -150,21 +154,33 @@ Alias keys uses regex for matching, so it's possible to get creative:
Remember to quote anything but `[a-zA-Z]`, and to escape your slashes. Due to
rust string escapes if you want a literal backslash use two slashes `\\d`.

### WM Property
### Aliases based on property

i3wsr supports 3 window properties currently:

```toml
[aliases.class]
[aliases.instance]
[aliases.name]
[aliases.name] // 1
[aliases.instance] // 2
[aliases.class] // 3
```
These are checked in decending order, so if i3wsr finds a name alias, it'll use
that and if not, then check instance, then finally use class
These are checked in descending order, so if i3wsr finds a name alias, it'll
use that and if not, then check instance, then finally use class

> Deprecation note: previously `wm_property` defined which prop to check for
> aliases, but this newer approach will allow for multiple types of aliases
### Display property

Which property to display if no aliases if found:

```toml
[general]
display_property = "instance"
```

Possible options are `class`, `instance`, and `name`, and will default to `class`
if not present.

#### Class

This is the default, and the most succinct.
Expand Down Expand Up @@ -228,8 +244,9 @@ Firefox = "🌍"
# Use quote when matching anything other than [a-zA-Z]
"Org.gnome.Nautilus" = "📘"
```
i3wsr tries to match an icon with an alias first, then falls back to window
class, so a config like this is valid:
i3wsr tries to match an icon with an alias first, if none are found it then
checks your `display_property`, and tries to match an icon with a non aliased
`display_property`, lastly it will try to match on class.

```toml
[aliases.class]
Expand Down
1 change: 1 addition & 0 deletions assets/example_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ separator = "  "
default_icon = ""
split_at = ":"
empty_label = "🌕"
display_property = "instance" # class, instance, name

[options]
remove_duplicates = false
Expand Down

0 comments on commit 37c4858

Please sign in to comment.