@@ -0,0 +1,47 @@ | |||
HOME_PATH=~ | |||
BIN_PATH=/usr/local/bin | |||
help: | |||
@echo " Available Actions:" | |||
@echo " install_user - builds & copies files into the user's home" | |||
@echo " install_system - builds & copies files into the system" | |||
@echo " fetch - copies files from the system into this build directory" | |||
@echo " help - this!" | |||
### | |||
# INSTALL - USER | |||
### | |||
install_user: install_user_sway install_user_waybar | |||
install_user_sway: | |||
cp home/config/sway/* $(HOME_PATH)/.config/sway/config | |||
install_user_waybar: | |||
cp home/config/waybar/* $(HOME_PATH)/.config/waybar/ | |||
### | |||
# INSTALL - SYSTEM | |||
### | |||
install_system: install_system_check install_system_lightdm | |||
install_system_check: | |||
@echo "Note: install needs to be run as root." | |||
install_system_lightdm: | |||
cp usr/share/wayland-sessions/* /usr/share/wayland-sessions/ | |||
### | |||
# FETCH | |||
### | |||
fetch: fetch_sway fetch_waybar fetch_lightdm | |||
fetch_sway: | |||
cp $(HOME_PATH)/.config/sway/config home/config/sway/config | |||
fetch_waybar: | |||
cp $(HOME_PATH)/.config/waybar/config* home/config/waybar/ | |||
cp $(HOME_PATH)/.config/waybar/style.css home/config/waybar/ | |||
fetch_lightdm: | |||
cp /usr/share/wayland-sessions/sway.desktop usr/share/wayland-sessions/ | |||
@@ -1,2 +1,47 @@ | |||
# pinephone-sway-poc | |||
Sway UI configured for PinePhone (Proof Of Concept) | |||
Sway UI configured for PINE64 PinePhone (Proof Of Concept) | |||
You can find ready-made config files and installation instructions on how to set up Sway on postmarketOS and use it with a PinePhone. | |||
**TODO: insert a photo** | |||
## Install | |||
Start with a [postmarketOS](https://wiki.postmarketos.org/wiki/PINE64_PinePhone_(pine64-pinephone)) for PinePhone image with `postmarketos-ui-sway` installed. Either use the pre-built demo image or build a custom one with `pmbootstrap`. | |||
Flash the system onto the phone (either to an SD card or directly to the eMMC with Jumpdrive). | |||
Open a terminal on the phone (either through SSH, the serial connection or directly on the screen) and run this: | |||
``` | |||
# components | |||
$ sudo apk add waybar bemenu networkmanager | |||
# build tools | |||
$ sudo apk add git make waybar bemenu networkmanager | |||
# installation | |||
$ git clone https://github.com/Dejvino/pinephone-sway-poc | |||
$ cd pinephone-sway-poc | |||
$ make install_user | |||
$ sudo make install_system | |||
``` | |||
That's it. You should now have everything in place. Reboot to use the new settings. | |||
## Usage | |||
**TODO: this.** | |||
## Components | |||
* postmarketOS - base Linux distribution (though any other would work as well) | |||
* sway (pmos package) - tiling Wayland compositor | |||
* squeekboard (pmos package) - on-screen keyboard for Wayland | |||
** [terminal.yaml](https://source.puri.sm/btantau/squeekboard/blob/btantau-master-patch-76686/data/keyboards/terminal.yaml) - keyboard layout based on this improved version | |||
* bemenu (pmos package) - app launcher | |||
* waybar (pmos package) - Wayland status bar | |||
** [carlosdss22/dotfiles](https://github.com/carlosdss22/dotfiles/tree/master/waybar) - styles used | |||
* [sxmo-lisgd](https://git.sr.ht/~mil/lisgd) - gesture detection daemon | |||
* [sxmo-utils](https://git.sr.ht/~mil/sxmo-utils) - various utilities for the PinePhone | |||
(*pmos package* = available as a package directly from the postmarketOS repository) | |||
@@ -0,0 +1,212 @@ | |||
# Read `man 5 sway` for a complete reference. | |||
### Variables | |||
# | |||
# Mod4 = Logo key. Mod1 = Alt. | |||
# Using Mod1 for now since nothing better is available on the virtual keyboard. | |||
set $mod Mod1 | |||
# Home row direction keys, like vim | |||
set $left h | |||
set $down j | |||
set $up k | |||
set $right l | |||
# Your preferred terminal emulator | |||
set $term termite | |||
# 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 bemenu-run | 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 | |||
# | |||
# 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+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 1 | |||
bindsym $mod+2 workspace 2 | |||
bindsym $mod+3 workspace 3 | |||
bindsym $mod+4 workspace 4 | |||
bindsym $mod+5 workspace 5 | |||
bindsym $mod+6 workspace 6 | |||
bindsym $mod+7 workspace 7 | |||
bindsym $mod+8 workspace 8 | |||
bindsym $mod+9 workspace 9 | |||
bindsym $mod+0 workspace 10 | |||
# Move focused container to workspace | |||
bindsym $mod+Shift+1 move container to workspace 1 | |||
bindsym $mod+Shift+2 move container to workspace 2 | |||
bindsym $mod+Shift+3 move container to workspace 3 | |||
bindsym $mod+Shift+4 move container to workspace 4 | |||
bindsym $mod+Shift+5 move container to workspace 5 | |||
bindsym $mod+Shift+6 move container to workspace 6 | |||
bindsym $mod+Shift+7 move container to workspace 7 | |||
bindsym $mod+Shift+8 move container to workspace 8 | |||
bindsym $mod+Shift+9 move container to workspace 9 | |||
bindsym $mod+Shift+0 move container to workspace 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" | |||
# Scale the touchscreen LCD 2x | |||
output DSI-1 scale 2 | |||
# Keyboard | |||
exec squeekboard | |||
# Gesture detection | |||
exec lisgd | |||
# Top and bottom status bar | |||
exec "waybar -c ~/.config/waybar/config_0 -b b0" | |||
exec "waybar -c ~/.config/waybar/config_1 -b b1" | |||
@@ -0,0 +1,160 @@ | |||
{ | |||
//GLOBAL | |||
"layer": "top", | |||
"position": "top", | |||
"modules-left": [ | |||
"sway/workspaces", | |||
"tray" | |||
], | |||
"modules-center": [ | |||
"clock#date" | |||
], | |||
"modules-right": [ | |||
"battery", | |||
"clock#time" | |||
], | |||
//MODULES | |||
"clock#time": { | |||
"interval": 10, | |||
"locale": "C", | |||
"timezone": "Europe/Berlin", | |||
"format": "{:%H:%M}", | |||
"tooltip": false | |||
}, | |||
"clock#date": { | |||
"interval": 20, | |||
"locale": "C", | |||
"timezone": "Europe/Berlin", | |||
"format": " {:%e %b %Y}", // Icon: calendar-alt | |||
//"tooltip-format": "{:%e %B %Y}" | |||
"tooltip": true | |||
}, | |||
"battery": { | |||
"interval": 1, | |||
"states": { | |||
"warning": 30, | |||
"critical": 15 | |||
}, | |||
// Connected to AC | |||
"format": " {capacity}%", // Icon: bolt | |||
// Not connected to AC | |||
"format-discharging": " {capacity}%", | |||
"format-icons": [ | |||
"", // Icon: battery-full | |||
"", // Icon: battery-three-quarters | |||
"", // Icon: battery-half | |||
"", // Icon: battery-quarter | |||
"" // Icon: battery-empty | |||
], | |||
"tooltip": false | |||
}, | |||
"cpu": { | |||
"interval": 5, | |||
"tooltip": false, | |||
"format": " {usage}%", //Icon: microchip | |||
"states": { | |||
"warning": 70, | |||
"critical": 90 | |||
} | |||
}, | |||
"memory": { | |||
"interval": 5, | |||
"format": " {}%", // Icon: memory | |||
"states": { | |||
"warning": 70, | |||
"critical": 90 | |||
} | |||
}, | |||
"network": { | |||
"interval": 5, | |||
"format-wifi": " {essid}", // Icon: wifi | |||
"format-ethernet": " {ifname}", // Icon: ethernet | |||
"format-disconnected": "Disconnected", | |||
"tooltip-format": "{ifname}: {ipaddr}", | |||
"on-click": "swaymsg exec cmst" | |||
}, | |||
"sway/mode": { | |||
"format": "<span style=\"italic\"> {}</span>", | |||
"tooltip": true | |||
}, | |||
"sway/workspaces": { | |||
"all-outputs": false, | |||
"disable-scroll": true, | |||
"format": "{name}", | |||
"format-icons": { | |||
"1:www": "龜", // Icon: firefox-browser | |||
"2:mail": "", // Icon: mail | |||
"3:editor": "", // Icon: code | |||
"4:terminals": "", // Icon: terminal | |||
"5:portal": "", // Icon: terminal | |||
"urgent": "", | |||
"focused": "", | |||
"default": "" | |||
} | |||
}, | |||
"pulseaudio": { | |||
"scroll-step": 1, | |||
"format": "{icon} {volume}%", | |||
"format-bluetooth": "{icon} {volume}%", | |||
"format-muted": "", | |||
"format-icons": { | |||
"headphones": "", | |||
"handsfree": "", | |||
"headset": "", | |||
"phone": "", | |||
"portable": "", | |||
"car": "", | |||
"default": ["", ""] | |||
}, | |||
"on-click": "pavucontrol" | |||
}, | |||
"disk": { | |||
"interval": 5, | |||
"format": " {percentage_used:2}%", | |||
"path": "/" | |||
}, | |||
"backlight": { | |||
// "device": "acpi_video1", | |||
"format": "{icon} {percent}% ", | |||
"states": [0,50], | |||
"format-icons": ["", ""] | |||
}, | |||
"tray": { | |||
"icon-size": 22 | |||
//"spacing": 10 | |||
}, | |||
"custom/bar": { | |||
"format": "", | |||
"tooltip": false | |||
} | |||
} | |||
@@ -0,0 +1,143 @@ | |||
{ | |||
//GLOBAL | |||
"layer": "top", | |||
"position": "bottom", | |||
"modules-left": [ | |||
"cpu", | |||
"memory" | |||
// "disk" | |||
], | |||
"modules-center": [ | |||
"network" | |||
], | |||
"modules-right": [ | |||
"tray", | |||
"backlight", | |||
"pulseaudio" | |||
], | |||
//MODULES | |||
"battery": { | |||
"interval": 1, | |||
"states": { | |||
"warning": 30, | |||
"critical": 15 | |||
}, | |||
// Connected to AC | |||
"format": " {capacity}%", // Icon: bolt | |||
// Not connected to AC | |||
"format-discharging": " {capacity}%", | |||
"format-icons": [ | |||
"", // Icon: battery-full | |||
"", // Icon: battery-three-quarters | |||
"", // Icon: battery-half | |||
"", // Icon: battery-quarter | |||
"" // Icon: battery-empty | |||
], | |||
"tooltip": false | |||
}, | |||
"cpu": { | |||
"interval": 5, | |||
"tooltip": false, | |||
"format": " {usage}%", //Icon: microchip | |||
"states": { | |||
"warning": 70, | |||
"critical": 90 | |||
} | |||
}, | |||
"memory": { | |||
"interval": 5, | |||
"format": " {}%", // Icon: memory | |||
"states": { | |||
"warning": 70, | |||
"critical": 90 | |||
} | |||
}, | |||
"network": { | |||
"interval": 5, | |||
"format-wifi": " {essid}", // Icon: wifi | |||
"format-ethernet": " {ifname}", // Icon: ethernet | |||
"format-disconnected": "Disconnected", | |||
"tooltip-format": "{ifname}: {ipaddr}", | |||
"on-click": "swaymsg exec cmst" | |||
}, | |||
"sway/mode": { | |||
"format": "<span style=\"italic\"> {}</span>", | |||
"tooltip": true | |||
}, | |||
"sway/workspaces": { | |||
"all-outputs": false, | |||
"disable-scroll": true, | |||
"format": "{name}", | |||
"format-icons": { | |||
"1:www": "龜", // Icon: firefox-browser | |||
"2:mail": "", // Icon: mail | |||
"3:editor": "", // Icon: code | |||
"4:terminals": "", // Icon: terminal | |||
"5:portal": "", // Icon: terminal | |||
"urgent": "", | |||
"focused": "", | |||
"default": "" | |||
} | |||
}, | |||
"pulseaudio": { | |||
"scroll-step": 1, | |||
"format": "{icon} {volume}%", | |||
"format-bluetooth": "{icon} {volume}%", | |||
"format-muted": "", | |||
"format-icons": { | |||
"headphones": "", | |||
"handsfree": "", | |||
"headset": "", | |||
"phone": "", | |||
"portable": "", | |||
"car": "", | |||
"default": ["", ""] | |||
}, | |||
"on-click": "pavucontrol" | |||
}, | |||
"disk": { | |||
"interval": 5, | |||
"format": " {percentage_used:2}%", | |||
"path": "/" | |||
}, | |||
"backlight": { | |||
// "device": "acpi_video1", | |||
"format": "{icon} {percent}% ", | |||
"states": [0,50], | |||
"format-icons": ["", ""] | |||
}, | |||
"tray": { | |||
"icon-size": 22 | |||
//"spacing": 10 | |||
}, | |||
"custom/bar": { | |||
"format": "", | |||
"tooltip": false | |||
} | |||
} | |||
@@ -0,0 +1,146 @@ | |||
/* Reset styles */ | |||
* { | |||
border: none; | |||
border-radius: 1; | |||
min-height: 0; | |||
margin: 0; | |||
padding: 0; | |||
} | |||
/* The bar */ | |||
#waybar { | |||
background: #282828; | |||
color: white; | |||
font-family: "awesome 5"; | |||
font-size: 10px; | |||
font-weight: bold; | |||
} | |||
#disk, | |||
#backlight, | |||
#battery, | |||
#clock, | |||
#cpu, | |||
#custom-keyboard-layout, | |||
#memory, | |||
#mode, | |||
#network, | |||
#pulseaudio, | |||
#custom-alsa, | |||
#tray { | |||
padding-left: 8px; | |||
padding-right: 8px; | |||
margin-left: 2px; | |||
margin-right: 2px; | |||
} | |||
/*modules style*/ | |||
#disk { | |||
background: #d79921; | |||
color: #282828; | |||
} | |||
#backlight { | |||
background: #689d6a; | |||
color: #282828; | |||
} | |||
#battery { | |||
animation-timing-function: linear; | |||
animation-iteration-count: infinite; | |||
animation-direction: alternate; | |||
background: #fbf1c7; | |||
color: #282828; | |||
} | |||
#battery.warning { | |||
color: orange; | |||
} | |||
#clock.date { | |||
background: #d65d0e; | |||
color: #282828; | |||
font-weight: bold; | |||
} | |||
#clock.time { | |||
background: #eceff4; | |||
color: #282828; | |||
font-weight: bold; | |||
} | |||
#cpu { | |||
background: #af3a03; | |||
color: #282828; | |||
} | |||
#cpu.warning { | |||
color: orange; | |||
} | |||
#cpu.critical { | |||
color: orange; | |||
} | |||
#memory { | |||
animation-timing-function: linear; | |||
animation-iteration-count: infinite; | |||
animation-direction: alternate; | |||
background: #458588; | |||
color: #282828; | |||
} | |||
#memory.warning { | |||
color: orange; | |||
} | |||
#mode { | |||
background: #64727d; | |||
border-top: 2px solid white; | |||
/* To compensate for the top border and still have vertical centering */ | |||
padding-bottom: 2px; | |||
} | |||
#network { | |||
background: #98971a; | |||
color: #282828; | |||
} | |||
#network.disconnected { | |||
color: orange; | |||
} | |||
#pulseaudio { | |||
background: #8f3f71; | |||
color: #282828; | |||
} | |||
#pulseaudio.muted { | |||
background: #98971a; | |||
color: #282828; | |||
} | |||
#tray { | |||
background: transparent; | |||
} | |||
#window { | |||
font-weight: bold; | |||
} | |||
#workspaces button { | |||
font-weight: bold; | |||
padding-bottom: 2px; | |||
padding-left: 5px; | |||
padding-right: 5px; | |||
color: #076678; | |||
background: #282828; | |||
border-radius: 10px; | |||
} | |||
#workspaces button.focused { | |||
font-weight: bold; | |||
color: #282828; | |||
background-color: #076678; | |||
} | |||
@@ -0,0 +1,12 @@ | |||
[Desktop Entry] | |||
Name=Sway | |||
Name[en]=Sway | |||
Comment=This session logs you into Sway | |||
Comment[en]=This session logs in you into Sway | |||
Exec=elogind-inhibit --what=shutdown:handle-power-key --mode=block dbus-run-session /usr/bin/sway | |||
#Exec=dbus-run-session /usr/bin/sway | |||
TryExec=/usr/bin/sway | |||
Icon= | |||
Type=Application | |||
X-DesktopNames=Sway | |||
Keywords=launch;Sway;desktop;session; |