Files

14 lines
541 B
Bash
Executable File

#!/usr/bin/env bash
# Open btop fullscreen in a ghostty window; focus it if it is already open.
# Intended as the on-click action for the waybar cpu/memory modules.
set -uo pipefail
if hyprctl clients -j 2>/dev/null | jq -e 'any(.[]; ((.title // "") + " " + (.class // "")) | ascii_downcase | contains("btop"))' >/dev/null 2>&1; then
hyprctl dispatch 'hl.dsp.focus({ window = "title:btop" })' 2>/dev/null || true
exit 0
fi
ghostty -e btop &
sleep 0.5
hyprctl dispatch 'hl.dsp.window.fullscreen({ action = "set" })' 2>/dev/null || true