It sounds simple; xdotool
selects desktop, simulates F5 key press and returns focus to calling window / program.
After googling though it doesn't sound simple anymore.
I need to do this from bash / gnome-shell.
Any ideas?
This project is related to this Q&A where the icons drop off the left screen into a black whole because of different sized monitors:
Thanks to Podesta's help I created this code:
TestIcons () {
[[ $TestSeconds == "" ]] || [[ $TestSeconds == 0 ]] && TestSeconds=5
local i Position File
for (( i=0; i<${#IconsArr[@]}; i=i+ICON_FLD_CNT )) ; do
File="$ICONS_DIR"/"${IconsArr[((i+ICON_NAME_NDX))]}"
Position="${IconsArr[((i+ICON_COL_NDX))]},${IconsArr[((i+ICON_ROW_NDX))]}"
gvfs-set-attribute -t string "$File" \
'metadata::nautilus-icon-position' "$Position"
done
wmctrl -k on # Show desktop
xdotool key F5 # Refresh desktop (show icon new positions)
sleep $TestSeconds # Pause for view
wmctrl -k off # Restore windows
for (( i=0; i<${#OldIconsArr[@]}; i=i+ICON_FLD_CNT )) ; do
File="$ICONS_DIR"/"${OldIconsArr[((i+ICON_NAME_NDX))]}"
Position="${OldIconsArr[((i+ICON_COL_NDX))]},${OldIconsArr[((i+ICON_ROW_NDX))]}"
gvfs-set-attribute -t string "$File" \
'metadata::nautilus-icon-position' "$Position"
done
wmctrl -k on # Show desktop
xdotool key F5 # Refresh desktop (show icon new positions)
wmctrl -k off # Restore windows
} # TestIcons
This is what the screen looks like:
windowminimize
should still do the trick without the show desktop shortcut. Otherwise you could also make it a loop to minimize everything. – Podesta May 30 '19 at 10:48xrandr 1 --pos 0x0
andxrandr 2 --pos 1921x0
the boundaries will be all broken. For the boundries to work they would have to start and end in the same pixel, so likexrandr 2 --pos 1920x0
(The y axis is irrelevant, you can change from 0 to anything). The xrandr obviously just a sketch. – Podesta May 30 '19 at 12:13