Here's an idea for a startup script or at least a script that can be bound to a shortcut to launch windows for the first time:
Step 1
Find out your root window width and height. This can be done with
xwininfo -root | awk '/Width/,/Height/ {print}'
or
xprop -root | awk '$1~/NET_DESKTOP_GEOMETRY/ {print }
Sample outputs are bellow
$ xwininfo -root | awk '/Width/,/Height/ {print}'
Width: 1366
Height: 768
$ xprop -root | awk '$1~/NET_DESKTOP_GEOMETRY/ {print}'
_NET_DESKTOP_GEOMETRY(CARDINAL) = 1366, 768
Step 2
Install wmctrl
with sudo apt-get install wmctrl
This tool allows for altering some of the windows properties by referring to their hex id or the window title. I've explained how it works on another question which i will link later here
Step 3
Create this script in your ~/bin
folder or somewhere that is part of your path. You can also bind the full path to this script to shortcut or create a .desktop
shortcut. Notice that since my screen is 1366 x 768, I use 1300 as my max right side x-offset. Adapt the script according to your specs in step 1. Notice that if you have duplicate windows, this might break, so this is good mostly for launching two program windows for the first time
#!/bin/sh
# Author: Serg Kolo
# Description: Send two different applications to different windows
set -x
LEFT=$(zenity --entry --text="What to put on the left?")
RIGHT=$(zenity --entry --text="What to put on the right?")
$LEFT &
$RIGHT &
sleep 1
if [ $? -eq 0 ]; then
# Get title of the left window
LEFT_TITLE="$(wmctrl -l | grep -i $LEFT | awk '{$1=$2=$3="";print}')"
# Get title of the right window
RIGHT_TITLE="$(wmctrl -l | grep -i $RIGHT | awk '{$1=$2=$3="";print }')"
printf "THIS IS A TEST %s",$LEFT_TITLE
printf "THIS IS A TEST 2 %s",$RIGHT_TITLE
wmctrl -r $LEFT_TITLE -e 0,0,0,600,600
sleep 0.5
wmctrl -r $RIGHT_TITLE -e 0,1300,0,600,600
fi
Now, you could adapt this script to behave as a launcher for just one window and specify if you want that to be on right side or left. I will work on this idea a little bit later in the day, but basic idea is to again, use two popups and if statement. Another idea that I have is to use awk to extract relevant info from single popup. I'll edit my answer once I complete the scripts
Edit
And here is the launcher for single window; type in programname,L
for left placement, and programname,R
for right placement
#!/bin/sh
# set -x
PROG=$(zenity --entry --text="Program,L or R ?")
NAME=$(echo $PROG | cut -d ',' -f1)
SIDE=$(echo $PROG | cut -d ',' -f2)
$NAME &
sleep 1
if [ $? -eq 0 ]
then
TITLE=$( wmctrl -l | grep -i $NAME| awk '{$1=$2=$3=""; print}' )
sleep 0.5
if [ $SIDE = "L" ];then
wmctrl -r $TITLE -e 0,0,0,600,600
else
wmctrl -r $TITLE -e 0,1300,0,600,600
fi
fi