mirror of
https://github.com/basecamp/omarchy.git
synced 2026-02-17 15:25:37 +00:00
updated omarchy-hyprland-window-pop to have an optional parameters (#3456)
* added optional argument for floating a window * added sample comment * Style * This file isn't meant to be changed so not a good place for commented out recommendations --------- Co-authored-by: David Heinemeier Hansson <david@hey.com>
This commit is contained in:
@@ -2,21 +2,45 @@
|
|||||||
|
|
||||||
# Toggle to pop-out a tile to stay fixed on a display basis.
|
# Toggle to pop-out a tile to stay fixed on a display basis.
|
||||||
|
|
||||||
active=$(hyprctl activewindow -j)
|
# Usage:
|
||||||
pinned=$(echo "$active" | jq .pinned)
|
# omarchy-hyprland-window-pop [width height [x y]]
|
||||||
addr=$(echo "$active" | jq -r ".address")
|
#
|
||||||
[ -z "$addr" ] && { echo "No active window"; exit 0; }
|
# Arguments:
|
||||||
|
# width Optional. Width of the floating window. Default: 1300
|
||||||
|
# height Optional. Height of the floating window. Default: 900
|
||||||
|
# x Optional. X position of the window. Must provide both X and Y to take effect.
|
||||||
|
# y Optional. Y position of the window. Must provide both X and Y to take effect.
|
||||||
|
#
|
||||||
|
# Behavior:
|
||||||
|
# - If the window is already pinned, it will be unpinned and removed from the pop layer.
|
||||||
|
# - If the window is not pinned, it will be floated, resized, moved/centered, pinned, brought to top, and popped.
|
||||||
|
|
||||||
if [ "$pinned" = "true" ]; then
|
width=${1:-1300}
|
||||||
|
height=${2:-900}
|
||||||
|
x=${3:-}
|
||||||
|
y=${4:-}
|
||||||
|
|
||||||
|
active=$(hyprctl activewindow -j)
|
||||||
|
pinned=$(echo "$active" | jq ".pinned")
|
||||||
|
addr=$(echo "$active" | jq -r ".address")
|
||||||
|
|
||||||
|
if [[ $pinned == "true" ]]; then
|
||||||
hyprctl -q --batch \
|
hyprctl -q --batch \
|
||||||
"dispatch pin address:$addr;" \
|
dispatch pin address:$addr; \
|
||||||
"dispatch togglefloating address:$addr;" \
|
dispatch togglefloating address:$addr; \
|
||||||
"dispatch tagwindow -pop address:$addr;"
|
dispatch tagwindow -pop address:$addr;
|
||||||
else
|
elif [[ -n $addr ]]; then
|
||||||
|
hyprctl dispatch togglefloating address:$addr
|
||||||
|
hyprctl dispatch resizeactive exact $width $height address:$addr
|
||||||
|
|
||||||
|
if [[ -n $x && -n $y ]]; then
|
||||||
|
hyprctl dispatch moveactive $x $y address:$addr
|
||||||
|
else
|
||||||
|
hyprctl dispatch centerwindow address:$addr
|
||||||
|
fi
|
||||||
|
|
||||||
hyprctl -q --batch \
|
hyprctl -q --batch \
|
||||||
"dispatch togglefloating address:$addr;" \
|
dispatch pin address:$addr; \
|
||||||
"dispatch centerwindow address:$addr;" \
|
dispatch alterzorder top address:$addr; \
|
||||||
"dispatch pin address:$addr;" \
|
dispatch tagwindow +pop address:$addr;
|
||||||
"dispatch alterzorder top address:$addr;" \
|
|
||||||
"dispatch tagwindow +pop address:$addr;"
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user