mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 13:46:49 +00:00
sway: initial package 1.7
This commit is contained in:
parent
71f8aacd28
commit
26cffee2b4
20
packages/wayland/compositor/sway/config/colorscheme
Normal file
20
packages/wayland/compositor/sway/config/colorscheme
Normal file
@ -0,0 +1,20 @@
|
||||
## Base16 Black Metal (Dark Funeral)
|
||||
# Author: metalelf0 (https://github.com/metalelf0)
|
||||
# Source: base16-sway (https://github.com/rkubosz/base16-sway)
|
||||
|
||||
set $base00 #000000
|
||||
set $base01 #121212
|
||||
set $base02 #222222
|
||||
set $base03 #333333
|
||||
set $base04 #999999
|
||||
set $base05 #c1c1c1
|
||||
set $base06 #999999
|
||||
set $base07 #c1c1c1
|
||||
set $base08 #5f8787
|
||||
set $base09 #aaaaaa
|
||||
set $base0A #5f81a5
|
||||
set $base0B #d0dfee
|
||||
set $base0C #aaaaaa
|
||||
set $base0D #888888
|
||||
set $base0E #999999
|
||||
set $base0F #444444
|
243
packages/wayland/compositor/sway/config/config
Normal file
243
packages/wayland/compositor/sway/config/config
Normal file
@ -0,0 +1,243 @@
|
||||
# Default config for sway
|
||||
#
|
||||
# Copy this to ~/.config/sway/config and edit it to your liking.
|
||||
#
|
||||
# Read `man 5 sway` for a complete reference.
|
||||
# Load prefered color scheme
|
||||
include colorscheme
|
||||
# Logo key. Use Mod1 for Alt.
|
||||
set $mod Mod4
|
||||
# Home row direction keys, like vim
|
||||
set $left h
|
||||
set $down j
|
||||
set $up k
|
||||
set $right l
|
||||
# Your preferred terminal emulator
|
||||
set $term foot.sh
|
||||
# Your preferred application launcher
|
||||
# Note: pass the final command to swaymsg so that the resulting window can be opened
|
||||
# on the original workspace that the command was run on.
|
||||
set $highlight $base0A
|
||||
set $prompt $base0B
|
||||
set $menu bemenu-run -p "#" -l 10 --scrollbar autohide -i -w --tf "$prompt" --hf "$highlight" --sf "$highlight" --scf "$highlight" --no-exec | xargs swaymsg exec --
|
||||
|
||||
### Output configuration
|
||||
#
|
||||
# Default wallpaper (more resolutions are available in /usr/share/sway/)
|
||||
output * bg /usr/share/sway/libreelec-wallpaper-2160.png fill
|
||||
|
||||
# hide_cursor hides the cursor image after the specified timeout (in milliseconds) has elapsed with no activity on that cursor
|
||||
seat * hide_cursor 3000
|
||||
|
||||
#
|
||||
# Example configuration:
|
||||
#
|
||||
# output HDMI-A-1 resolution 1920x1080 position 1920,0
|
||||
#
|
||||
# You can get the names of your outputs by running: swaymsg -t get_outputs
|
||||
|
||||
### Idle configuration
|
||||
#
|
||||
# Example configuration:
|
||||
#
|
||||
# exec swayidle -w \
|
||||
# timeout 300 'swaylock -f -c 000000' \
|
||||
# timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
|
||||
# before-sleep 'swaylock -f -c 000000'
|
||||
#
|
||||
# This will lock your screen after 300 seconds of inactivity, then turn off
|
||||
# your displays after another 300 seconds, and turn your screens back on when
|
||||
# resumed. It will also lock your screen before your computer goes to sleep.
|
||||
|
||||
### Input configuration
|
||||
#
|
||||
# Example configuration:
|
||||
#
|
||||
# input "2:14:SynPS/2_Synaptics_TouchPad" {
|
||||
# dwt enabled
|
||||
# tap enabled
|
||||
# natural_scroll enabled
|
||||
# middle_emulation enabled
|
||||
# }
|
||||
#
|
||||
# You can get the names of your inputs by running: swaymsg -t get_inputs
|
||||
# Read `man 5 sway-input` for more information about this section.
|
||||
|
||||
# Set keyboard layout (default US)
|
||||
input * {
|
||||
xkb_layout "us"
|
||||
}
|
||||
|
||||
### Key bindings
|
||||
#
|
||||
# Basics:
|
||||
#
|
||||
# Start a terminal
|
||||
bindsym $mod+Return exec $term
|
||||
|
||||
# Kill focused window
|
||||
bindsym $mod+Shift+q kill
|
||||
|
||||
# Start your launcher
|
||||
bindsym $mod+d exec $menu
|
||||
|
||||
# Drag floating windows by holding down $mod and left mouse button.
|
||||
# Resize them with right mouse button + $mod.
|
||||
# Despite the name, also works for non-floating windows.
|
||||
# Change normal to inverse to use left mouse button for resizing and right
|
||||
# mouse button for dragging.
|
||||
floating_modifier $mod normal
|
||||
|
||||
# Reload the configuration file
|
||||
bindsym $mod+Shift+c reload
|
||||
|
||||
# Exit sway (logs you out of your Wayland session)
|
||||
bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'
|
||||
#
|
||||
# Moving around:
|
||||
#
|
||||
# Move your focus around
|
||||
bindsym $mod+$left focus left
|
||||
bindsym $mod+$down focus down
|
||||
bindsym $mod+$up focus up
|
||||
bindsym $mod+$right focus right
|
||||
# Or use $mod+[up|down|left|right]
|
||||
bindsym $mod+Left focus left
|
||||
bindsym $mod+Down focus down
|
||||
bindsym $mod+Up focus up
|
||||
bindsym $mod+Right focus right
|
||||
|
||||
# Move the focused window with the same, but add Shift
|
||||
bindsym $mod+Shift+$left move left
|
||||
bindsym $mod+Shift+$down move down
|
||||
bindsym $mod+Shift+$up move up
|
||||
bindsym $mod+Shift+$right move right
|
||||
# Ditto, with arrow keys
|
||||
bindsym $mod+Shift+Left move left
|
||||
bindsym $mod+Shift+Down move down
|
||||
bindsym $mod+Shift+Up move up
|
||||
bindsym $mod+Shift+Right move right
|
||||
#
|
||||
# Workspaces:
|
||||
#
|
||||
# Switch to workspace
|
||||
bindsym $mod+1 workspace number 1
|
||||
bindsym $mod+2 workspace number 2
|
||||
bindsym $mod+3 workspace number 3
|
||||
bindsym $mod+4 workspace number 4
|
||||
bindsym $mod+5 workspace number 5
|
||||
bindsym $mod+6 workspace number 6
|
||||
bindsym $mod+7 workspace number 7
|
||||
bindsym $mod+8 workspace number 8
|
||||
bindsym $mod+9 workspace number 9
|
||||
bindsym $mod+0 workspace number 10
|
||||
# Move focused container to workspace
|
||||
bindsym $mod+Shift+1 move container to workspace number 1
|
||||
bindsym $mod+Shift+2 move container to workspace number 2
|
||||
bindsym $mod+Shift+3 move container to workspace number 3
|
||||
bindsym $mod+Shift+4 move container to workspace number 4
|
||||
bindsym $mod+Shift+5 move container to workspace number 5
|
||||
bindsym $mod+Shift+6 move container to workspace number 6
|
||||
bindsym $mod+Shift+7 move container to workspace number 7
|
||||
bindsym $mod+Shift+8 move container to workspace number 8
|
||||
bindsym $mod+Shift+9 move container to workspace number 9
|
||||
bindsym $mod+Shift+0 move container to workspace number 10
|
||||
# Note: workspaces can have any name you want, not just numbers.
|
||||
# We just use 1-10 as the default.
|
||||
#
|
||||
# Layout stuff:
|
||||
#
|
||||
# You can "split" the current object of your focus with
|
||||
# $mod+b or $mod+v, for horizontal and vertical splits
|
||||
# respectively.
|
||||
bindsym $mod+b splith
|
||||
bindsym $mod+v splitv
|
||||
|
||||
# Switch the current container between different layout styles
|
||||
bindsym $mod+s layout stacking
|
||||
bindsym $mod+w layout tabbed
|
||||
bindsym $mod+e layout toggle split
|
||||
|
||||
# Make the current focus fullscreen
|
||||
bindsym $mod+f fullscreen
|
||||
|
||||
# Toggle the current focus between tiling and floating mode
|
||||
bindsym $mod+Shift+space floating toggle
|
||||
|
||||
# Swap focus between the tiling area and the floating area
|
||||
bindsym $mod+space focus mode_toggle
|
||||
|
||||
# Move focus to the parent container
|
||||
bindsym $mod+a focus parent
|
||||
#
|
||||
# Scratchpad:
|
||||
#
|
||||
# Sway has a "scratchpad", which is a bag of holding for windows.
|
||||
# You can send windows there and get them back later.
|
||||
|
||||
# Move the currently focused window to the scratchpad
|
||||
bindsym $mod+Shift+minus move scratchpad
|
||||
|
||||
# Show the next scratchpad window or hide the focused scratchpad window.
|
||||
# If there are multiple scratchpad windows, this command cycles through them.
|
||||
bindsym $mod+minus scratchpad show
|
||||
#
|
||||
# Resizing containers:
|
||||
#
|
||||
mode "resize" {
|
||||
# left will shrink the containers width
|
||||
# right will grow the containers width
|
||||
# up will shrink the containers height
|
||||
# down will grow the containers height
|
||||
bindsym $left resize shrink width 10px
|
||||
bindsym $down resize grow height 10px
|
||||
bindsym $up resize shrink height 10px
|
||||
bindsym $right resize grow width 10px
|
||||
|
||||
# Ditto, with arrow keys
|
||||
bindsym Left resize shrink width 10px
|
||||
bindsym Down resize grow height 10px
|
||||
bindsym Up resize shrink height 10px
|
||||
bindsym Right resize grow width 10px
|
||||
|
||||
# Return to default mode
|
||||
bindsym Return mode "default"
|
||||
bindsym Escape mode "default"
|
||||
}
|
||||
bindsym $mod+r mode "resize"
|
||||
|
||||
#
|
||||
# Status Bar:
|
||||
#
|
||||
# Read `man 5 sway-bar` for more information about this section.
|
||||
bar {
|
||||
position top
|
||||
|
||||
# When the status_command prints a new line to stdout, swaybar updates.
|
||||
# The default just shows the current date and time.
|
||||
status_command while date +'%a %e %b %G - %k:%M'; do sleep 1; done
|
||||
|
||||
colors {
|
||||
background $base00
|
||||
separator $base01
|
||||
statusline $base04
|
||||
|
||||
# State Border BG Text
|
||||
focused_workspace $base05 $base0D $base00
|
||||
active_workspace $base05 $base03 $base00
|
||||
inactive_workspace $base03 $base01 $base05
|
||||
urgent_workspace $base08 $base08 $base00
|
||||
binding_mode $base00 $base0A $base00 }
|
||||
}
|
||||
|
||||
# Basic color configuration using the Base16 variables for windows and borders.
|
||||
# Property Name Border BG Text Indicator Child Border
|
||||
client.focused $base05 $base0D $base00 $base0D $base0D
|
||||
client.focused_inactive $base01 $base01 $base05 $base03 $base01
|
||||
client.unfocused $base01 $base00 $base05 $base01 $base01
|
||||
client.urgent $base08 $base08 $base00 $base08 $base08
|
||||
client.placeholder $base00 $base00 $base05 $base00 $base00
|
||||
client.background $base07
|
||||
|
||||
# Load etc config
|
||||
include /etc/sway/config.d/*
|
4
packages/wayland/compositor/sway/config/sway-daemon.conf
Normal file
4
packages/wayland/compositor/sway/config/sway-daemon.conf
Normal file
@ -0,0 +1,4 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2021-present Team LibreELEC (https://libreelec.tv)
|
||||
# Pass config args to Sway e.g. --unsupported-gpu for NVIDIA GPUs
|
||||
SWAY_DAEMON_CONF=""
|
47
packages/wayland/compositor/sway/package.mk
Normal file
47
packages/wayland/compositor/sway/package.mk
Normal file
@ -0,0 +1,47 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2021-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
PKG_NAME="sway"
|
||||
PKG_VERSION="1.7"
|
||||
PKG_SHA256="0c64536fb2883ec518e75cfb119f9300115fb49b084e3fde62b794fe2c6c8d84"
|
||||
PKG_LICENSE="MIT"
|
||||
PKG_SITE="https://swaywm.org/"
|
||||
PKG_URL="https://github.com/swaywm/sway/archive/${PKG_VERSION}.tar.gz"
|
||||
PKG_DEPENDS_TARGET="toolchain wayland wayland-protocols libdrm libxkbcommon libinput cairo pango libjpeg-turbo dbus json-c wlroots gdk-pixbuf swaybg foot bemenu"
|
||||
PKG_LONGDESC="i3-compatible Wayland compositor"
|
||||
|
||||
PKG_MESON_OPTS_TARGET="-Ddefault-wallpaper=false \
|
||||
-Dzsh-completions=false \
|
||||
-Dbash-completions=false \
|
||||
-Dfish-completions=false \
|
||||
-Dswaybar=true \
|
||||
-Dswaynag=true \
|
||||
-Dxwayland=disabled \
|
||||
-Dtray=disabled \
|
||||
-Dgdk-pixbuf=enabled \
|
||||
-Dman-pages=disabled \
|
||||
-Dsd-bus-provider=auto"
|
||||
|
||||
pre_configure_target() {
|
||||
# sway does not build without -Wno flags as all warnings being treated as errors
|
||||
export TARGET_CFLAGS=$(echo "${TARGET_CFLAGS} -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-function -Wno-maybe-uninitialized")
|
||||
}
|
||||
|
||||
post_makeinstall_target() {
|
||||
mkdir -p ${INSTALL}/usr/lib/sway
|
||||
cp ${PKG_DIR}/scripts/sway.sh ${INSTALL}/usr/bin
|
||||
cp ${PKG_DIR}/scripts/sway-config ${INSTALL}/usr/lib/sway
|
||||
|
||||
# install config & wallpaper
|
||||
mkdir -p ${INSTALL}/usr/share/sway
|
||||
cp ${PKG_DIR}/config/* ${INSTALL}/usr/share/sway
|
||||
find_file_path "splash/splash-2160.png" && cp ${FOUND_PATH} ${INSTALL}/usr/share/sway/libreelec-wallpaper-2160.png
|
||||
|
||||
# clean up
|
||||
safe_remove ${INSTALL}/etc
|
||||
safe_remove ${INSTALL}/usr/share/wayland-sessions
|
||||
}
|
||||
|
||||
post_install() {
|
||||
enable_service sway.service
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
--- a/sway/ipc-server.c
|
||||
+++ b/sway/ipc-server.c
|
||||
@@ -140,7 +140,7 @@ struct sockaddr_un *ipc_user_sockaddr(vo
|
||||
dir = "/tmp";
|
||||
}
|
||||
if (path_size <= snprintf(ipc_sockaddr->sun_path, path_size,
|
||||
- "%s/sway-ipc.%u.%i.sock", dir, getuid(), getpid())) {
|
||||
+ "%s/sway-ipc.%u.sock", dir, getuid())) {
|
||||
sway_abort("Socket path won't fit into ipc_sockaddr->sun_path");
|
||||
}
|
||||
|
@ -0,0 +1,13 @@
|
||||
--- a/sway/main.c
|
||||
+++ b/sway/main.c
|
||||
@@ -152,6 +152,10 @@ static void log_kernel(void) {
|
||||
|
||||
|
||||
static bool drop_permissions(void) {
|
||||
+ if (getuid() == 0 || getgid() == 0) {
|
||||
+ sway_log(SWAY_INFO, "Running sway as root user");
|
||||
+ return true;
|
||||
+ }
|
||||
if (getuid() != geteuid() || getgid() != getegid()) {
|
||||
sway_log(SWAY_ERROR, "!!! DEPRECATION WARNING: "
|
||||
"SUID privilege drop will be removed in a future release, please migrate to seatd-launch");
|
6
packages/wayland/compositor/sway/profile.d/04-sway.conf
Normal file
6
packages/wayland/compositor/sway/profile.d/04-sway.conf
Normal file
@ -0,0 +1,6 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2021-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
export WAYLAND_DISPLAY=wayland-1
|
||||
export XDG_RUNTIME_DIR=/var/run/0-runtime-dir
|
||||
export SWAYSOCK="${XDG_RUNTIME_DIR}/sway-ipc.0.sock"
|
47
packages/wayland/compositor/sway/scripts/sway-config
Executable file
47
packages/wayland/compositor/sway/scripts/sway-config
Executable file
@ -0,0 +1,47 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2021-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
export XDG_RUNTIME_DIR=/var/run/0-runtime-dir
|
||||
export WAYLAND_DISPLAY=wayland-1
|
||||
SWAY_DAEMON_ARGS=""
|
||||
|
||||
SWAY_RUNTIME_DIR=/var/run/sway
|
||||
SWAY_CONFIG_BASEDIR=/storage/.config/sway
|
||||
SWAY_CONFIG_SHAREDIR=/usr/share/sway
|
||||
|
||||
SWAY_CONFIG_COLOR=${SWAY_CONFIG_BASEDIR}/colorscheme
|
||||
SWAY_CONFIG_COLOR_DEFAULT=${SWAY_CONFIG_SHAREDIR}/colorscheme
|
||||
SWAY_CONFIG_DAEMON=${SWAY_CONFIG_BASEDIR}/sway-daemon.conf
|
||||
SWAY_CONFIG_DAEMON_DEFAULT=${SWAY_CONFIG_SHAREDIR}/sway-daemon.conf
|
||||
SWAY_CONFIG_USER=${SWAY_CONFIG_BASEDIR}/config
|
||||
SWAY_CONFIG_USER_DEFAULT=${SWAY_CONFIG_SHAREDIR}/config
|
||||
SWAY_CONFIG_RUN=${SWAY_RUNTIME_DIR}/sway-daemon.conf
|
||||
|
||||
if [ ! -d "$XDG_RUNTIME_DIR" ]; then
|
||||
mkdir "$XDG_RUNTIME_DIR"
|
||||
chmod 0700 "$XDG_RUNTIME_DIR"
|
||||
fi
|
||||
|
||||
if [ ! -d "$SWAY_RUNTIME_DIR" ]; then
|
||||
mkdir "$SWAY_RUNTIME_DIR"
|
||||
fi
|
||||
|
||||
if [ ! -f ${SWAY_CONFIG_USER} ]; then
|
||||
mkdir -p ${SWAY_CONFIG_BASEDIR}
|
||||
cp ${SWAY_CONFIG_USER_DEFAULT} ${SWAY_CONFIG_BASEDIR}
|
||||
fi
|
||||
|
||||
if [ ! -f ${SWAY_CONFIG_COLOR} ]; then
|
||||
cp ${SWAY_CONFIG_COLOR_DEFAULT} ${SWAY_CONFIG_BASEDIR}
|
||||
fi
|
||||
|
||||
if [ ! -f ${SWAY_CONFIG_DAEMON} ]; then
|
||||
cp ${SWAY_CONFIG_DAEMON_DEFAULT} ${SWAY_CONFIG_BASEDIR}
|
||||
fi
|
||||
|
||||
if [ -f ${SWAY_CONFIG_DAEMON} ] ; then
|
||||
SWAY_DAEMON_CONF=$(cat ${SWAY_CONFIG_DAEMON} | grep -E '^SWAY_DAEMON_CONF=' | cut -d "\"" -f2)
|
||||
fi
|
||||
|
||||
echo SWAY_DAEMON_ARGS=\"${SWAY_DAEMON_CONF} ${SWAY_DAEMON_ARGS}\" > ${SWAY_CONFIG_RUN}
|
14
packages/wayland/compositor/sway/scripts/sway.sh
Executable file
14
packages/wayland/compositor/sway/scripts/sway.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2021-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
. /run/sway/sway-daemon.conf
|
||||
SWAY_LOG_FILE=/var/log/sway.log
|
||||
|
||||
if [ ! -z "$(lsmod | grep 'nvidia')" ]; then
|
||||
export WLR_NO_HARDWARE_CURSORS=1
|
||||
SWAY_GPU_ARGS="--unsupported-gpu"
|
||||
fi
|
||||
|
||||
logger -t Sway "### Starting Sway with -V ${SWAY_GPU_ARGS} ${SWAY_DAEMON_ARGS}"
|
||||
/usr/bin/sway -V ${SWAY_GPU_ARGS} ${SWAY_DAEMON_ARGS} > ${SWAY_LOG_FILE} 2>&1
|
20
packages/wayland/compositor/sway/system.d/sway.service
Normal file
20
packages/wayland/compositor/sway/system.d/sway.service
Normal file
@ -0,0 +1,20 @@
|
||||
[Unit]
|
||||
Description=Sway Wayland Compositor
|
||||
Before=graphical.target kodi.service
|
||||
After=multi-user.target
|
||||
ConditionKernelCommandLine=!installer
|
||||
|
||||
[Service]
|
||||
Environment=HOME=/storage
|
||||
Environment=XDG_RUNTIME_DIR=/var/run/0-runtime-dir
|
||||
EnvironmentFile=/usr/share/sway/sway-daemon.conf
|
||||
EnvironmentFile=-/run/sway/sway-daemon.conf
|
||||
WorkingDirectory=/storage
|
||||
ExecStartPre=-/usr/lib/sway/sway-config
|
||||
ExecStart=/usr/bin/sway.sh
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
Alias=display-manager.service
|
||||
WantedBy=graphical.target
|
Loading…
x
Reference in New Issue
Block a user