Hello and welcome to the forums.
To use the following script, you need to have the package xdotool installed. Look for it in the Software Centre or install it manually via:
sudo apt-get install xdotool
Once thats done, with root privlidges, create the file /usr/local/bin/cw (from a terminal window):
...or if you have an earlier version of Xubuntu with leafpad:
sudo -i mousepad /usr/local/bin/cw
...enter your password when prompted then copy/paste the following:
sudo -i leafpad /usr/local/bin/cw
...and save the file.
SCREEN_WIDTH=`xdotool getdisplaygeometry | cut -d' ' -f1`
SCREEN_HEIGHT=`xdotool getdisplaygeometry | cut -d' ' -f2`
ACTIVE_WINDOW_WIDTH=`xwininfo -id $ACTIVE_WINDOW_ID | grep Width | cut -d' ' -f4`
ACTIVE_WINDOW_HEIGHT=`xwininfo -id $ACTIVE_WINDOW_ID | grep Height | cut -d' ' -f4`
xdotool windowmove $ACTIVE_WINDOW_ID $xpos $ypos
Next, make the file executable via:
You can now test the script by opening a terminal window, moving it away from centre, then executing the command:
sudo chmod +x /usr/local/bin/cw
...and the window should centre.
The script acts on the currently focused window, so by adding it to a keyboard shortcut, it will act on whichever window is currently active. To create a keyboard shortcut in Xfce, go to Settings Manager -> Keyboard -> Application Shortcuts, click on the "Add" button, for the command enter:
...press "Ok" then press the keyboard combination you want to use.
Note: The script includes two variables:
Feel free to adjust these by giving them the values (in pixels) of the total widths/heights of your panels if you want the window to centre relative to the panels (not screen dimensions).