I'm working in multi display workspace, I would like to have keyboard shortcut for moving active window to another display (I don't mean workspaces). How can I achieve this in XFCE? In Unity I was using Compiz with predefined keyboard shortcuts.
XFCE does not have a built-in command that allows you to move a window to another monitor, however there is this Python script that can do that.
The script is used as:
movescreen.py <up|down|left|right|prev|next|fit> [win_id|mouse]
First, make sure the script's dependencies are satisfied:
sudo apt install python xrandr xwininfo wmctrl xdotool
Download the script and move it to the folder that you want, for example
~/scripts/(I am assuming this as the script's folder for the next steps, you may, however, use whatever you want).
Give executable rights to the script:
chmod u+x ~/scripts/movescreen.py
Open Keyboard and select the Application Shortcuts tab.
Click the Add button at the bottom left.
In the Command pop-up window enter the command to move the window, using the absolute path to the script. For example, to move the window to the monitor left, enter:
Press OK and assign the shortcut you want, for example Ctrl+Super+Left.
Repeat the steps for all other directions.
The script is not perfect, but works reasonably well. Also, being built in Python means that it is relatively easy to tweak it.
Managed to do it as follows:
apt install xdotool
xdotool getactivewindow getwindowgeometry
Window 69206023 Position: 2201,251 (screen: 0) Geometry: 774x568
Moving to right command:
xdotool getactivewindow windowmove 2201 251 windowsize 774 568
Finally just put the following in
/usr/bin/moverightscript and bind it on a keyboard shortcut:
#!/bin/bash xdotool getactivewindow windowmove 2201 251 windowsize 774 568