logo

dotfiles

My dotfiles, one branch per machine, rebased on base
commit: 4e02b3f7bbdddb5aa5ead2aae161d6165303369b
parent 504ffdedb066573643cceb2b5ed7dae89a0b835b
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sun,  8 Nov 2020 20:19:00 +0100

Exit the login shell right after launching Xorg|Wayland

Diffstat:

M.common.sh26+++++++++++++++++++++++++-
D.local/bin/wl-run17-----------------
2 files changed, 25 insertions(+), 18 deletions(-)

diff --git a/.common.sh b/.common.sh @@ -16,7 +16,7 @@ alias pscpu='ps -eo pid,user,pcpu,pmem,comm --sort -pcpu | head -20' alias psmem='ps -eo pid,user,pcpu,pmem,comm --sort -pmem | head -20' alias rm='rm -ri' alias sleep="/bin/sleep" # avoid sleep as a builtin -alias xstart='startx -- $(tty | sed "s/\/dev\/tty/vt/")' +alias xstart='exec startx -- $(tty | sed "s/\/dev\/tty/vt/")' alias .='cd .' alias ..='cd ..' alias ...='cd ../..' @@ -138,6 +138,30 @@ log_cmd() { echo "$(date -u '+%FT%TZ') EXITED[$?] $@" >> $HOME/.log_cmd_"$1".log } +# Wayland wrapper +wstart() { + [ -z "${XDG_RUNTIME_DIR}" ] && ( echo "$0"': Error: XDG_RUNTIME_DIR undefined, exiting…' 1>&2; false ) + + export GDK_BACKEND=wayland + export QT_QPA_PLATFORM=wayland-egl + export CLUTTER_BACKEND=wayland + export SDL_VIDEODRIVER=wayland + export MY_LOCKER=swaylock + + # Default to sway when unspecified + compositor=${1:-sway} + + name="$(sed 's/[^a-z]//g' <<<$compositor)" + uptime="$(cut -d' ' -f1 /proc/uptime)" + + echo 'wstart_'"$uptime"'_'"$name"'.log' >&2 + + "${@:-sway}" 2>&1 | tee "${XDG_RUNTIME_DIR}"'/wstart_'"$uptime"'_'"$name"'.log' 2>&1 + + # Quit the login shell for security + exit +} + # startup stty sane # I can haz urandom diff --git a/.local/bin/wl-run b/.local/bin/wl-run @@ -1,17 +0,0 @@ -#!/bin/sh -# Wayland wrapper -export GDK_BACKEND=wayland -export QT_QPA_PLATFORM=wayland-egl -export CLUTTER_BACKEND=wayland -export SDL_VIDEODRIVER=wayland -export MY_LOCKER=swaylock - -[ -z "${XDG_RUNTIME_DIR}" ] && ( echo "$0"': Error: XDG_RUNTIME_DIR undefined, exiting…' 1>&2; exit 1 ) -[ -z "$*" ] && ( echo "$0"': Nothing to execute, exiting…' 1>&2; exit 0 ) - -name="$(sed 's/[^a-z]//g' <<<$1)" -uptime="$(cut -d' ' -f1 /proc/uptime)" - -echo 'wl-run_'"$uptime"'_'"$name"'.log' >&2 - -"$@" 2>&1 | tee "${XDG_RUNTIME_DIR}"'/wl-run_'"$uptime"'_'"$name"'.log' 2>&1