From ac10b9578907bcf2ef17dd26417986c443e1345e Mon Sep 17 00:00:00 2001 From: Fierelier Date: Tue, 12 Dec 2023 07:08:51 +0100 Subject: [PATCH] Initial commit --- LICENSE | 9 +++++++ eldont-pipewire | 8 ++++++ eldont-pipewire-pulse | 8 ++++++ eldont-wireplumber | 8 ++++++ eldont-xorg | 27 +++++++++++++++++++ readme.txt | 13 +++++++++ skel/.eldont-xorg | 25 +++++++++++++++++ .../bluetooth.lua.d/80-disable-logind.lua | 2 ++ .../main.lua.d/80-disable-dbus.lua | 4 +++ 9 files changed, 104 insertions(+) create mode 100644 LICENSE create mode 100755 eldont-pipewire create mode 100755 eldont-pipewire-pulse create mode 100755 eldont-wireplumber create mode 100755 eldont-xorg create mode 100644 readme.txt create mode 100755 skel/.eldont-xorg create mode 100644 skelroot/.config/wireplumber/bluetooth.lua.d/80-disable-logind.lua create mode 100644 skelroot/.config/wireplumber/main.lua.d/80-disable-dbus.lua diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..67fe97b --- /dev/null +++ b/LICENSE @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2023 + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/eldont-pipewire b/eldont-pipewire new file mode 100755 index 0000000..c82b96d --- /dev/null +++ b/eldont-pipewire @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +if [ "$SUDO_UID" = "" ]; then + echo "SUDO_UID is not set." + exit 1 +fi + +export XDG_RUNTIME_DIR="/tmp/$SUDO_UID-runtime-dir" +exec pipewire diff --git a/eldont-pipewire-pulse b/eldont-pipewire-pulse new file mode 100755 index 0000000..fcaa8bf --- /dev/null +++ b/eldont-pipewire-pulse @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +if [ "$SUDO_UID" = "" ]; then + echo "SUDO_UID is not set." + exit 1 +fi + +export XDG_RUNTIME_DIR="/tmp/$SUDO_UID-runtime-dir" +exec pipewire-pulse diff --git a/eldont-wireplumber b/eldont-wireplumber new file mode 100755 index 0000000..e354349 --- /dev/null +++ b/eldont-wireplumber @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +if [ "$SUDO_UID" = "" ]; then + echo "SUDO_UID is not set." + exit 1 +fi + +export XDG_RUNTIME_DIR="/tmp/$SUDO_UID-runtime-dir" +exec wireplumber diff --git a/eldont-xorg b/eldont-xorg new file mode 100755 index 0000000..bfca405 --- /dev/null +++ b/eldont-xorg @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +set -e +VT="$(basename "$(ps hotty $$)")" +VT="${VT//tty/}" +#DISPLAY_RAW="$(($VT - 1))" +DISPLAY_RAW="$VT" +VT="$(($VT + 6))" +DISPLAY=":$DISPLAY_RAW" +CMD=(X "$DISPLAY") +if ! [ "$1" = "" ]; then + CMD+=("-config") + CMD+=("$1") +fi +CMD+=("vt$VT") + +LOGFILE="$SUDO_HOME/.local/share/eldont-xorg/${DISPLAY_RAW}.txt" +unprivlx mkdir -p "$(dirname "$LOGFILE")" +if [ -f "$LOGFILE" ]; then + rm -f "$LOGFILE" +fi +unprivlx touch "$LOGFILE" + +echo "* Starting: ${CMD[@]}" +"${CMD[@]}" & +PID=$! +unprivlx "$SUDO_HOME/.eldont-xorg" "$DISPLAY" +kill -n 15 "$PID" &>/dev/null diff --git a/readme.txt b/readme.txt new file mode 100644 index 0000000..c9095ac --- /dev/null +++ b/readme.txt @@ -0,0 +1,13 @@ +Some scripts for elogind-less systems. Made to be used in conjunction with privlx: https://git.lumen.sh/Fierelier/privlx + +* skel/: +Stuff that goes into the user directory + +* skelroot/ +Stuff that goes into the root user's directory + +* eldont-pipewire-pulse, eldont-wireplumber, eldont-pipewire: +Scripts enabling the use of pipewire (need to be launched with privlx) + +* eldont-xorg: +Script enabling the use of X, launches X server with a user's ~/.eldont-xorg (needs to be launched with privlx) diff --git a/skel/.eldont-xorg b/skel/.eldont-xorg new file mode 100755 index 0000000..bf48741 --- /dev/null +++ b/skel/.eldont-xorg @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +export DISPLAY="$1" +DISPLAY_RAW="${DISPLAY:1}" + +set +e +while true; do + echo "* Waiting for Xorg server ..." + if [ -S "/tmp/.X11-unix/X$DISPLAY_RAW" ]; then + break + fi + sleep 1 +done + +# Dirty, not needed if you use a "proper" DE +xterm & disown +sleep 3 + +# Here you can do some more stuff if you need it +glxinfo -B | grep "Vendor: AMD" +if [ "$?" = "0" ]; then + xrandr --output "VGA-1" --mode "1680x1050" +fi + +# Your DE +exec me.fier.de start diff --git a/skelroot/.config/wireplumber/bluetooth.lua.d/80-disable-logind.lua b/skelroot/.config/wireplumber/bluetooth.lua.d/80-disable-logind.lua new file mode 100644 index 0000000..6e32b6e --- /dev/null +++ b/skelroot/.config/wireplumber/bluetooth.lua.d/80-disable-logind.lua @@ -0,0 +1,2 @@ +-- Disable arbitration of user allowance of bluetooth via D-Bus user session +bluez_monitor.properties["with-logind"] = false diff --git a/skelroot/.config/wireplumber/main.lua.d/80-disable-dbus.lua b/skelroot/.config/wireplumber/main.lua.d/80-disable-dbus.lua new file mode 100644 index 0000000..7e2b703 --- /dev/null +++ b/skelroot/.config/wireplumber/main.lua.d/80-disable-dbus.lua @@ -0,0 +1,4 @@ +-- Disable reserving devices via D-Bus user session +alsa_monitor.properties["alsa.reserve"] = false +-- Disable use of flatpak portal integration +default_access.properties["enable-flatpak-portal"] = false