Add swhkd package and use systemd.eclass

- Add swhkd package with support for systemd and openrc
- Use systemd.eclass in greenclip, snapborg, and swhkd packages
- Add swhkd as dwl dependency
This commit is contained in:
Sravan Balaji
2024-09-28 13:09:19 -04:00
parent 666a835901
commit 22aa128454
6 changed files with 97 additions and 10 deletions

View File

@@ -6,7 +6,7 @@ EAPI=8
PYTHON_COMPAT=( python3_{11..13} ) PYTHON_COMPAT=( python3_{11..13} )
DISTUTILS_SINGLE_IMPL=1 DISTUTILS_SINGLE_IMPL=1
DISTUTILS_USE_PEP517=setuptools DISTUTILS_USE_PEP517=setuptools
inherit distutils-r1 git-r3 inherit distutils-r1 git-r3 systemd
DESCRIPTION="Synchronize snapper snapshots to a borg repository" DESCRIPTION="Synchronize snapper snapshots to a borg repository"
HOMEPAGE="https://github.com/enzingerm/snapborg" HOMEPAGE="https://github.com/enzingerm/snapborg"
@@ -34,13 +34,13 @@ python_install() {
distutils-r1_python_install distutils-r1_python_install
if use systemd ; then if use systemd ; then
insinto /usr/lib/systemd/system systemd_dounit "${S}/usr/lib/systemd/system/snapborg-backup-all-daily.timer"
doins "${S}/usr/lib/systemd/system/snapborg-backup-all-daily.timer" systemd_dounit "${S}/usr/lib/systemd/system/snapborg-backup-all-hourly.timer"
doins "${S}/usr/lib/systemd/system/snapborg-backup-all-hourly.timer" systemd_dounit "${S}/usr/lib/systemd/system/snapborg-backup-all.service"
doins "${S}/usr/lib/systemd/system/snapborg-backup-all.service" systemd_dounit "${S}/usr/lib/systemd/system/snapborg-backup-daily@.timer"
doins "${S}/usr/lib/systemd/system/snapborg-backup-daily@.timer" systemd_dounit "${S}/usr/lib/systemd/system/snapborg-backup-hourly@.timer"
doins "${S}/usr/lib/systemd/system/snapborg-backup-hourly@.timer" systemd_dounit "${S}/usr/lib/systemd/system/snapborg-backup@.service"
doins "${S}/usr/lib/systemd/system/snapborg-backup@.service"
elog "Run \`systemctl enable --now snapborg-backup-all-<frequency>.timer\` to enable regular backups (hourly or daily) for all configs." elog "Run \`systemctl enable --now snapborg-backup-all-<frequency>.timer\` to enable regular backups (hourly or daily) for all configs."
elog "Run \`systemctl enable --now snapborg-backup-<frequency>@<config-name>.timer\` enable regular backups (hourly or daily) for a specific config." elog "Run \`systemctl enable --now snapborg-backup-<frequency>@<config-name>.timer\` enable regular backups (hourly or daily) for a specific config."
fi fi

View File

@@ -0,0 +1,5 @@
#!/sbin/openrc-run
command="/usr/bin/swhkd"
command_background=true
pidfile="/run/${RC_SVCNAME}.pid"

View File

@@ -0,0 +1,10 @@
[Unit]
Description=swhkd hotkey daemon
BindsTo=default.target
[Service]
Type=simple
ExecStart=/usr/bin/hotkeys.sh
[Install]
WantedBy=default.target

View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
killall swhks
/usr/bin/swhks & sudo /usr/bin/swhkd

View File

@@ -0,0 +1,65 @@
# Copyright 2022-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit linux-info cargo git-r3 systemd
DESCRIPTION="Simple Wayland HotKey Daemon"
HOMEPAGE="https://github.com/waycrate/swhkd"
EGIT_REPO_URI="${HOMEPAGE}.git"
LICENSE="BSD-2"
SLOT="0"
KEYWORDS="~amd64"
IUSE="man systemd openrc"
S="${WORKDIR}/${P}"
CONFIG_CHECK="
INPUT_EVDEV
INPUT_UINPUT
"
BDEPEND="
man? (
app-text/scdoc
)
virtual/libudev
app-arch/gzip
"
src_unpack(){
git-r3_src_unpack
cargo_live_src_unpack
}
src_compile(){
emake build
}
src_install(){
# Man Files
gzip -d ${S}/docs/*.gz
doman ${S}/docs/*.1
doman ${S}/docs/*.5
# Binaries
dobin ${S}/target/release/swhkd
dobin ${S}/target/release/swhks
if use systemd ; then
dobin ${FILESDIR}/systemd/hotkeys.sh
systemd_douserunit ${FILESDIR}/systemd/hotkeys.service
elog "Add \`%wheel ALL=(ALL:ALL) NOPASSWD: /usr/bin/swhkd\` to \`/etc/sudoers\` to allow \`wheel\` group users to run \`sudo /usr/bin/swhkd\` without asking for a password."
elog "Run \`systemctl --user enable --now hotkeys.service\` to enable swhkd daemon and server."
fi
if use openrc ; then
doinitd ${FILESDIR}/openrc/swhkd
elog "Run \`sudo rc-update add swhkd\` to enable swhkd service."
elog "Add \`swhks\` to startup processes."
fi
}

View File

@@ -3,6 +3,8 @@
EAPI=8 EAPI=8
inherit systemd
DESCRIPTION="Simple clipboard manager to be integrated with rofi - Static binary available" DESCRIPTION="Simple clipboard manager to be integrated with rofi - Static binary available"
HOMEPAGE="https://github.com/erebe/greenclip" HOMEPAGE="https://github.com/erebe/greenclip"
@@ -31,8 +33,8 @@ src_compile() {
src_install() { src_install() {
if use systemd ; then if use systemd ; then
insinto /usr/lib/systemd/user/ systemd_douserunit "${FILESDIR}"/greenclip.service
doins "${FILESDIR}"/greenclip.service
elog "Run \`systemctl --user enable --now greenclip.service\` to enable greenclip systemd user service." elog "Run \`systemctl --user enable --now greenclip.service\` to enable greenclip systemd user service."
fi fi