repositories / dotfiles
dotfiles
bugabingas dorkfiles
owned by bugabinga
hypr/scripts/show_clients.nu
Raw# Fetch and parse hyprctl clients JSON
let clients = (hyprctl clients -j | from json)
# Format clients for fuzzel: "class: title (workspace)"
let formatted = ($clients | each { |client|
$"($client.class): ($client.title) \(($client.workspace.name)\)"
} | str join "\n")
# Pipe formatted list to fuzzel and get selected item
let selected = ($formatted | fuzzel --dmenu --prompt "Select window: " | str trim)
# Exit if no selection
if ($selected | is-empty) {
exit 0
}
# Find the index of the selected item
let selected_index = ($formatted | split row "\n" | enumerate | where item == $selected | get 0.index)
# Get the address of the selected client
let address = ($clients | get $selected_index | get address)
# Focus the selected window
hyprctl -q dispatch focuswindow address:($address)
hyprctl -q dispatch alterzorder top