1
0
Fork 0
mirror of https://github.com/lcpz/awesome-copycats.git synced 2024-10-22 20:41:22 +00:00
awesome-copycats/themes/holo/theme.lua

389 lines
17 KiB
Lua
Raw Normal View History

2013-09-13 19:20:22 +00:00
--[[
Holo Awesome WM theme 3.0
2017-10-07 11:10:43 +00:00
github.com/lcpz
2013-09-13 19:20:22 +00:00
--]]
2013-08-02 17:39:41 +00:00
2017-01-29 17:23:52 +00:00
local gears = require("gears")
local lain = require("lain")
local awful = require("awful")
local wibox = require("wibox")
local string = string
local os = { getenv = os.getenv }
2013-08-02 17:39:41 +00:00
2017-01-29 16:42:55 +00:00
local theme = {}
theme.default_dir = require("awful.util").get_themes_dir() .. "default"
2017-01-14 17:32:35 +00: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"
theme.border_width = 3
theme.border_normal = "#252525"
theme.border_focus = "#0099CC"
theme.taglist_fg_focus = "#FFFFFF"
theme.tasklist_bg_normal = "#222222"
theme.tasklist_fg_focus = "#4CB7DB"
theme.menu_height = 20
theme.menu_width = 160
2017-01-29 17:23:52 +00:00
theme.menu_icon_size = 32
theme.awesome_icon = theme.icon_dir .. "/awesome_icon_white.png"
theme.awesome_icon_launcher = theme.icon_dir .. "/awesome_icon.png"
2017-01-14 17:32:35 +00: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 16:42:55 +00:00
theme.mpdl = theme.icon_dir .. "/mpd.png"
2017-01-14 17:32:35 +00: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
theme.useless_gap = 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 17:39:41 +00:00
2017-01-29 16:42:55 +00: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)
local clockwidget = wibox.container.margin(clockbg, 0, 3, 5, 5)
-- 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)
local calendarwidget = wibox.container.margin(calbg, 0, 0, 5, 5)
2017-02-08 13:16:12 +00:00
lain.widget.calendar({
2017-01-29 16:42:55 +00:00
attach_to = { mytextclock, mytextcalendar },
notification_preset = {
fg = "#FFFFFF",
bg = theme.bg_normal,
position = "bottom_right",
font = "Monospace 10"
}
})
--[[ Mail IMAP check
-- commented because it needs to be set before use
2017-02-08 13:16:12 +00:00
local mail = lain.widget.imap({
2017-01-29 16:42:55 +00: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 13:16:12 +00:00
theme.mpd = lain.widget.mpd({
2017-01-29 16:42:55 +00: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)
local musicwidget = wibox.container.margin(musicbg, 0, 0, 5, 5)
musicwidget:buttons(awful.util.table.join(awful.button({ }, 1,
function () awful.spawn(theme.musicplr) end)))
prev_icon:buttons(awful.util.table.join(awful.button({}, 1,
function ()
awful.spawn.with_shell("mpc prev")
theme.mpd.update()
2017-01-29 16:42:55 +00:00
end)))
next_icon:buttons(awful.util.table.join(awful.button({}, 1,
function ()
awful.spawn.with_shell("mpc next")
theme.mpd.update()
2017-01-29 16:42:55 +00:00
end)))
stop_icon:buttons(awful.util.table.join(awful.button({}, 1,
function ()
play_pause_icon:set_image(theme.play)
awful.spawn.with_shell("mpc stop")
theme.mpd.update()
2017-01-29 16:42:55 +00:00
end)))
play_pause_icon:buttons(awful.util.table.join(awful.button({}, 1,
function ()
awful.spawn.with_shell("mpc toggle")
theme.mpd.update()
2017-01-29 16:42:55 +00:00
end)))
-- Battery
--[[
2017-02-08 13:16:12 +00:00
local bat = lain.widget.bat({
2017-01-29 16:42:55 +00: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
})
--]]
--
-- fs
2017-02-08 13:16:12 +00:00
theme.fs = lain.widget.fs({
2017-01-29 16:42:55 +00:00
options = "--exclude-type=tmpfs",
notification_preset = { bg = theme.bg_normal, font = "Monospace 9, " },
})
-- ALSA volume bar
2017-02-08 13:16:12 +00:00
theme.volume = lain.widget.alsabar({
2017-01-29 16:42:55 +00:00
notification_preset = { font = "Monospace 9"},
--togglechannel = "IEC958,3",
width = 80, height = 10, border_width = 0,
colors = {
background = "#383838",
unmute = "#80CCE6",
mute = "#FF9F9F"
},
})
theme.volume.bar.paddings = 0
theme.volume.bar.margins = 5
local volumewidget = wibox.container.background(theme.volume.bar, theme.bg_focus, gears.shape.rectangle)
volumewidget = wibox.container.margin(volumewidget, 0, 0, 5, 5)
-- CPU
local cpu_icon = wibox.widget.imagebox(theme.cpu)
2017-02-08 13:16:12 +00:00
local cpu = lain.widget.cpu({
2017-01-29 16:42:55 +00: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)
local cpuwidget = wibox.container.margin(cpubg, 0, 0, 5, 5)
-- Net
local netdown_icon = wibox.widget.imagebox(theme.net_down)
local netup_icon = wibox.widget.imagebox(theme.net_up)
2017-02-08 13:16:12 +00:00
local net = lain.widget.net({
2017-01-29 16:42:55 +00: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)
local networkwidget = wibox.container.margin(netbg, 0, 0, 5, 5)
-- Weather
2017-02-08 13:16:12 +00:00
theme.weather = lain.widget.weather({
2017-01-29 16:42:55 +00:00
city_id = 2643743, -- placeholder (London)
notification_preset = { font = "Monospace 9", position = "bottom_right" },
})
2017-01-29 17:23:52 +00: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 16:42:55 +00: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",
from = { 32, 0 },
to = { 32, 32 },
2017-01-29 17:23:52 +00:00
stops = { {0, theme.bg_focus}, {0.25, "#505050"}, {1, theme.bg_focus} }
2017-01-29 16:42:55 +00: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 16:42:55 +00:00
end
gears.wallpaper.maximized(wallpaper, s, true)
2017-01-29 16:42:55 +00: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(awful.util.table.join(
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(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)
s.mytag = wibox.container.margin(mytaglistcont, 0, 0, 5, 5)
-- 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
s.mywibox = awful.wibar({ position = "top", screen = s, height = 32 })
-- 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(),
--mail.widget,
--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
s.mybottomwibox = awful.wibar({ position = "bottom", screen = s, border_width = 0, height = 32 })
s.borderwibox = awful.wibar({ position = "bottom", screen = s, height = 1, bg = theme.fg_focus, x = 0, y = 33})
-- 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 17:39:41 +00:00
return theme