Coder Social home page Coder Social logo

i3wsr's Introduction

i3wsr - i3 workspace renamer

Test Status Crates.io

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

TOC

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:

Requirements

i3wsr requires i3wm and numbered workspaces, see i3-configuration

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

i3 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
assign [class="(?i)firefox"] number 1

Keeping part of the workspace name

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:

set $myws "1:[Q]" # my sticky part
bindsym $mod+q workspace number $myws
assign [class="(?i)firefox"] number $myws

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

Configuration / options

Configuration for i3wsr can be done using cmd flags, or a config file. A config file allows for more nuanced settings, and is required to configure icons and aliases. By default i3wsr looks for the config file at $XDG_HOME/.config/i3wsr/config.toml or $XDG_CONFIG_HOME/i3wsr/config.toml. To specify another path, pass it to the --config option on invocation:

i3wsr --config ~/my_config.toml

Example config can be found in assets/example_config.toml.

Aliases

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

[aliases.class]

# Exact match
"^Google-chrome-unstable$" = "Chrome-dev"

# Substring match
firefox = "Firefox"

# Escape if you want to match literal periods
"Org\\.gnome\\.Nautilus" = "Nautilus"

Alias keys uses regex for matching, so it's possible to get creative:

# This will match gimp regardless of version number reported in class
"Gimp-\\d\\.\\d\\d" = "Gimp"

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.

Aliases based on property

i3wsr supports 3 window properties currently:

[aliases.name]     # 1
[aliases.instance] # 2
[aliases.class]    # 3

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

Class

This is the default, and the most succinct.

Instance

Use WM_INSTANCE instead of WM_CLASS when assigning workspace names, instance is usually more specific. i3wsr will try to get the instance but if it isn't defined will fall back to class.

A use case for this option could be launching chromium --app="https://web.whatsapp.com", and then assign a different icon to whatsapp in your config file, while chrome retains its own alias:

[icons]
"WhatsApp" = "๐Ÿ—ฉ"

[aliases.class]
Google-chrome = "Chrome"

[aliases.instance]
"web\\.whatsapp\\.com" = "Whatsapp"

Name

Uses WM_NAME instead of WM_INSTANCE and WM_CLASS, this option is very verbose and relies on regex matching of aliases to be of any use.

A use-case is running some terminal application, and as default i3wsr will only display class regardless of whats running in the terminal.

So you could do something like this:

[aliases.name]
".*mutt$" = "Mutt"

You could display whatever the terminal is running, but this comes with one caveat: i3 has no way of knowing what happens in a terminal and starting say mutt will not trigger any IPC events. The alias will take effect whenever i3 receives a window or workspace event.

It should be possible to write a launcher script, that wraps whatever command your running with a custom i3 ipc trigger event. If anyone figures out a nice way of doing it let me know.

Display property

Which property to display if no aliases is found:

[general]
display_property = "instance"

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

You can alternatively supply cmd argument:

i3wsr --display-property instance

Icons

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

A more in depth icon configuration can be setup by using a configuration file. In there you can define icons for whatever title you'd like.

[icons]
Firefox = "๐ŸŒ"

# Use quote when matching anything other than [a-zA-Z]
"Org.gnome.Nautilus" = "๐Ÿ“˜"

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.

[aliases.class]
"Gimp-\\d\\.\\d\\d" = "Gimp"

[icons]
Gimp = "๐Ÿ“„"

A font that provides icons is of course recommended, like font-awesome. Make sure your bar has that font configured.

Separator

Normally i3wsr uses the pipe character | between class names in a workspace, but a custom separator can be configured in the config file:

[general]
separator = " ๎‚ฑ "

Default icon

To use a default icon when no other is defined use:

[general]
default_icon = "๐Ÿ’€"

Empty label

Set a label for empty workspaces.

[general]
empty_label = "๐ŸŒ•"

No icon names

To display names only if icon is not available, you can use the --no-icon-names flag, or enable it in your config file like so:

[options]
no_icon_names = true

No names

If you don't want i3wsr to display names at all, you can use the --no-names flag, or enable it in your config file like so:

[options]
no_names = true

Remove duplicates

If you want duplicates removed from workspaces use either the flag --remove-duplicates, or configure it in the options section of the config file:

[options]
remove_duplicates = true

Split at character

