Created "core" module
parent
36ee880a0a
commit
f25ff7f8c2
|
@ -1,3 +1,5 @@
|
||||||
|
local layoutmanager = require("core.layouts.layoutmanager")
|
||||||
|
|
||||||
return gears.table.join(
|
return gears.table.join(
|
||||||
awful.key( {"Mod4"}, "j",
|
awful.key( {"Mod4"}, "j",
|
||||||
function ()
|
function ()
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
return {
|
||||||
|
-- When everything is ready, call core.start()
|
||||||
|
start = require("core.start")
|
||||||
|
}
|
|
@ -1,5 +1,3 @@
|
||||||
-- Client layout manager
|
|
||||||
|
|
||||||
local LayoutManager = {
|
local LayoutManager = {
|
||||||
layouts = nil, -- Table of groups
|
layouts = nil, -- Table of groups
|
||||||
-- current state is kept in each tag, as tag.layout.
|
-- current state is kept in each tag, as tag.layout.
|
|
@ -1,6 +1,4 @@
|
||||||
local layoutbox = {}
|
local make = function(screen)
|
||||||
|
|
||||||
layoutbox.make = function(screen)
|
|
||||||
local widget
|
local widget
|
||||||
|
|
||||||
widget = wibox.widget {
|
widget = wibox.widget {
|
||||||
|
@ -35,4 +33,4 @@ layoutbox.make = function(screen)
|
||||||
return widget
|
return widget
|
||||||
end
|
end
|
||||||
|
|
||||||
return layoutbox.make
|
return make
|
|
@ -1,7 +1,7 @@
|
||||||
local shortcuts = {}
|
local shortcuts = {}
|
||||||
|
|
||||||
function shortcuts:new(command, icon)
|
function shortcuts:new(command, icon)
|
||||||
widget = wibox.widget {
|
local widget = wibox.widget {
|
||||||
{
|
{
|
||||||
{ -- Right space
|
{ -- Right space
|
||||||
widget = wibox.widget.separator,
|
widget = wibox.widget.separator,
|
|
@ -0,0 +1,232 @@
|
||||||
|
local function start()
|
||||||
|
local desktop = {
|
||||||
|
widgets = {
|
||||||
|
tasklist = require("core.tasklist"),
|
||||||
|
textclock = require("core.textclock"),
|
||||||
|
keymap = modules.ibus.widgets.ibus,
|
||||||
|
volume = modules.volume.widgets.volume,
|
||||||
|
launcher = modules.launcher.widgets.launcher,
|
||||||
|
shortcut = require("core.shortcut"),
|
||||||
|
|
||||||
|
space = function(size)
|
||||||
|
return wibox.widget {
|
||||||
|
{
|
||||||
|
widget = wibox.widget.separator,
|
||||||
|
color = beautiful.color.transparent,
|
||||||
|
forced_width = beautiful.dpi(size)
|
||||||
|
},
|
||||||
|
layout = wibox.container.background,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
|
||||||
|
|
||||||
|
separator = function(size, margin_h, margin_v)
|
||||||
|
return wibox.widget {
|
||||||
|
{
|
||||||
|
widget = wibox.widget.separator,
|
||||||
|
color = "#FFFFFF55",
|
||||||
|
forced_width = beautiful.dpi(size),
|
||||||
|
thickness = beautiful.dpi(size)
|
||||||
|
},
|
||||||
|
layout = wibox.container.margin,
|
||||||
|
top = beautiful.dpi(margin_v),
|
||||||
|
bottom = beautiful.dpi(margin_v),
|
||||||
|
left = beautiful.dpi(margin_h),
|
||||||
|
right = beautiful.dpi(margin_h)
|
||||||
|
}
|
||||||
|
end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Manages tag grid and widget
|
||||||
|
local tagger = require("core.tagger.tagger")
|
||||||
|
|
||||||
|
-- Makes a layout indicator.
|
||||||
|
-- make_layoutbox(screen) will return a widget for the given screen.
|
||||||
|
local make_layoutbox = require("core.layouts.widget")
|
||||||
|
|
||||||
|
|
||||||
|
-- Load conditional modules
|
||||||
|
if conf.backlight_enabled then
|
||||||
|
desktop.widgets.backlight = modules.backlight.widgets.backlight
|
||||||
|
end
|
||||||
|
if conf.battery_enabled then
|
||||||
|
desktop.widgets.battery = modules.battery.widgets.battery
|
||||||
|
end
|
||||||
|
if conf.mpc_enabled then
|
||||||
|
desktop.widgets.mpc = modules.mpc.widgets.mpc
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- If timed wallpaper is enabled, load timed manager
|
||||||
|
if (type(beautiful.wallpaper) == "table") then
|
||||||
|
desktop.wallpaper = require("desktop.wallpaper")
|
||||||
|
screen.connect_signal("property::geometry", desktop.wallpaper.update)
|
||||||
|
desktop.wallpaper.update()
|
||||||
|
desktop.wallpaper.start()
|
||||||
|
else
|
||||||
|
|
||||||
|
-- Otherwise, set static wallpaper on each screen
|
||||||
|
-- We loop over screens to prevent the wallpaper from being stretched over
|
||||||
|
-- all displays. If, for some reason, you want that to happen, use a single
|
||||||
|
-- call of "gears.wallpaper.maximized(beautiful.wallpaper)" instead of
|
||||||
|
-- this loop.
|
||||||
|
|
||||||
|
for s in screen do
|
||||||
|
gears.wallpaper.maximized(beautiful.wallpaper, s)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Set a timer that will update the tag indicators of all screens.
|
||||||
|
-- Even if we do not want continuous updates, we still need a timer:
|
||||||
|
-- there must be a significant delay (1ish second) before awesome prepares
|
||||||
|
-- all clients
|
||||||
|
desktop.screen_timer = gears.timer {
|
||||||
|
timeout = 2,
|
||||||
|
call_now = false,
|
||||||
|
autostart = true,
|
||||||
|
single_shot = not conf.continuous_tag_updates,
|
||||||
|
|
||||||
|
callback = function()
|
||||||
|
for s in screen do
|
||||||
|
s.tagger:update_widget()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Prepare screens
|
||||||
|
awful.screen.connect_for_each_screen(
|
||||||
|
function(s)
|
||||||
|
-- s: the screen this function is being called for
|
||||||
|
-- Create tag table
|
||||||
|
|
||||||
|
s.tagger = tagger:new(s)
|
||||||
|
|
||||||
|
|
||||||
|
-- Create a promptbox for each s
|
||||||
|
s.mypromptbox = awful.widget.prompt()
|
||||||
|
|
||||||
|
-- Create the bar
|
||||||
|
s.bar = awful.wibar({
|
||||||
|
position = conf.bar_position,
|
||||||
|
screen = s,
|
||||||
|
--bg = "#00000000",
|
||||||
|
bg = beautiful.color.bar.color,
|
||||||
|
border_width = 0,
|
||||||
|
height = beautiful.dpi(conf.bar_height),
|
||||||
|
type = "desktop"
|
||||||
|
})
|
||||||
|
|
||||||
|
s.systray = wibox.widget.systray()
|
||||||
|
s.systraysep = desktop.widgets.separator(2, 5, 3)
|
||||||
|
s.bar:connect_signal("button::press",
|
||||||
|
function(_, _, _, button, mods)
|
||||||
|
|
||||||
|
-- Middle-click
|
||||||
|
if (button == 2) then
|
||||||
|
s.systray.visible = not s.systray.visible
|
||||||
|
s.systraysep.visible = s.systray.visible
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- Create shortcut list from config value
|
||||||
|
if (#conf.bar_shortcuts > 0) then
|
||||||
|
s.shortcuts = {
|
||||||
|
layout = wibox.layout.fixed.horizontal,
|
||||||
|
desktop.widgets.separator(2, 5, 3),
|
||||||
|
desktop.widgets.space(6)
|
||||||
|
}
|
||||||
|
for k, v in pairs(conf.bar_shortcuts) do
|
||||||
|
s.shortcuts[#s.shortcuts + 1] = desktop.widgets.shortcut:new(v[1], v[2])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Assemble left bar widgets
|
||||||
|
|
||||||
|
local rightside = {
|
||||||
|
layout = wibox.layout.fixed.horizontal,
|
||||||
|
spacing = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
rightside = gears.table.join(rightside, {
|
||||||
|
desktop.widgets.space(10),
|
||||||
|
s.systraysep,
|
||||||
|
desktop.widgets.space(10),
|
||||||
|
{
|
||||||
|
s.systray,
|
||||||
|
top = beautiful.dpi(3),
|
||||||
|
bottom = beautiful.dpi(3),
|
||||||
|
left = 0, right = 0,
|
||||||
|
layout = wibox.container.margin,
|
||||||
|
},
|
||||||
|
desktop.widgets.separator(2, 5, 3),
|
||||||
|
desktop.widgets.space(10),
|
||||||
|
})
|
||||||
|
|
||||||
|
if (conf.mpc_enabled) then
|
||||||
|
rightside = gears.table.join(rightside, {
|
||||||
|
desktop.widgets.mpc,
|
||||||
|
desktop.widgets.space(5),
|
||||||
|
desktop.widgets.separator(2, 5, 3),
|
||||||
|
desktop.widgets.space(15),
|
||||||
|
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
rightside = gears.table.join(rightside, {
|
||||||
|
desktop.widgets.textclock,
|
||||||
|
desktop.widgets.space(8),
|
||||||
|
|
||||||
|
desktop.widgets.battery,
|
||||||
|
desktop.widgets.backlight,
|
||||||
|
desktop.widgets.volume,
|
||||||
|
desktop.widgets.space(8),
|
||||||
|
|
||||||
|
desktop.widgets.keymap,
|
||||||
|
desktop.widgets.space(8),
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
s.bar:setup {
|
||||||
|
layout = wibox.container.margin,
|
||||||
|
margins = beautiful.dpi(conf.bar_margin),
|
||||||
|
|
||||||
|
{
|
||||||
|
layout = wibox.layout.align.horizontal,
|
||||||
|
{
|
||||||
|
layout = wibox.layout.fixed.horizontal,
|
||||||
|
|
||||||
|
desktop.widgets.space(8),
|
||||||
|
|
||||||
|
|
||||||
|
desktop.widgets.launcher,
|
||||||
|
|
||||||
|
desktop.widgets.space(18),
|
||||||
|
s.tagger.widget,
|
||||||
|
make_layoutbox(s),
|
||||||
|
|
||||||
|
s.shortcuts,
|
||||||
|
|
||||||
|
desktop.widgets.space(6),
|
||||||
|
desktop.widgets.separator(2, 5, 3),
|
||||||
|
desktop.widgets.space(18),
|
||||||
|
desktop.widgets.tasklist(s),
|
||||||
|
},
|
||||||
|
|
||||||
|
s.mypromptbox,
|
||||||
|
rightside
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
return start
|
|
@ -1,5 +1,7 @@
|
||||||
-- Tag grid manager
|
-- Tag grid manager
|
||||||
|
|
||||||
|
local widget = require("core.tagger.widget")
|
||||||
|
|
||||||
local Tagger = {
|
local Tagger = {
|
||||||
screen = nil, rows = 2, cols = 4
|
screen = nil, rows = 2, cols = 4
|
||||||
}
|
}
|
||||||
|
@ -26,6 +28,8 @@ function Tagger:new(screen)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
t.widget = widget(t)
|
||||||
return t
|
return t
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -53,7 +57,7 @@ function Tagger:setpos(row, col)
|
||||||
self:update_widget()
|
self:update_widget()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Update this tagger's screen's tagindicator
|
-- Update this tagindicator
|
||||||
function Tagger:update_widget()
|
function Tagger:update_widget()
|
||||||
local clients
|
local clients
|
||||||
local tgs = self.screen.tags
|
local tgs = self.screen.tags
|
||||||
|
@ -65,16 +69,16 @@ function Tagger:update_widget()
|
||||||
-- Make that the currently active tag is checked and that all
|
-- Make that the currently active tag is checked and that all
|
||||||
-- others are not.
|
-- others are not.
|
||||||
if (tgs[i].index == self.screen.selected_tag.index) then
|
if (tgs[i].index == self.screen.selected_tag.index) then
|
||||||
self.screen.tagindicators[i].checked = true
|
self.widget.tagindicators[i].checked = true
|
||||||
else
|
else
|
||||||
self.screen.tagindicators[i].checked = false
|
self.widget.tagindicators[i].checked = false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Highlight tags that are not empty
|
-- Highlight tags that are not empty
|
||||||
if (#clients == 0) then
|
if (#clients == 0) then
|
||||||
self.screen.tagindicators[i].border_color = beautiful.color.bar.inactive
|
self.widget.tagindicators[i].border_color = beautiful.color.bar.inactive
|
||||||
else
|
else
|
||||||
self.screen.tagindicators[i].border_color = beautiful.color.bar.active
|
self.widget.tagindicators[i].border_color = beautiful.color.bar.active
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -1,13 +1,11 @@
|
||||||
local tagindicator = {}
|
local make = function(tagger)
|
||||||
|
local widget = {}
|
||||||
tagindicator.make = function(screen)
|
|
||||||
local widget
|
|
||||||
|
|
||||||
-- Create tag tagindicators
|
-- Create tag tagindicators
|
||||||
-- We're using flex.vertical and flex.horizontal layouts because the grid
|
-- We're using flex.vertical and flex.horizontal layouts because the grid
|
||||||
-- layout doesn't expand things properly.
|
-- layout doesn't expand things properly.
|
||||||
screen.tagindicators = {}
|
widget.tagindicators = {}
|
||||||
screen.tagindicator = wibox.widget {
|
widget.tagindicator = wibox.widget {
|
||||||
homogeneous = true,
|
homogeneous = true,
|
||||||
spacing = beautiful.dpi(2),
|
spacing = beautiful.dpi(2),
|
||||||
min_cols_size = 10,
|
min_cols_size = 10,
|
||||||
|
@ -16,9 +14,9 @@ tagindicator.make = function(screen)
|
||||||
}
|
}
|
||||||
|
|
||||||
local tmp_row
|
local tmp_row
|
||||||
for r=1, screen.tagger.rows do
|
for r=1, tagger.rows do
|
||||||
for c=1, screen.tagger.cols do
|
for c=1, tagger.cols do
|
||||||
screen.tagindicators[(c + (screen.tagger.cols * (r - 1)))] = wibox.widget {
|
widget.tagindicators[(c + (tagger.cols * (r - 1)))] = wibox.widget {
|
||||||
checked = false,
|
checked = false,
|
||||||
border_width = beautiful.dpi(2),
|
border_width = beautiful.dpi(2),
|
||||||
paddings = beautiful.dpi(3),
|
paddings = beautiful.dpi(3),
|
||||||
|
@ -30,39 +28,39 @@ tagindicator.make = function(screen)
|
||||||
-- Calculate checkbox size limit
|
-- Calculate checkbox size limit
|
||||||
local cbox_maxsize = beautiful.dpi(conf.bar_height)
|
local cbox_maxsize = beautiful.dpi(conf.bar_height)
|
||||||
cbox_maxsize = cbox_maxsize - (2 * beautiful.dpi(conf.bar_margin))
|
cbox_maxsize = cbox_maxsize - (2 * beautiful.dpi(conf.bar_margin))
|
||||||
cbox_maxsize = cbox_maxsize - (screen.tagger.rows - 1)*(beautiful.dpi(screen.tagindicator.spacing))
|
cbox_maxsize = cbox_maxsize - (tagger.rows - 1)*(beautiful.dpi(widget.tagindicator.spacing))
|
||||||
|
|
||||||
if ((conf.bar_position == "bottom") or (conf.bar_position == "top")) then
|
if ((conf.bar_position == "bottom") or (conf.bar_position == "top")) then
|
||||||
cbox_maxsize = cbox_maxsize / screen.tagger.rows
|
cbox_maxsize = cbox_maxsize / tagger.rows
|
||||||
else
|
else
|
||||||
cbox_maxsize = cbox_maxsize / screen.tagger.cols
|
cbox_maxsize = cbox_maxsize / tagger.cols
|
||||||
end
|
end
|
||||||
|
|
||||||
screen.tagindicator:add_widget_at(
|
widget.tagindicator:add_widget_at(
|
||||||
-- The constraint container is VERY necessary here!
|
-- The constraint container is VERY necessary here!
|
||||||
-- Otherwise, the checkboxes will fill all the height that is available to them.
|
-- Otherwise, the checkboxes will fill all the height that is available to them.
|
||||||
wibox.container.constraint(
|
wibox.container.constraint(
|
||||||
screen.tagindicators[(c + (screen.tagger.cols * (r - 1)))],
|
widget.tagindicators[(c + (tagger.cols * (r - 1)))],
|
||||||
"exact", cbox_maxsize, cbox_maxsize
|
"exact", cbox_maxsize, cbox_maxsize
|
||||||
), r, c)
|
), r, c)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
widget = wibox.widget {
|
widget.widget = wibox.widget {
|
||||||
screen.tagindicator,
|
widget.tagindicator,
|
||||||
layout = wibox.container.background
|
layout = wibox.container.background
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Change background when mouse is over widget
|
-- Change background when mouse is over widget
|
||||||
widget:connect_signal("mouse::enter", function(result)
|
widget.widget:connect_signal("mouse::enter", function(result)
|
||||||
widget.bg = beautiful.color.bar.hover_bg
|
widget.bg = beautiful.color.bar.hover_bg
|
||||||
end)
|
end)
|
||||||
|
|
||||||
widget:connect_signal("mouse::leave", function(result)
|
widget.widget:connect_signal("mouse::leave", function(result)
|
||||||
widget.bg = beautiful.color.transparent
|
widget.bg = beautiful.color.transparent
|
||||||
end)
|
end)
|
||||||
|
|
||||||
return widget
|
return widget
|
||||||
end
|
end
|
||||||
|
|
||||||
return tagindicator.make
|
return make
|
|
@ -2,7 +2,6 @@ local textclock = {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
textclock.widget = wibox.widget {
|
textclock.widget = wibox.widget {
|
||||||
{
|
{
|
||||||
{ -- Right spacer
|
{ -- Right spacer
|
225
desktop/init.lua
225
desktop/init.lua
|
@ -1,225 +0,0 @@
|
||||||
local desktop = {
|
|
||||||
Tagger = require("desktop.tagger"),
|
|
||||||
|
|
||||||
widgets = {
|
|
||||||
tasklist = require("desktop.widgets.tasklist"),
|
|
||||||
textclock = require("desktop.widgets.textclock"),
|
|
||||||
layoutbox = require("desktop.widgets.layoutbox"),
|
|
||||||
keymap = modules.ibus.widgets.ibus,
|
|
||||||
volume = modules.volume.widgets.volume,
|
|
||||||
tagindicator = require("desktop.widgets.tagindicator"),
|
|
||||||
launcher = modules.launcher.widgets.launcher,
|
|
||||||
shortcut = require("desktop.widgets.shortcut"),
|
|
||||||
|
|
||||||
space = function(size)
|
|
||||||
return wibox.widget {
|
|
||||||
{
|
|
||||||
widget = wibox.widget.separator,
|
|
||||||
color = beautiful.color.transparent,
|
|
||||||
forced_width = beautiful.dpi(size)
|
|
||||||
},
|
|
||||||
layout = wibox.container.background,
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
|
|
||||||
|
|
||||||
separator = function(size, margin_h, margin_v)
|
|
||||||
return wibox.widget {
|
|
||||||
{
|
|
||||||
widget = wibox.widget.separator,
|
|
||||||
color = "#FFFFFF55",
|
|
||||||
forced_width = beautiful.dpi(size),
|
|
||||||
thickness = beautiful.dpi(size)
|
|
||||||
},
|
|
||||||
layout = wibox.container.margin,
|
|
||||||
top = beautiful.dpi(margin_v),
|
|
||||||
bottom = beautiful.dpi(margin_v),
|
|
||||||
left = beautiful.dpi(margin_h),
|
|
||||||
right = beautiful.dpi(margin_h)
|
|
||||||
}
|
|
||||||
end
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
-- Load conditional modules
|
|
||||||
if conf.backlight_enabled then
|
|
||||||
desktop.widgets.backlight = modules.backlight.widgets.backlight
|
|
||||||
end
|
|
||||||
if conf.battery_enabled then
|
|
||||||
desktop.widgets.battery = modules.battery.widgets.battery
|
|
||||||
end
|
|
||||||
if conf.mpc_enabled then
|
|
||||||
desktop.widgets.mpc = modules.mpc.widgets.mpc
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- If timed wallpaper is enabled, load timed manager
|
|
||||||
if (type(beautiful.wallpaper) == "table") then
|
|
||||||
desktop.wallpaper = require("desktop.wallpaper")
|
|
||||||
screen.connect_signal("property::geometry", desktop.wallpaper.update)
|
|
||||||
desktop.wallpaper.update()
|
|
||||||
desktop.wallpaper.start()
|
|
||||||
else
|
|
||||||
|
|
||||||
-- Otherwise, set static wallpaper on each screen
|
|
||||||
-- We loop over screens to prevent the wallpaper from being stretched over
|
|
||||||
-- all displays. If, for some reason, you want that to happen, use a single
|
|
||||||
-- call of "gears.wallpaper.maximized(beautiful.wallpaper)" instead of
|
|
||||||
-- this loop.
|
|
||||||
|
|
||||||
for s in screen do
|
|
||||||
gears.wallpaper.maximized(beautiful.wallpaper, s)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Set a timer that will update the tag indicators of all screens.
|
|
||||||
-- Even if we do not want continuous updates, we still need a timer:
|
|
||||||
-- there must be a significant delay (1ish second) before awesome prepares
|
|
||||||
-- all clients
|
|
||||||
desktop.screen_timer = gears.timer {
|
|
||||||
timeout = 2,
|
|
||||||
call_now = false,
|
|
||||||
autostart = true,
|
|
||||||
single_shot = not conf.continuous_tag_updates,
|
|
||||||
|
|
||||||
callback = function()
|
|
||||||
for s in screen do
|
|
||||||
s.tagger:update_widget()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Prepare each screen
|
|
||||||
awful.screen.connect_for_each_screen(
|
|
||||||
function(s)
|
|
||||||
-- s: the screen this function is being called for
|
|
||||||
-- Create tag table
|
|
||||||
|
|
||||||
s.tagger = desktop.Tagger:new(s)
|
|
||||||
desktop.widgets.tagindicator(s)
|
|
||||||
|
|
||||||
|
|
||||||
-- Create a promptbox for each s
|
|
||||||
s.mypromptbox = awful.widget.prompt()
|
|
||||||
|
|
||||||
-- Create the bar
|
|
||||||
s.bar = awful.wibar({
|
|
||||||
position = conf.bar_position,
|
|
||||||
screen = s,
|
|
||||||
--bg = "#00000000",
|
|
||||||
bg = beautiful.color.bar.color,
|
|
||||||
border_width = 0,
|
|
||||||
height = beautiful.dpi(conf.bar_height),
|
|
||||||
type = "desktop"
|
|
||||||
})
|
|
||||||
|
|
||||||
s.systray = wibox.widget.systray()
|
|
||||||
s.systraysep = desktop.widgets.separator(2, 5, 3)
|
|
||||||
s.bar:connect_signal("button::press",
|
|
||||||
function(_, _, _, button, mods)
|
|
||||||
|
|
||||||
-- Middle-click
|
|
||||||
if (button == 2) then
|
|
||||||
s.systray.visible = not s.systray.visible
|
|
||||||
s.systraysep.visible = s.systray.visible
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Create shortcut list from config value
|
|
||||||
if (#conf.bar_shortcuts > 0) then
|
|
||||||
s.shortcuts = {
|
|
||||||
layout = wibox.layout.fixed.horizontal,
|
|
||||||
desktop.widgets.separator(2, 5, 3),
|
|
||||||
desktop.widgets.space(6)
|
|
||||||
}
|
|
||||||
for k, v in pairs(conf.bar_shortcuts) do
|
|
||||||
s.shortcuts[#s.shortcuts + 1] = desktop.widgets.shortcut:new(v[1], v[2])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Assemble left bar widgets
|
|
||||||
|
|
||||||
rightside = {
|
|
||||||
layout = wibox.layout.fixed.horizontal,
|
|
||||||
spacing = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
rightside = gears.table.join(rightside, {
|
|
||||||
desktop.widgets.space(10),
|
|
||||||
s.systraysep,
|
|
||||||
desktop.widgets.space(10),
|
|
||||||
{
|
|
||||||
s.systray,
|
|
||||||
top = beautiful.dpi(3),
|
|
||||||
bottom = beautiful.dpi(3),
|
|
||||||
left = 0, right = 0,
|
|
||||||
layout = wibox.container.margin,
|
|
||||||
},
|
|
||||||
desktop.widgets.separator(2, 5, 3),
|
|
||||||
desktop.widgets.space(10),
|
|
||||||
})
|
|
||||||
|
|
||||||
if (conf.mpc_enabled) then
|
|
||||||
rightside = gears.table.join(rightside, {
|
|
||||||
desktop.widgets.mpc,
|
|
||||||
desktop.widgets.space(5),
|
|
||||||
desktop.widgets.separator(2, 5, 3),
|
|
||||||
desktop.widgets.space(15),
|
|
||||||
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
rightside = gears.table.join(rightside, {
|
|
||||||
desktop.widgets.textclock,
|
|
||||||
desktop.widgets.space(8),
|
|
||||||
|
|
||||||
desktop.widgets.battery,
|
|
||||||
desktop.widgets.backlight,
|
|
||||||
desktop.widgets.volume,
|
|
||||||
desktop.widgets.space(8),
|
|
||||||
|
|
||||||
desktop.widgets.keymap,
|
|
||||||
desktop.widgets.space(8),
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
s.bar:setup {
|
|
||||||
layout = wibox.container.margin,
|
|
||||||
margins = beautiful.dpi(conf.bar_margin),
|
|
||||||
|
|
||||||
{
|
|
||||||
layout = wibox.layout.align.horizontal,
|
|
||||||
{
|
|
||||||
layout = wibox.layout.fixed.horizontal,
|
|
||||||
|
|
||||||
desktop.widgets.space(8),
|
|
||||||
|
|
||||||
|
|
||||||
desktop.widgets.launcher,
|
|
||||||
|
|
||||||
desktop.widgets.space(18),
|
|
||||||
s.tagindicator,
|
|
||||||
desktop.widgets.layoutbox(s),
|
|
||||||
|
|
||||||
s.shortcuts,
|
|
||||||
|
|
||||||
desktop.widgets.space(6),
|
|
||||||
desktop.widgets.separator(2, 5, 3),
|
|
||||||
desktop.widgets.space(18),
|
|
||||||
desktop.widgets.tasklist(s),
|
|
||||||
},
|
|
||||||
|
|
||||||
s.mypromptbox,
|
|
||||||
rightside
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
|
||||||
)
|
|
||||||
|
|
||||||
return desktop
|
|
7
rc.lua
7
rc.lua
|
@ -27,7 +27,7 @@ end
|
||||||
conf = require("conf")
|
conf = require("conf")
|
||||||
|
|
||||||
|
|
||||||
layoutmanager = require("desktop.layoutmanager")
|
layoutmanager = require("core.layouts.layoutmanager")
|
||||||
layoutmanager.layouts = conf.layouts
|
layoutmanager.layouts = conf.layouts
|
||||||
|
|
||||||
bin = require("bin")
|
bin = require("bin")
|
||||||
|
@ -36,6 +36,8 @@ bin = require("bin")
|
||||||
beautiful.init(require("theme"))
|
beautiful.init(require("theme"))
|
||||||
|
|
||||||
|
|
||||||
|
core = require("core")
|
||||||
|
|
||||||
Sound = require("sound")
|
Sound = require("sound")
|
||||||
|
|
||||||
-- Load key bindings
|
-- Load key bindings
|
||||||
|
@ -74,8 +76,6 @@ end
|
||||||
root.keys(keys)
|
root.keys(keys)
|
||||||
root.buttons(buttons)
|
root.buttons(buttons)
|
||||||
|
|
||||||
desktop = require("desktop")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Autostart
|
-- Autostart
|
||||||
|
@ -88,6 +88,7 @@ end
|
||||||
-- when client with a matching name is opened:
|
-- when client with a matching name is opened:
|
||||||
--require("awful.hotkeys_popup.keys")
|
--require("awful.hotkeys_popup.keys")
|
||||||
|
|
||||||
|
core.start()
|
||||||
|
|
||||||
-- Check for errors
|
-- Check for errors
|
||||||
dofile(configuration_dir .. "errors.lua")
|
dofile(configuration_dir .. "errors.lua")
|
||||||
|
|
Loading…
Reference in New Issue