Originally Posted by
mandarke
Is it possible to:
- bind windows key + c to have the currently selected window centre itself
Install xdotool, then use this script:
Code:
#!/bin/bash
PANEL_HEIGHTS=24
PANEL_WIDTHS=0
SCREEN_WIDTH=`xdotool getdisplaygeometry | cut -d' ' -f1`
SCREEN_HEIGHT=`xdotool getdisplaygeometry | cut -d' ' -f2`
ACTIVE_WINDOW_ID=`xdotool getactivewindow`
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`
xpos=$((($SCREEN_WIDTH-$PANEL_WIDTHS-$ACTIVE_WINDOW_WIDTH)/2))
ypos=$((($SCREEN_HEIGHT-$PANEL_HEIGHTS-$ACTIVE_WINDOW_HEIGHT)/2))
xdotool windowmove $ACTIVE_WINDOW_ID $xpos $ypos
Make sure to adjust the values of PANEL_HEIGHTS and PANEL_WIDTHS to the size of the panels that don't allow windows to go over them (struts enabled by default).
Assign this script to your hotkey at Settings->Settings Manager->Keyboard->Application Shortcuts.
Bookmarks