autostart: preserve last window state

Use the --restore-last-window-state option in the autostart
.desktop file in order to autostart the client in the same
state as when it was quit.

The use case is that if users log-out with their client in
a hidden state, when they log back in, it should still be
hidden.

Issue: #78993
Change-Id: I43e5c27e14749dde9cc851f29560f88263d6c9a8
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fcb12b1..2a4b485 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -337,6 +337,12 @@
    "${PROJECT_BINARY_DIR}/gnome-ring.desktop"
 )
 
+# generate .desktop file for autostart
+CONFIGURE_FILE (
+   "${PROJECT_SOURCE_DIR}/gnome-ring.desktop.autostart.in"
+   "${PROJECT_BINARY_DIR}/gnome-ring.desktop.autostart"
+)
+
 INSTALL(TARGETS gnome-ring
    RUNTIME DESTINATION bin
 )
@@ -348,7 +354,7 @@
 
 # install .desktop in the gnome-ring data dir, so that it can be copied to the
 # autostart dir by the client
-INSTALL(FILES ${PROJECT_BINARY_DIR}/gnome-ring.desktop
+INSTALL(FILES ${PROJECT_BINARY_DIR}/gnome-ring.desktop.autostart
    DESTINATION
       ${CMAKE_INSTALL_PREFIX}/share/gnome-ring/
    PERMISSIONS
@@ -356,6 +362,8 @@
       OWNER_WRITE
       OWNER_READ
       GROUP_READ
+   RENAME
+      gnome-ring.desktop
 )
 
 INSTALL(FILES pixmaps/ring.svg