├── screenshots.png ├── usr ├── local │ └── bin │ │ ├── swayphone_power_sleep │ │ ├── swayphone_keyboard_hide │ │ ├── swayphone_power_rest │ │ ├── swayphone_power_presleep │ │ ├── swayphone_keyboard_show │ │ ├── swayphone_power_wakeup │ │ ├── swayphone_backlightselect │ │ ├── swayphone_menuselect │ │ └── swayphone_rotated └── share │ └── wayland-sessions │ └── sway.desktop ├── .gitmodules ├── home └── config │ ├── htop │ └── htoprc │ ├── waybar │ ├── style.css │ ├── config_1 │ ├── config_0 │ └── config_v │ └── sway │ └── config ├── Makefile ├── patches └── lisgd.patch ├── README.md └── LICENSE /screenshots.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dejvino/pinephone-sway-poc/HEAD/screenshots.png -------------------------------------------------------------------------------- /usr/local/bin/swayphone_power_sleep: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | swayphone_power_presleep 4 | 5 | systemctl suspend 6 | 7 | -------------------------------------------------------------------------------- /usr/local/bin/swayphone_keyboard_hide: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b false 4 | -------------------------------------------------------------------------------- /usr/local/bin/swayphone_power_rest: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | pptk-led set green 1 4 | pptk-cpu-sleep enable 5 | pptk-backlight set 0 6 | 7 | 8 | -------------------------------------------------------------------------------- /usr/local/bin/swayphone_power_presleep: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | pptk-led set red 0 4 | pptk-led set green 0 5 | pptk-led set blue 1 6 | pptk-backlight set 0 7 | 8 | -------------------------------------------------------------------------------- /usr/local/bin/swayphone_keyboard_show: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | pidof squeekboard || squeekboard & 4 | busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b true 5 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "pinephone-toolkit"] 2 | path = pinephone-toolkit 3 | url = https://github.com/Dejvino/pinephone-toolkit 4 | [submodule "rot8"] 5 | path = rot8 6 | url = https://github.com/Dejvino/rot8.git 7 | branch = pinephone 8 | [submodule "lisgd"] 9 | path = lisgd 10 | url = https://git.sr.ht/~mil/lisgd 11 | -------------------------------------------------------------------------------- /usr/local/bin/swayphone_power_wakeup: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | BACKLIGHT_FILE=~/.backlight 4 | BACKLIGHT_MIN=10 5 | 6 | pptk-led set red 0 7 | pptk-led set green 0 8 | pptk-led set blue 0 9 | pptk-cpu-sleep disable 10 | 11 | # restore last saved backlight level 12 | BACKLIGHT=$((`cat $BACKLIGHT_FILE` >= $BACKLIGHT_MIN ? `cat $BACKLIGHT_FILE` : $BACKLIGHT_MIN)) 13 | pptk-backlight set_percent $BACKLIGHT 14 | 15 | -------------------------------------------------------------------------------- /usr/share/wayland-sessions/sway.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=Sway 3 | Name[en]=Sway 4 | Comment=This session logs you into Sway 5 | Comment[en]=This session logs in you into Sway 6 | Exec=elogind-inhibit --what=shutdown:handle-power-key --mode=block dbus-run-session /usr/bin/sway 7 | #Exec=dbus-run-session /usr/bin/sway 8 | TryExec=/usr/bin/sway 9 | Icon= 10 | Type=Application 11 | X-DesktopNames=Sway 12 | Keywords=launch;Sway;desktop;session; 13 | -------------------------------------------------------------------------------- /usr/local/bin/swayphone_backlightselect: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | BACKLIGHT=~/.backlight 4 | 5 | usleep 250000 # term stabilization 6 | 7 | DEFAULT=$(((`pptk-backlight get_percent`+5)/10*10)) 8 | 9 | dialog --scrollbar --default-item $DEFAULT --menu Backlight 0 0 10 \ 10 | 100 FULL \ 11 | 90 :::: \ 12 | 80 :::. \ 13 | 70 ::: \ 14 | 60 ::. \ 15 | 50 :: \ 16 | 40 :. \ 17 | 30 : \ 18 | 20 . \ 19 | 10 MIN \ 20 | 2>$BACKLIGHT && pptk-backlight set_percent `cat $BACKLIGHT` 21 | 22 | -------------------------------------------------------------------------------- /usr/local/bin/swayphone_menuselect: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MENUOPTIONS=~/.menuoptions 4 | MENUSELECT=~/.menuselect 5 | 6 | HEIGHT=0 7 | WIDTH=0 8 | LINES=0 9 | 10 | if [ ! -f $MENUOPTIONS ] 11 | then 12 | echo 'termite Terminal' > $MENUOPTIONS 13 | echo 'audacious "Music Player"' >> $MENUOPTIONS 14 | echo 'firefox "Web Browser"' >> $MENUOPTIONS 15 | echo '"sudo reboot" Restart' >> $MENUOPTIONS 16 | echo '"sudo poweroff" Shutdown' >> $MENUOPTIONS 17 | fi 18 | 19 | usleep 250000 # term stabilization 20 | 21 | cat $MENUOPTIONS | xargs dialog --menu EXECUTE $HEIGHT $WIDTH $LINES 2>$MENUSELECT && swaymsg exec "`cat $MENUSELECT`" 22 | 23 | -------------------------------------------------------------------------------- /usr/local/bin/swayphone_rotated: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function rotate 4 | { 5 | kill -10 `pidof waybar` 6 | } 7 | 8 | ROTFILE=/tmp/sway_rotation 9 | PREV=-1 10 | if [[ -f $ROTFILE ]] 11 | then 12 | PREV=$(<$ROTFILE) 13 | fi 14 | TRANSFORM=`swaymsg -p -t get_outputs | grep -A 15 "Output DSI-1" | grep "Transform:"` 15 | NOW=-1 16 | 17 | if [[ $TRANSFORM == *"normal"* ]]; then 18 | NOW=0 19 | elif [[ $TRANSFORM == *"90"* ]]; then 20 | NOW=1 21 | elif [[ $TRANSFORM == *"180"* ]]; then 22 | NOW=2 23 | elif [[ $TRANSFORM == *"270"* ]]; then 24 | NOW=3 25 | fi 26 | 27 | echo $NOW > $ROTFILE 28 | 29 | if [[ $(($PREV % 2)) -eq $(($NOW % 2)) ]]; then 30 | echo "No change." 31 | else 32 | echo Rotated from $PREV to $NOW. 33 | rotate 34 | fi 35 | 36 | -------------------------------------------------------------------------------- /home/config/htop/htoprc: -------------------------------------------------------------------------------- 1 | # Beware! This file is rewritten by htop when settings are changed in the interface. 2 | # The parser is also very primitive, and not human-friendly. 3 | fields=0 48 46 47 38 2 49 1 4 | sort_key=47 5 | sort_direction=1 6 | hide_threads=0 7 | hide_kernel_threads=1 8 | hide_userland_threads=1 9 | shadow_other_users=0 10 | show_thread_names=0 11 | show_program_path=1 12 | highlight_base_name=1 13 | highlight_megabytes=1 14 | highlight_threads=1 15 | tree_view=0 16 | header_margin=1 17 | detailed_cpu_time=0 18 | cpu_count_from_zero=0 19 | update_process_names=0 20 | account_guest_in_cpu_meter=0 21 | color_scheme=0 22 | delay=15 23 | left_meters=AllCPUs CPU Memory Swap 24 | left_meter_modes=1 2 1 1 25 | right_meters=Tasks LoadAverage Uptime 26 | right_meter_modes=2 2 2 27 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | HOME_PATH=~ 2 | BIN_PATH=/usr/local/bin 3 | 4 | help: 5 | @echo " Available Actions:" 6 | @echo " install_user - builds & copies files into the user's home" 7 | @echo " install_system - builds & copies files into the system" 8 | @echo " fetch - copies files from the system into this build directory" 9 | @echo " help - this!" 10 | 11 | ### 12 | # INSTALL - USER 13 | ### 14 | install_user: install_user_sway install_user_waybar install_user_htop 15 | 16 | install_user_sway: 17 | mkdir -p $(HOME_PATH)/.config/sway/ 18 | cp home/config/sway/* $(HOME_PATH)/.config/sway/config 19 | 20 | install_user_waybar: 21 | mkdir -p $(HOME_PATH)/.config/waybar/ 22 | cp home/config/waybar/* $(HOME_PATH)/.config/waybar/ 23 | 24 | install_user_htop: 25 | mkdir -p $(HOME_PATH)/.config/htop/ 26 | cp home/config/htop/* $(HOME_PATH)/.config/htop/ 27 | 28 | ### 29 | # INSTALL - SYSTEM 30 | ### 31 | install_system: install_system_check install_system_lightdm install_system_bin install_pptk install_rot8 install_lisgd 32 | 33 | install_system_check: 34 | @echo "Note: install needs to be run as root." 35 | 36 | install_system_lightdm: 37 | cp usr/share/wayland-sessions/* /usr/share/wayland-sessions/ 38 | 39 | install_system_bin: 40 | chmod go+rx usr/local/bin/* 41 | cp usr/local/bin/* /usr/local/bin/ 42 | 43 | install_pptk: 44 | cd pinephone-toolkit && meson build 45 | ninja -C pinephone-toolkit/build 46 | ninja -C pinephone-toolkit/build install 47 | 48 | install_rot8: 49 | cd rot8 && cargo build --release 50 | cp rot8/target/release/rot8 /usr/local/bin/ 51 | 52 | install_lisgd: 53 | cd lisgd && git fetch origin && git reset --hard 877beea2738df5f3a99da3f4e2ab5442b92baa80 54 | cd lisgd && git apply ../patches/lisgd.patch 55 | cd lisgd && make 56 | cp lisgd/lisgd /usr/local/bin/ 57 | 58 | ### 59 | # FETCH 60 | ### 61 | fetch: fetch_sway fetch_waybar fetch_htop fetch_lightdm 62 | 63 | fetch_sway: 64 | cp $(HOME_PATH)/.config/sway/config home/config/sway/config 65 | 66 | fetch_waybar: 67 | cp $(HOME_PATH)/.config/waybar/config* home/config/waybar/ 68 | cp $(HOME_PATH)/.config/waybar/style.css home/config/waybar/ 69 | 70 | fetch_htop: 71 | cp $(HOME_PATH)/.config/htop/htoprc home/config/htop/ 72 | 73 | fetch_lightdm: 74 | cp /usr/share/wayland-sessions/sway.desktop usr/share/wayland-sessions/ 75 | 76 | -------------------------------------------------------------------------------- /patches/lisgd.patch: -------------------------------------------------------------------------------- 1 | diff --git a/lisgd.c b/lisgd.c 2 | index 9d3442b..af49a80 100644 3 | --- a/lisgd.c 4 | +++ b/lisgd.c 5 | @@ -1,3 +1,4 @@ 6 | +#include 7 | #include 8 | #include 9 | #include 10 | @@ -86,6 +87,51 @@ touchmotion(struct libinput_event *e) 11 | yend[slot] = libinput_event_touch_get_y(tevent); 12 | } 13 | 14 | +bool display_rotation_matches(char* transform) { 15 | + char cmd[256]; 16 | + snprintf(cmd, sizeof(cmd), 17 | + "swaymsg -t get_outputs | grep DSI-1 -A 50 | grep transform | grep %s", 18 | + transform); 19 | + return system(cmd) == 0; 20 | +} 21 | + 22 | +enum rotation{normal, left, right, invert}; 23 | +enum rotation get_display_rotation() 24 | +{ 25 | + if (display_rotation_matches("normal")) 26 | + return normal; 27 | + if (display_rotation_matches("90")) 28 | + return left; 29 | + if (display_rotation_matches("180")) 30 | + return invert; 31 | + if (display_rotation_matches("270")) 32 | + return right; 33 | + return normal; 34 | +} 35 | + 36 | +void rotate_move_based_on_display(int* move_x, int* move_y) 37 | +{ 38 | + enum rotation rot = get_display_rotation(); 39 | + int t; 40 | + switch (get_display_rotation()) { 41 | + case normal: 42 | + break; 43 | + case left: 44 | + t = *move_x; 45 | + (*move_x) = (*move_y); 46 | + (*move_y) = -t; 47 | + break; 48 | + case right: 49 | + t = *move_x; 50 | + (*move_x) = -(*move_y); 51 | + (*move_y) = t; 52 | + break; 53 | + case invert: 54 | + (*move_y) = -(*move_y); 55 | + break; 56 | + } 57 | +} 58 | + 59 | void 60 | touchup(struct libinput_event *e) 61 | { 62 | @@ -109,19 +155,27 @@ touchup(struct libinput_event *e) 63 | ); 64 | } 65 | 66 | - if (xend[slot] > xstart[slot] && fabs(xend[slot] - xstart[slot]) > threshold) { 67 | - start = Left; 68 | - end = Right; 69 | - } else if (xend[slot] < xstart[slot] && fabs(xend[slot] - xstart[slot]) > threshold) { 70 | - start = Right; 71 | - end = Left; 72 | - } else if (yend[slot] > ystart[slot] && fabs(yend[slot] - ystart[slot]) > threshold) { 73 | - start = Up; 74 | - end = Down; 75 | - } else if (yend[slot] < ystart[slot] && fabs(yend[slot] - ystart[slot]) > threshold) { 76 | - start = Down; 77 | - end = Up; 78 | - } else { 79 | + int move_x = fabs(xend[slot] - xstart[slot]) > threshold 80 | + ? (xend[slot] > xstart[slot] ? 1 : -1) : 0; 81 | + int move_y = fabs(yend[slot] - ystart[slot]) > threshold 82 | + ? (yend[slot] > ystart[slot] ? 1 : -1) : 0; 83 | + 84 | + rotate_move_based_on_display(&move_x, &move_y); 85 | + 86 | +#define X_DIR 4 87 | +#define Y_DIR 1 88 | +#define NODIR 0 89 | + switch (move_x * X_DIR + move_y * Y_DIR) { 90 | + case -X_DIR -Y_DIR: start = Right; end = Up; break; 91 | + case -X_DIR +NODIR: start = Right; end = Left; break; 92 | + case -X_DIR +Y_DIR: start = Right; end = Down; break; 93 | + case +NODIR -Y_DIR: start = Down; end = Up; break; 94 | + case +NODIR +Y_DIR: start = Up; end = Down; break; 95 | + case +X_DIR -Y_DIR: start = Left; end = Up; break; 96 | + case +X_DIR +NODIR: start = Left; end = Right; break; 97 | + case +X_DIR +Y_DIR: start = Left; end = Down; break; 98 | + case +NODIR +NODIR: 99 | + default: 100 | if (verbose) { 101 | fprintf(stderr, "Input didn't match a known gesture\n"); 102 | } 103 | -------------------------------------------------------------------------------- /home/config/waybar/style.css: -------------------------------------------------------------------------------- 1 | /* Reset styles */ 2 | * { 3 | border: none; 4 | border-radius: 1; 5 | min-height: 0; 6 | margin: 0; 7 | padding: 0; 8 | } 9 | 10 | /* The bar */ 11 | #waybar { 12 | background: #282828; 13 | color: white; 14 | font-family: "awesome 5"; 15 | font-size: 10px; 16 | font-weight: bold; 17 | } 18 | 19 | #disk, 20 | #backlight, 21 | #battery, 22 | #clock, 23 | #cpu, 24 | #custom-keyboard-layout, 25 | #memory, 26 | #mode, 27 | #network, 28 | #pulseaudio, 29 | #custom-alsa, 30 | #custom-kill, 31 | #custom.kill, 32 | #tray { 33 | padding-left: 8px; 34 | padding-right: 8px; 35 | margin-left: 2px; 36 | margin-right: 2px; 37 | padding-top: 2px; 38 | padding-bottom: 2px; 39 | } 40 | 41 | #disk, 42 | #backlight, 43 | #battery, 44 | #clock, 45 | #cpu, 46 | #custom-keyboard-layout, 47 | #memory, 48 | #mode, 49 | #network, 50 | #pulseaudio, 51 | #custom-alsa, 52 | #custom-kill, 53 | #custom.kill, 54 | #tray { 55 | padding-top: 4px; 56 | padding-bottom: 4px; 57 | margin-top: 2px; 58 | margin-bottom: 2px; 59 | } 60 | 61 | 62 | /*@media (width > 800px) { 63 | #clock { 64 | padding: 10px; 65 | } 66 | }*/ 67 | 68 | /*modules style*/ 69 | #disk { 70 | background: #d79921; 71 | color: #282828; 72 | } 73 | 74 | #backlight { 75 | background: #689d6a; 76 | color: #282828; 77 | } 78 | 79 | #battery { 80 | animation-timing-function: linear; 81 | animation-iteration-count: infinite; 82 | animation-direction: alternate; 83 | background: #fbf1c7; 84 | color: #282828; 85 | } 86 | 87 | #battery.warning { 88 | color: orange; 89 | } 90 | 91 | #clock.date { 92 | background: #d65d0e; 93 | color: #282828; 94 | font-weight: bold; 95 | } 96 | 97 | #clock.time { 98 | background: #eceff4; 99 | color: #282828; 100 | font-weight: bold; 101 | font-size: 12px; 102 | } 103 | 104 | #cpu { 105 | background: #af3a03; 106 | color: #282828; 107 | } 108 | 109 | #cpu.warning { 110 | color: orange; 111 | } 112 | 113 | #cpu.critical { 114 | color: orange; 115 | } 116 | 117 | #memory { 118 | animation-timing-function: linear; 119 | animation-iteration-count: infinite; 120 | animation-direction: alternate; 121 | background: #458588; 122 | color: #282828; 123 | } 124 | 125 | #memory.warning { 126 | color: orange; 127 | } 128 | 129 | #mode { 130 | background: #64727d; 131 | border-top: 2px solid white; 132 | /* To compensate for the top border and still have vertical centering */ 133 | padding-bottom: 2px; 134 | } 135 | 136 | #network { 137 | background: #98971a; 138 | color: #282828; 139 | } 140 | 141 | #network.disconnected { 142 | color: orange; 143 | } 144 | 145 | #pulseaudio { 146 | background: #8f3f71; 147 | color: #282828; 148 | } 149 | 150 | #pulseaudio.muted { 151 | background: #98971a; 152 | color: #282828; 153 | } 154 | 155 | #custom-kill { 156 | background: #a32a03; 157 | color: #282828; 158 | } 159 | 160 | #tray { 161 | background: transparent; 162 | } 163 | 164 | #window { 165 | font-weight: bold; 166 | } 167 | 168 | #workspaces button { 169 | font-weight: bold; 170 | padding-bottom: 2px; 171 | padding-left: 5px; 172 | padding-right: 5px; 173 | color: #076678; 174 | background: #282828; 175 | border-radius: 10px; 176 | } 177 | 178 | #workspaces button.focused { 179 | font-weight: bold; 180 | color: #282828; 181 | background-color: #076678; 182 | } 183 | 184 | -------------------------------------------------------------------------------- /home/config/waybar/config_1: -------------------------------------------------------------------------------- 1 | 2 | { 3 | //GLOBAL 4 | 5 | "layer": "top", 6 | 7 | "position": "bottom", 8 | 9 | "modules-left": [ 10 | "custom/kill", 11 | "cpu", 12 | "memory" 13 | // "disk" 14 | ], 15 | 16 | "modules-center": [ 17 | "network" 18 | ], 19 | 20 | "modules-right": [ 21 | "tray", 22 | "backlight", 23 | "pulseaudio" 24 | ], 25 | 26 | //MODULES 27 | 28 | "custom/kill": { 29 | "on-click": "swaymsg kill", 30 | "format": "[x]" 31 | }, 32 | 33 | "battery": { 34 | "interval": 1, 35 | "states": { 36 | "warning": 30, 37 | "critical": 15 38 | }, 39 | // Connected to AC 40 | "format": " {capacity}%", // Icon: bolt 41 | // Not connected to AC 42 | "format-discharging": " {capacity}%", 43 | "format-icons": [ 44 | "", // Icon: battery-full 45 | "", // Icon: battery-three-quarters 46 | "", // Icon: battery-half 47 | "", // Icon: battery-quarter 48 | "" // Icon: battery-empty 49 | ], 50 | "tooltip": false 51 | }, 52 | 53 | 54 | 55 | 56 | "cpu": { 57 | "interval": 5, 58 | "tooltip": false, 59 | "format": " {usage}%", //Icon: microchip 60 | "states": { 61 | "warning": 70, 62 | "critical": 90 63 | }, 64 | "on-click": "termite -e \"htop --sort-key=PERCENT_CPU\"" 65 | }, 66 | 67 | 68 | "memory": { 69 | "interval": 5, 70 | "format": " {}%", // Icon: memory 71 | "states": { 72 | "warning": 70, 73 | "critical": 90 74 | }, 75 | "on-click": "termite -e \"htop --sort-key=PERCENT_MEM\"" 76 | }, 77 | 78 | "network": { 79 | "interval": 5, 80 | "format-wifi": "  {essid}", // Icon: wifi 81 | "format-ethernet": " {ifname}", // Icon: ethernet 82 | "format-disconnected": "Disconnected", 83 | "tooltip-format": "{ifname}: {ipaddr}", 84 | "on-click": "swaymsg exec \"termite -e nmtui\"" 85 | }, 86 | 87 | "sway/mode": { 88 | "format": " {}", 89 | "tooltip": true 90 | }, 91 | 92 | 93 | "sway/workspaces": { 94 | "all-outputs": false, 95 | "disable-scroll": true, 96 | "format": "{name}", 97 | "format-icons": { 98 | "1:www": "龜", // Icon: firefox-browser 99 | "2:mail": "", // Icon: mail 100 | "3:editor": "", // Icon: code 101 | "4:terminals": "", // Icon: terminal 102 | "5:portal": "", // Icon: terminal 103 | "urgent": "", 104 | "focused": "", 105 | "default": "" 106 | } 107 | }, 108 | 109 | "pulseaudio": { 110 | "scroll-step": 1, 111 | "format": "{icon} {volume}%", 112 | "format-bluetooth": "{icon} {volume}%", 113 | "format-muted": "", 114 | "format-icons": { 115 | "headphones": "", 116 | "handsfree": "", 117 | "headset": "", 118 | "phone": "", 119 | "portable": "", 120 | "car": "", 121 | "default": ["", ""] 122 | }, 123 | "on-click": "pavucontrol" 124 | }, 125 | 126 | "disk": { 127 | "interval": 5, 128 | "format": " {percentage_used:2}%", 129 | "path": "/" 130 | 131 | }, 132 | "backlight": { 133 | // "device": "acpi_video1", 134 | "format": "{icon} {percent}% ", 135 | "states": [0,50], 136 | "format-icons": ["", ""], 137 | "on-click": "termite -e swayphone_backlightselect" 138 | }, 139 | "tray": { 140 | "icon-size": 22 141 | 142 | //"spacing": 10 143 | }, 144 | 145 | 146 | "custom/bar": { 147 | "format": "", 148 | "tooltip": false 149 | } 150 | } 151 | 152 | -------------------------------------------------------------------------------- /home/config/waybar/config_0: -------------------------------------------------------------------------------- 1 | 2 | { 3 | //GLOBAL 4 | 5 | 6 | "layer": "top", 7 | 8 | "position": "top", 9 | 10 | "modules-left": [ 11 | "sway/workspaces", 12 | "tray" 13 | ], 14 | 15 | "modules-center": [ 16 | "clock#date" 17 | ], 18 | 19 | "modules-right": [ 20 | "battery", 21 | "clock#time" 22 | ], 23 | 24 | //MODULES 25 | 26 | "clock#time": { 27 | "interval": 10, 28 | "locale": "C", 29 | "timezone": "Europe/Berlin", 30 | "format": "{:%H:%M}", 31 | "tooltip": false 32 | }, 33 | 34 | 35 | "clock#date": { 36 | "interval": 20, 37 | "locale": "C", 38 | "timezone": "Europe/Berlin", 39 | "format": " {:%e %b %Y}", // Icon: calendar-alt 40 | //"tooltip-format": "{:%e %B %Y}" 41 | "tooltip": true, 42 | "on-click": "termite -e swayphone_menuselect" 43 | }, 44 | 45 | "battery": { 46 | "interval": 1, 47 | "states": { 48 | "warning": 30, 49 | "critical": 15 50 | }, 51 | // Connected to AC 52 | "format": " {capacity}%", // Icon: bolt 53 | // Not connected to AC 54 | "format-discharging": " {capacity}%", 55 | "format-icons": [ 56 | "", // Icon: battery-full 57 | "", // Icon: battery-three-quarters 58 | "", // Icon: battery-half 59 | "", // Icon: battery-quarter 60 | "" // Icon: battery-empty 61 | ], 62 | "tooltip": false 63 | }, 64 | 65 | 66 | 67 | 68 | "cpu": { 69 | "interval": 5, 70 | "tooltip": false, 71 | "format": " {usage}%", //Icon: microchip 72 | "states": { 73 | "warning": 70, 74 | "critical": 90 75 | } 76 | }, 77 | 78 | 79 | "memory": { 80 | "interval": 5, 81 | "format": " {}%", // Icon: memory 82 | "states": { 83 | "warning": 70, 84 | "critical": 90 85 | } 86 | }, 87 | 88 | "network": { 89 | "interval": 5, 90 | "format-wifi": "  {essid}", // Icon: wifi 91 | "format-ethernet": " {ifname}", // Icon: ethernet 92 | "format-disconnected": "Disconnected", 93 | "tooltip-format": "{ifname}: {ipaddr}", 94 | "on-click": "swaymsg exec cmst" 95 | }, 96 | 97 | "sway/mode": { 98 | "format": " {}", 99 | "tooltip": true 100 | }, 101 | 102 | 103 | "sway/workspaces": { 104 | "all-outputs": false, 105 | "disable-scroll": true, 106 | "persistent_workspaces": { 107 | "1": [], 108 | "3:F": [], 109 | "8:M": [], 110 | "9:K": [] 111 | }, 112 | "format": "{name}", 113 | "format-icons": { 114 | //"1:T": "", // Icon: terminal 115 | "3:F": "龜", // Icon: firefox-browser 116 | "8:M": "", // Icon: mail 117 | "urgent": "", 118 | "focused": "", 119 | "default": "" 120 | } 121 | }, 122 | 123 | "pulseaudio": { 124 | "scroll-step": 1, 125 | "format": "{icon} {volume}%", 126 | "format-bluetooth": "{icon} {volume}%", 127 | "format-muted": "", 128 | "format-icons": { 129 | "headphones": "", 130 | "handsfree": "", 131 | "headset": "", 132 | "phone": "", 133 | "portable": "", 134 | "car": "", 135 | "default": ["", ""] 136 | }, 137 | "on-click": "pavucontrol" 138 | }, 139 | 140 | "disk": { 141 | "interval": 5, 142 | "format": " {percentage_used:2}%", 143 | "path": "/" 144 | 145 | }, 146 | "backlight": { 147 | // "device": "acpi_video1", 148 | "format": "{icon} {percent}% ", 149 | "states": [0,50], 150 | "format-icons": ["", ""] 151 | }, 152 | "tray": { 153 | "icon-size": 22 154 | 155 | //"spacing": 10 156 | }, 157 | 158 | 159 | "custom/bar": { 160 | "format": "", 161 | "tooltip": false 162 | } 163 | } 164 | 165 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # pinephone-sway-poc 2 | Sway UI configured for PINE64 PinePhone (Proof Of Concept) 3 | 4 | You can find ready-made config files, scripts and installation instructions on how to set up Sway on Arch Linux ARM or postmarketOS and use it with a PinePhone. 5 | 6 | ![Screenshots](./screenshots.png) 7 | 8 | ## Install 9 | ### postmarketOS 10 | 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`. 11 | 12 | Flash the system onto the phone (either to an SD card or directly to the eMMC with Jumpdrive). 13 | 14 | Open a terminal on the phone (either through SSH, the serial connection or directly on the screen) and run this: 15 | ```bash 16 | # system components 17 | $ sudo apk add waybar bemenu swaylock swayidle squeekboard bash dialog tzdata 18 | 19 | # user components 20 | $ sudo apk add networkmanager htop pavucontrol 21 | 22 | # build tools 23 | $ sudo apk add git make meson ninja cargo linux-headers libinput-dev eudev-dev 24 | ``` 25 | 26 | ### Arch Linux ARM 27 | Start with a [Pine64-Arch](https://github.com/dreemurrs-embedded/Pine64-Arch/) image flashed to the phone. You'll need the `sway` package and most of what is mentioned in the `postmarketOS` section. Disable (or remove) the default `phosh` package so that it doesn't get loaded on boot. 28 | 29 | ### Common 30 | ```bash 31 | # installation 32 | $ git clone --recurse-submodules https://github.com/Dejvino/pinephone-sway-poc 33 | $ cd pinephone-sway-poc 34 | $ make install_user 35 | $ sudo make install_system 36 | 37 | # power button 38 | sudo vim /etc/systemd/logind.conf # or /etc/elogind/logind.conf for non-systemd distros (pmOS) 39 | # replace: 40 | # #HandlePowerKey=poweroff 41 | # with: 42 | # HandlePowerKey=suspend 43 | ``` 44 | 45 | That's it. You should now have everything in place. Reboot to use the new settings. 46 | 47 | ## Usage 48 | Study the provided config files and shell scripts to get more details. The following is just an introduction. 49 | 50 | ### Power Button 51 | The power button activates or deactivates a "sleep mode" (suspend). This mode is automatically entered after a period of inactivity (via swayidle). Before that, the backlight is first turned low, then the backlight is turned off and all the CPUs except for the primary one are shut down. The indicator LED is used to indicate the power mode: 1) green = running, low power usage, 2) blue = suspend. 52 | 53 | ### Top and bottom waybar 54 | The bars show you CPU/MEM usage, backlight brightness, time, etc. Touching them opens a relevant app (e.g. NetworkManager or htop). Touching the date opens a custom "quick execute" menu to launch an app. The **[x]** icon closes the active window. Touching the backlight indicator brings up a custom brightness setting app. 55 | 56 | ### Touch gestures 57 | Swiping two fingers up / down activates or hides the on-screen keyboard. Swiping two fingers left / right changes the active workspace. Three fingers change the active window in the direction of the swipe. Four fingers move the active window accordingly. 58 | 59 | ### Screen Rotation 60 | The screen is automatically rotated based on the readings from the phone's built-in accelerometer. 61 | 62 | ## TIP! 63 | You can use this as a configs backup mechanism! 64 | ``` 65 | $ make fetch 66 | ``` 67 | Running this command gathers the relevant config files from your running system and replaces the files in the repository. You can then `git add` and `commit` your own changes, straight from the phone! This is actually how the config files here were created. 68 | 69 | ## Components 70 | * postmarketOS / Arch Linux ARM - base Linux distribution (though any other would work as well) 71 | * sway (packaged) - tiling Wayland compositor 72 | * * swayidle, swaylock - utils for sway 73 | * bemenu (packaged) - app launcher 74 | * waybar (packaged) - Wayland status bar 75 | * * [carlosdss22/dotfiles](https://github.com/carlosdss22/dotfiles/tree/master/waybar) - styles used 76 | * squeekboard (packaged) - on-screen keyboard for Wayland 77 | * * [terminal.yaml](https://source.puri.sm/btantau/squeekboard/blob/btantau-master-patch-76686/data/keyboards/terminal.yaml) - keyboard layout based on this improved version 78 | * [pinephone-toolkit](https://github.com/Dejvino/pinephone-toolkit) - various utilities for the PinePhone 79 | * [sxmo-lisgd](https://git.sr.ht/~mil/lisgd) - gesture detection daemon 80 | * [rot8](https://github.com/efernau/rot8) - screen rotation daemon using data from the accelerometer 81 | * htop (packaged) - Processes monitoring 82 | * pavucontrol (packaged) - PulseAudio control panel 83 | * mako (packaged) - Notify daemon 84 | 85 | (*packaged* = available as a package directly from the repository) 86 | 87 | -------------------------------------------------------------------------------- /home/config/waybar/config_v: -------------------------------------------------------------------------------- 1 | 2 | { 3 | //GLOBAL 4 | 5 | 6 | "layer": "top", 7 | 8 | "position": "right", 9 | "width": 100, 10 | 11 | "modules-left": [ 12 | "clock#time", 13 | "clock#date", 14 | "battery", 15 | "tray" 16 | ], 17 | 18 | "modules-center": [ 19 | "sway/workspaces" 20 | ], 21 | 22 | "modules-right": [ 23 | "custom/kill", 24 | "cpu", 25 | "memory", 26 | // "disk" 27 | "network", 28 | "backlight", 29 | "pulseaudio" 30 | ], 31 | 32 | //MODULES 33 | 34 | "clock#time": { 35 | "interval": 10, 36 | "locale": "C", 37 | "timezone": "Europe/Berlin", 38 | "format": "{:%H:%M}", 39 | "tooltip": false 40 | }, 41 | 42 | 43 | "clock#date": { 44 | "interval": 20, 45 | "locale": "C", 46 | "timezone": "Europe/Berlin", 47 | "format": " {:%e %b %Y}", // Icon: calendar-alt 48 | //"tooltip-format": "{:%e %B %Y}" 49 | "tooltip": true, 50 | "on-click": "termite -e swayphone_menuselect" 51 | }, 52 | 53 | "battery": { 54 | "interval": 1, 55 | "states": { 56 | "warning": 30, 57 | "critical": 15 58 | }, 59 | // Connected to AC 60 | "format": " {capacity}%", // Icon: bolt 61 | // Not connected to AC 62 | "format-discharging": " {capacity}%", 63 | "format-icons": [ 64 | "", // Icon: battery-full 65 | "", // Icon: battery-three-quarters 66 | "", // Icon: battery-half 67 | "", // Icon: battery-quarter 68 | "" // Icon: battery-empty 69 | ], 70 | "tooltip": false 71 | }, 72 | 73 | 74 | 75 | 76 | "sway/mode": { 77 | "format": " {}", 78 | "tooltip": true 79 | }, 80 | 81 | 82 | "sway/workspaces": { 83 | "all-outputs": false, 84 | "disable-scroll": true, 85 | "persistent_workspaces": { 86 | "1": [], 87 | "3:F": [], 88 | "8:M": [], 89 | "9:K": [] 90 | }, 91 | "format": "{name}", 92 | "format-icons": { 93 | //"1:T": "", // Icon: terminal 94 | "3:F": "龜", // Icon: firefox-browser 95 | "8:M": "", // Icon: mail 96 | "urgent": "", 97 | "focused": "", 98 | "default": "" 99 | } 100 | }, 101 | 102 | "custom/kill": { 103 | "on-click": "swaymsg kill", 104 | "format": "[x]" 105 | }, 106 | 107 | "battery": { 108 | "interval": 1, 109 | "states": { 110 | "warning": 30, 111 | "critical": 15 112 | }, 113 | // Connected to AC 114 | "format": " {capacity}%", // Icon: bolt 115 | // Not connected to AC 116 | "format-discharging": " {capacity}%", 117 | "format-icons": [ 118 | "", // Icon: battery-full 119 | "", // Icon: battery-three-quarters 120 | "", // Icon: battery-half 121 | "", // Icon: battery-quarter 122 | "" // Icon: battery-empty 123 | ], 124 | "tooltip": false 125 | }, 126 | 127 | 128 | 129 | "cpu": { 130 | "interval": 5, 131 | "tooltip": false, 132 | "format": " {usage}%", //Icon: microchip 133 | "states": { 134 | "warning": 70, 135 | "critical": 90 136 | }, 137 | "on-click": "termite -e \"htop --sort-key=PERCENT_CPU\"" 138 | }, 139 | 140 | 141 | "memory": { 142 | "interval": 5, 143 | "format": " {}%", // Icon: memory 144 | "states": { 145 | "warning": 70, 146 | "critical": 90 147 | }, 148 | "on-click": "termite -e \"htop --sort-key=PERCENT_MEM\"" 149 | }, 150 | 151 | "network": { 152 | "interval": 5, 153 | "format-wifi": "  {essid}", // Icon: wifi 154 | "format-ethernet": " {ifname}", // Icon: ethernet 155 | "format-disconnected": "Disconnected", 156 | "tooltip-format": "{ifname}: {ipaddr}", 157 | "on-click": "swaymsg exec \"termite -e nmtui\"" 158 | }, 159 | 160 | "pulseaudio": { 161 | "scroll-step": 1, 162 | "format": "{icon} {volume}%", 163 | "format-bluetooth": "{icon} {volume}%", 164 | "format-muted": "", 165 | "format-icons": { 166 | "headphones": "", 167 | "handsfree": "", 168 | "headset": "", 169 | "phone": "", 170 | "portable": "", 171 | "car": "", 172 | "default": ["", ""] 173 | }, 174 | "on-click": "pavucontrol" 175 | }, 176 | 177 | "disk": { 178 | "interval": 5, 179 | "format": " {percentage_used:2}%", 180 | "path": "/" 181 | 182 | }, 183 | "backlight": { 184 | // "device": "acpi_video1", 185 | "format": "{icon} {percent}% ", 186 | "states": [0,50], 187 | "format-icons": ["", ""], 188 | "on-click": "termite -e swayphone_backlightselect" 189 | }, 190 | "tray": { 191 | "icon-size": 22 192 | 193 | //"spacing": 10 194 | }, 195 | 196 | 197 | "custom/bar": { 198 | "format": "", 199 | "tooltip": false 200 | } 201 | } 202 | 203 | -------------------------------------------------------------------------------- /home/config/sway/config: -------------------------------------------------------------------------------- 1 | # Read `man 5 sway` for a complete reference. 2 | 3 | ### Variables 4 | # 5 | # Mod4 = Logo key. Mod1 = Alt. 6 | # Using Mod1 for now since nothing better is available on the virtual keyboard. 7 | set $mod Mod1 8 | 9 | # Home row direction keys, like vim 10 | set $left h 11 | set $down j 12 | set $up k 13 | set $right l 14 | 15 | # Your preferred terminal emulator 16 | set $term termite 17 | 18 | # Your preferred application launcher 19 | # Note: pass the final command to swaymsg so that the resulting window can be opened 20 | # on the original workspace that the command was run on. 21 | set $menu bemenu-run -n -p RUN | xargs swaymsg exec -- 22 | 23 | ### Output configuration 24 | # 25 | # Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/) 26 | output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill 27 | # 28 | # Example configuration: 29 | # 30 | # output HDMI-A-1 resolution 1920x1080 position 1920,0 31 | # 32 | # You can get the names of your outputs by running: swaymsg -t get_outputs 33 | 34 | ### Idle configuration 35 | # 36 | # Example configuration: 37 | # 38 | # exec swayidle -w \ 39 | # timeout 300 'swaylock -f -c 000000' \ 40 | # timeout 600 'swaymsg "output * dpms off"' \ 41 | # resume 'swaymsg "output * dpms on"' \ 42 | # before-sleep 'swaylock -f -c 000000' 43 | # 44 | # This will lock your screen after 300 seconds of inactivity, then turn off 45 | # your displays after another 300 seconds, and turn your screens back on when 46 | # resumed. It will also lock your screen before your computer goes to sleep. 47 | 48 | ### Input configuration 49 | # 50 | # Example configuration: 51 | # 52 | # input "2:14:SynPS/2_Synaptics_TouchPad" { 53 | # dwt enabled 54 | # tap enabled 55 | # natural_scroll enabled 56 | # middle_emulation enabled 57 | # } 58 | # 59 | # You can get the names of your inputs by running: swaymsg -t get_inputs 60 | # Read `man 5 sway-input` for more information about this section. 61 | 62 | ### Key bindings 63 | # 64 | # Basics: 65 | # 66 | # Start a terminal 67 | bindsym $mod+Return exec $term 68 | 69 | # Kill focused window 70 | bindsym $mod+q kill 71 | 72 | # Start your launcher 73 | bindsym $mod+d exec $menu 74 | 75 | # Drag floating windows by holding down $mod and left mouse button. 76 | # Resize them with right mouse button + $mod. 77 | # Despite the name, also works for non-floating windows. 78 | # Change normal to inverse to use left mouse button for resizing and right 79 | # mouse button for dragging. 80 | floating_modifier $mod normal 81 | 82 | # Reload the configuration file 83 | bindsym $mod+Ctrl+c reload 84 | 85 | # Exit sway (logs you out of your Wayland session) 86 | 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' 87 | # 88 | # Moving around: 89 | # 90 | # Move your focus around 91 | bindsym $mod+$left focus left 92 | bindsym $mod+$down focus down 93 | bindsym $mod+$up focus up 94 | bindsym $mod+$right focus right 95 | # Or use $mod+[up|down|left|right] 96 | bindsym $mod+Left focus left 97 | bindsym $mod+Down focus down 98 | bindsym $mod+Up focus up 99 | bindsym $mod+Right focus right 100 | 101 | # Move the focused window with the same, but add Shift 102 | bindsym $mod+Shift+$left move left 103 | bindsym $mod+Shift+$down move down 104 | bindsym $mod+Shift+$up move up 105 | bindsym $mod+Shift+$right move right 106 | # Ditto, with arrow keys 107 | bindsym $mod+Shift+Left move left 108 | bindsym $mod+Shift+Down move down 109 | bindsym $mod+Shift+Up move up 110 | bindsym $mod+Shift+Right move right 111 | # 112 | # Workspaces: 113 | # 114 | set $W1 '1' 115 | set $W2 '2' 116 | set $W3 '3:F' 117 | set $W4 '4:4' 118 | set $W5 '5:P' 119 | set $W6 '6:6' 120 | set $W7 '7:7' 121 | set $W8 '8:M' 122 | set $W9 '9:K' 123 | 124 | for_window [app_id="firefox"] move workspace $W3; workspace $W3; border none 125 | for_window [app_id="keepassxc"] move workspace $W9; workspace $W9; border none 126 | 127 | # Switch to workspace 128 | bindsym $mod+1 workspace $W1 129 | bindsym $mod+2 workspace $W2 130 | bindsym $mod+3 workspace $W3 131 | bindsym $mod+4 workspace $W4 132 | bindsym $mod+5 workspace $W5 133 | bindsym $mod+6 workspace $W6 134 | bindsym $mod+7 workspace $W7 135 | bindsym $mod+8 workspace $W8 136 | bindsym $mod+9 workspace $W9 137 | bindsym $mod+0 workspace $W10 138 | # Move focused container to workspace 139 | bindsym $mod+Shift+1 move container to workspace $W1 140 | bindsym $mod+Shift+2 move container to workspace $W2 141 | bindsym $mod+Shift+3 move container to workspace $W3 142 | bindsym $mod+Shift+4 move container to workspace $W4 143 | bindsym $mod+Shift+5 move container to workspace $W5 144 | bindsym $mod+Shift+6 move container to workspace $W6 145 | bindsym $mod+Shift+7 move container to workspace $W7 146 | bindsym $mod+Shift+8 move container to workspace $W8 147 | bindsym $mod+Shift+9 move container to workspace $W9 148 | bindsym $mod+Shift+0 move container to workspace $W10 149 | # Note: workspaces can have any name you want, not just numbers. 150 | # We just use 1-10 as the default. 151 | # 152 | # Layout stuff: 153 | # 154 | # You can "split" the current object of your focus with 155 | # $mod+b or $mod+v, for horizontal and vertical splits 156 | # respectively. 157 | bindsym $mod+b splith 158 | bindsym $mod+v splitv 159 | 160 | # Switch the current container between different layout styles 161 | bindsym $mod+s layout stacking 162 | bindsym $mod+w layout tabbed 163 | bindsym $mod+e layout toggle split 164 | 165 | # Make the current focus fullscreen 166 | bindsym $mod+f fullscreen 167 | 168 | # Toggle the current focus between tiling and floating mode 169 | bindsym $mod+Shift+space floating toggle 170 | 171 | # Swap focus between the tiling area and the floating area 172 | bindsym $mod+space focus mode_toggle 173 | 174 | # Move focus to the parent container 175 | bindsym $mod+a focus parent 176 | # 177 | # Scratchpad: 178 | # 179 | # Sway has a "scratchpad", which is a bag of holding for windows. 180 | # You can send windows there and get them back later. 181 | 182 | # Move the currently focused window to the scratchpad 183 | bindsym $mod+Shift+minus move scratchpad 184 | 185 | # Show the next scratchpad window or hide the focused scratchpad window. 186 | # If there are multiple scratchpad windows, this command cycles through them. 187 | bindsym $mod+minus scratchpad show 188 | 189 | # 190 | # Resizing containers: 191 | # 192 | mode "resize" { 193 | # left will shrink the containers width 194 | # right will grow the containers width 195 | # up will shrink the containers height 196 | # down will grow the containers height 197 | bindsym $left resize shrink width 10px 198 | bindsym $down resize grow height 10px 199 | bindsym $up resize shrink height 10px 200 | bindsym $right resize grow width 10px 201 | 202 | # Ditto, with arrow keys 203 | bindsym Left resize shrink width 10px 204 | bindsym Down resize grow height 10px 205 | bindsym Up resize shrink height 10px 206 | bindsym Right resize grow width 10px 207 | 208 | # Return to default mode 209 | bindsym Return mode "default" 210 | bindsym Escape mode "default" 211 | } 212 | bindsym $mod+r mode "resize" 213 | 214 | # 215 | # Power Button 216 | # 217 | set $pplock 'swayphone_power_sleep' 218 | set $ppunlock 'swayphone_power_wakeup' 219 | set $lockapp swaylock 220 | set $lock '$lockapp -f -c 555555' 221 | set $unlock 'killall $lockapp' 222 | ## wish this worked... 223 | #bindsym XF86PowerOff exec $lock 224 | #bindsym --locked XF86PowerOff exec $unlock 225 | # alternative: 226 | bindcode 124 exec '$lock ; swayphone_power_presleep' 227 | bindcode --locked 124 exec '$unlock ; swayphone_power_wakeup' 228 | 229 | exec swayidle -w \ 230 | timeout 30 'pptk-backlight set_percent 10' \ 231 | resume 'swayphone_power_wakeup' \ 232 | timeout 60 'swayphone_power_rest' \ 233 | resume 'swayphone_power_wakeup' \ 234 | timeout 120 'swayphone_power_sleep' \ 235 | before-sleep 'swayphone_power_presleep' \ 236 | after-resume 'killall swaylock; swayphone_power_wakeup' \ 237 | unlock 'killall swaylock' 238 | 239 | # Scale the touchscreen LCD UI 240 | output DSI-1 scale 2 241 | 242 | # Bind input and output for correct rotation support 243 | input 1046:4097:Goodix_Capacitive_TouchScreen map_to_output DSI-1 244 | #output DSI-1 transform 90 245 | output DSI-1 transform 0 246 | 247 | # Display rotation daemon 248 | exec 'rot8 --display DSI-1 --threshold 0.97 --x-file /sys/bus/iio/devices/iio:device2/in_accel_y_raw --y-file /sys/bus/iio/devices/iio:device2/in_accel_x_raw --y-invert --on-change swayphone_rotated' 249 | 250 | # Keyboard 251 | exec squeekboard 252 | 253 | # Gesture detection 254 | exec lisgd \ 255 | -g "1,l,r, false" \ 256 | -g "1,r,l, false" \ 257 | -g "1,u,d, false" \ 258 | -g "1,d,u, false" \ 259 | -g "2,l,r, swaymsg workspace prev" \ 260 | -g "2,r,l, swaymsg workspace next" \ 261 | -g "2,u,d, swaymsg exec swayphone_keyboard_hide" \ 262 | -g "2,d,u, swaymsg exec swayphone_keyboard_show" \ 263 | -g "2,l,u, swaymsg fullscreen" \ 264 | -g "2,r,d, swaymsg kill" \ 265 | -g "3,l,r, swaymsg focus right" \ 266 | -g "3,r,l, swaymsg focus left" \ 267 | -g "3,u,d, swaymsg focus down" \ 268 | -g "3,d,u, swaymsg focus up" \ 269 | -g "4,l,r, swaymsg move right" \ 270 | -g "4,r,l, swaymsg move left" \ 271 | -g "4,u,d, swaymsg move down" \ 272 | -g "4,d,u, swaymsg move up" 273 | 274 | # Status Bar 275 | # side 276 | exec "rm /tmp/sway_rotation" 277 | exec "waybar -c ~/.config/waybar/config_v -b side" 278 | exec "sleep 2 ; kill -10 `pgrep -f 'waybar.*-b side'`" 279 | exec "waybar -c ~/.config/waybar/config_0 -b top" 280 | exec "waybar -c ~/.config/waybar/config_1 -b bottom" 281 | 282 | # Restore backlight 283 | exec 'swayphone_power_wakeup' 284 | 285 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------