master ohmu/wmutils / scripts / move.sh
ohmu  ·  2026-07-25
 1#!/bin/sh
 2
 3. ~/.theme
 4
 5if [ $# -ne 1 ]; then
 6    echo "Usage: $0 {up|down|left|right}"
 7    exit 1
 8fi
 9
10case $1 in
11    up)
12        dx=0
13        dy=-40
14        ;;
15    down)
16        dx=0
17        dy=40
18        ;;
19    left)
20        dx=-40
21        dy=0
22        ;;
23    right)
24        dx=40
25        dy=0
26        ;;
27    *)
28        echo "Invalid direction. Use: up, down, left, right"
29        exit 1
30        ;;
31esac
32
33CUR=$(pfw)
34geom=$(wattr xywh $CUR)
35set -- $geom
36x=$1; y=$2; w=$3; h=$4
37center_x=$((x + w/2))
38center_y=$((y + h/2))
39wmp -a $center_x $center_y
40
41wmv $dx $dy $CUR
42
43geom=$(wattr xywh $CUR)
44set -- $geom
45x=$1; y=$2; w=$3; h=$4
46center_x=$((x + w/2))
47center_y=$((y + h/2))
48wmp -a $center_x $center_y
49