3

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)

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

Thanks for your help!

Habebit
  • 957
  • 6
  • 23
  • try using `-b remove,fullscreen` on the same window before resizing it. It seems to generally not resize full-screen/full-width windows. Not sure if bug or feature. – Ufos Aug 28 '18 at 20:24
  • Thanks for you answer, but it's not working. `-b remove,fullscreen` doesn't work, I have no idea, why not. – Habebit Nov 17 '18 at 22:51

1 Answers1

1

From Ask Ubuntu

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

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 "window-name" "monitor-name"
WinEunuuchs2Unix
  • 1,801
  • 1
  • 17
  • 34