From e351037f1e0f48a2a1602a07d376980c9e595091 Mon Sep 17 00:00:00 2001 From: Yaroslav Date: Mon, 6 Apr 2020 00:10:29 +0300 Subject: finally got myself into adapt the "picture-in-picture" script for sway --- dotfiles/.config/sway/config | 6 +++--- dotfiles/.local/bin/picinpic | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100755 dotfiles/.local/bin/picinpic (limited to 'dotfiles') diff --git a/dotfiles/.config/sway/config b/dotfiles/.config/sway/config index 6c6d6b7..0ed7bc8 100644 --- a/dotfiles/.config/sway/config +++ b/dotfiles/.config/sway/config @@ -222,9 +222,9 @@ bindsym --to-code { #focus_follows_mouse no - # Sticky float to bottom left - $mod+Ctrl+b floating toggle; sticky toggle; exec --no-startup-id bottomleft - $mod+Shift+b floating toggle; sticky toggle; exec --no-startup-id bottomright + # Sticky float to a bottom corner + $mod+Shift+b floating toggle; sticky toggle; exec --no-startup-id picinpic + $mod+Ctrl+b floating toggle; sticky toggle; exec --no-startup-id picinpic left # change focus $mod+h focus left 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" -- cgit v1.2.3