Skip to content

Commit 204e787

Browse files
ADKasterbugaevcNicolas Ramztarob0baXexxa
committed
CMake: Add service, desktop, and icon files for Linux-like systems
These files are lifted from the ladybird-gtk4 repository and adapted to work with the Qt UI port. They are installed by default on Linux, but can be installed via a CMake option on other platforms. Co-Authored-By: Sergey Bugaev <bugaevc@serenityos.org> Co-Authored-By: Nicolas Ramz <nicolas.ramz@adevinta.com> Co-Authored-By: Beckett Normington <beckett@b0ba.dev> Co-Authored-By: Xexxa <93391300+Xexxa@users.noreply.github.com>
1 parent 69d4811 commit 204e787

File tree

5 files changed

+65
-0
lines changed

5 files changed

+65
-0
lines changed

Meta/CMake/common_options.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,15 @@ ladybird_option(ENABLE_NETWORK_DOWNLOADS ON CACHE BOOL "Allow downloads of requi
3232
ladybird_option(ENABLE_CLANG_PLUGINS OFF CACHE BOOL "Enable building with the Clang plugins")
3333
ladybird_option(ENABLE_CLANG_PLUGINS_INVALID_FUNCTION_MEMBERS OFF CACHE BOOL "Enable detecting invalid function types as members of GC-allocated objects")
3434

35+
if (LINUX AND NOT ANDROID)
36+
set(freedesktop_files_default ON)
37+
else()
38+
set(freedesktop_files_default OFF)
39+
endif()
40+
3541
ladybird_option(ENABLE_GUI_TARGETS ON CACHE BOOL "Enable building GUI targets")
3642
ladybird_option(ENABLE_INSTALL_HEADERS ON CACHE BOOL "Enable installing headers")
43+
ladybird_option(ENABLE_INSTALL_FREEDESKTOP_FILES ${freedesktop_files_default} CACHE BOOL "Enable installing .desktop and .service files")
3744
ladybird_option(ENABLE_SWIFT OFF CACHE BOOL "Enable building Swift files")
3845
ladybird_option(ENABLE_STD_STACKTRACE OFF CACHE BOOL "Force use of std::stacktrace instead of libbacktrace. If it is not supported the build will fail")
3946
ladybird_option(ENABLE_WINDOWS_CI OFF CACHE BOOL "Enable building targets supported on Windows for CI")
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[Desktop Entry]
2+
Name=Ladybird
3+
GenericName=Web Browser
4+
GenericName[eo]=Retumilo
5+
GenericName[fr]=Navigateur Web
6+
GenericName[ru]=Веб-браузер
7+
GenericName[sv]=Webbläsare
8+
Exec=Ladybird --force-new-process %U
9+
Icon=org.ladybird.Ladybird
10+
DBusActivatable=false
11+
Type=Application
12+
Categories=Network;WebBrowser;Qt;KDE;
13+
StartupNotify=false
14+
MimeType=text/html;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;
15+
Actions=new-window;
16+
X-Purism-FormFactor=Workstation;
17+
18+
[Desktop Action new-window]
19+
Name=New Window
20+
Name[eo]=Nova fenestro
21+
Name[fr]=Nouvelle Fenêtre
22+
Name[ru]=Новое окно
23+
Name[sv]=Nytt fönster
24+
Exec=Ladybird --new-window
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[D-BUS Service]
2+
Name=org.ladybird.Ladybird
3+
Exec=Ladybird --force-new-process
Lines changed: 12 additions & 0 deletions
Loading

UI/cmake/InstallRules.cmake

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,22 @@ if (NOT APPLE)
109109
# On macOS the resources are handled via the MACOSX_PACKAGE_LOCATION property on each resource file
110110
install_ladybird_resources("${CMAKE_INSTALL_DATADIR}/Lagom" ladybird_Runtime)
111111
endif()
112+
113+
if (ENABLE_INSTALL_FREEDESKTOP_FILES)
114+
set(FREEDESKTOP_RESOURCE_DIR "${LADYBIRD_SOURCE_DIR}/Meta/CMake/freedesktop")
115+
install(FILES
116+
"${FREEDESKTOP_RESOURCE_DIR}/org.ladybird.Ladybird.svg"
117+
DESTINATION "${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps"
118+
COMPONENT ladybird_Runtime
119+
)
120+
install(FILES
121+
"${FREEDESKTOP_RESOURCE_DIR}/org.ladybird.Ladybird.desktop"
122+
DESTINATION "${CMAKE_INSTALL_DATADIR}/applications"
123+
COMPONENT ladybird_Runtime
124+
)
125+
install(FILES
126+
"${FREEDESKTOP_RESOURCE_DIR}/org.ladybird.Ladybird.service"
127+
DESTINATION "${CMAKE_INSTALL_DATADIR}/dbus-1/services"
128+
COMPONENT ladybird_Runtime
129+
)
130+
endif()

0 commit comments

Comments
 (0)