wmctrl:移动全屏窗口 [英] wmctrl: moving a fullscreen window

查看:41
本文介绍了wmctrl:移动全屏窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个小的Shell脚本应该可以解决我的幻影屏幕问题.我正在尝试将每个窗口沿某个方向仅移动1px,然后在接下来的第二秒将其向另一个方向移动.

A small shell script should fix my ghosting-screen problem. I'm trying to move each window just 1px in a certain direction and in the following second it should do a move in the other direction back.

#!/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)

是否可以在某个方向上将全屏窗口仅移动1像素?( wmctrl ).

Is it possible to move a fullscreen window just by 1px in a certain direction? (wmctrl).

感谢您的帮助!

推荐答案

询问Ubuntu

我已经将@jacobs python代码重写为简单的bash并使其起作用(我在ubuntu 16肉桂上对此进行了测试).

I've rewrited @jacobs python code to simple bash and make it works (I tested this on ubuntu 16 cinnamon).

我必须添加 remove,maximized_vert,remove,maximized_horz ,而窗口不会移动.

I had to add remove,maximized_vert, remove,maximized_horz without that windows didn't move.

#!/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窗口名称"监视器名称"

这篇关于wmctrl:移动全屏窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