aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.local/bin/picinpic
blob: 98be77746b777484af8c973bd7411dc1e3f95e53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh

currentmonrect="$(swaymsg -t get_outputs | jq ".[] | select(.focused == true) | .rect")"
resx=$(echo $currentmonrect | jq --raw-output ".width")
resy=$(echo $currentmonrect | jq --raw-output ".height")

sx=$(($resx / 4))
sy=$(($resy / 4))
posx=$(($resx - $sx - 15))
posy=$(($resy - $sy - 40))

swaymsg resize set "$sx" "$sy"

if [ "$1" = "left" ]; then
  swaymsg move position -- "-15" "$posy"
  exit
fi
swaymsg move position -- "$posx" "$posy"