By default i3wsr will keep everything until the first space character is found, then replace the remainder with titles.

If you want to define a different character that is used to split the numbered/constant part of the workspace and the dynamic content, you can use the option --split-at [CHAR]

[general]
split_at = ":"

Here we define colon as the split character, which results in i3wsr only keeping the numbered part of a workspace name when renaming.

This can give a cleaner config, but I've kept the old behavior as default.

Sway

Check [Pedro Scaff](https://github.com/pedroscaff)'s port [swaywsr](https://github.com/pedroscaff/swaywsr).

Testing

To run tests locally Vagrant is required. Run script/run_tests.sh to run tests on ubuntu xenial.

Attribution

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

i3wsr's People

Contributors

bbrks avatar cauebs avatar jordan-zilch avatar luukvbaal avatar mikewalrus avatar mksafavi avatar roosta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

i3wsr's Issues

Option to specify default icon

It would be useful to have an option to specify a default icon when one is not available in the icons map.

You could use this to specify a visually obvious "missing" icon that stands out when you've got an application that does not have an icon specified:
Screenshot_2020-06-01_23-49-13

Or simply a nice "default" icon that blends in with your existing set:
Screenshot_2020-06-01_23-55-16

option for hiding windows names

Hi!

I was looking for almost exactly what you're program is doing so thanks for your work!
The only thing is I just want to show icons for a few apps but only want workspace number when there is no match. Currently there is the name of the applications written in letter, but it can take a lot of space.

Thanks!

Issue when trying to install i3wsr

I get this error when running 'cargo install i3wsr':

error: linking with cc failed: exit code: 1
|
= note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-Wl,--eh-frame-hdr" "-L" "/home/dapper_core/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/tmp/cargo-installyqQgJ1/release/deps/i3wsr-d97f0d410688ada2.i3wsr.cf9699zw-cgu.0.rcgu.o" "/tmp/cargo-installyqQgJ1/release/deps/i3wsr-d97f0d410688ada2.i3wsr.cf9699zw-cgu.1.rcgu.o" "/tmp/cargo-installyqQgJ1/release/deps/i3wsr-d97f0d410688ada2.i3wsr.cf9699zw-cgu.10.rcgu.o" "/tmp/cargo-installyqQgJ1/release/deps/i3wsr-d97f0d410688ada2.i3wsr.cf9699zw-cgu.11.rcgu.o" "/tmp/cargo-installyqQgJ1/release/deps/i3wsr-d97f0d410688ada2.i3wsr.cf9699zw-cgu.12.rcgu.o" "/tmp/cargo-installyqQgJ1/release/deps/i3wsr-d97f0d410688ada2.i3wsr.cf9699zw-cgu.13.rcgu.o" "/tmp/cargo-installyqQgJ1/release/deps/i3wsr-d97f0d410688ada2.i3wsr.cf9699zw-cgu.14.rcgu.o" "/tmp/cargo-installyqQgJ1/release/deps/i3wsr-d97f0d410688ada2.i3wsr.cf9699zw-cgu.15.rcgu.o" "/tmp/cargo-installyqQgJ1/release/deps/i3wsr-d97f0d410688ada2.i3wsr.cf9699zw-cgu.2.rcgu.o" "/tmp/cargo-installyqQgJ1/release/deps/i3wsr-d97f0d410688ada2.i3wsr.cf9699zw-cgu.3.rcgu.o" "/tmp/cargo-installyqQgJ1/release/deps/i3wsr-d97f0d410688ada2.i3wsr.cf9699zw-cgu.4.rcgu.o" "/tmp/cargo-installyqQgJ1/release/deps/i3wsr-d97f0d410688ada2.i3wsr.cf9699zw-cgu.5.rcgu.o" "/tmp/cargo-installyqQgJ1/release/deps/i3wsr-d97f0d410688ada2.i3wsr.cf9699zw-cgu.6.rcgu.o" "/tmp/cargo-installyqQgJ1/release/deps/i3wsr-d97f0d410688ada2.i3wsr.cf9699zw-cgu.7.rcgu.o" "/tmp/cargo-installyqQgJ1/release/deps/i3wsr-d97f0d410688ada2.i3wsr.cf9699zw-cgu.8.rcgu.o" "/tmp/cargo-installyqQgJ1/release/deps/i3wsr-d97f0d410688ada2.i3wsr.cf9699zw-cgu.9.rcgu.o" "-o" "/tmp/cargo-installyqQgJ1/release/deps/i3wsr-d97f0d410688ada2" "/tmp/cargo-installyqQgJ1/release/deps/i3wsr-d97f0d410688ada2.2w4h3me5ehghndzl.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/tmp/cargo-installyqQgJ1/release/deps" "-L" "/home/dapper_core/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/tmp/cargo-installyqQgJ1/release/deps/libclap-c526051765af2762.rlib" "/tmp/cargo-installyqQgJ1/release/deps/libvec_map-aa70a9b8a46da868.rlib" "/tmp/cargo-installyqQgJ1/release/deps/libtextwrap-fa17f008fcb6a641.rlib" "/tmp/cargo-installyqQgJ1/release/deps/libunicode_width-788a7bb8f6848a2f.rlib" "/tmp/cargo-installyqQgJ1/release/deps/libstrsim-0f90bfc1e86d296f.rlib" "/tmp/cargo-installyqQgJ1/release/deps/libbitflags-ce22fd3ba40b4cc7.rlib" "/tmp/cargo-installyqQgJ1/release/deps/libatty-7dec57944fd8b8e1.rlib" "/tmp/cargo-installyqQgJ1/release/deps/libansi_term-87d88f946b658a4b.rlib" "/tmp/cargo-installyqQgJ1/release/deps/libexitfailure-50dd0472c4a40bbc.rlib" "/tmp/cargo-installyqQgJ1/release/deps/libi3wsr-625593a5eb90c448.rlib" "/tmp/cargo-installyqQgJ1/release/deps/libtoml-f2b47329b1fc0843.rlib" "/tmp/cargo-installyqQgJ1/release/deps/liblazy_static-7838e4e1e8aa819d.rlib" "/tmp/cargo-installyqQgJ1/release/deps/libfailure-5245e130a93a5f85.rlib" "/tmp/cargo-installyqQgJ1/release/deps/libbacktrace-1461e14f88f553da.rlib" "/tmp/cargo-installyqQgJ1/release/deps/libminiz_oxide-a8bf6954a40d2e67.rlib" "/tmp/cargo-installyqQgJ1/release/deps/libadler-3d2dfd5868192abb.rlib" "/tmp/cargo-installyqQgJ1/release/deps/libobject-9be1ef9b7785053d.rlib" "/tmp/cargo-installyqQgJ1/release/deps/libaddr2line-e2f1bfbbe48e656e.rlib" "/tmp/cargo-installyqQgJ1/release/deps/libgimli-4fabdeae3b437c69.rlib" "/tmp/cargo-installyqQgJ1/release/deps/librustc_demangle-f4ab8b54ec54ece8.rlib" "/tmp/cargo-installyqQgJ1/release/deps/libitertools-9a1f466c7d95b679.rlib" "/tmp/cargo-installyqQgJ1/release/deps/libeither-3e3b8d0bde29ae6f.rlib" "/tmp/cargo-installyqQgJ1/release/deps/libxcb-d7a47d4a8d9f5baa.rlib" "/tmp/cargo-installyqQgJ1/release/deps/liblibc-84daafcb68f5c7d3.rlib" "/tmp/cargo-installyqQgJ1/release/deps/libi3ipc-dadf7c0a61ba834c.rlib" "/tmp/cargo-installyqQgJ1/release/deps/libserde_json-2cdac68885c45f2c.rlib" "/tmp/cargo-installyqQgJ1/release/deps/libryu-ef2af33493f472be.rlib" "/tmp/cargo-installyqQgJ1/release/deps/libitoa-9362a2041495c501.rlib" "/tmp/cargo-installyqQgJ1/release/deps/libserde-57253e2c3da4cef7.rlib" "/tmp/cargo-installyqQgJ1/release/deps/liblog-310f65f1f10f3ea2.rlib" "/tmp/cargo-installyqQgJ1/release/deps/libcfg_if-6443c9fece9c5a8b.rlib" "/tmp/cargo-installyqQgJ1/release/deps/libbyteorder-c97e92207226d6ea.rlib" "-Wl,--start-group" "/home/dapper_core/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-6f77337c1826707d.rlib" "/home/dapper_core/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-e238540f8faf9927.rlib" "/home/dapper_core/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-78f8506dd5004913.rlib" "/home/dapper_core/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-c0e64497deb085aa.rlib" "/home/dapper_core/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-217a514dc8d845c6.rlib" "/home/dapper_core/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-65e4f8df4b8bbd73.rlib" "/home/dapper_core/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-fec1b74170245419.rlib" "/home/dapper_core/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-e74f867eb2f15322.rlib" "/home/dapper_core/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-72a374d36f3d0a31.rlib" "/home/dapper_core/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-cb9206ed96de54c3.rlib" "/home/dapper_core/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-33ee81149d314805.rlib" "/home/dapper_core/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-2e8740599b11634b.rlib" "/home/dapper_core/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-241cf59851357bea.rlib" "/home/dapper_core/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-edc29aa8c04b480f.rlib" "/home/dapper_core/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-6a141406945fda5a.rlib" "/home/dapper_core/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-2408224b4af46d83.rlib" "-Wl,--end-group" "/home/dapper_core/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-d36087076e1dd756.rlib" "-Wl,-Bdynamic" "-lxcb" "-lxcb" "-lxcb" "-lxcb" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc"
= note: /usr/bin/ld: cannot find -lxcb
/usr/bin/ld: cannot find -lxcb
/usr/bin/ld: cannot find -lxcb
/usr/bin/ld: cannot find -lxcb
collect2: error: ld returned 1 exit status

error: aborting due to previous error

error: failed to compile i3wsr v1.3.1, intermediate artifacts can be found at /tmp/cargo-installyqQgJ1

Caused by:
could not compile i3wsr

Mouse hover on i3bar causes automatic workspace switching to first workspace

Description:

when i3wsr is running, if you hover mouse over i3bar (any window with type of _NET_WM_WINDOW_TYPE_DOCK) under certain situations it changes the workspace to the first one. It happens when the currently focused workspace is renamed.
personally I experienced it with dual monitor setup but I've heard it's also happens with a single monitor(needs verification)
I also replicated this issue with python i3ipc and it had the same behavior as i3wsr. So I think the problem might not be from i3wsr itself but given that dynamically renaming workspaces is not an i3 feature, I thought I should discuss this issue here first.

steps to reproduce:

  • step 1:
    On the top monitor workspaces 1 and 2 are open. workspace 2 is focused
    On the bottom monitor workspaces 7 and 8 are open. workspace 8 is focused
    image
  • step 2:
    open new window in workspace 8 that changes its name.
    image
  • step 3:
    move mouse from bottom monitor to top and bottom again. workspace switchs to 7
    image

clip showing the same procedure:
issue.webm

further information:

While investigating the source of the bug, I found some workarounds to reduce the occurrence of this issue.
normally you would traverse the workspace tree and renamed all the workspaces.
To make it happen less often, I changed it so that it only renamed the effected workspaces.
for title new events, it is possible to get the workspace name and only rename that workspace.
for move and close, I had to check if the names changed and only rename those workspaces. which again made the bug trigger way less.

wm_property to "name" produce get_title error

Hello,

I'm testing the 2.0 version but can't get wm_property = "name" to work.
I have the following messages:
get_title error: invalid utf-8 sequence of 1 bytes from index 9

Thanks for your work!

Using alias name for icons

Hey there,
I want to start off by saying I really enjoy this project, thank you so much!

This might be more of a feature request, but maybe you already looked at it. Anyhow, currently the icons section does not seem to use the alias section names. I think it would be nice to match a name with an alias and then use that alias in the icons section.

The reason for this is it allows for easier definitions of icons, a simple example configuration in the current situation:

[icons]
"i-three-workspaces-renamer-v1.30" = "โ™ก"

[aliases]
"i-three-workspaces-renamer-v1.30" = "i3wsr"

Which would be nice to simplify to:

[icons]
"i3wsr" = "โ™ก"

[aliases]
"i-three-workspaces-renamer-v1.30" = "i3wsr"

Crashing when WM_CLASS is not set

Some edge-case programs do not set a WM_CLASS for their window and cause i3wsr to crash while one is present, such cases include the Linux version of the game Plague Inc: Evolved and the Android emulator provided by Android Studio.

If i3wsr was launched before the said window appears i3wsr will cease to function until the said window has been closed and will resume normal function afterwards. If trying to launch i3wsr while the said window is active it will simply exit instantly.

Duplicate workspace is created when applications are assigned workspaces

Hi
Thanks for such a wonderful tool. It has been working great.

However, there's one problem.
I have assigned workspaces to classes as assign [class=Google-chrome] 2.
Whenever I open a new window of chrome, it opens directly in the 2nd workspace. This is what i3 does.

But, when I'm running i3wsr, it creates another new workspace numbered 2 and open the new window in that workspace. This works fine when there are no applications open in 2nd workspace. Other times, it just gets confusing and the binding for going to workspace number 2 only goes to the newly formed 2nd workspace and not the previously opened 2nd workspace.

I've already changed the bindings from bindsym $mod+2 workspace 2 to bindsym $mod+2 workspace number 2.
I also tried doing something like for_window [class="Spotify"] move container to workspace 3, workspace number 3. But, it didn't work and this one also created another new workspace numbered 3.

Is there any workaround ? Kindly suggest
Thanks

Using aliases to edit, not overwrite, names

I have a program with a pretty long name, that I often have running in multiple instances. I'd like to be able to alias this in a way that, for example, Window Title - Superlong Programname becomes Window Title - SLP. Currently I can only find the option to have it appear as SLP, without catching the rest of the name of the window.

[HELP] Empty workspace custom label

Was looking for an option or setting in the config.toml that let's me set the default label for a workspace even when there's nothing there at all. The same way you can set an icon or text label for a program running in a workspace, can you set a default label to be displayed when you move to a workspace that has no windows at all? Right now I can only see the number that belongs to that can.

For example i want to have a Browser running on workspace 1, and see it's icon displayed like "๐ŸŒ" and if I move to the next empty one, instead of seeing a "2" another icon I choose like "๐Ÿ†“"

Using regexes in alias names

Hey there,

I would like to request the option to use regexes for alias names. This could make matching window names easier/more future proof for updates of said window names.

An example:
Currently gimp has the window name gimp-2.10, now if gimp has an update to v2.11 I will need to update my config file. I would rather like to define my alias as a regex, so that I can use gimp-\d\.\d\d or ^gimp.

I foresee a few breaking changes/issues with this, being:

  • Previous aliases such as "Org.gnome.Nautilus" need to be changed to "Org\.gnome\.Nautilus", as the . otherwise means any character, but it will still work.
  • Plainly using substring will also match against somethingsubstring-something, whilst it did not before. This should be changed to ^substring$ to obtain the current behavior.

Hide split_at when there are no windows in a workspace

Hey, I currently have split_at configured like so:

split_at = ":"

When I switch to a workspace with no windows in it, I get something that looks like 1:. It would be great if I could hide the : on empty workspaces.

i3wsr not capturing WM_NAME for chrome tabs

I'm trying to add specific icons based on the contents of a chrome tab (for example YouTube). I can get this from the name as seen by:

$ xprop WM_NAME
WM_NAME(UTF8_STRING) = "YouTube - Google Chrome"

However, I am unable to alias this in i3wsr. I've tried various versions of "^YouTube - Google Chrome$", "YouTube", and ".*YouTube.*". None of these successfully change the i3 window name.

Additionally, the window name is always "Google-chrome" (the WM_CLASS) regardless of the WM_NAME property, despite me having wm_property = "name" set and seeing other i3 windows change name by the content's WM_NAME (I made sure to trigger i3 events while YouTube was the visible tab and was included in the WM_NAME as part of this testing).

I'm wondering why the behavior for chrome is different from other applications. My best guess is it has to do with either the "-" in the WM_NAME or the fact that the WM_NAME attribute is a UTF8_STRING for chrome rather than a STRING (as it seems to be in most applications).

Please let me know if additional info would be helpful in reproducing this or if I'm misunderstanding the expected behavior.

number / name separator for polybar strip_wsnumbers

Is there an opportunity to specify a specific separator between the workspace number and name? Your code cuts the old ws name at the first space, and adds whatever afterwards, but given polybars strip_wsnumber requires "number:name" and most i3 examples use a colon too, I would rather split it at the colon instead, or instead just take the workspace number, ignoring the name, add a separator and then the new titles afterwards.

From playing around this evening, I see a few ... quirks... this would also benefit?

  1. In order to safely get a colon in there I appear to need to add it to the workspace name in my config:

set $ws1 "1:"

This is potentially fine, but feels like a hack to me in some sense. If you optionally took the num value, instead of splitting the name, then that ws name doesn't need this "safe" formatting to survive. I appreciate the benefits though of the whitespace in your "1:[Q]" style examples though, would be nice to have either approach a) possible and b) documented, rather than the current version not really being explained, and confusing me for one :)

  1. If i (ignorantly?) use

i3-msg "workspace number 2"

To change to workspace 2, regardless of the workspace name it "works" however it also seems to change the workspace name that i3wsr processes. I don't think this is fundamentally i3wsr's responsibility, but based on my uses, it'd be a lot cleaner for a slightly stupid user across the board.

i3wsr incompatible with auto-assigning applications to workspaces

When I am running i3wsr and I have assigned certain classes in my i3 config to start on specific workspaces (e.g. "assign [class="Kodi"] $ws10"), if I have another class auto assigned to the same workspace, two workspaces of the same number are created. This behaviour doesn't occur when i3wsr is disabled. Instead what I would expect to happen - both classes start on the same workspace - occurs.

Issue in config file with certain app names

Not sure why yet but if I try to add Gimp-2.10 = "Gimp" to the config i3wsr errors out

thread 'main' panicked at 'Could not parse config file
 invalid type: map, expected a string for key `aliases.Gimp-2` at line 17 column 13', /home/roosta/.cargo/registry/src/github.com-1ecc6299db9ec823/i3wsr-1.2.2/src/main.rs:40:27
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:76
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:60
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1030
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1412
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:64
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:196
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:210
  10: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:473
  11: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:380
  12: std::panicking::begin_panic_fmt
             at src/libstd/panicking.rs:335
  13: i3wsr::main
  14: std::rt::lang_start::{{closure}}
  15: std::rt::lang_start_internal::{{closure}}
             at src/libstd/rt.rs:49
  16: std::panicking::try::do_call
             at src/libstd/panicking.rs:292
  17: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:80
  18: std::panicking::try
             at src/libstd/panicking.rs:271
  19: std::panic::catch_unwind
             at src/libstd/panic.rs:394
  20: std::rt::lang_start_internal
             at src/libstd/rt.rs:48
  21: main
  22: __libc_start_main
  23: _start
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

make WM_CLASS overridable

Hi,

thanks for this tool!

It would be nice to be able to override WM_CLASS so that i3wsr would show them with a different name in i3. Maybe via a configuration file or CLI option?

That way it would be possible to have Xfce4-terminal shown as term for example.

3.0.0 release & crates.io

I've merged the develop branch into main, but I forgot one thing, that is that I used a fork of i3ipc as a git dependency, which prevents me from publishing a new release on crates.io just yet.

The fork merged a couple of pull requests, and fixes an issue with getting window properties directly from i3ipc instead of having to use xcb dependencies. The fork can be found here, and the original source here.

To get 3.0.0 released I'd have to publish my fork, which I really don't want to but the last activity upstream was 5 years ago, so I don't really se much of an alternative, unless anyone got suggestions?

Option to remove duplicates?

Hi,
In some workspace, I use the same app multiples times. For example: the terminal. I have 4 open terminals. Is there a way to display the name "terminal" only one time instead of 4 times ?

Thank you!

Ignore specific namespaces

Hello, thank you for this awesome plugin. I wonder whether it is possible to ignore naming certain workspaces. E.g. if I change workspace name explicitly with i3-msg "rename workspace..." is it possible for i3wsr to stop renaming it (appending opened windows information)?

allways show icons

when i am in a workspace the icons in that workspace don't show up and i want the icons to be allways shown can you add and option that do that

Feature inquiry: using a combination of both WM_NAME and WM_CLASS

I'm guessing this is out of scope, but I'm wondering if there's a way to specify the wm_property option on a per-application basis -- so I could have WM_NAME be used for terminal apps, as it's helpful to know what's running in it, and WM_CLASS be used in other situations when the WM_NAME property is too verbose and cannot be simplified via regex rules

A possibly more implement-able feature could be specifying whether to use WM_CLASS or WM_NAME in the [aliases] section to accomplish the same task. E.g. there could be a main [aliases] section that would rename based on wm_property as it does now, and users could also have a section [aliases.wm_class] to rename based on WM_CLASS regardless of whatever X window property is specified in wm_property

please let me know what your thoughts are! Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.