3 Rainbow Awesome WM theme 2.0
8 local gears = require("gears")
9 local lain = require("lain")
10 local awful = require("awful")
11 local wibox = require("wibox")
12 local dpi = require("beautiful.xresources").apply_dpi
15 local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility
18 theme.default_dir = require("awful.util").get_themes_dir() .. "default"
19 theme.dir = os.getenv("HOME") .. "/.config/awesome/themes/rainbow"
20 theme.wallpaper = theme.dir .. "/wall.png"
21 theme.font = "Terminus 10.5"
22 theme.fg_normal = "#9E9E9E"
23 theme.fg_focus = "#EBEBFF"
24 theme.bg_normal = "#242424"
25 theme.bg_focus = "#242424"
26 theme.fg_urgent = "#000000"
27 theme.bg_urgent = "#FFFFFF"
28 theme.border_width = dpi(1)
29 theme.border_normal = "#242424"
30 theme.border_focus = "#EBEBFF"
31 theme.taglist_fg_focus = "#EDEFFF"
32 theme.taglist_bg_focus = "#242424"
33 theme.menu_height = dpi(16)
34 theme.menu_width = dpi(140)
35 theme.ocol = "<span color='" .. theme.fg_normal .. "'>"
36 theme.tasklist_sticky = theme.ocol .. "[S]</span>"
37 theme.tasklist_ontop = theme.ocol .. "[T]</span>"
38 theme.tasklist_floating = theme.ocol .. "[F]</span>"
39 theme.tasklist_maximized_horizontal = theme.ocol .. "[M] </span>"
40 theme.tasklist_maximized_vertical = ""
41 theme.tasklist_disable_icon = true
42 theme.awesome_icon = theme.dir .."/icons/awesome.png"
43 theme.menu_submenu_icon = theme.dir .."/icons/submenu.png"
44 theme.taglist_squares_sel = theme.dir .. "/icons/square_sel.png"
45 theme.taglist_squares_unsel = theme.dir .. "/icons/square_unsel.png"
46 theme.useless_gap = dpi(8)
47 theme.layout_txt_tile = "[t]"
48 theme.layout_txt_tileleft = "[l]"
49 theme.layout_txt_tilebottom = "[b]"
50 theme.layout_txt_tiletop = "[tt]"
51 theme.layout_txt_fairv = "[fv]"
52 theme.layout_txt_fairh = "[fh]"
53 theme.layout_txt_spiral = "[s]"
54 theme.layout_txt_dwindle = "[d]"
55 theme.layout_txt_max = "[m]"
56 theme.layout_txt_fullscreen = "[F]"
57 theme.layout_txt_magnifier = "[M]"
58 theme.layout_txt_floating = "[*]"
59 theme.titlebar_close_button_normal = theme.default_dir.."/titlebar/close_normal.png"
60 theme.titlebar_close_button_focus = theme.default_dir.."/titlebar/close_focus.png"
61 theme.titlebar_minimize_button_normal = theme.default_dir.."/titlebar/minimize_normal.png"
62 theme.titlebar_minimize_button_focus = theme.default_dir.."/titlebar/minimize_focus.png"
63 theme.titlebar_ontop_button_normal_inactive = theme.default_dir.."/titlebar/ontop_normal_inactive.png"
64 theme.titlebar_ontop_button_focus_inactive = theme.default_dir.."/titlebar/ontop_focus_inactive.png"
65 theme.titlebar_ontop_button_normal_active = theme.default_dir.."/titlebar/ontop_normal_active.png"
66 theme.titlebar_ontop_button_focus_active = theme.default_dir.."/titlebar/ontop_focus_active.png"
67 theme.titlebar_sticky_button_normal_inactive = theme.default_dir.."/titlebar/sticky_normal_inactive.png"
68 theme.titlebar_sticky_button_focus_inactive = theme.default_dir.."/titlebar/sticky_focus_inactive.png"
69 theme.titlebar_sticky_button_normal_active = theme.default_dir.."/titlebar/sticky_normal_active.png"
70 theme.titlebar_sticky_button_focus_active = theme.default_dir.."/titlebar/sticky_focus_active.png"
71 theme.titlebar_floating_button_normal_inactive = theme.default_dir.."/titlebar/floating_normal_inactive.png"
72 theme.titlebar_floating_button_focus_inactive = theme.default_dir.."/titlebar/floating_focus_inactive.png"
73 theme.titlebar_floating_button_normal_active = theme.default_dir.."/titlebar/floating_normal_active.png"
74 theme.titlebar_floating_button_focus_active = theme.default_dir.."/titlebar/floating_focus_active.png"
75 theme.titlebar_maximized_button_normal_inactive = theme.default_dir.."/titlebar/maximized_normal_inactive.png"
76 theme.titlebar_maximized_button_focus_inactive = theme.default_dir.."/titlebar/maximized_focus_inactive.png"
77 theme.titlebar_maximized_button_normal_active = theme.default_dir.."/titlebar/maximized_normal_active.png"
78 theme.titlebar_maximized_button_focus_active = theme.default_dir.."/titlebar/maximized_focus_active.png"
81 theme.layout_txt_cascade = "[cascade]"
82 theme.layout_txt_cascadetile = "[cascadetile]"
83 theme.layout_txt_centerwork = "[centerwork]"
84 theme.layout_txt_termfair = "[termfair]"
85 theme.layout_txt_centerfair = "[centerfair]"
87 local markup = lain.util.markup
88 local white = theme.fg_focus
89 local gray = theme.fg_normal
92 local mytextclock = wibox.widget.textclock(markup(white, " %H:%M "))
93 mytextclock.font = theme.font
96 theme.cal = lain.widget.cal({
97 attach_to = { mytextclock },
98 notification_preset = {
106 --[[ commented because it needs to be set before use
107 theme.mail = lain.widget.imap({
111 password = "keyring get mail",
112 settings = function()
113 mail_notification_preset.fg = white
118 if mailcount > 0 then
120 count = mailcount .. " "
123 widget:set_markup(markup.font(theme.font, markup(gray, mail) .. markup(white, count)))
129 theme.mpd = lain.widget.mpd({
130 settings = function()
131 mpd_notification_preset.fg = white
133 artist = mpd_now.artist .. " "
134 title = mpd_now.title .. " "
136 if mpd_now.state == "pause" then
139 elseif mpd_now.state == "stop" then
144 widget:set_markup(markup.font(theme.font, markup(gray, artist) .. markup(white, title)))
149 --[[ commented because it needs Gio/Glib >= 2.54
150 theme.fs = lain.widget.fs({
151 notification_preset = { fg = white, bg = theme.bg_normal, font = "Terminus 10.5" },
152 settings = function()
153 local fs_header, fs_p = "", ""
155 if fs_now["/home"].percentage >= 90 then
157 fs_p = fs_now["/home"].percentage
160 widget:set_markup(markup.font(theme.font, markup(gray, fs_header) .. markup(white, fs_p)))
166 theme.volume = lain.widget.alsabar({
167 ticks = true, width = dpi(67),
168 notification_preset = { font = theme.font }
170 theme.volume.tooltip.wibox.fg = theme.fg_focus
171 theme.volume.tooltip.wibox.font = theme.font
172 theme.volume.bar:buttons(my_table.join (
173 awful.button({}, 1, function()
174 awful.spawn(string.format("%s -e alsamixer", terminal))
176 awful.button({}, 2, function()
177 os.execute(string.format("%s set %s 100%%", theme.volume.cmd, theme.volume.channel))
178 theme.volume.update()
180 awful.button({}, 3, function()
181 os.execute(string.format("%s set %s toggle", theme.volume.cmd, theme.volume.togglechannel or theme.volume.channel))
182 theme.volume.update()
184 awful.button({}, 4, function()
185 os.execute(string.format("%s set %s 1%%+", theme.volume.cmd, theme.volume.channel))
186 theme.volume.update()
188 awful.button({}, 5, function()
189 os.execute(string.format("%s set %s 1%%-", theme.volume.cmd, theme.volume.channel))
190 theme.volume.update()
193 local volumebg = wibox.container.background(theme.volume.bar, "#585858", gears.shape.rectangle)
194 local volumewidget = wibox.container.margin(volumebg, dpi(7), dpi(7), dpi(5), dpi(5))
197 theme.weather = lain.widget.weather({
198 city_id = 2643743, -- placeholder (London)
199 notification_preset = { font = theme.font, fg = white }
203 local first = wibox.widget.textbox(markup.font("Terminus 4", " "))
204 local spr = wibox.widget.textbox(' ')
206 local function update_txt_layoutbox(s)
207 -- Writes a string representation of the current layout in a textbox widget
208 local txt_l = theme["layout_txt_" .. awful.layout.getname(awful.layout.get(s))] or ""
209 s.mytxtlayoutbox:set_text(txt_l)
212 function theme.at_screen_connect(s)
214 s.quake = lain.util.quake({ app = awful.util.terminal })
216 -- If wallpaper is a function, call it with the screen
217 local wallpaper = theme.wallpaper
218 if type(wallpaper) == "function" then
219 wallpaper = wallpaper(s)
221 gears.wallpaper.maximized(wallpaper, s, true)
224 awful.tag(awful.util.tagnames, s, awful.layout.layouts)
226 -- Create a promptbox for each screen
227 s.mypromptbox = awful.widget.prompt()
230 s.mytxtlayoutbox = wibox.widget.textbox(theme["layout_txt_" .. awful.layout.getname(awful.layout.get(s))])
231 awful.tag.attached_connect_signal(s, "property::selected", function () update_txt_layoutbox(s) end)
232 awful.tag.attached_connect_signal(s, "property::layout", function () update_txt_layoutbox(s) end)
233 s.mytxtlayoutbox:buttons(my_table.join(
234 awful.button({}, 1, function() awful.layout.inc(1) end),
235 awful.button({}, 2, function () awful.layout.set( awful.layout.layouts[1] ) end),
236 awful.button({}, 3, function() awful.layout.inc(-1) end),
237 awful.button({}, 4, function() awful.layout.inc(1) end),
238 awful.button({}, 5, function() awful.layout.inc(-1) end)))
240 -- Create a taglist widget
241 s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, awful.util.taglist_buttons)
243 -- Create a tasklist widget
244 s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, awful.util.tasklist_buttons)
247 s.mywibox = awful.wibar({ position = "top", screen = s, height = dpi(18), bg = theme.bg_normal, fg = theme.fg_normal })
249 -- Add widgets to the wibox
251 layout = wibox.layout.align.horizontal,
253 layout = wibox.layout.fixed.horizontal,
262 s.mytasklist, -- Middle widget
264 layout = wibox.layout.fixed.horizontal,
265 wibox.widget.systray(),