-
-
Save davidrios/535c43cbaafe6be665b7c6bd345ea6f4 to your computer and use it in GitHub Desktop.
#!/bin/bash | |
set -e | |
if [ $(id -u) -eq 0 ]; then | |
echo 'Please execute this script as a regular user.' | |
exit 1 | |
fi | |
which sudo >/dev/null | |
if [ $? -ne 0 ]; then | |
echo 'An installation with sudo is required.' | |
exit 1 | |
fi | |
function reconfig_meson() { | |
if [ -d build ]; then | |
sudo rm -r build/meson-logs | |
meson build --wipe | |
else | |
meson build | |
fi | |
} | |
echo 'Enabling contrib and non-free repositories' | |
sudo sed -i -e 's/main$/main contrib non-free/g' /etc/apt/sources.list | |
sudo apt update | |
mkdir -p ~/sway-src | |
echo 'Installing wlroots...' | |
sudo apt install -y build-essential cmake meson libwayland-dev wayland-protocols \ | |
libegl1-mesa-dev libgles2-mesa-dev libdrm-dev libgbm-dev libinput-dev \ | |
libxkbcommon-dev libudev-dev libpixman-1-dev libsystemd-dev libcap-dev \ | |
libxcb1-dev libxcb-composite0-dev libxcb-xfixes0-dev libxcb-xinput-dev \ | |
libxcb-image0-dev libxcb-render-util0-dev libx11-xcb-dev libxcb-icccm4-dev \ | |
freerdp2-dev libwinpr2-dev libpng-dev libavutil-dev libavcodec-dev \ | |
libavformat-dev universal-ctags git | |
cd ~/sway-src | |
[ ! -d wlroots ] && git clone https://github.com/swaywm/wlroots.git | |
cd wlroots | |
git fetch | |
git checkout 0.7.0 | |
reconfig_meson | |
ninja -C build | |
sudo ninja -C build install | |
sudo ldconfig | |
echo 'Installing json-c...' | |
sudo apt install -y autoconf libtool | |
cd ~/sway-src | |
[ ! -d json-c ] && git clone https://github.com/json-c/json-c.git | |
cd json-c | |
git fetch | |
git checkout json-c-0.13.1-20180305 | |
sh autogen.sh | |
./configure --enable-threading --prefix=/usr/local | |
CPUCOUNT=$(grep processor /proc/cpuinfo | wc -l) | |
make -j$CPUCOUNT | |
sudo make install | |
sudo ldconfig | |
echo 'Installing scdoc' | |
cd ~/sway-src | |
[ ! -d scdoc ] && git clone https://git.sr.ht/~sircmpwn/scdoc | |
cd scdoc | |
git fetch | |
git checkout 1.9.7 | |
make PREFIX=/usr/local -j$CPUCOUNT | |
sudo make PREFIX=/usr/local install | |
echo 'Installing sway' | |
sudo apt install -y libpcre3-dev libcairo2-dev libpango1.0-dev libgdk-pixbuf2.0-dev xwayland | |
cd ~/sway-src | |
[ ! -d sway ] && git clone https://github.com/swaywm/sway.git | |
cd sway | |
git fetch | |
git checkout 1.2 | |
reconfig_meson | |
ninja -C build | |
sudo ninja -C build install | |
echo 'Installing swaybg' | |
cd ~/sway-src | |
[ ! -d swaybg ] && git clone https://github.com/swaywm/swaybg.git | |
cd swaybg | |
git fetch | |
git checkout 1.0 | |
reconfig_meson | |
ninja -C build | |
sudo ninja -C build install | |
read -p "Do you wish to install kitty, a wayland terminal emulator, and configure it as default for Sway? (Or else you won't be able to do anything after entering Sway) " -n 1 -r | |
echo | |
if [[ $REPLY =~ ^[Yy]$ ]]; then | |
sudo apt install -y curl xz-utils libcanberra0 libxcb-xkb1 | |
sudo mkdir -p /opt/kitty | |
curl -L https://github.com/kovidgoyal/kitty/releases/download/v0.14.4/kitty-0.14.4-x86_64.txz | sudo tar xvJ -C /opt/kitty | |
sudo ln -sf /opt/kitty/bin/kitty /usr/local/bin | |
sudo sed -i -e 's/urxvt/kitty/g' /usr/local/etc/sway/config | |
fi | |
echo 'All set, now you should be able to just execute "sway" from a tty.' | |
echo 'The default key combination for opening a terminal in Sway is <WinKey>+<Enter>' |
Please update the version:
wlroots 0.7.0
scdoc 1.9.7
sway 1.2
kitty 0.14.3
@tristanvvatson 👍 I removed the check for Debian, I guess it's not really necessary.
@beli3ver Updated. I see you updated the wiki, thanks man!
Please add in the main packages installation xwayland
Else the urxvt is not working anymore: swaywm/sway#3651 (comment)
Maybe you can add this too:
read -p "Do you wish to install mako, a lightweight notification daemon for Wayland? " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
cd ~/sway-src
git clone https://github.com/emersion/mako
cd mako
meson build
ninja -C build
sudo ninja -C build install
echo "##########################################"
echo
echo "Please add following line to you sway config:"
echo
echo "exec mako --anchor bottom-right"
echo
echo "##########################################"
fi
@beli3ver I added xwayland and two more libraries that are necessary for kitty to work.
As for the suggestion to include mako, that is out of the scope of this script, which is to setup a minimal sway installation.
I had a wiki page with instructions for some extras, including mako, but the Sway maitainers removed it. Here is a copy if you are interested: https://gist.github.com/davidrios/c1f053fe4525e2cd36995058493b3cda
Update please:
wlroots 0.8.1
kitty 0.15.0
For wlroots you need now:
libelogind-dev
libxcb-util0-dev
Dangerous command when there a different repos in that file:
sudo sed -i -e 's/main$/main contrib non-free/g' /etc/apt/sources.list
wouldn't it be safer to use something like apt-add-repository non-free
instead of sed
replacement?
Not sure how long this script will be maintained, but I appreciated it. I had to add this one line patch on my compile:
swaywm/wlroots@d5e68ef
I can confirm that minus the check for Debian (see lines 9-12) that this works for Ubuntu 19.04. Thanks or the effort!