STARTWayland, basically all my dotfiles + wayland equivalent to xinit
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
startw/startw

136 lines
3.7 KiB

#!/bin/sh
# This script, much like startx, starts a wayland session.
# Startup programs, configuration and environment variables all
# reside in $HOME/.local/share/startw
#
# PRELIMINARY CONFIGURATION
#
# Variable definitions
STARTW_ROOT=$HOME/.local/share/startw
DOTS_ROOT=$STARTW_ROOT/conf
STARTW_LOG_FILE=$STARTW_ROOT/"err-$(date +%F).log"
# Padding for systemd-less systems
if test -z "${XDG_RUNTIME_DIR}"; then
XDG_RUNTIME_DIR=/tmp/$(id -u)-runtime-dir
export XDG_RUNTIME_DIR
if ! test -d "${XDG_RUNTIME_DIR}"; then
mkdir "${XDG_RUNTIME_DIR}"
chmod 0700 "${XDG_RUNTIME_DIR}"
fi
fi
# Start a local dbus daemon (required for mako)
if ! pgrep -f "dbus-daemon --session --address=unix:path=$XDG_RUNTIME_DIR/bus"
then
dbus-daemon --session --address=unix:path="$XDG_RUNTIME_DIR"/bus 2>&1 |
"$STARTW_ROOT"/addts >> "$STARTW_LOG_FILE" &
fi
#
# APPLY USER CONFIG
#
# The conf folder contains two subfolders home
# and config, everything in the home folder will
# be symlinked to $HOME as a hidden file/folder,
# whereas everything in the config folder will be
# symlinked to $HOME/.config as-is
# Dotfiles in these folder will be ignored
for f in "$DOTS_ROOT"/home/* ; do
# If the filename already exists and it is not a link override it
if [ -e "$HOME/.$(basename "$f")" ]; then
if [ ! -L "$HOME/.$(basename "$f")" ]; then
rm -rf "$HOME/.$(basename "$f")"
fi
fi
ln -sf "$f" "$HOME/.$(basename "$f")"
done
for f in "$DOTS_ROOT"/config/* ; do
# If the filename already exists and it is not a link override it
if [ -e "$HOME/.config/$(basename "$f")" ]; then
if [ ! -L "$HOME/.config/$(basename "$f")" ]; then
rm -rf "$HOME/.config/$(basename "$f")"
fi
fi
ln -sf "$f" "$HOME/.config/"
done
#
# SET ENVIRONMENT VARIABLES
#
# Enable wayland native support
export _JAVA_AWT_WM_NONREPARENTING=1
# Breaks gtk dialog box as of 10-04-2020
# export MOZ_ENABLE_WAYLAND=1
export MOZ_WEBRENDER=1
export SDL_VIDEODRIVER=wayland
export QT_QPA_PLATFORM=wayland-egl
export QT_WAYLAND_FORCE_DPI=physical
export BEMENU_BACKEND=wayland
# Set the hardware acceleration driver
export LIBVA_DRIVER_NAME=radeonsi
export VDPAU_DRIVER=radeonsi
# Set the default interface used by wpa_cli
export WPA_CLI_INTERFACE=wlp2s0
# Set the editor
export EDITOR=vim
export VISUAL=vim
# Application compatibility
export GIO_USE_VFS="local"
export GIO_USE_VOLUME_MONITOR="unix"
# XDG specification variables
export XDG_CURRENT_DESKTOP=Unity
export XDG_DATA_HOME=$HOME/.local/share
export XDG_CACHE_HOME=$HOME/.cache
export XDG_CONFIG_HOME=$HOME/.config
xdg-user-dirs-update &
# Clean home directory
export GTK2_RC_FILES="$XDG_CONFIG_HOME"/gtk-2.0/gtkrc
export ATOM_HOME="$XDG_DATA_HOME"/atom
export BASH_COMPLETION_USER_FILE="$XDG_CONFIG_HOME"/bash-completion/bash_completion
export CARGO_HOME="$XDG_DATA_HOME"/cargo
# Set user script dir
export SCRIPT_DIR="$XDG_CONFIG_HOME"/scripts
# Ignore same input in histroy
export HISTCONTROL=ignoreboth
# Set WM variable for ufetch
export WM=sway
# Do NOT uncomment this, breaks stuff
# export GDK_BACKEND=wayland
# export XDG_DESKTOP_DIR="$HOME/Desktop"
# export XDG_DOCUMENTS_DIR="$HOME/Documents"
# export XDG_DOWNLOAD_DIR="$HOME/Downloads"
# export XDG_MUSIC_DIR="$HOME/Music"
# export XDG_PICTURES_DIR="$HOME/Pictures"
# export XDG_PUBLICSHARE_DIR="$HOME/Public"
# export XDG_TEMPLATES_DIR="$HOME/Templates"
# export XDG_VIDEOS_DIR="$HOME/Videos"
#
# LAUNCH APPLICATIONS
#
if ! pgrep -x "devmon" > /dev/null
then
devmon 2>&1 | "$STARTW_ROOT"/addts >> "$STARTW_LOG_FILE" &
fi
# Swaybg needs to run after sway is launched
# killall swaybg
# swaybg -o "*" -i "$HOME"/Images/walls/roses.jpg -m tile
#
# START COMPOSITOR
#
# create a log file
touch "$STARTW_LOG_FILE"
exec sway 2>&1 | "$STARTW_ROOT"/addts >> "$STARTW_LOG_FILE"
# exec wayfire