diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..50780a4 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,42 @@ +_name="hl-zed-dc-rpc" +pkgname="$_name-git" + +pkgver=r4.30034b9 +pkgrel=1 + +pkgdesc="zed discord rpc for the poor, and only for hyprland (but it like actually works)" +url="https://copeberg.org/virt/$_name" +license=(GPL-3.0) +arch=(x86_64) + +makedepends=('cargo-nightly') +optdepends=('hyprland: this will not do anything without hyprland') + +source=("$_name::git+$url.git") +md5sums=('SKIP') + +pkgver() { + cd $_name + + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" +} + +prepare() { + cd $_name + + export RUSTUP_TOOLCHAIN=nightly + cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')" +} + +build() { + cd $_name + + export RUSTUP_TOOLCHAIN=nightly + cargo build --frozen --release +} + +package() { + cd $_name + + install -Dm0755 -t "$pkgdir/usr/bin/" "target/release/$_name" +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..d3ac08b --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +# hl-zed-dc-rpc +A discord rich presence for the [Zed Editor](https://zed.dev/) using the [Hyprland](https://hypr.land) IPC to detect running zed instances. Why? Because the [existing extension](https://github.com/xhyrom/zed-discord-presence) is extremely broken. Why you need discord rich presence for your stupid editor in the first place is a completely different question. + +> **IMPORTANT:** This uses the Hyprland IPC to get events for your activity, which means this only works on Hyprland. Yes, this is sketchy af but works suprisingly well. + +## Installation +If you are on Arch, you can build a package with the included [PKGBUILD](./PKGBUILD). + +If you are not on Arch, too bad, you'll have to build yourself: +``` +cargo build --release +``` + +## Usage +The produced executable is a deamon that should run in the background when you have zed and discord open. Start it in your hyprland config: +``` +exec-once = hl-zed-dc-rpc +``` + +The daemon supports a couple of commandline arguments to customize the idle time behaviour: +``` +Usage: hl-zed-dc-rpc [OPTIONS] + +Options: + -i, --idle idle timeout in minutes [default: 10] + -r, --reset-idle whether to reset the elapsed time on idle + -h, --help Print help +``` + +## Credits +The assets shown on Discord, including the application id are blatanly stolen from the [existing extension](https://github.com/xhyrom/zed-discord-presence). Thanks! Also tried to steal some more code but that has largely been refactored to non-resemblance.