fix(waybar): add hakase-popup-launch

This commit is contained in:
kenji
2026-01-04 22:08:11 -06:00
parent 10374ba152
commit 6167ca3d0a
2 changed files with 86 additions and 26 deletions
+52 -4
View File
@@ -4,7 +4,54 @@
myConfig,
...
}: let
# --- POPUP SCRIPTS ---
hakase-popup-launch = pkgs.writeShellScriptBin "hakase-popup-launch" ''
tui_name=$1
active_popup=$(${pkgs.hyprland}/bin/hyprctl clients -j | ${pkgs.jq}/bin/jq -r '.[] | select(.class | startswith("org.hakase.")) | .class')
if [[ -z "''${tui_name}" ]]; then
echo "Usage: $(basename "$0") [tui-name]"
exit 1
fi
popup_checker() {
if [[ -z "$active_popup" ]]; then
echo "no_popup"
elif [[ "$active_popup" != "org.hakase.popup.''${tui_name}" ]]; then
echo "different"
else
echo "same"
fi
}
launch() {
exec ${pkgs.util-linux}/bin/setsid uwsm-app -- xdg-terminal-exec --app-id=org.hakase.popup."''${tui_name}" -e "''${tui_name}"
}
focus() {
exec ${pkgs.hyprland}/bin/hyprctl dispatch focuswindow "class:org.hakase.popup.''${tui_name}"
}
replace() {
${pkgs.hyprland}/bin/hyprctl dispatch closewindow "class:''${active_popup}"
sleep 1
launch
}
run() {
local status
status=$(popup_checker)
if [[ "$status" == "no_popup" ]]; then
launch
elif [[ "$status" == "same" ]]; then
focus
elif [[ "$status" == "different" ]]; then
replace
fi
}
run
'';
in {
wayland.windowManager.hyprland.settings = {
exec-once = [
@@ -16,6 +63,7 @@ in {
];
home.packages = [
hakase-popup-launch
pkgs.jq
pkgs.socat
pkgs.util-linux
@@ -120,7 +168,7 @@ in {
tooltip-format-disconnected = "Disconnected";
interval = 3;
spacing = 1;
on-click = "hakase-popup-wifi";
on-click = "hakase-popup-launch impala";
};
"battery" = {
@@ -149,12 +197,12 @@ in {
format-connected = "󰂱";
format-no-controller = "";
tooltip-format = "Devices connected: {num_connections}";
on-click = "hakase-popup-bluetooth";
on-click = "hakase-popup-launch bluetui";
};
"pulseaudio" = {
format = "{icon}";
on-click = "hakase-popup-volume";
on-click = "hakase-popup-launch wiremix ";
on-click-right = "pamixer -t";
tooltip-format = "Playing at {volume}%";
scroll-step = 5;