Skip to content

Commit b28e6d3

Browse files
committed
Add app data and xdg autostart support
1 parent a5a0551 commit b28e6d3

6 files changed

+51
-35
lines changed

CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ option(ENABLE_PRESAGE "Enable presage for word predication" Off)
2727
option(ENABLE_WAYLAND "Enable wayland support" On)
2828
option(ENABLE_DOC "Build doxygen" Off)
2929
option(USE_SYSTEMD "Use systemd for event loop and dbus, will fallback to libevent/libdbus if not found." On)
30+
option(ENABLE_XDGAUTOSTART "Enable xdg autostart desktop file installation" On)
3031

3132
#######################################################################
3233
# Find packages

Messages.sh

+1-29
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,3 @@
11
#!/bin/bash
2-
DOMAIN=$(basename $PWD)
3-
POT_FILE=po/$DOMAIN.pot
4-
set -x
5-
XGETTEXT="xgettext --package-name=$DOMAIN --add-comments --sort-output [email protected]"
6-
source_files=$(find . -name \*.cpp -o -name \*.h)
7-
$XGETTEXT --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 --language=C++ -o ${POT_FILE} $source_files
8-
sh_files=$(find . -name \*.sh)
9-
$XGETTEXT --keyword=_ --keyword=N_ --language=Shell -j -o ${POT_FILE} $sh_files
10-
desktop_files=$(find . -name \*.conf.in -o -name \*.conf.in.in -o -name \*.desktop.in -o -name \*.desktop.in.in)
11-
$XGETTEXT --language=Desktop -k --keyword=Name --keyword=GenericName --keyword=Comment --keyword=Keywords $desktop_files -j -o ${POT_FILE}
122

