initial commit

This commit is contained in:
Emma Tebibyte 2023-03-29 18:28:42 -04:00
commit 41fab4b892
Signed by: emma
GPG Key ID: 6D661C738815E7DD

40
startsway Executable file
View File

@ -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 isnt, 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