From 41fab4b89245c7fe73a946c913834f1b55ec6c5e Mon Sep 17 00:00:00 2001 From: emma Date: Wed, 29 Mar 2023 18:28:42 -0400 Subject: [PATCH] initial commit --- startsway | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 startsway diff --git a/startsway b/startsway new file mode 100755 index 0000000..cd63732 --- /dev/null +++ b/startsway @@ -0,0 +1,40 @@ +#!/bin/sh + +# Copyright (c) 2023 Emma Tebibyte +# SPDX-License-Identifier: FSFAP +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice and this +# notice are preserved. This file is offered as-is, without any warranty. + +# check if $LOG_DIR is set, if it isn’t, provide a default +if test -z "$LOG_DIR"; then + LOG_DIR="$HOME/.var/log" +fi + +# create log directory +mkdir -p "$LOG_DIR" 2>&1 + +# move the previous log to “latest” log +mv "$LOG_DIR/sway.log" "$LOG_DIR/sway.log.latest" 2>&1 + +# print date and time information at the top of the log file +date '+%Y-%d-%mT%T %Z' >"$LOG_DIR/sway.log" 2>&1 + +# count the number of previous log files +count=1 +for file in "$LOG_DIR/sway.log.*"; do + count="$(printf "%s+1\n" "$count" | bc)" +done + +# move the previous log to the log count number +mv "$LOG_DIR/sway.log.latest" "$LOG_DIR/sway.log.$count" 2>&1 + +# run the sway desktop with KDE set as the current desktop to allow the Plasma +# xdg_desktop_portal implementation run as the provider of file choosers and the +# like, but set it also to sway to run the xdg_desktop_portal implementation for +# wlroots so streaming is possible +# +# run dbus-run-session-sway so that sway is run with dbus support, and redirect +# all output to the sway log file +XDG_CURRENT_DESKTOP="sway:KDE" dbus-run-session sway >>"$LOG_DIR/sway.log" 2>&1