awesome-copycats/themes/holo/theme.lua

394 lines
17 KiB
Lua
Raw Normal View History

2013-09-13 21:20:22 +02:00
--[[
Holo Awesome WM theme 3.0
2017-10-07 13:10:43 +02:00
github.com/lcpz
2013-09-13 21:20:22 +02:00
--]]
2013-08-02 19:39:41 +02:00
local gears = require("gears")
local lain = require("lain")
local awful = require("awful")
local wibox = require("wibox")
2019-03-02 19:05:33 +01:00
local dpi = require("beautiful.xresources").apply_dpi
local string, os = string, os
local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility
2013-08-02 19:39:41 +02:00
2017-01-29 17:42:55 +01:00
local theme = {}
theme.default_dir = require("awful.util").get_themes_dir() .. "default"
2017-01-14 18:32:35 +01:00
theme.icon_dir = os.getenv("HOME") .. "/.config/awesome/themes/holo/icons"
theme.wallpaper = os.getenv("HOME") .. "/.config/awesome/themes/holo/wall.png"
theme.font = "Roboto Bold 10"
theme.taglist_font = "Roboto Condensed Regular 8"
theme.fg_normal = "#FFFFFF"
theme.fg_focus = "#0099CC"
theme.bg_focus = "#303030"
theme.bg_normal = "#242424"
theme.fg_urgent = "#CC9393"
theme.bg_urgent = "#006B8E"
2019-03-02 19:05:33 +01:00
theme.border_width = dpi(3)
2017-01-14 18:32:35 +01:00
theme.border_normal = "#252525"
theme.border_focus = "#0099CC"
theme.taglist_fg_focus = "#FFFFFF"
theme.tasklist_bg_normal = "#222222"
theme.tasklist_fg_focus = "#4CB7DB"
2019-03-02 19:05:33 +01:00
theme.menu_height = dpi(20)
theme.menu_width = dpi(160)
theme.menu_icon_size = dpi(32)
2017-01-29 18:23:52 +01:00
theme.awesome_icon = theme.icon_dir .. "/awesome_icon_white.png"
theme.awesome_icon_launcher = theme.icon_dir .. "/awesome_icon.png"
2017-01-14 18:32:35 +01:00
theme.taglist_squares_sel = theme.icon_dir .. "/square_sel.png"
theme.taglist_squares_unsel = theme.icon_dir .. "/square_unsel.png"
theme.spr_small = theme.icon_dir .. "/spr_small.png"
theme.spr_very_small = theme.icon_dir .. "/spr_very_small.png"
theme.spr_right = theme.icon_dir .. "/spr_right.png"
theme.spr_bottom_right = theme.icon_dir .. "/spr_bottom_right.png"
theme.spr_left = theme.icon_dir .. "/spr_left.png"
theme.bar = theme.icon_dir .. "/bar.png"
theme.bottom_bar = theme.icon_dir .. "/bottom_bar.png"
2017-01-29 17:42:55 +01:00
theme.mpdl = theme.icon_dir .. "/mpd.png"
2017-01-14 18:32:35 +01:00
theme.mpd_on = theme.icon_dir .. "/mpd_on.png"
theme.prev = theme.icon_dir .. "/prev.png"
theme.nex = theme.icon_dir .. "/next.png"
theme.stop = theme.icon_dir .. "/stop.png"
theme.pause = theme.icon_dir .. "/pause.png"
theme.play = theme.icon_dir .. "/play.png"
theme.clock = theme.icon_dir .. "/clock.png"
theme.calendar = theme.icon_dir .. "/cal.png"
theme.cpu = theme.icon_dir .. "/cpu.png"
theme.net_up = theme.icon_dir .. "/net_up.png"
theme.net_down = theme.icon_dir .. "/net_down.png"
theme.layout_tile = theme.icon_dir .. "/tile.png"
theme.layout_tileleft = theme.icon_dir .. "/tileleft.png"
theme.layout_tilebottom = theme.icon_dir .. "/tilebottom.png"
theme.layout_tiletop = theme.icon_dir .. "/tiletop.png"
theme.layout_fairv = theme.icon_dir .. "/fairv.png"
theme.layout_fairh = theme.icon_dir .. "/fairh.png"
theme.layout_spiral = theme.icon_dir .. "/spiral.png"
theme.layout_dwindle = theme.icon_dir .. "/dwindle.png"
theme.layout_max = theme.icon_dir .. "/max.png"
theme.layout_fullscreen = theme.icon_dir .. "/fullscreen.png"
theme.layout_magnifier = theme.icon_dir .. "/magnifier.png"
theme.layout_floating = theme.icon_dir .. "/floating.png"
theme.tasklist_plain_task_name = true
theme.tasklist_disable_icon = true
2019-03-02 19:05:33 +01:00
theme.useless_gap = dpi(4)
theme.titlebar_close_button_normal = theme.default_dir.."/titlebar/close_normal.png"
theme.titlebar_close_button_focus = theme.default_dir.."/titlebar/close_focus.png"
theme.titlebar_minimize_button_normal = theme.default_dir.."/titlebar/minimize_normal.png"
theme.titlebar_minimize_button_focus = theme.default_dir.."/titlebar/minimize_focus.png"
theme.titlebar_ontop_button_normal_inactive = theme.default_dir.."/titlebar/ontop_normal_inactive.png"
theme.titlebar_ontop_button_focus_inactive = theme.default_dir.."/titlebar/ontop_focus_inactive.png"
theme.titlebar_ontop_button_normal_active = theme.default_dir.."/titlebar/ontop_normal_active.png"
theme.titlebar_ontop_button_focus_active = theme.default_dir.."/titlebar/ontop_focus_active.png"
theme.titlebar_sticky_button_normal_inactive = theme.default_dir.."/titlebar/sticky_normal_inactive.png"
theme.titlebar_sticky_button_focus_inactive = theme.default_dir.."/titlebar/sticky_focus_inactive.png"
theme.titlebar_sticky_button_normal_active = theme.default_dir.."/titlebar/sticky_normal_active.png"
theme.titlebar_sticky_button_focus_active = theme.default_dir.."/titlebar/sticky_focus_active.png"
theme.titlebar_floating_button_normal_inactive = theme.default_dir.."/titlebar/floating_normal_inactive.png"
theme.titlebar_floating_button_focus_inactive = theme.default_dir.."/titlebar/floating_focus_inactive.png"
theme.titlebar_floating_button_normal_active = theme.default_dir.."/titlebar/floating_normal_active.png"
theme.titlebar_floating_button_focus_active = theme.default_dir.."/titlebar/floating_focus_active.png"
theme.titlebar_maximized_button_normal_inactive = theme.default_dir.."/titlebar/maximized_normal_inactive.png"
theme.titlebar_maximized_button_focus_inactive = theme.default_dir.."/titlebar/maximized_focus_inactive.png"
theme.titlebar_maximized_button_normal_active = theme.default_dir.."/titlebar/maximized_normal_active.png"
theme.titlebar_maximized_button_focus_active = theme.default_dir.."/titlebar/maximized_focus_active.png"
2013-08-02 19:39:41 +02:00
2017-01-29 17:42:55 +01:00
theme.musicplr = string.format("%s -e ncmpcpp", awful.util.terminal)
local markup = lain.util.markup
local blue = "#80CCE6"
local space3 = markup.font("Roboto 3", " ")
-- Clock
local mytextclock = wibox.widget.textclock(markup("#FFFFFF", space3 .. "%H:%M " .. markup.font("Roboto 4", " ")))
mytextclock.font = theme.font
local clock_icon = wibox.widget.imagebox(theme.clock)
local clockbg = wibox.container.background(mytextclock, theme.bg_focus, gears.shape.rectangle)
2019-03-02 19:05:33 +01:00
local clockwidget = wibox.container.margin(clockbg, dpi(0), dpi(3), dpi(5), dpi(5))
2017-01-29 17:42:55 +01:00
-- Calendar
local mytextcalendar = wibox.widget.textclock(markup.fontfg(theme.font, "#FFFFFF", space3 .. "%d %b " .. markup.font("Roboto 5", " ")))
local calendar_icon = wibox.widget.imagebox(theme.calendar)
local calbg = wibox.container.background(mytextcalendar, theme.bg_focus, gears.shape.rectangle)
2019-03-02 19:05:33 +01:00
local calendarwidget = wibox.container.margin(calbg, dpi(0), dpi(0), dpi(5), dpi(5))
2018-09-14 21:24:48 +02:00
theme.cal = lain.widget.cal({
2017-01-29 17:42:55 +01:00
attach_to = { mytextclock, mytextcalendar },
notification_preset = {
fg = "#FFFFFF",
bg = theme.bg_normal,
position = "bottom_right",
font = "Monospace 10"
}
})
2018-09-17 21:35:27 +02:00
-- Mail IMAP check
--[[ to be set before use
2018-09-17 21:35:27 +02:00
theme.mail = lain.widget.imap({
2017-01-29 17:42:55 +01:00
timeout = 180,
server = "server",
mail = "mail",
password = "keyring get mail",
settings = function()
mail_notification_preset.fg = "#FFFFFF"
mail = ""
count = ""
if mailcount > 0 then
mail = "Mail "
count = mailcount .. " "
end
widget:set_markup(markup.font(theme.font, markup(blue, mail) .. markup("#FFFFFF", count)))
end
})
--]]
-- MPD
local mpd_icon = awful.widget.launcher({ image = theme.mpdl, command = theme.musicplr })
local prev_icon = wibox.widget.imagebox(theme.prev)
local next_icon = wibox.widget.imagebox(theme.nex)
local stop_icon = wibox.widget.imagebox(theme.stop)
local pause_icon = wibox.widget.imagebox(theme.pause)
local play_pause_icon = wibox.widget.imagebox(theme.play)
2017-02-08 14:16:12 +01:00
theme.mpd = lain.widget.mpd({
2017-01-29 17:42:55 +01:00
settings = function ()
if mpd_now.state == "play" then
mpd_now.artist = mpd_now.artist:upper():gsub("&.-;", string.lower)
mpd_now.title = mpd_now.title:upper():gsub("&.-;", string.lower)
widget:set_markup(markup.font("Roboto 4", " ")
.. markup.font(theme.taglist_font,
" " .. mpd_now.artist
.. " - " ..
mpd_now.title .. " ") .. markup.font("Roboto 5", " "))
play_pause_icon:set_image(theme.pause)
elseif mpd_now.state == "pause" then
widget:set_markup(markup.font("Roboto 4", " ") ..
markup.font(theme.taglist_font, " MPD PAUSED ") ..
markup.font("Roboto 5", " "))
play_pause_icon:set_image(theme.play)
else
widget:set_markup("")
play_pause_icon:set_image(theme.play)
end
end
})
local musicbg = wibox.container.background(theme.mpd.widget, theme.bg_focus, gears.shape.rectangle)
2019-03-02 19:05:33 +01:00
local musicwidget = wibox.container.margin(musicbg, dpi(0), dpi(0), dpi(5), dpi(5))
2017-01-29 17:42:55 +01:00
musicwidget:buttons(my_table.join(awful.button({ }, 1,
2017-01-29 17:42:55 +01:00
function () awful.spawn(theme.musicplr) end)))
prev_icon:buttons(my_table.join(awful.button({}, 1,
2017-01-29 17:42:55 +01:00
function ()
2018-08-03 11:29:32 +02:00
os.execute("mpc prev")
theme.mpd.update()
2017-01-29 17:42:55 +01:00
end)))
next_icon:buttons(my_table.join(awful.button({}, 1,
2017-01-29 17:42:55 +01:00
function ()
2018-08-03 11:29:32 +02:00
os.execute("mpc next")
theme.mpd.update()
2017-01-29 17:42:55 +01:00
end)))
stop_icon:buttons(my_table.join(awful.button({}, 1,
2017-01-29 17:42:55 +01:00
function ()
play_pause_icon:set_image(theme.play)
2018-08-03 11:29:32 +02:00
os.execute("mpc stop")
theme.mpd.update()
2017-01-29 17:42:55 +01:00
end)))
play_pause_icon:buttons(my_table.join(awful.button({}, 1,
2017-01-29 17:42:55 +01:00
function ()
2018-08-03 11:29:32 +02:00
os.execute("mpc toggle")
theme.mpd.update()
2017-01-29 17:42:55 +01:00
end)))
-- Battery
2017-02-08 14:16:12 +01:00
local bat = lain.widget.bat({
2017-01-29 17:42:55 +01:00
settings = function()
bat_header = " Bat "
bat_p = bat_now.perc .. " "
if bat_now.ac_status == 1 then
bat_p = bat_p .. "Plugged "
end
widget:set_markup(markup.font(theme.font, markup(blue, bat_header) .. bat_p))
end
})
2018-02-16 17:56:03 +01:00
2018-09-17 21:35:27 +02:00
-- / fs
--[[ commented because it needs Gio/Glib >= 2.54
2017-02-08 14:16:12 +01:00
theme.fs = lain.widget.fs({
2018-02-16 17:56:03 +01:00
notification_preset = { bg = theme.bg_normal, font = "Monospace 9" },
2017-01-29 17:42:55 +01:00
})
2018-09-17 21:35:27 +02:00
--]]
2017-01-29 17:42:55 +01:00
-- ALSA volume bar
2017-02-08 14:16:12 +01:00
theme.volume = lain.widget.alsabar({
2017-01-29 17:42:55 +01:00
notification_preset = { font = "Monospace 9"},
--togglechannel = "IEC958,3",
2019-03-02 19:05:33 +01:00
width = dpi(80), height = dpi(10), border_width = dpi(0),
2017-01-29 17:42:55 +01:00
colors = {
background = "#383838",
unmute = "#80CCE6",
mute = "#FF9F9F"
},
})
2019-03-02 19:05:33 +01:00
theme.volume.bar.paddings = dpi(0)
theme.volume.bar.margins = dpi(5)
2017-01-29 17:42:55 +01:00
local volumewidget = wibox.container.background(theme.volume.bar, theme.bg_focus, gears.shape.rectangle)
2019-03-02 19:05:33 +01:00
volumewidget = wibox.container.margin(volumewidget, dpi(0), dpi(0), dpi(5), dpi(5))
2017-01-29 17:42:55 +01:00
-- CPU
local cpu_icon = wibox.widget.imagebox(theme.cpu)
2017-02-08 14:16:12 +01:00
local cpu = lain.widget.cpu({
2017-01-29 17:42:55 +01:00
settings = function()
widget:set_markup(space3 .. markup.font(theme.font, "CPU " .. cpu_now.usage
.. "% ") .. markup.font("Roboto 5", " "))
end
})
local cpubg = wibox.container.background(cpu.widget, theme.bg_focus, gears.shape.rectangle)
2019-03-02 19:05:33 +01:00
local cpuwidget = wibox.container.margin(cpubg, dpi(0), dpi(0), dpi(5), dpi(5))
2017-01-29 17:42:55 +01:00
-- Net
local netdown_icon = wibox.widget.imagebox(theme.net_down)
local netup_icon = wibox.widget.imagebox(theme.net_up)
2017-02-08 14:16:12 +01:00
local net = lain.widget.net({
2017-01-29 17:42:55 +01:00
settings = function()
widget:set_markup(markup.font("Roboto 1", " ") .. markup.font(theme.font, net_now.received .. " - "
.. net_now.sent) .. markup.font("Roboto 2", " "))
end
})
local netbg = wibox.container.background(net.widget, theme.bg_focus, gears.shape.rectangle)
2019-03-02 19:05:33 +01:00
local networkwidget = wibox.container.margin(netbg, dpi(0), dpi(0), dpi(5), dpi(5))
2017-01-29 17:42:55 +01:00
-- Weather
--[[ to be set before use
2017-02-08 14:16:12 +01:00
theme.weather = lain.widget.weather({
--APPID =
2017-01-29 17:42:55 +01:00
city_id = 2643743, -- placeholder (London)
notification_preset = { font = "Monospace 9", position = "bottom_right" },
})
--]]
2017-01-29 17:42:55 +01:00
2017-01-29 18:23:52 +01:00
-- Launcher
local mylauncher = awful.widget.button({ image = theme.awesome_icon_launcher })
mylauncher:connect_signal("button::press", function() awful.util.mymainmenu:toggle() end)
2017-01-29 17:42:55 +01:00
-- Separators
local first = wibox.widget.textbox('<span font="Roboto 7"> </span>')
local spr_small = wibox.widget.imagebox(theme.spr_small)
local spr_very_small = wibox.widget.imagebox(theme.spr_very_small)
local spr_right = wibox.widget.imagebox(theme.spr_right)
local spr_bottom_right = wibox.widget.imagebox(theme.spr_bottom_right)
local spr_left = wibox.widget.imagebox(theme.spr_left)
local bar = wibox.widget.imagebox(theme.bar)
local bottom_bar = wibox.widget.imagebox(theme.bottom_bar)
local barcolor = gears.color({
type = "linear",
2019-03-02 19:05:33 +01:00
from = { dpi(32), 0 },
to = { dpi(32), dpi(32) },
2017-01-29 18:23:52 +01:00
stops = { {0, theme.bg_focus}, {0.25, "#505050"}, {1, theme.bg_focus} }
2017-01-29 17:42:55 +01:00
})
function theme.at_screen_connect(s)
-- Quake application
s.quake = lain.util.quake({ app = awful.util.terminal })
-- If wallpaper is a function, call it with the screen
local wallpaper = theme.wallpaper
if type(wallpaper) == "function" then
wallpaper = wallpaper(s)
2017-01-29 17:42:55 +01:00
end
gears.wallpaper.maximized(wallpaper, s, true)
2017-01-29 17:42:55 +01:00
-- Tags
awful.tag(awful.util.tagnames, s, awful.layout.layouts)
-- Create a promptbox for each screen
s.mypromptbox = awful.widget.prompt()
-- Create an imagebox widget which will contains an icon indicating which layout we're using.
-- We need one layoutbox per screen.
s.mylayoutbox = awful.widget.layoutbox(s)
s.mylayoutbox:buttons(my_table.join(
awful.button({}, 1, function () awful.layout.inc( 1) end),
awful.button({}, 2, function () awful.layout.set( awful.layout.layouts[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)))
2017-01-29 17:42:55 +01:00
-- Create a taglist widget
s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, awful.util.taglist_buttons, { bg_focus = barcolor })
mytaglistcont = wibox.container.background(s.mytaglist, theme.bg_focus, gears.shape.rectangle)
2019-03-02 19:05:33 +01:00
s.mytag = wibox.container.margin(mytaglistcont, dpi(0), dpi(0), dpi(5), dpi(5))
2017-01-29 17:42:55 +01:00
-- Create a tasklist widget
s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, awful.util.tasklist_buttons, { bg_focus = theme.bg_focus, shape = gears.shape.rectangle, shape_border_width = 5, shape_border_color = theme.tasklist_bg_normal, align = "center" })
-- Create the wibox
2019-03-02 19:05:33 +01:00
s.mywibox = awful.wibar({ position = "top", screen = s, height = dpi(32) })
2017-01-29 17:42:55 +01:00
-- Add widgets to the wibox
s.mywibox:setup {
layout = wibox.layout.align.horizontal,
{ -- Left widgets
layout = wibox.layout.fixed.horizontal,
first,
s.mytag,
spr_small,
s.mylayoutbox,
spr_small,
s.mypromptbox,
},
nil, -- Middle widget
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
wibox.widget.systray(),
2018-09-17 21:35:27 +02:00
--theme.mail.widget,
2017-01-29 17:42:55 +01:00
--bat.widget,
spr_right,
musicwidget,
bar,
prev_icon,
next_icon,
stop_icon,
play_pause_icon,
bar,
mpd_icon,
bar,
spr_very_small,
volumewidget,
spr_left,
},
}
-- Create the bottom wibox
2019-03-02 19:05:33 +01:00
s.mybottomwibox = awful.wibar({ position = "bottom", screen = s, border_width = dpi(0), height = dpi(32) })
s.borderwibox = awful.wibar({ position = "bottom", screen = s, height = dpi(1), bg = theme.fg_focus, x = dpi(0), y = dpi(33)})
2017-01-29 17:42:55 +01:00
-- Add widgets to the bottom wibox
s.mybottomwibox:setup {
layout = wibox.layout.align.horizontal,
{ -- Left widgets
layout = wibox.layout.fixed.horizontal,
mylauncher,
},
s.mytasklist, -- Middle widget
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
spr_bottom_right,
netdown_icon,
networkwidget,
netup_icon,
bottom_bar,
cpu_icon,
cpuwidget,
bottom_bar,
calendar_icon,
calendarwidget,
bottom_bar,
clock_icon,
clockwidget,
},
}
end
2013-08-02 19:39:41 +02:00
return theme