awesome/core/layout.lua

115 lines
3.5 KiB
Lua

local beautiful = require("beautiful")
local awful = require("awful")
local gears = require("gears")
local wibox = require("wibox")
-- {{{ Wibar
-- Create a wibox for each screen and add it
local 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
-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
screen.connect_signal("property::geometry", set_wallpaper)
-- {{{ Non-widget modules
-- The following modules are not exactly widgets, however they are part of the ui.
-- Load the keybindings list
require("core.widgets.hotkeys_popup")
-- Load the menubar
require("core.widgets.menubar")
-- }}}
awful.screen.connect_for_each_screen(function(s)
-- Wallpaper
set_wallpaper(s)
-- Each screen has its own tag table.
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1])
-- Create a promptbox for each screen
s.mypromptbox = require("core.widgets.prompt")()
require("widgets.stickers")(s)
-- Create an imagebox widget which will contain an icon indicating which layout we're using.
-- Create the taglist
s.mytaglist = require("core.widgets.taglist")(s)
-- We need one layoutbox per screen.
s.mylayoutbox = require("core.widgets.layout_box")(s)
-- Create a tasklist widget
s.mytasklist = require("core.widgets.tasklist")(s)
-- Create the wibox
s.mywibox = awful.wibar({
position = "top",
screen = s,
bg = beautiful.topbar_bg
})
-- Add screen lock
require("widgets.unitybar")(s,{
top_widgets = {
require("widgets.polytasklist")({
vertical = true,
stretch = false,
--constraint = 180,
names = false,
margins = 5
})(s),
},
bottom_widgets = {
require("widgets.polylauncher")({vertical = true})
}
})
-- Add widgets to the wibox
s.mywibox:setup {
layout = wibox.layout.align.horizontal,
{ -- Left widgets
layout = wibox.layout.fixed.horizontal,
require("core.widgets.menu_launcher"),
--require("widgets.polylauncher")({vertical = false}),
s.mytaglist,
s.mypromptbox,
},
-- Middle widget
{
--[[require("widgets.polytasklist")({
vertical = false,
stretch = false,
constraint = 180,
names = true,
margins = 5
})(s),]]
layout = wibox.layout.fixed.horizontal
},
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
awful.widget.keyboardlayout(),
require("widgets.wallpapers")({
screen = s,
path = os.getenv("HOME").."/Pictures/Wallpapers/"
}),
require("widgets.mailbox")({
screen = s,
style = {
rounding = 1
}
}),
wibox.widget.systray(),
require("widgets.volume")({}),
require("widgets.battery")({percentage = true}),
wibox.widget.textclock(),
s.mylayoutbox,
},
}
end)
-- }}}