gpt4 book ai didi

linux - wmctrl:移动全屏窗口

转载 作者:行者123 更新时间:2023-12-01 19:38:59 26 4
gpt4 key购买 nike

一个小的 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"

关于linux - wmctrl:移动全屏窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49755831/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com