Crates.io | hyprland-activewindow |
lib.rs | hyprland-activewindow |
version | 1.0.5 |
source | src |
created_at | 2024-01-26 02:41:08.956441 |
updated_at | 2024-11-01 23:43:53.77573 |
description | A multi-monitor aware Hyprland active window title outputer |
homepage | https://github.com/FieldofClay/hyprland-activewindow |
repository | https://github.com/FieldofClay/hyprland-activewindow |
max_upload_size | |
id | 1115108 |
size | 31,186 |
A multi-monitor aware Hyprland active window title outputer. Follows the specified monitor and outputs the current active window title. Designed to be used with Eww, but may function with other bars.
Arch users can install from AUR using your favourite package manager.
pikaur -S hyprland-activewindow
NixOS users can use the unstable channel to try or install the package.
nix-shell -p hyprland-activewindow
It can be installed directly from crates.io with cargo.
cargo install hyprland-activewindow
git clone https://github.com/FieldofClay/hyprland-activewindow.git
cd hyprland-activewindow
cargo build --release
Pass the name of the monitor to follow as the only argument. It will then follow that monitor and output the active window title to stdout.
./hyprland-activewindow eDP-1
You can get the names of your monitors by running:
hyprctl monitors -j
It can be used as a title widget in Eww with config similar to below.
(deflisten window0 "hyprland-activewindow eDP-1")
(defwidget title0 []
(label :text "${window0}"))
(deflisten window1 "hyprland-activewindow DP-1")
(defwidget title1 []
(label :text "${window1}"))
(defwidget bar0 []
(box
(window0)
)
)
(defwidget bar1 []
(box
(window1)
)
)
Pass the wildcard "_" as the only argument and it will follow all monitors and output active window title information in json to stdout.
./hyprland-activewindow _
The output will be a json array of each monitors name and the active window's title & initial title.
[{"initial_title":"Alacritty","name":"eDP-1","title":"~/hyprland-activewindow"},{"initial_title":"VSCodium","name":"DP-1","title":"main.rs - hyprland-activewindow (Workspace) - VSCodium"}]
This allows simplified Eww config similar to this:
(deflisten windows "hyprland-activewindow _")
(defwidget window [monitor]
(box
(label :text "${windows['${monitor}'].title}")
)
)
(defwidget bar0 []
(box
(window :monitor 0)
)
)
(defwidget bar1 []
(box
(window :monitor 1)
)
)