WMctrl:移动全屏窗口



一个小的shell脚本应该可以解决我的重影屏幕问题。我正在尝试将每个窗口沿某个方向仅移动 1px,在接下来的一秒钟中,它应该向另一个方向移动。

#!/bin/bash
while read windowId g x y w h deviceId windowTitle; do
    # ignore desktop screen
    if [ "${windowTitle}" != "Desktop" ]; then
        # ...
        # test values (fullscreen: not possible | window-mode: possible)
        `wmctrl -i -r ${windowId} -e 0,200,200,500,500`
        # ...
    fi
done < <(wmctrl -lG)

是否可以在某个方向上仅将全屏窗口移动 1px?(WMctrl(。

感谢您的帮助!

来自 Ask Ubuntu

我已经重写了@jacobs python代码以简化bash并使其工作(我在ubuntu 16 cinnamon上对此进行了测试(。

我不得不添加remove,maximized_vert, remove,maximized_horz没有窗户没有移动。

#!/bin/bash
if [ ! -z "$1" ] || [ -z "$2" ]; then
    command=$(wmctrl -l | grep $1 | cut -d" " -f1)
    if [ ! -z "$command" ]; then
        position=$(xrandr | grep "^$2" | cut -d"+" -f2)
        if [ ! -z "$position" ]; then
            for window in $command; do
               wmctrl -ir $window -b remove,maximized_vert
               wmctrl -ir $window -b remove,maximized_horz
               wmctrl -ir $window -e 0,$position,0,1920,1080
               wmctrl -ir $window -b add,maximized_vert
               wmctrl -ir $window -b add,maximized_horz
            done
        else
            echo -e "not found monitor with given name"
        fi
    else
        echo -e "not found windows with given name"
    fi
else
    echo -e "specify window and monitor name;nmove.sh window-name monitor-name"
fi
  1. sudo apt-get install xdotool wmctrl
  2. /path/to/script.sh "window-name" "monitor-name"

相关内容

  • 没有找到相关文章

最新更新