Began as a fork of my favorite Polybar script polywins
Windowlist has been fully rewritten in C using the relevant parts of the source code from wmctrl and xprop.
- Fixed a bug where names would not be correct if WM_CLASS contains spaces or dots
- Option to sort the window list:
- By horizontal position on the screen
- By the application name
- Ability to set nicknames for windows if a window has a bad default name
- More flexible styling
- Configurable click actions
Project directory should be in ~/.config/polybar/scripts/
In ~/.config/polybar/scripts/windowlist/
run make
Add module in ~/.config/polybar/config.ini
:
[module/windowlist]
type = custom/script
exec = ~/.config/polybar/scripts/windowlist/main 2> /dev/null
tail = true
Add module windowlist
in any of modules-left
, modules-center
or modules-right
Windowlist can be configured in config.toml
in the root of the project.
All options are detailed below:
Option | Description | Possible values |
---|---|---|
sort_by |
Criteria to sort the list of windows |
|
max_windows |
How many windows can be visible on the list. Number of windows that did not fit will be shown e.g. (+3) |
number (int) |
name |
Which X window property is considered window name (label for a window) |
|
name_case |
Text case for window names |
|
name_max_length |
Maximum length for a window name before it's truncated with ‥ |
number (int) |
name_padding |
How many spaces to add before and after a window name | number (int) |
separator_string |
String displayed between window names | any string |
empty_desktop_string |
String to show when no windows are open | any string |
active_window_left_click active_window_middle_click active_window_right_click active_window_scroll_up active_window_scroll_down inactive_window_left_click inactive_window_middle_click inactive_window_right_click inactive_window_scroll_up inactive_window_scroll_down |
Click actions for window names can be set as "raise" , "minimize" or "close" , or a custom script/program in the click-actions directory. Window currently in focus (active) and unfocused windows (inactive) are configurable separately. |
|
active_window_fg_color
inactive_window_fg_color
separator_fg_color
empty_desktop_fg_color
overflow_fg_color
|
Foreground colors for:
|
|
*_bg_color |
All of the foreground colors have a background color counterpart, e.g. active_window_bg_color |
|
*_ul_color |
All colors also have an underline color counterpart, e.g. active_window_ul_color Note that line-size must be set to 1 or higher in your polybar config.ini , otherwise underline isn't visible. |
|
ignored_classes |
Windows with a WM_CLASS in this array will not be shown on the bar. Strings are matched case insensitively. | array of strings |
window_nicknames |
A window name can be substituted with a custom name using key value pairs. The keys are matched case insensitively. | table of string key-value pairs |
Note: polybar must be reset before changes take effect.
Check the config.toml
in this repo, the options set there are the default values.
You can also remove any key and it will fall back to the default value.
The most convenient way is to write a shell script in the click-actions
directory. Any language could be used, though. There are three "default" actions as small C programs: raise
, minimize
and close
.
You can write a new action as a script such as:
click-actions/foo.sh
#!/bin/sh
window_id="$1"
# Do something with the window id of the window that has been clicked/scrolled on
Set the script as executable: chmod +x click-actions/foo.sh
Then in config.toml
:
active_window_middle_click = "foo.sh"
Window id is always given as arg $1
. Tools I know that could be used to make something happen with a window id:
Requires an EWMH compliant window manager
- Wikipedia table to see if a window manager is EWMH compliant: link