Home

Awesome

Ixwindow – iconized xwindow

CI crate

About

Ixwindow is an improved version of the standard xwindow polybar module. The main feature is that ixwindow displays not only info about active window, but also an icon for it. It also allows you more customization of printing window info, than regular xwindow polybar module. Below is represented a demonstration of what ixwindow looks like in action:

<p align="center"> <img src="assets/demo.gif" alt="animated" /> </p>

Note: basically, it doesn't really depend on polybar itself, it can be used with any other bar as well, you just need to implement the same behavior, as polybar's tail = true.

Features

Installation

Cargo Installation

You can install it using cargo install as such:

cargo install ixwindow

But in this case you will have to create config file yourself (see examples/ixwindow.toml for example configuration).

Install Script

Another way to install ixwindow is from github repository. First you have to clone it:

git clone https://github.com:andreykaere/ixwindow && cd ixwindow

If you want the bleeding edge version, switch to dev branch.

To install it to your system you just have to run ./install. To see installation options run ./install --help.

Setting up polybar

After you have installed ixwindow on your system and created a config file for it, you need to set up ixwindow module in your polybar config. To do that, you have to add the following to your polybar config file:

[module/ixwindow]
type = custom/script
exec = /path/to/ixwindow
tail = true

Now you have to put it somewhere on bar: for example, you can add it right next to your window manager module like that: modules-left = <wm> ixwindow. Also, you will have to have override-redirect = true set in your bar config. This will, however make polybar appear even in fullscreen mode, overlapping the window. To restore normal behaviour also add wm-restak = <your-wm>.

If you have multi monitors setup, then you need to have distinct bar for each of them and create modules like this:

[module/ixwindow1]
type = custom/script
exec = /path/to/ixwindow <name_of_monitor_1>
tail = true

[module/ixwindow2]
type = custom/script
exec = /path/to/ixwindow <name_of_monitor_2>
tail = true
...

and then put these modules on respective bars:

...
; Bar for monitor1
[bar/bar1]
...
modules-left = <wm> ixwindow1
...

; Bar for monitor2
[bar/bar2]
...
modules-left = <wm> ixwindow2
...

...

You will also need a config file for ixwindow. Example of this file you may find in examples/ixwindow.toml. For more info see the section below.

Configuration

Default configuration file is supposed to be located at $XDG_CONFIG_HOME/ixwindow/ixwindow.toml. If you want it to be located somewhere else, you should specify that in environmental variable IXWINDOW_CONFIG_PATH, or run ixwindow script with --config=<path_to_config> option.

In config file, there are various options, that can be modified (example of configuration file can be found in examples/ixwindow.toml), such as:

# Path to folder for the cached icons 
# Note: it makes sense to keep it around `.config/polybar` folder, so you won't
# lose your custom icons, if you have them
cache_dir = "path/to/cache/directory"

# This represents the size of the icon in pixels, for example:
size = 24

# This represents background color of the polybar bar. Color should be
# specified in hex format:
color = "#RRGGBB"

# Absolute coordinates of the icon in pixels, for example: 
x = 270
y = 6

# Amount of spaces in the output of the `ixwindow`. This is needed to add
# space between previous module and the title of the window
# It's recommended to be configured together with the coordinates of the icon 
# to achieve the best result
gap = "<spaces>"


# For i3 (but if there will be request, can be easily added for bspwm as
# well). 
#
# This variable is used for calculation of the position of the icon, when the number 
# of active desktops is dynamic, i.e. is not constant and can be changed when
# new nodes are added. This setting is optional and if it is not set, it
# means, that the icon position will be static.
# 
# For more accurate configuration, floating numbers are acceptable. For
# example:
gap_per_desk = 24.0

To change your configuration, just edit your config file. For new settings to take affect, you have to restart polybar (for example with polybar-msg cmd restart).

Generating icons

ixwindow uses the X11 atom _NEW_WM_ICON for generating icons automatically. Most of the times it works, but for some applications, this field may be empty and there is no way to generate it automatically. In this case, if you want to have an icon for these applications, you have to add them manually.

<!-- For information how to do it, see the section below. --> <!-- ### Adding custom icons --> <!-- To replace or add custom icons, you need to have `png` or `svg` version --> <!-- of the icon, named as `WM_CLASS` (which you can find by running `xprop --> <!-- WM_CLASS` and selecting your app). Then you run the following command --> <!-- (requires `imagemagick`): --> <!-- ```bash --> <!-- ixwindow-convert --size <size> --color <color> --cache <cache_dir> <icon-name> --> <!-- ``` --> <!-- where `<icon-name>` is the right name as described above. This will convert --> <!-- icon to `jpg` format with appropriate background color and move to your cache --> <!-- directory. --> <!-- **Note:** Almost all apps have their icons on your system in `png` or `svg` --> <!-- format. Usually, one can find it somewhere in `/usr/share/icons` directory --> <!-- (for example using `find` or `fd` utility for it). --> <!-- You can try it out on some icons located in `examples/custom-icons` folder. -->

Known issues & limitations

Feel free to open issue if you have any questions or you've noticed a bug. Also pull requests are welcome; don't hesitate to crate one, if you have a solution to any of the issues, stated above.

Goals

Thanks

Inspired by

I got inspired to start this project, when I saw similar feature in awesome-wm. I thought it would be hard to simulate the exact same behavior on polybar, however I came across this project and I thought, that I can just improve the default xwindow, by formatting its output a bit and adding icon of the focused application.

With a great help of

I would like to thank psychon for helping me understand x11rb and xorg in general, which made it possible to rewrite code in rust and drastically improve that project.