flakes: switch codex-cli-nix back to sadjow/main
This commit is contained in:
@@ -6,6 +6,24 @@ root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
pkill -u "$USER" -x taffybar || true
|
||||
|
||||
cd "$root"
|
||||
|
||||
# Hyprland can restart and change the instance signature, leaving old shells with
|
||||
# a stale HYPRLAND_INSTANCE_SIGNATURE. Fix it before launching taffybar so any
|
||||
# `hyprctl` calls inside the bar work.
|
||||
if command -v hyprctl >/dev/null 2>&1 && command -v jq >/dev/null 2>&1; then
|
||||
if ! hyprctl monitors -j >/dev/null 2>&1; then
|
||||
if [[ -n "${WAYLAND_DISPLAY:-}" ]]; then
|
||||
inst="$(hyprctl instances -j | jq -r --arg sock "$WAYLAND_DISPLAY" '.[] | select(.wl_socket == $sock) | .instance' | head -n1)"
|
||||
else
|
||||
inst="$(hyprctl instances -j | jq -r '.[0].instance // empty')"
|
||||
fi
|
||||
|
||||
if [[ -n "${inst:-}" ]]; then
|
||||
export HYPRLAND_INSTANCE_SIGNATURE="$inst"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
setsid -f direnv exec . cabal run >/tmp/taffybar.log 2>&1
|
||||
|
||||
echo "Started taffybar in the background. Logs: /tmp/taffybar.log"
|
||||
|
||||
@@ -4,4 +4,21 @@ set -euo pipefail
|
||||
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$root"
|
||||
|
||||
# Hyprland can restart and change the instance signature, leaving old shells with
|
||||
# a stale HYPRLAND_INSTANCE_SIGNATURE. Fix it before launching taffybar so any
|
||||
# `hyprctl` calls inside the bar work.
|
||||
if command -v hyprctl >/dev/null 2>&1 && command -v jq >/dev/null 2>&1; then
|
||||
if ! hyprctl monitors -j >/dev/null 2>&1; then
|
||||
if [[ -n "${WAYLAND_DISPLAY:-}" ]]; then
|
||||
inst="$(hyprctl instances -j | jq -r --arg sock "$WAYLAND_DISPLAY" '.[] | select(.wl_socket == $sock) | .instance' | head -n1)"
|
||||
else
|
||||
inst="$(hyprctl instances -j | jq -r '.[0].instance // empty')"
|
||||
fi
|
||||
|
||||
if [[ -n "${inst:-}" ]]; then
|
||||
export HYPRLAND_INSTANCE_SIGNATURE="$inst"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
exec direnv exec . cabal run
|
||||
|
||||
@@ -1,7 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
monitors="$(hyprctl monitors -j)"
|
||||
hyprctl_cmd=(hyprctl)
|
||||
|
||||
# Hyprland can restart and change the instance signature, leaving old shells with
|
||||
# a stale HYPRLAND_INSTANCE_SIGNATURE. Detect the live instance and use it.
|
||||
if ! hyprctl monitors -j >/dev/null 2>&1; then
|
||||
if [[ -n "${WAYLAND_DISPLAY:-}" ]]; then
|
||||
inst="$(hyprctl instances -j | jq -r --arg sock "$WAYLAND_DISPLAY" '.[] | select(.wl_socket == $sock) | .instance' | head -n1)"
|
||||
else
|
||||
inst="$(hyprctl instances -j | jq -r '.[0].instance // empty')"
|
||||
fi
|
||||
|
||||
if [[ -n "${inst:-}" ]]; then
|
||||
hyprctl_cmd=(hyprctl --instance "$inst")
|
||||
fi
|
||||
fi
|
||||
|
||||
monitors="$("${hyprctl_cmd[@]}" monitors -j)"
|
||||
height="$(jq -r '.[] | select(.focused) | .reserved[1]' <<<"$monitors")"
|
||||
geo="$(jq -r '.[] | select(.focused) | "\(.x),\(.y) \(.width)x\(.reserved[1])"' <<<"$monitors")"
|
||||
|
||||
@@ -11,6 +27,7 @@ if [[ -z "$geo" || "$height" == "0" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
out="/tmp/taffybar-$(date +%Y%m%d-%H%M%S).png"
|
||||
# Include nanoseconds so consecutive screenshots don't overwrite each other.
|
||||
out="/tmp/taffybar-$(date +%Y%m%d-%H%M%S-%N).png"
|
||||
grim -g "$geo" "$out"
|
||||
echo "$out"
|
||||
|
||||
@@ -1,7 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ts="$(date +%Y%m%d-%H%M%S)"
|
||||
hyprctl_cmd=(hyprctl)
|
||||
|
||||
# Hyprland can restart and change the instance signature, leaving old shells with
|
||||
# a stale HYPRLAND_INSTANCE_SIGNATURE. Detect the live instance and use it.
|
||||
if ! hyprctl monitors -j >/dev/null 2>&1; then
|
||||
if [[ -n "${WAYLAND_DISPLAY:-}" ]]; then
|
||||
inst="$(hyprctl instances -j | jq -r --arg sock "$WAYLAND_DISPLAY" '.[] | select(.wl_socket == $sock) | .instance' | head -n1)"
|
||||
else
|
||||
inst="$(hyprctl instances -j | jq -r '.[0].instance // empty')"
|
||||
fi
|
||||
|
||||
if [[ -n "${inst:-}" ]]; then
|
||||
hyprctl_cmd=(hyprctl --instance "$inst")
|
||||
fi
|
||||
fi
|
||||
|
||||
# Include nanoseconds so consecutive screenshots don't overwrite each other.
|
||||
ts="$(date +%Y%m%d-%H%M%S-%N)"
|
||||
found="0"
|
||||
|
||||
while IFS=$'\t' read -r name geo; do
|
||||
@@ -9,7 +26,7 @@ while IFS=$'\t' read -r name geo; do
|
||||
out="/tmp/taffybar-${name}-${ts}.png"
|
||||
grim -g "$geo" "$out"
|
||||
echo "$out"
|
||||
done < <(hyprctl monitors -j | jq -r '.[] | select(.reserved[1] > 0) | "\(.name)\t\(.x),\(.y) \(.width)x\(.reserved[1])"')
|
||||
done < <("${hyprctl_cmd[@]}" monitors -j | jq -r '.[] | select(.reserved[1] > 0) | "\(.name)\t\(.x),\(.y) \(.width)x\(.reserved[1])"')
|
||||
|
||||
if [[ "$found" == "0" ]]; then
|
||||
echo "No monitors with a top reserved area found." >&2
|
||||
|
||||
Reference in New Issue
Block a user