master ohmu/wmutils / scripts / mtc
ohmu  ·  2026-07-25
 1#!/bin/bash
 2wid=$(pfw)
 3root_wid=$(lsw -r | head -n 1)
 4screen_w=$(wattr w $root_wid)
 5screen_h=$(wattr h $root_wid)
 6win_w=$(wattr w $wid)
 7win_h=$(wattr h $wid)
 8
 9border=${TBW}
10border_total=$((border * 2))
11
12margin_x=${2:-0}
13margin_y=$((${3:-0}))
14
15case $1 in
16    lu)
17        pos_x=$margin_x
18        pos_y=$margin_y
19        ;;
20    ld)
21        pos_x=$margin_x
22        pos_y=$((screen_h - win_h - margin_y - border_total))
23        ;;
24    ru)
25        pos_x=$((screen_w - win_w - margin_x - border_total))
26        pos_y=$margin_y
27        ;;
28    rd)
29        pos_x=$((screen_w - win_w - margin_x - border_total))
30        pos_y=$((screen_h - win_h - margin_y - border_total))
31        ;;
32    *)
33        echo "Неверный аргумент: $1"
34        exit 1
35        ;;
36esac
37
38[ $pos_x -lt 0 ] && pos_x=0
39[ $pos_y -lt 0 ] && pos_y=0
40
41wtp $pos_x $pos_y $win_w $win_h $wid
42
43center_x=$((pos_x + win_w / 2))
44center_y=$((pos_y + win_h / 2))
45#wmp -a $center_x $center_y