Skip to content

Commit 24ee97c

Browse files
Merge pull request #5 from EmbeddedAndroid/weston-launcher
vscode-weston-launcher: appends a Weston panel entry for VSCode
2 parents c6bb398 + 7518271 commit 24ee97c

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
SUMMARY = "Weston panel launcher entry for Visual Studio Code"
2+
DESCRIPTION = "Optional companion package for meta-vscode: appends a [launcher] \
3+
section to /etc/xdg/weston/weston.ini at install time so the VSCode icon \
4+
appears on the Weston panel. Pull in via IMAGE_INSTALL when the target image \
5+
ships a Weston desktop and should expose VSCode as a one-click launch."
6+
LICENSE = "MIT"
7+
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
8+
9+
# Pure config; no compile + no arch-specific content.
10+
inherit allarch
11+
12+
# We don't build-depend on either package, only need them on the
13+
# target at install time.
14+
RDEPENDS:${PN} = "vscode weston-init"
15+
16+
do_install() {
17+
install -d ${D}${datadir}/vscode-weston-launcher
18+
# The launcher fragment is appended verbatim to weston.ini at
19+
# postinst. Sentinel comments delimit the block so prerm can
20+
# cleanly strip it back out on package removal.
21+
cat > ${D}${datadir}/vscode-weston-launcher/launcher.ini <<'EOF'
22+
23+
# meta-vscode-launcher-begin
24+
[launcher]
25+
icon=${datadir}/vscode/resources/app/resources/linux/code.png
26+
path=${datadir}/vscode/bin/code
27+
displayname=Visual Studio Code
28+
# meta-vscode-launcher-end
29+
EOF
30+
}
31+
32+
FILES:${PN} = "${datadir}/vscode-weston-launcher"
33+
34+
pkg_postinst:${PN} () {
35+
weston_ini="$D${sysconfdir}/xdg/weston/weston.ini"
36+
fragment="$D${datadir}/vscode-weston-launcher/launcher.ini"
37+
if [ -e "$weston_ini" ] && ! grep -q "meta-vscode-launcher-begin" "$weston_ini"; then
38+
cat "$fragment" >> "$weston_ini"
39+
fi
40+
}
41+
42+
pkg_prerm:${PN} () {
43+
weston_ini="$D${sysconfdir}/xdg/weston/weston.ini"
44+
if [ -e "$weston_ini" ] && grep -q "meta-vscode-launcher-begin" "$weston_ini"; then
45+
sed -i '/# meta-vscode-launcher-begin/,/# meta-vscode-launcher-end/d' "$weston_ini"
46+
fi
47+
}

0 commit comments

Comments
 (0)