mirror of
https://github.com/prdlk/dotfiles.git
synced 2026-11-02 19:32:43 +00:00
feat(cli): add omarchy-pip and summon commands, enhance smart-move, remove youtube from toggle-scratch
This commit is contained in:
1 parent
f30eee4215
commit
c81271b10b
4 files changed
+155
-10
No files matched your search
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Move the focused window into a neighboring group, or swap with the neighbor
|
||||
# omarchy:summary=Move the focused window into a neighboring group or swap with the neighbor; floating windows go to a screen corner
|
||||
# omarchy:args=<l|r|u|d>
|
||||
|
||||
set -uo pipefail
|
||||
@@ -31,6 +31,33 @@ GROUPED=$(jq -r '(.grouped // []) | length' <<<"$ACTIVE")
|
||||
|
||||
[[ -n $ADDRESS && -n $WORKSPACE ]] || exit 0
|
||||
|
||||
# A floating window has no neighbours to swap with, so the four keys park it
|
||||
# in a corner of its monitor instead, size unchanged, inside the reserved
|
||||
# area (the bar) and inset by GAP (matches general:gaps_out, same as
|
||||
# omarchy-pip). h/j/k/l read clockwise from the bottom left: l bottom-left,
|
||||
# d top-left, u top-right, r bottom-right.
|
||||
if [[ $(jq -r '.floating' <<<"$ACTIVE") == true ]]; then
|
||||
GAP=10
|
||||
read -r WIN_W WIN_H MON_ID < <(jq -r '"\(.size[0]) \(.size[1]) \(.monitor)"' <<<"$ACTIVE")
|
||||
read -r MON_X MON_Y MON_W MON_H RES_L RES_T RES_R RES_B < <(hyprctl monitors -j | jq -r --argjson id "$MON_ID" \
|
||||
'.[] | select(.id == $id) | "\(.x) \(.y) \(((.width / .scale) | floor)) \(((.height / .scale) | floor)) \(.reserved | join(" "))"')
|
||||
[[ -n ${RES_B:-} ]] || exit 1
|
||||
|
||||
LEFT=$((MON_X + RES_L + GAP))
|
||||
RIGHT=$((MON_X + MON_W - RES_R - WIN_W - GAP))
|
||||
TOP=$((MON_Y + RES_T + GAP))
|
||||
BOTTOM=$((MON_Y + MON_H - RES_B - WIN_H - GAP))
|
||||
case $DIR in
|
||||
l) X=$LEFT Y=$BOTTOM ;;
|
||||
d) X=$LEFT Y=$TOP ;;
|
||||
u) X=$RIGHT Y=$TOP ;;
|
||||
r) X=$RIGHT Y=$BOTTOM ;;
|
||||
esac
|
||||
|
||||
hypr_dispatch "hl.dsp.window.move({ x = $X, y = $Y })" movewindowpixel "exact $X $Y,address:$ADDRESS"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Find the nearest window in the given direction. A window counts as a
|
||||
# neighbor only when it overlaps the focused window on the other axis, so a
|
||||
# window in a far corner is not picked.
|
||||
|
||||
Reference in new issue
Block a user