summaryrefslogtreecommitdiff
path: root/init.d
diff options
context:
space:
mode:
Diffstat (limited to 'init.d')
-rwxr-xr-xinit.d/dbus6
-rwxr-xr-xinit.d/emacs10
-rwxr-xr-xinit.d/mpd32
-rwxr-xr-xinit.d/pipewire5
-rwxr-xr-xinit.d/pipewire-pulse10
-rwxr-xr-xinit.d/tmux18
-rwxr-xr-xinit.d/wireplumber12
7 files changed, 93 insertions, 0 deletions
diff --git a/init.d/dbus b/init.d/dbus
new file mode 100755
index 0000000..055c1ba
--- /dev/null
+++ b/init.d/dbus
@@ -0,0 +1,6 @@
+#!/sbin/openrc-run
+
+pidfile="${XDG_RUNTIME_DIR:-${RC_SVCDIR}}/${RC_SVCNAME#*.}"
+command="/usr/bin/dbus-daemon"
+command_args="--session --syslog --nofork --address unix:path=${XDG_RUNTIME_DIR:-${RC_SVCDIR}}/bus"
+command_background=yes
diff --git a/init.d/emacs b/init.d/emacs
new file mode 100755
index 0000000..f882e86
--- /dev/null
+++ b/init.d/emacs
@@ -0,0 +1,10 @@
+#!/sbin/openrc-run
+
+command="/usr/bin/emacs"
+command_args="--fg-daemon"
+command_background="true"
+pidfile=${XDG_RUNTIME_DIR:-${SVCDIR}}/emacs.pid
+description="Start an Emacs server running in the background"
+depend() {
+ after dbus
+}
diff --git a/init.d/mpd b/init.d/mpd
new file mode 100755
index 0000000..d2a7654
--- /dev/null
+++ b/init.d/mpd
@@ -0,0 +1,32 @@
+#!/sbin/openrc-run
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+: CFGFILE=${CFGFILE:=${XDG_CONFIG_HOME:-${HOME}/.config}/mpd/mpd.conf}
+
+depend() {
+ use pipewire pulseaudio
+ config ${CFGFILE}
+}
+
+get_config() {
+ x=$1
+ test -e ${CFGFILE} || return 1
+ sed -n \
+ -e '/^[ \t]*'${x}'/{s:^[ \t]*'${x}'[ \t]\+"\?\([^#"]\+\)[^"]*"\?$:\1: ; p }' \
+ ${CFGFILE}
+}
+
+extra_started_commands='reload'
+# Required by io_uring
+command=/usr/bin/mpd
+command_args=${CFGFILE}
+required_files=${CFGFILE}
+pidfile=$(get_config pid_file)
+description="Music Player Daemon"
+
+reload() {
+ ebegin "Reloading ${RC_SVCNAME}"
+ start-stop-daemon --pidfile ${pidfile} --signal HUP
+ eend $?
+}
diff --git a/init.d/pipewire b/init.d/pipewire
new file mode 100755
index 0000000..e5c9e89
--- /dev/null
+++ b/init.d/pipewire
@@ -0,0 +1,5 @@
+#!/sbin/openrc-run
+
+command="/usr/bin/pipewire"
+command_background="true"
+pidfile="${XDG_RUNTIME_DIR:-${SVCDIR}}/pipewire.pid"
diff --git a/init.d/pipewire-pulse b/init.d/pipewire-pulse
new file mode 100755
index 0000000..9e029c3
--- /dev/null
+++ b/init.d/pipewire-pulse
@@ -0,0 +1,10 @@
+#!/sbin/openrc-run
+
+depend() {
+ need pipewire
+}
+
+command="/usr/bin/pipewire"
+command_args="-c pipewire-pulse.conf"
+command_background="true"
+pidfile="${XDG_RUNTIME_DIR:-${SVCDIR}}/pipewire-pulse.pid"
diff --git a/init.d/tmux b/init.d/tmux
new file mode 100755
index 0000000..770a996
--- /dev/null
+++ b/init.d/tmux
@@ -0,0 +1,18 @@
+#!/sbin/openrc-run
+
+user=$(whoami)
+command="/usr/bin/tmux"
+command_args="new-session -s ${user} -t ${user} -d"
+pidfile="${XDG_RUNTIME_DIR:-RC_SVCDIR}/tmux.pid"
+description="Start a tmux session"
+
+start_post() {
+ tmux display-message -p '#{pid}' > ${pidfile}
+ for session in ${sessions}; do
+ tmux new-session -s ${session} -d
+ eval local commands="\${commands_${session}}"
+ for command in "${commands}"; do
+ tmux new-window -n "${session}":"${command}" "${command}"
+ done
+ done
+}
diff --git a/init.d/wireplumber b/init.d/wireplumber
new file mode 100755
index 0000000..823ff2d
--- /dev/null
+++ b/init.d/wireplumber
@@ -0,0 +1,12 @@
+#!/sbin/openrc-run
+
+depend() {
+ need pipewire dbus
+}
+
+DBUS_SESSION_BUS_ADDRESS="unix:path=${XDG_RUNTIME_DIR:-${RC_SVCDIR}}/bus"
+export DBUS_SESSION_BUS_ADDRESS
+
+command="/usr/bin/wireplumber"
+command_background=true
+pidfile="${XDG_RUNTIME_DIR-:${SVCDIR}}/wireplumber.pid"