#!/bin/bash
#
# xwinwrap for live video wallpaper on awesomewm 
# *for correct transparency in urxvt, set transparent to false in
# Xresources and set urxvt to start as (utilize transparency from compton):
# urxvt --depth 32 -bg rgba:0000/0000/0000/6666
#
# 1. Installer nødvendige pakker (Ubuntu/Debian)
sudo apt update
sudo apt install git build-essential libx11-dev libxext-dev libxrender-dev

# 2. Klon kildekoden
git clone https://github.com/mmhobi7/xwinwrap.git
cd xwinwrap

# 3. Kompiler og installer
make
sudo make install


# xwinwrap -fs -fdt -ni -b -nf -un -o 1.0 -debug -- mpv -wid WID --loop --no-audio /path/to/your/video.mp4

# test loop a video wallpaper:
# xwinwrap -g 1920x1080+0+0 -ni -s -nf -b -un -ov -fdt -- mpv -wid WID --loop --no-audio --no-osc --no-osd-bar --panscan=1.0 /path/to/video.mp4

# Prevent AwesomeWM from tiling it
#{
#    rule_any = { class = { "xwinwrap", "mpv" }, type = { "desktop" } },
#    properties = {
#        focusable = false,
#        floating = true,
#        below = true,
#        sticky = true,
#        skip_taskbar = true,
#        border_width = 0,
#    },
#    callback = function(c)
#        if c.type == "desktop" then
#            c:lower()
#        end
#    end
#},

# Auto start on login script sh
#!/usr/bin/env bash
#killall -q xwinwrap
#xwinwrap -g 1920x1080+0+0 -ni -s -nf -b -un -ov -fdt -- \
#    mpv -wid WID --x11-name=mpv-bg --loop --no-audio --no-osc --no-osd-bar --panscan=1.0 /path/to/video.mp4 &

# spawn bottom of rc.lua etc
#awful.spawn.with_shell("~/.config/awesome/wallpaper.sh")
# or use the run_once in twily config rc_new
