initial commit
This commit is contained in:
34
bspwm/set_window_size.sh
Executable file
34
bspwm/set_window_size.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
# Get current window size
|
||||
current_size=$(bspc query -T -n focused | jq -r '.rectangle.width, .rectangle.height')
|
||||
|
||||
#current_width=$(echo $current_size | head -n 1)
|
||||
#current_height=$(echo $current_size | tail -n 1)
|
||||
current_width=$(echo "$current_size" | sed -n '1p')
|
||||
current_height=$(echo "$current_size" | sed -n '2p')
|
||||
|
||||
# Define target size
|
||||
target_width=$1
|
||||
target_height=$2
|
||||
|
||||
echo "Current size: $current_width x $current_height"
|
||||
|
||||
# Calculate dx and dy
|
||||
dx=$((target_width - current_width))
|
||||
dy=$((target_height - current_height))
|
||||
|
||||
# Resize the window horizontally
|
||||
if [ $dx -gt 0 ]; then
|
||||
handle="right"
|
||||
else
|
||||
handle="left"
|
||||
fi
|
||||
bspc node --resize $handle ${dx#-} 0 # Use absolute value for dx
|
||||
|
||||
# Resize the window vertically
|
||||
if [ $dy -gt 0 ]; then
|
||||
handle="bottom"
|
||||
else
|
||||
handle="top"
|
||||
fi
|
||||
bspc node --resize $handle 0 ${dy#-} # Use absolute value for dy
|
||||
|
||||
Reference in New Issue
Block a user