main/postmarketos-ui-sway: modernize (MR 2162)

* use tinydm instead of lightdm
* set default term to foot, as alacritty needs a recent opengl version
  (issue 984)
* override sway config to actually use foot (there is no
  sway-sensible-terminal and upstream isn't interested in adding it)
* set the pmOS wallpaper in the overridden sway config
* add a subpackage that allows changing $mod to Alt, so it's easier to
  test this in QEMU while running i3/sway on the host with $mod set to
  Mod4
* re-enable previously disabled architectures
* set myself as maintainer
This commit is contained in:
Oliver Smith 2021-05-09 21:08:56 +02:00
parent e8d0a36ae0
commit 66752818bf
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
6 changed files with 256 additions and 23 deletions

View file

@ -1,5 +0,0 @@
# This file gets removed with postmarketos-ui-sway, even if modified!
[Seat:*]
autologin-user=username
autologin-user-timeout=0
autologin-session=sway

View file

@ -1,36 +1,48 @@
# Maintainer: Danct12 <danct12@disroot.org>
# Maintainer: Oliver Smith <ollieparanoid@postmarketos.org>
pkgname=postmarketos-ui-sway
pkgver=2
pkgrel=4
pkgver=3
pkgrel=0
pkgdesc="(Wayland) Tiling WM, drop-in replacement for i3wm (DOES NOT RUN WITHOUT HW ACCELERATION!)"
url="https://postmarketos.org"
arch="noarch !armhf !x86" # armhf,x86: aports#11807
arch="noarch"
license="GPL-3.0-or-later"
subpackages="$pkgname-logo-key-alt:logo_key_alt"
depends="
dnsmasq
elogind
lightdm
lightdm-openrc
networkmanager
postmarketos-base-ui
sway
tinydm
tinydm-openrc
"
_pmb_recommends="alacritty
_pmb_recommends="
dmenu
foot
postmarketos-artwork-wallpapers
swayidle
swaylock
xwayland
"
install="$pkgname.post-install $pkgname.post-upgrade"
source="67-lightdm-autologin.conf postmarketos_background"
source="
etc-sway-config
etc-sway-config.d-00-logo-key.conf
"
options="!check" # no testsuite
replaces="sway"
package() {
install -Dm644 "$srcdir"/67-lightdm-autologin.conf \
"$pkgdir"/usr/share/lightdm/lightdm.conf.d/67-autologin.conf
install -Dm644 "$srcdir"/postmarketos_background \
"$pkgdir"/etc/sway/config.d/postmarketos_background
install -Dm644 "$srcdir"/etc-sway-config \
"$pkgdir"/etc/sway/config
}
sha512sums="5cf8c2e04ec1e1f7a330a3c81f82bc8c9eff4af0b61fb1b4f4a3b2f00fd0f149ab4e517ba38b4be97b22b6316c20861977e99548a9ecf0d89d81faf916c4e714 67-lightdm-autologin.conf
1a70c9a0709d4474317b75ad4929673509a1198e4b95378f8dd02f795b2585ad296b409f06c66d4375c5b6732643f86d04a5220a32de794f464b9375af8487ec postmarketos_background"
logo_key_alt() {
install -Dm644 "$srcdir"/etc-sway-config.d-00-logo-key.conf \
"$subpkgdir"/etc/sway/config.d/00-logo-key.conf
}
sha512sums="
07d8d0f93e6437b62299baf472242adfb84502420659a6fc3f1bea2e5f64556b409552ee35de1ef1a0806653fdfc504bb222ed3ef488a25fd589f9a4bc734ce9 etc-sway-config
889f10fb247396a11375057f7e81eae0f0b21ec90cd47964e02ba24fc0f6db8bb7678545e3272149535cf0bb6a2019456cc59d06a9564ce4a1797bb434013b78 etc-sway-config.d-00-logo-key.conf
"

View file

@ -0,0 +1,223 @@
# postmarketOS specific config for sway
#
# Copy this to ~/.config/sway/config and edit it to your liking.
#
# Read `man 5 sway` for a complete reference.
### Variables
#
# Logo key. Use Mod1 for Alt.
set $mod Mod4
# In postmarketOS, the package postmarketos-ui-sway-logo-key-alt can be
# installed to override the logo key with Alt in the following config. This is
# used by QEMU devices for easier testing.
include /etc/sway/config.d/00-logo-key.conf
# Home row direction keys, like vim
set $left h
set $down j
set $up k
set $right l
# Your preferred terminal emulator (pma#984: set to foot)
set $term foot
# 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 $menu dmenu_path | dmenu | xargs swaymsg exec --
### Output configuration
#
# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
# output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
output * bg /usr/share/wallpapers/postmarketos.jpg fill
#
# 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.
### 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 +'%Y-%m-%d %l:%M:%S %p'; do sleep 1; done
colors {
statusline #ffffff
background #323232
inactive_workspace #32323200 #32323200 #5c5c5c
}
}
include /etc/sway/config.d/*

View file

@ -0,0 +1,4 @@
# This file is provided by postmarketos-ui-sway-logo-key-alt.
# Change logo key to Alt
set $mod Mod1

View file

@ -1,6 +1,7 @@
#!/bin/sh
sed -i "s/username/$(getent passwd 10000 | cut -d: -f1)/g" /usr/share/lightdm/lightdm.conf.d/67-autologin.conf
rc-update add tinydm default
tinydm-set-session -s /usr/share/wayland-sessions/sway.desktop
rc-update add lightdm default
rc-update add networkmanager default
exit 0

View file

@ -1,2 +0,0 @@
# Default postmarketOS background (aka branding)
output * bg /usr/share/wallpapers/postmarketos.jpg fill