Skip to content

Instantly share code, notes, and snippets.

@nununoisy
Created November 24, 2019 01:25
Show Gist options
  • Save nununoisy/1f19f9d5b7d78fb7cc837e7fd8290aa9 to your computer and use it in GitHub Desktop.
Save nununoisy/1f19f9d5b7d78fb7cc837e7fd8290aa9 to your computer and use it in GitHub Desktop.
Sway Start Script

Quick and dirty script to start Sway from TTY and a .desktop file for use in LightDM/GDM.

sudo install -vm755 start-sway /usr/bin/
sudo install -vm644 sway.desktop /usr/share/wayland-sessions/
#!/bin/bash
# ---------- Xwayland ------------
# ensure xdg run dir exists and is clean
[[ -d "/tmp/run/$USER" ]] && rm -rf "/tmp/run/$USER"
mkdir -p "/tmp/run/$USER"
chmod 0700 "/tmp/run/$USER"
XDG_RUNTIME_DIR="/tmp/run/$USER"
#setup other variables
mkdir -p "$HOME"/.{config,cache,local/share}
XDG_DATA_HOME="$HOME/.local/share"
XDG_DATA_DIRS="/usr/local/share:/usr/share"
XDG_CONFIG_HOME="$HOME/.config"
XDG_CACHE_HOME="$HOME/.cache"
export XDG_RUNTIME_DIR XDG_DATA_{HOME,DIRS} XDG_{CONFIG,CACHE}_HOME
# ---------- Wayland -------------
#setup variables
QT_WAYLAND_FORCE_DPI=physical
GDK_BACKEND=wayland
QT_QPA_PLATFORM=wayland-egl
CLUTTER_BACKEND=wayland
SDL_VIDEODRIVER=wayland
BEMENU_BACKEND=wayland
export QT_WAYLAND_FORCE_DPI GDK_BACKEND QT_QPA_PLATFORM CLUTTER_BACKEND SDL_VIDEODRIVER BEMENU_BACKEND
dbus-run-session -- sway
[Desktop Entry]
Name=Sway
Comment=An i3-compatible Wayland compositor
Exec=/usr/bin/start-sway
Type=Application
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment