# Borderless Netflix and YouTube windows on Ubuntu

This post shows two lua scripts to set a specific window size and get rid of the window decorations for youtube and netflix. As an extra I will also include the configurations I use for my terminal.

To perform the tasks descrived above we are going to use Devilspie2. Devilspie2 is a scripting tool that allows to manipulate the windows, changing the size, the window decoration and the position using Lua scripts.

## Installation

To install Devilspi2 is straightforward either from the package manager or a terminal:

sudo apt-get install devilspie2

## Creating the lua scripts

devilspie2 works using lua scripts, you can read a full list of the supported functions on their manual. We are going to use just 4 of them.

First, for the netflix window, create a script called netflix.lua in .config/devilspie2/ containing this:

if (get_window_name()=="Netflix") then
undecorate_window();
-- x position, y position, x width, y width
set_window_geometry(1200, 0, 725, 428);
-- show netflix on every desktop
pin_window();
end

The last option pin_window() is not working on my Ubuntu 16.04 installation, but I still have hope. If you run devilspie2 and then open netflix it wont work, because the website has to load before it sets the window name, but the script picks the name right after the application is opened. We will fix that in the next section.

For YouTube this is my youtube.lua file, again it is located in .config/devislpie2/:

undecorate_window();
-- width, height
set_window_size(866, 544);
-- show youtube on every desktop
pin_window();
end

In this case instead of defining the whole window geometry I just set the window size. Again, some extra tweaking is needed for this to work.

## Launching Netflix and YouTube on Chrome

To open Netflix I created the following shell script called netflix in my bin/ folder:

#!/bin/bash

ps cax | grep "devilspie2" > /dev/null
if [ $? -eq 0 ]; then killall "devilspie2" fi sleep 6s$(devilspie2)

It opens netflix in app mode and checks if devilspie2 is running. If it is it kills the process, afterwards it waits 6 seconds to give time for the website to load then it runs devilspie2.

#!/bin/bash

if [ $? -eq 0 ]; then killall "devilspie2" fi sleep 6s$(devilspie2)