Skip to content

Commit

Permalink
Add Discord RPC support
Browse files Browse the repository at this point in the history
If someone has Discord and Keypunch open at the same time, their
Keypunch activity will now show up in Discord using its rich presence
API. For some reason, Builder doesn't like the new folder access
requirements, so I've added a new one that grants access to the specific
folders needed to do this.
  • Loading branch information
bragefuglseth authored Dec 23, 2024
1 parent a02b48b commit a6f9f83
Show file tree
Hide file tree
Showing 12 changed files with 3,236 additions and 178 deletions.
575 changes: 447 additions & 128 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
discord-presence = "1.4.1"
gettext-rs = { version = "0.6", features = ["gettext-system"] }
gvdb-macros = "0.1.12"
i18n-format = "0.2.0"
Expand Down
86 changes: 86 additions & 0 deletions build-aux/dev.bragefuglseth.Keypunch.DiscordAccess.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"id" : "dev.bragefuglseth.Keypunch.Devel",
"runtime" : "org.gnome.Platform",
"runtime-version" : "master",
"sdk" : "org.gnome.Sdk",
"sdk-extensions" : [
{
"id" : "org.freedesktop.Sdk.Extension.rust-stable",
"version" : "24.08"
}
],
"command" : "keypunch-wrapper.sh",
"finish-args" : [
"--share=network",
"--share=ipc",
"--socket=fallback-x11",
"--device=dri",
"--socket=wayland",
"--filesystem=xdg-run/app/com.discordapp.Discord:create",
"--env=RUST_BACKTRACE=1"
],
"build-options" : {
"append-path" : "/usr/lib/sdk/rust-stable/bin",
"build-args" : [
"--share=network"
],
"env" : {
"RUST_BACKTRACE" : "1",
"RUST_LOG" : "keypunch=debug"
}
},
"cleanup" : [
"/include",
"/lib/pkgconfig",
"/man",
"/share/doc",
"/share/gtk-doc",
"/share/man",
"/share/pkgconfig",
"*.la",
"*.a"
],
"modules" : [
{
"name": "blueprint-compiler",
"buildsystem": "meson",
"cleanup": ["*"],
"sources": [
{
"type": "git",
"url": "https://gitlab.gnome.org/jwestman/blueprint-compiler",
"tag": "v0.14.0"
}
]
},
{
"name" : "keypunch-wrapper",
"buildsystem" : "simple",
"build-commands" : [
"install -Dm755 keypunch-wrapper.sh /app/bin/keypunch-wrapper.sh"
],
"sources" : [
{
"type" : "script",
"dest-filename" : "keypunch-wrapper.sh",
"commands" : [
"for i in {0..9}; do\ntest -S $XDG_RUNTIME_DIR/discord-ipc-$i || ln -sf {app/com.discordapp.Discord,$XDG_RUNTIME_DIR}/discord-ipc-$i;\ndone",
"keypunch"
]
}
]
},
{
"name" : "keypunch",
"builddir" : true,
"buildsystem" : "meson",
"run-tests" : true,
"sources" : [
{
"type" : "dir",
"path" : ".."
}
]
}
]
}
Loading

0 comments on commit a6f9f83

Please sign in to comment.