I am providing you two shell scripts. It will help you to save your arrangement of windows positions and size. If somehow your desired windows arrangements get disturbed, you will be able to restore those arrangements with exact windows size and positions for all windows using these script.
You need to install wmctrl
unless you already have it. Install via terminal,
sudo apt-get install wmctrl
Script to save windows configuration
# Script_Name: save_window_conf.sh
#!/bin/bash
if [ -f $HOME/.my_windows_config.txt ]; then
echo -e "Information: Previous configuration file \"$HOME/.my_windows_config.txt\" already exists.\nTo save a new configuration remove it manually using the following command,\n\n\trm $HOME/.my_windows_config.txt"
exit 1
else
wmctrl -p -G -l | awk '($2 != -1)&&($3 != 0)&&($NF != "Desktop")' | awk '{print $1}' | while read mywinid
do
xwininfo -id "$mywinid" >> $HOME/.my_windows_config.txt
done
fi
At execution the above script will save your windows position and size for all your open windows to a file named .my_windows_config.txt
in your home directory. It is a hidden text file.
Script to reload the windows configuration
# Script_Name: load_window_conf.sh
#!/bin/bash
file=$HOME/.my_windows_config.txt
declare -a mywinid
declare -a x
declare -a y
declare -a width
declare -a height
nl=$(cat "$file" | grep xwininfo |wc -l)
for i in $(seq 1 $nl)
do
mywinid[i]=$(cat "$file" | grep "xwininfo" | awk -v p="$i" '{if(NR==p) print $4}')
x[i]=$(cat "$file" | grep "Absolute upper-left X" | awk -v p="$i" '{if(NR==p) print $NF}')
y[i]=$(cat "$file" | grep "Absolute upper-left Y" | awk -v p="$i" '{if(NR==p) print $NF}')
width[i]=$(cat "$file" | grep "Width" | awk -v p="$i" '{if(NR==p) print $NF}')
height[i]=$(cat "$file" | grep "Height" | awk -v p="$i" '{if(NR==p) print $NF}')
done
for it in $(seq 1 $nl)
do
wmctrl -i -r "${mywinid[$it]}" -e 0,"${x[$it]}","${y[$it]}","${width[it]}","${height[it]}"
done
When you execute the second script it will restore your windows position with exact size for all your windows.
Usage
Save these scripts in your $HOME/bin/
directory. Add $HOME/bin/
in your PATH
. For this add these lines at the end of your $HOME/.bashrc
PATH=$HOME/bin:$PATH
export PATH
It will enable you execute those scripts with their name only. Give the scripts execution permission,
chmod +x $HOME/bin/save_window_conf.sh
chmod +x $HOME/bin/load_window_conf.sh
To save the configuration in your $HOME/.my_windows_config.txt
After you open and adjusted all your windows run in terminal,
save_window_conf.sh
To reload the configuration from your $HOME/.my_windows_config.txt
load_window_conf.sh
Hope it will solve your problem. Here is a screen shot,
![enter image description here](https://i.stack.imgur.com/ib5vx.gif)
Best Answer
Status for Gnome Shell on 18.04
I now migrated to Gnome Shell. Multi Monitors makes it a bit easier giving me a the Ubuntu dock, top bar and and workspace selector on every screen.
What I'm missing at the moment is the possibility to show and run installed apps or commands no matter if I'm on the primary screen or not. Unity's Dash and Windows 10 start menu let me do this. In other words, it feels as limited as Windows 8.
I'm also missing the possibility to pull windows from a different screen and workspace which may not be usable at the moment (KVM switch or switched to a different monitor input).Turns out Gnome has a useful shortcut which Unity had not and which works quite well in conjunction with the preview functionality of the launcher.There is Workspace Grid, but it doesn't (intend to) solve the problem.Many issues seem to be rooted in the a lack of understanding that multi-monitor users may just want to have the same configuration on every screen and access to all windows. Gnome would be my favorite desktop if it hadn't these two issues. I hope developers are open to improvements in this regard. I don't want them copy old patterns that they think would not fit, I just wan't to work with the least friction across multiple monitors.Investigation and alternatives
… or in other words it just handles all but the primary display like the are no workspaces.
Turns out extensions are the wrong place to look for a solution. Gnome's Mutter is capable of doing it out of the box, the problem as I found is a design decision! I did not expect Ubuntu shipping the desktop like this after having used Gnome 2 and Unity before.
This solved my problems:
I also checked other Ubuntu flavors. I heard praise for KDE Neon regarding resource usage, but using it feels no different than 10 years ago, it looks very modern though. Ubuntu Studio is based on XFCE looking very polished. Mate comes also with Mutiny but that doesn't affect multiple monitors and workspaces, it's still like using Gnome 2. Budgie/Solus looks promising, but transition from Budgie 10 to the upcoming 11 is going move from GTK/Gnome to Qt. Not sure how well that will go, how the current status is, how long this will take and what the future brings. Latest (preview) builds of Linux Deepin look very fancy but appear to be for types of users who care more about wallpapers and transparency/blur effects while just using one monitor and workspace.
Edit 2018-09-13: Kwin comes with some desktop effects including Desktop Cube and Desktop Grid. One can create a shortcut to a command and put it in the panel which comes close to Unity, but it doesn't display the grid for both screens on one, which was quite handy in Unity using a KVM switch.
Edit 2020-03-26: Wayfire has a lot of bling that Compiz had. Not that I need all of that, but after working with Gnome in 18.04 and Windows 10 and latest ChromeOS, some parts were ahead of its time. Latest Pop_OS! Shell is probably also worth a second look.