Restructure wibar such that its layout is per-theme now

This commit is contained in:
yosh 2022-10-24 23:57:36 -04:00
parent fd9ee1a308
commit 5e9744472e
8 changed files with 182 additions and 14 deletions

View File

@ -16,15 +16,16 @@ The structure is setup as such:
- defs - global definitions
- layouts.lua - define the layout table
- rules.lua - define client rules
- tags.lua - define the tags
- theme.lua - define the theme
- vars.lua - define misc. variables
- ui - ui modules
- wibar - configure the wibar
- init.lua - actually builds the wibar
- widgets.lua - misc. widgets defined outside of `screen.connect_signal`
- menubar.lua - configure the menubar
- notifications.lua - configure notifications
- promptmenu.lua - configure the prompt menu
- titlebars.lua - configure window titlebars
- widgets.lua - misc. widgets
- themes - use themes
- note: I made wallpapers go by a per-theme basis. wallpaper.lua in the theme directory will get loaded, and the wallpaper image is defined there
- wibar.lua - configure the wibar layout
- wallpaper.lua - configure the wallpaper
- wallpapers and wibars are loaded per-theme

13
defs/tags.lua Normal file
View File

@ -0,0 +1,13 @@
local awful = require("awful")
local tag_names = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }
-- this is a very basic tag implementation
-- for more fine-grained tag defaults, look at the documentation for awful.tag.add
screen.connect_signal("request::desktop_decoration", function(s)
awful.tag(
tag_names,
s,
awful.layout.layouts[1]
)
end)

View File

@ -6,5 +6,6 @@ theme = "default"
beautiful.init(gears.filesystem.get_themes_dir() .. theme .. "/theme.lua")
-- per-theme wallpaper config
-- per-theme wallpaper and bar config
require("themes." .. theme .. ".wallpaper")
require("themes." .. theme .. ".wibar")

4
rc.lua
View File

@ -23,14 +23,12 @@ end)
require("defs.vars")
require("defs.theme")
require("defs.layouts")
require("defs.tags")
-- Load menus
require("ui.promptmenu")
require("ui.menubar")
-- Load Wibar
require("ui.wibar")
-- Load bindings
require("bindings.mouse")
require("bindings.key")

View File

@ -1,14 +1,9 @@
local awful = require("awful")
local wibox = require("wibox")
require("ui.wibar.widgets")
local tag_names = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }
require("ui.widgets")
screen.connect_signal("request::desktop_decoration", function(s)
-- Each screen has its own tag table.
awful.tag(tag_names, s, awful.layout.layouts[1])
-- Create a promptbox for each screen
s.mypromptbox = awful.widget.prompt()

80
themes/sky/wibar.lua Normal file
View File

@ -0,0 +1,80 @@
local awful = require("awful")
local wibox = require("wibox")
require("ui.widgets")
screen.connect_signal("request::desktop_decoration", function(s)
-- Create a promptbox for each screen
s.mypromptbox = awful.widget.prompt()
-- Create an imagebox widget which will contain an icon indicating which layout we're using.
-- We need one layoutbox per screen.
s.mylayoutbox = awful.widget.layoutbox {
screen = s,
buttons = {
awful.button({ }, 1, function () awful.layout.inc( 1) end),
awful.button({ }, 3, function () awful.layout.inc(-1) end),
awful.button({ }, 4, function () awful.layout.inc(-1) end),
awful.button({ }, 5, function () awful.layout.inc( 1) end),
}
}
-- Create a taglist widget
s.mytaglist = awful.widget.taglist {
screen = s,
filter = awful.widget.taglist.filter.all,
buttons = {
awful.button({ }, 1, function(t) t:view_only() end),
awful.button({ modkey }, 1, function(t)
if client.focus then
client.focus:move_to_tag(t)
end
end),
awful.button({ }, 3, awful.tag.viewtoggle),
awful.button({ modkey }, 3, function(t)
if client.focus then
client.focus:toggle_tag(t)
end
end),
awful.button({ }, 4, function(t) awful.tag.viewprev(t.screen) end),
awful.button({ }, 5, function(t) awful.tag.viewnext(t.screen) end),
}
}
-- Create a tasklist widget
s.mytasklist = awful.widget.tasklist {
screen = s,
filter = awful.widget.tasklist.filter.currenttags,
buttons = {
awful.button({ }, 1, function (c)
c:activate { context = "tasklist", action = "toggle_minimization" }
end),
awful.button({ }, 3, function() awful.menu.client_list { theme = { width = 250 } } end),
awful.button({ }, 4, function() awful.client.focus.byidx(-1) end),
awful.button({ }, 5, function() awful.client.focus.byidx( 1) end),
}
}
-- Create the wibox
s.mywibox = awful.wibar {
position = "top",
screen = s,
widget = {
layout = wibox.layout.align.horizontal,
{ -- Left widgets
layout = wibox.layout.fixed.horizontal,
mylauncher,
s.mytaglist,
s.mypromptbox,
},
s.mytasklist, -- Middle widget
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
mykeyboardlayout,
wibox.widget.systray(),
mytextclock,
s.mylayoutbox,
},
}
}
end)

80
themes/zenburn/wibar.lua Normal file
View File

@ -0,0 +1,80 @@
local awful = require("awful")
local wibox = require("wibox")
require("ui.widgets")
screen.connect_signal("request::desktop_decoration", function(s)
-- Create a promptbox for each screen
s.mypromptbox = awful.widget.prompt()
-- Create an imagebox widget which will contain an icon indicating which layout we're using.
-- We need one layoutbox per screen.
s.mylayoutbox = awful.widget.layoutbox {
screen = s,
buttons = {
awful.button({ }, 1, function () awful.layout.inc( 1) end),
awful.button({ }, 3, function () awful.layout.inc(-1) end),
awful.button({ }, 4, function () awful.layout.inc(-1) end),
awful.button({ }, 5, function () awful.layout.inc( 1) end),
}
}
-- Create a taglist widget
s.mytaglist = awful.widget.taglist {
screen = s,
filter = awful.widget.taglist.filter.all,
buttons = {
awful.button({ }, 1, function(t) t:view_only() end),
awful.button({ modkey }, 1, function(t)
if client.focus then
client.focus:move_to_tag(t)
end
end),
awful.button({ }, 3, awful.tag.viewtoggle),
awful.button({ modkey }, 3, function(t)
if client.focus then
client.focus:toggle_tag(t)
end
end),
awful.button({ }, 4, function(t) awful.tag.viewprev(t.screen) end),
awful.button({ }, 5, function(t) awful.tag.viewnext(t.screen) end),
}
}
-- Create a tasklist widget
s.mytasklist = awful.widget.tasklist {
screen = s,
filter = awful.widget.tasklist.filter.currenttags,
buttons = {
awful.button({ }, 1, function (c)
c:activate { context = "tasklist", action = "toggle_minimization" }
end),
awful.button({ }, 3, function() awful.menu.client_list { theme = { width = 250 } } end),
awful.button({ }, 4, function() awful.client.focus.byidx(-1) end),
awful.button({ }, 5, function() awful.client.focus.byidx( 1) end),
}
}
-- Create the wibox
s.mywibox = awful.wibar {
position = "top",
screen = s,
widget = {
layout = wibox.layout.align.horizontal,
{ -- Left widgets
layout = wibox.layout.fixed.horizontal,
mylauncher,
s.mytaglist,
s.mypromptbox,
},
s.mytasklist, -- Middle widget
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
mykeyboardlayout,
wibox.widget.systray(),
mytextclock,
s.mylayoutbox,
},
}
}
end)