initial commit
This commit is contained in:
commit
41fab4b892
40
startsway
Executable file
40
startsway
Executable 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 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
|
Loading…
Reference in New Issue
Block a user