2021-05-25 17:37:29 +02:00
|
|
|
local abutton = require 'awful.button'
|
|
|
|
local atitlebar = require 'awful.titlebar'
|
2021-06-28 19:05:22 +02:00
|
|
|
local beautiful = require 'beautiful'
|
2021-05-25 17:37:29 +02:00
|
|
|
local lalign = require 'wibox.layout.align'
|
|
|
|
local lfixed = require 'wibox.layout.fixed'
|
|
|
|
local lflex = require 'wibox.layout.flex'
|
|
|
|
local naughty = require 'naughty'
|
|
|
|
|
|
|
|
local slots = {}
|
|
|
|
|
2021-09-29 01:48:44 +02:00
|
|
|
function slots.wallpaper(screen)
|
|
|
|
local awallpaper = require 'awful.wallpaper'
|
|
|
|
local beautiful = require 'beautiful'
|
|
|
|
local gcolor = require 'gears.color'
|
|
|
|
local gsurface = require 'gears.surface'
|
|
|
|
local imagebox = require 'wibox.widget.imagebox'
|
|
|
|
local cairo = require('lgi').cairo
|
|
|
|
|
|
|
|
local screen_geo = screen.geometry
|
|
|
|
local source = cairo.ImageSurface(cairo.Format.RGB32, screen_geo.width, screen_geo.height)
|
|
|
|
local cr = cairo.Context(source)
|
|
|
|
|
|
|
|
-- Load base image
|
|
|
|
local image_surface = gsurface.load_uncached(beautiful.wallpaper)
|
|
|
|
local w, h = gsurface.get_size(image_surface)
|
|
|
|
cr:scale(screen_geo.width / w, screen_geo.height / h)
|
|
|
|
cr:set_source_surface(image_surface, 0, 0)
|
|
|
|
cr:paint()
|
|
|
|
|
|
|
|
-- Add color layer
|
|
|
|
local color_pattern = gcolor.create_linear_pattern {
|
|
|
|
from = { 0, 0 },
|
|
|
|
to = { screen.width, screen.height },
|
|
|
|
stops = {
|
|
|
|
{ 0, '#26323840' }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cr:set_source(color_pattern)
|
|
|
|
cr:paint()
|
|
|
|
|
|
|
|
awallpaper {
|
|
|
|
screen = screen,
|
|
|
|
widget = {
|
|
|
|
image = source,
|
|
|
|
widget = imagebox,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2021-05-25 17:37:29 +02:00
|
|
|
function slots.create_tags (screen)
|
2021-06-28 19:05:22 +02:00
|
|
|
local atag = require 'awful.tag'
|
|
|
|
local home_layout = require 'MyTagLayout.home_layout'
|
|
|
|
|
|
|
|
local first_tag = atag.add('home', {
|
|
|
|
screen = screen,
|
|
|
|
icon = beautiful.icon_hometag,
|
|
|
|
layout = home_layout,
|
|
|
|
master_width_factor = beautiful.hometag_master_width_factor
|
|
|
|
})
|
|
|
|
|
|
|
|
first_tag:view_only()
|
2021-05-25 17:37:29 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function slots.build_desktop_decoration (screen)
|
|
|
|
local desktop_bar = require 'rc.ui.desktop_decoration.bar'
|
|
|
|
|
|
|
|
desktop_bar(screen)
|
|
|
|
end
|
|
|
|
|
|
|
|
function slots.build_client_titlebars (client)
|
|
|
|
-- Mouse buttons bindings for the titlebar
|
|
|
|
local buttons = {
|
|
|
|
abutton({}, 1,
|
|
|
|
function ()
|
|
|
|
client:activate { context = 'titlebar', action = 'mouse_move' }
|
|
|
|
end),
|
|
|
|
abutton({}, 3,
|
|
|
|
function ()
|
|
|
|
client:activate { context = 'titlebar', action = 'mouse_resize' }
|
|
|
|
end),
|
|
|
|
}
|
|
|
|
|
|
|
|
-- Titlebar UI
|
|
|
|
atitlebar(client).widget = {
|
|
|
|
{ -- Left
|
|
|
|
atitlebar.widget.iconwidget(client),
|
|
|
|
buttons = buttons,
|
|
|
|
layout = lfixed.horizontal
|
|
|
|
},
|
|
|
|
{ -- Middle
|
|
|
|
{ -- Title
|
|
|
|
align = 'center',
|
|
|
|
widget = atitlebar.widget.titlewidget(client)
|
|
|
|
},
|
|
|
|
buttons = buttons,
|
|
|
|
layout = lflex.horizontal
|
|
|
|
},
|
|
|
|
{ -- Right
|
|
|
|
atitlebar.widget.floatingbutton(client),
|
|
|
|
atitlebar.widget.maximizedbutton(client),
|
|
|
|
atitlebar.widget.stickybutton(client),
|
|
|
|
atitlebar.widget.ontopbutton(client),
|
|
|
|
atitlebar.widget.closebutton(client),
|
|
|
|
layout = lfixed.horizontal()
|
|
|
|
},
|
|
|
|
layout = lalign.horizontal
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
function slots.naughty_display (notification)
|
|
|
|
naughty.layout.box { notification = notification }
|
|
|
|
end
|
|
|
|
|
|
|
|
return slots
|