Skip to content

Commit 52fd088

Browse files
committed
feat: Provide .desktop and .appdata.xml in .deb package
1 parent e16a82d commit 52fd088

File tree

6 files changed

+49
-12
lines changed

6 files changed

+49
-12
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "system76-keyboard-configurator"
33
version = "0.1.0"
44
authors = ["Ian Douglas Scott <[email protected]>", "Jeremy Soller <[email protected]>"]
5+
license = "GPL-3.0-only"
56
edition = "2018"
67

78
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Makefile

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ prefix ?= /usr/local
22
bindir = $(prefix)/bin
33
libdir = $(prefix)/lib
44
includedir = $(prefix)/include
5+
datarootdir = $(prefix)/share
6+
datadir = $(datarootdir)
57

68
TARGET = debug
79
DEBUG ?= 0
@@ -16,9 +18,12 @@ ifneq ($(VENDOR),0)
1618
endif
1719

1820
PACKAGE = system76_keyboard_configurator
19-
PKGCONFIG = target/$(PACKAGE).pc
20-
BIN = target/$(TARGET)/system76-keyboard-configurator
21-
FFI = target/$(TARGET)/lib$(PACKAGE).so
21+
APPID = "com.system76.KeyboardConfigurator"
22+
PKGCONFIG = $(PACKAGE).pc
23+
BIN = system76-keyboard-configurator
24+
FFI = lib$(PACKAGE).so
25+
APPDATA = $(APPID).appdata.xml
26+
DESKTOP = $(APPID).desktop
2227

2328
all: $(BIN) $(PKGCONFIG)
2429

@@ -35,10 +40,12 @@ $(FFI): Cargo.toml Cargo.lock ffi/src/lib.rs vendor-check
3540
cargo build $(ARGS) --manifest-path ffi/Cargo.toml
3641

3742
install:
38-
install -Dm0755 $(BIN) $(DESTDIR)$(bindir)/system76-keyboard-configurator
39-
install -Dm0644 $(FFI) "$(DESTDIR)$(libdir)/lib$(PACKAGE).so"
40-
install -Dm0644 $(PKGCONFIG) "$(DESTDIR)$(libdir)/pkgconfig/$(PACKAGE).pc"
43+
install -Dm0755 target/$(TARGET)/$(BIN) $(DESTDIR)$(bindir)/$(BIN)
44+
install -Dm0644 target/$(TARGET)/$(FFI) "$(DESTDIR)$(libdir)/$(FFI)"
45+
install -Dm0644 target/$(PKGCONFIG) "$(DESTDIR)$(libdir)/pkgconfig/$(PKGCONFIG)"
4146
install -Dm0644 ffi/$(PACKAGE).h "$(DESTDIR)$(includedir)/$(PACKAGE).h"
47+
install -Dm0644 "linux/$(DESKTOP)" "$(DESTDIR)$(datadir)/applications/$(DESKTOP)"
48+
install -Dm0644 "linux/$(APPDATA)" "$(DESTDIR)$(datadir)/metainfo/$(APPDATA)"
4249

4350
$(PKGCONFIG): $(FFI) tools/src/pkgconfig.rs
4451
cargo run -p tools --bin pkgconfig $(DESKTOP_ARGS) -- \
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
usr/bin/system76-keyboard-configurator
2+
usr/share/applications/com.system76.KeyboardConfigurator.desktop
3+
usr/share/metainfo/com.system76.KeyboardConfigurator.appdata.xml

linux/build.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
# Appimage packaging
1515
PKG = "keyboard-configurator"
16+
APPID = "com.system76.KeyboardConfigurator"
1617
ARCH = "x86_64"
1718

1819
# Remove previous build
@@ -30,7 +31,7 @@
3031
subprocess.check_call(cmd)
3132

3233
# Copy executable
33-
subprocess.check_call([f"strip", '-o', PKG, f"{TARGET_DIR}/system76-keyboard-configurator"])
34+
subprocess.check_call([f"strip", '-o', "system76-keyboard-configurator", f"{TARGET_DIR}/system76-keyboard-configurator"])
3435

3536
# Download linuxdeploy
3637
LINUXDEPLOY = f"linuxdeploy-{ARCH}.AppImage"
@@ -41,12 +42,17 @@
4142
f.write(u.read())
4243
os.chmod(LINUXDEPLOY, os.stat(LINUXDEPLOY).st_mode | 0o111)
4344

45+
# Copy appdata
46+
# Not working due to https://github.com/pop-os/popsicle/pull/106#issuecomment-694310715
47+
# os.makedirs(f"{PKG}.AppDir/usr/share/metainfo")
48+
# shutil.copy("com.system76.KeyboardConfigurator.appdata.xml", f"{PKG}.AppDir/usr/share/metainfo")
49+
4450
# Build appimage
4551
subprocess.check_call([f"./{LINUXDEPLOY}",
4652
f"--appdir={PKG}.AppDir",
47-
f"--executable={PKG}",
48-
f"--desktop-file={PKG}.desktop",
53+
f"--executable=system76-keyboard-configurator",
54+
f"--desktop-file={APPID}.desktop",
4955
f"--icon-file={PKG}.png",
5056
"--plugin", "gtk",
5157
"--output", "appimage"])
52-
shutil.move(glob.glob(f"{PKG}-*-{ARCH}.AppImage")[0], f"{PKG}-{ARCH}.AppImage")
58+
shutil.move(glob.glob(f"System76_Keyboard_Configurator-*-{ARCH}.AppImage")[0], f"{PKG}-{ARCH}.AppImage")
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<component type="desktop-application">
3+
<id>com.system76.KeyboardConfigurator</id>
4+
<metadata_license>CC0-1.0</metadata_license>
5+
<project_license>GPL-3.0-only</project_license>
6+
<developer_name>System76</developer_name>
7+
<update_contact>[email protected]</update_contact>
8+
<url type="homepage">https://github.com/pop-os/keyboard-configurator</url>
9+
<url type="bugtracker">https://github.com/pop-os/keyboard-configurator</url>
10+
<name>System76 Keyboard Configurator</name>
11+
<summary>Configure System76 keyboards</summary>
12+
<description>
13+
Configures keymap and backlight of System76 keyboards.
14+
</description>
15+
<categories>
16+
<category>Utility</category>
17+
</categories>
18+
<launchable type="desktop-id">keyboard-configurator.desktop</launchable>
19+
<project_group>Pop!_OS</project_group>
20+
<content_rating type="oars-1.0" />
21+
</component>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[Desktop Entry]
2-
Name=keyboard-configurator
3-
Exec=keyboard-configurator
2+
Name=System76 Keyboard Configurator
3+
Exec=system76-keyboard-configurator
44
Icon=keyboard-configurator
55
Type=Application
66
Categories=Utility;

0 commit comments

Comments
 (0)