3

TLDR I'm looking for a ubuntu replacement of windowpad

I know window placement can be defined with Ctrl-Alt-Numpad# and Ctrl-Super-arrow But those are not sufficent. I do have CompizConfig > Cycle Through Multiple Sizes

But I want to assign a hotkey to make a window stick to the left, full height, 1/3rd width. The same for the right. and one for the middle. I'm used to using Windowpad (on windows) which allows me to define pretty much anything. And I'm so used to it.

Any way to tweak this?

Clarify Edit. This is not about opening windows but about the current active windows.

janw
  • 556

1 Answers1

2

Sounds like you're looking for xdotool or wmctrl. These are tools that let you script various interactions with the GUI. Both can be installed from the repositories, you can use whichever one you prefer:

sudo apt-get install wmctrl xdotool

My display is 1920 x 1080, so 1/3rd width would be 640. To place the active window at the left side of the screen, full height and 1/3rd width, I would run:

wmctrl -r :ACTIVE: -e 0,0,0,640,1080

The format is explained in man wmctrl:

-r <WIN>
     Specify a target window for an action.
-e <MVARG>
     Resize and move a window that has been specified with a -r action 
     according to the  <MVARG> argument.

 [...]

<MVARG>
     A move and resize argument has the format 'g,x,y,w,h'.  All five components  are  integers.
     The  first  value, g, is the gravity of the window, with 0 being the
     most common value (the default value for the window). [...]
     The four remaining values are a standard geometry specification: x,y 
     is the position of the top  left  corner  of  the  window, and w,h
     is the width and height of the window [...].

<WIN>
     This  argument  specifies a window that is the target of an action. [...]
     The  window name string :ACTIVE: may be used to instruct wmctrl to 
     use the currently active window for the action.

You could also make it more dynamic by detecting the width automatically. This command prints the width of your display:

$ xrandr | grep -Po 'current\s*\K\d+'
1920

You could, therefore, integrate it into wmctrl like this:

wmctrl -r :ACTIVE: -e 0,0,0,$(($(xrandr | grep -Po 'current\s*\K\d+')/3)),1080

Now, all you have to do is assign that command to a keyboard shortcut from the Unity Settings and you're all set.

terdon
  • 104,119