13-
sed -i 's|^"Content-Type: text/plain; charset=CHARSET\\n"|"Content-Type: text/plain; charset=utf-8\\n"|g' ${POT_FILE}
14-
15-
# Due to transifex problem, delete the date.
16-
#sed -i '/^"PO-Revision-Date/d' ${POT_FILE}
17-
#sed -i '/^"PO-Revision-Date/d' ${POT_FILE}
18-
sed -i '/^# FIRST AUTHOR/d' ${POT_FILE}
19-
sed -i '/^#, fuzzy/d' ${POT_FILE}
20-
sed -i 's|^"Language: \\n"|"Language: LANG\\n"|g' ${POT_FILE}
21-
22-
echo > po/LINGUAS
23-
24-
for pofile in $(ls po/*.po | sort); do
25-
pofilebase=$(basename $pofile)
26-
pofilebase=${pofilebase/.po/}
27-
msgmerge -U --backup=none $pofile ${POT_FILE}
28-
project_line=$(grep "Project-Id-Version" ${POT_FILE} | head -n 1 | tr --delete '\n' | sed -e 's/[\/&]/\\&/g')
29-
sed -i "s|.*Project-Id-Version.*|$project_line|g" $pofile
30-
echo $pofilebase >> po/LINGUAS
31-
done
3+
gen_pot cxx:desktop:appdata:sh fcitx5 po .

data/CMakeLists.txt

+12-4
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,26 @@ add_subdirectory(icon)
22

33
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fcitx5-configtool.desktop.in.in
44
${CMAKE_CURRENT_BINARY_DIR}/fcitx5-configtool.desktop.in @ONLY)
5-
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fcitx5.desktop.in.in
6-
${CMAKE_CURRENT_BINARY_DIR}/fcitx5.desktop.in @ONLY)
5+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/org.fcitx.Fcitx5.desktop.in.in
6+
${CMAKE_CURRENT_BINARY_DIR}/org.fcitx.Fcitx5.desktop.in @ONLY)
77

88
fcitx5_translate_desktop_file(${CMAKE_CURRENT_BINARY_DIR}/fcitx5-configtool.desktop.in
99
fcitx5-configtool.desktop)
1010
fcitx5_translate_desktop_file(${CMAKE_CURRENT_BINARY_DIR}/fcitx5.desktop.in
11-
fcitx5.desktop)
11+
org.fcitx.Fcitx5.desktop)
12+
fcitx5_translate_desktop_file(org.fcitx.Fcitx5.metainfo.xml.in
13+
org.fcitx.Fcitx5.metainfo.xml XML)
1214

13-
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/fcitx5.desktop"
15+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/org.fcitx.Fcitx5.desktop"
1416
"${CMAKE_CURRENT_BINARY_DIR}/fcitx5-configtool.desktop"
1517
DESTINATION "${FCITX_INSTALL_DATADIR}/applications")
1618

19+
if (ENABLE_XDGAUTOSTART)
20+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/org.fcitx.Fcitx5.desktop" DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/xdg)
21+
endif()
22+
23+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/org.fcitx.Fcitx5.metainfo.xml" DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo)
24+
1725
install(FILES fcitx5-configtool.sh RENAME fcitx5-configtool DESTINATION "${FCITX_INSTALL_BINDIR}" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
1826
GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
1927
install(FILES fcitx5-diagnose.sh RENAME fcitx5-diagnose DESTINATION "${FCITX_INSTALL_BINDIR}" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
File renamed without changes.

data/org.fcitx.Fcitx5.metainfo.xml.in

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<component type="desktop">
3+
<id>org.fcitx.Fcitx5.desktop</id>
4+
<metadata_license>CC0-1.0</metadata_license>
5+
<project_license>LGPL-2.0+</project_license>
6+
<name>Fcitx 5</name>
7+
<summary>Input Method</summary>
8+
<description>
9+
<p>
10+
Fcitx is an input method framework.
11+
It can help you to type your own language. It also features variant choice of addons that improve your typing experience.
12+
</p>
13+
</description>
14+
<url type="homepage">https://fcitx-im.org/</url>
15+
<url type="bugtracker">https://github.com/fcitx/fcitx5</url>
16+
<url type="help">https://fcitx-im.org/wiki/Fcitx</url>
17+
<screenshots>
18+
<screenshot type="default">
19+
<caption>Typing with Fcitx and Kimpanel</caption>
20+
<image>https://fcitx-im.org/images/8/80/Fcitx-Keyboard.png</image>
21+
</screenshot>
22+
</screenshots>
23+
<provides>
24+
<binary>fcitx5</binary>
25+
</provides>
26+
<releases>
27+
<release version="5.0.0" date="2020-10-30"/>
28+
</releases>
29+
</component>

src/lib/fcitx-utils/Fcitx5Macros.cmake

+8-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function(_fcitx5_get_unique_target_name _name _unique_name)
101101
endfunction()
102102

103103
function(fcitx5_translate_desktop_file SRC DEST)
104-
set(options)
104+
set(options XML)
105105
set(one_value_args PO_DIRECTORY)
106106
set(multi_value_args KEYWORDS)
107107
cmake_parse_arguments(FCITX5_TRANSLATE
@@ -128,8 +128,14 @@ function(fcitx5_translate_desktop_file SRC DEST)
128128
endforeach()
129129
endif()
130130

131+
if (FCITX5_TRANSLATE_XML)
132+
set(TYPE_ARG "--xml")
133+
else()
134+
set(TYPE_ARG "--desktop")
135+
endif()
136+
131137
add_custom_command(OUTPUT "${DEST}"
132-
COMMAND "${GETTEXT_MSGFMT_EXECUTABLE}" --desktop -d ${FCITX5_TRANSLATE_PO_DIRECTORY}
138+
COMMAND "${GETTEXT_MSGFMT_EXECUTABLE}" "${TYPE_ARG}" -d ${FCITX5_TRANSLATE_PO_DIRECTORY}
133139
${KEYWORD_ARGS} --template "${SRC}" -o "${DEST}"
134140
DEPENDS "${SRC}" ${PO_FILES})
135141
_fcitx5_get_unique_target_name("${SRC_BASE}-fmt" uniqueTargetName)

0 commit comments

Comments
 (0)