local gears = require("gears")
local beautiful = require("beautiful")
local awful = require("awful")
local wibox = require("wibox")

beautiful.init(gears.filesystem.get_configuration_dir() .. "theme/default/theme.lua")
beautiful.font = "Ubuntu Sans 11"
beautiful.useless_gap = 7
beautiful.gap_single_client = true

local theme = "nordic_firewatch"
beautiful.wallpaper = "/home/nick/Pictures/wallpapers/" .. theme .. "/wallpaper.png"
local cutout = "/home/nick/Pictures/wallpapers/" .. theme .. "/cutout.png"

function set_wallpaper(s)
    -- Wallpaper
    if beautiful.wallpaper then
        local wallpaper = beautiful.wallpaper
        -- If wallpaper is a function, call it with the screen
        if type(wallpaper) == "function" then
            wallpaper = wallpaper(s)
        end
        gears.wallpaper.maximized(wallpaper, s, true)
    end
end

local bling = require("extras.bling")

awful.layout.layouts = {
    awful.layout.suit.tile,
    awful.layout.suit.fair,
    awful.layout.suit.tile.bottom,
    bling.layout.centered,
    awful.layout.suit.spiral.dwindle,
    bling.layout.equalarea,
    awful.layout.suit.corner.nw,
    awful.layout.suit.floating
}

-- Wallpaper cutout
local imgbox = wibox({
    type = "desktop",
    width = 2560,
    height = 1600,
    x = 0,
    y = 0,
    visible = true,
    focusable = false,
    opacity = 1,
    bg = "#00000000",
})
imgbox:setup{
    layout = wibox.layout.fixed.vertical,
    {
        widget = wibox.widget.imagebox,
        image = cutout,
    }
}

-- Launch conky if theme is nordic_legion
if theme == "nordic_legion" then
    awful.spawn.with_shell("killall conky; conky -c /home/nick/.config/conky/conky_left.conf; conky -c /home/nick/.config/conky/conky_right.conf")
end