Skip to content

Commit

Permalink
Merge pull request #548 from jonpetri/jon/add-autostart-desktop-file
Browse files Browse the repository at this point in the history
Enable application autostart across all Linux desktop managers
  • Loading branch information
rcaelers authored Jun 16, 2024
2 parents 86f8dac + 4efb76f commit c407df0
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ if (UNIX AND NOT APPLE)
set (EXERCISESDIR "${PKGDATADIR}/exercises")
set (IMAGESDIR "${PKGDATADIR}/images")
set (LOCALEDIR "${DATADIR}/locale")
set (SYSCONFDIR "${CMAKE_INSTALL_SYSCONFDIR}" CACHE PATH "system conf. dir (etc)")
set (XDGCONFDIR "${SYSCONFDIR}/xdg")
set (XDGAUTOSTARTDIR "${XDGCONFDIR}/autostart")
elseif (APPLE)
set (BUNDLEDIR Workrave.app/Contents/)
set (BINDIR ${BUNDLEDIR}/MacOS/)
Expand Down
14 changes: 14 additions & 0 deletions ui/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ if (PLATFORM_OS_UNIX)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.workrave.Workrave.desktop DESTINATION ${DATADIR}/applications)
target_include_directories(workrave-app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/platforms/unix)

# Desktop Application Autostart
# This enables application autostart and indicates autostart parameters across
# all Linux desktop managers.
# https://specifications.freedesktop.org/autostart-spec/autostart-spec-latest.html
intltool_merge_desktop(
${CMAKE_CURRENT_SOURCE_DIR}/org.workrave.Workrave-autostart.desktop.in
${CMAKE_CURRENT_BINARY_DIR}/org.workrave.Workrave-autostart.desktop)
add_custom_target(generate_desktop_autostart_file ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/org.workrave.Workrave-autostart.desktop)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.workrave.Workrave-autostart.desktop
DESTINATION ${XDGAUTOSTARTDIR}
RENAME org.workrave.Workrave.desktop)
endif()

if (PLATFORM_OS_WINDOWS)
Expand Down
36 changes: 36 additions & 0 deletions ui/app/org.workrave.Workrave-autostart.desktop.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[Desktop Entry]
Type=Application
Name=Workrave
Comment=Assists in the prevention and recovery of Repetitive Strain Injury (RSI)
Categories=Utility;GTK;Accessibility;
Exec=workrave
TryExec=workrave
Icon=workrave
Terminal=false

# Hidden
# ------
# In GNOME environments, indicates to the desktop environment whether the
# application should be displayed in the autostart settings UI. If
# hidden, autostart is also disabled. The user can enable or disable
# autostart only if it is not hidden.
#
# In non-GNOME environments, `Hidden` means "disable". It indicates to the
# desktop environment the default autostart enabling status when the
# application is installed. It doesn't hide the application in the autostart
# settings UI.
# - `Hidden=false` means that the desktop environment will enable autostart as
# soon as the application is installed.
# - `Hidden=true` means that the desktop environment will show the autostart
# feature as available to the user, but not enabled.
# In both cases the user can enable or disable autostart as desired.
Hidden=false

# X-GNOME-Autostart-enabled
# -------------------------
# In GNOME environments, indicates to the desktop environment the default
# autostart status when the application is installed. The user can enable or
# disable autostart as desired.
#
# In non-GNOME environments, this key is ignored.
X-GNOME-Autostart-enabled=true

0 comments on commit c407df0

Please sign in to comment.