aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.local/bin
diff options
context:
space:
mode:
authorYaroslav <contact@yaroslavps.com>2020-04-06 00:10:29 +0300
committerYaroslav <contact@yaroslavps.com>2020-04-06 00:10:29 +0300
commite351037f1e0f48a2a1602a07d376980c9e595091 (patch)
tree403921b5b897df25dc5525fda457497e8acdafa2 /dotfiles/.local/bin
parent69204c648abbd4463b6a1e3b6cbb67a394842379 (diff)
downloadswayrice-e351037f1e0f48a2a1602a07d376980c9e595091.tar.gz
swayrice-e351037f1e0f48a2a1602a07d376980c9e595091.zip
finally got myself into adapt the "picture-in-picture" script for sway
Diffstat (limited to 'dotfiles/.local/bin')
-rwxr-xr-xdotfiles/.local/bin/picinpic18
1 files changed, 18 insertions, 0 deletions
diff --git a/dotfiles/.local/bin/picinpic b/dotfiles/.local/bin/picinpic
new file mode 100755
index 0000000..1005d6b
--- /dev/null
+++ b/dotfiles/.local/bin/picinpic
@@ -0,0 +1,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 -- "$((0 - 15))" "$posy"
+ exit
+fi
+swaymsg move position -- "$posx" "$posy"