2015-05-14 22:57:22 +02:00
|
|
|
---------------------------------------------
|
|
|
|
-- Awesome theme which follows xrdb config --
|
|
|
|
-- by Yauhen Kirylau --
|
|
|
|
---------------------------------------------
|
|
|
|
|
2017-01-14 04:09:54 +01:00
|
|
|
local theme_assets = require("beautiful.theme_assets")
|
|
|
|
local xresources = require("beautiful.xresources")
|
2020-02-16 07:33:45 +01:00
|
|
|
local rnotification = require("ruled.notification")
|
2015-05-14 22:57:22 +02:00
|
|
|
local dpi = xresources.apply_dpi
|
2017-01-14 04:09:54 +01:00
|
|
|
local xrdb = xresources.get_current_theme()
|
2021-09-12 10:37:51 +02:00
|
|
|
local gdebug = require("gears.debug")
|
2017-02-14 00:16:45 +01:00
|
|
|
local gfs = require("gears.filesystem")
|
|
|
|
local themes_path = gfs.get_themes_dir()
|
2015-05-14 22:57:22 +02:00
|
|
|
|
2015-08-02 12:46:44 +02:00
|
|
|
-- inherit default theme
|
2017-01-14 04:09:54 +01:00
|
|
|
local theme = dofile(themes_path.."default/theme.lua")
|
2015-08-02 12:46:44 +02:00
|
|
|
-- load vector assets' generators for this theme
|
2015-05-14 22:57:22 +02:00
|
|
|
|
|
|
|
theme.font = "sans 8"
|
|
|
|
|
|
|
|
theme.bg_normal = xrdb.background
|
|
|
|
theme.bg_focus = xrdb.color12
|
|
|
|
theme.bg_urgent = xrdb.color9
|
|
|
|
theme.bg_minimize = xrdb.color8
|
|
|
|
theme.bg_systray = theme.bg_normal
|
|
|
|
|
|
|
|
theme.fg_normal = xrdb.foreground
|
|
|
|
theme.fg_focus = theme.bg_normal
|
|
|
|
theme.fg_urgent = theme.bg_normal
|
|
|
|
theme.fg_minimize = theme.bg_normal
|
|
|
|
|
2015-09-03 00:42:51 +02:00
|
|
|
theme.useless_gap = dpi(3)
|
|
|
|
theme.border_width = dpi(2)
|
2019-11-11 02:47:43 +01:00
|
|
|
theme.border_color_normal = xrdb.color0
|
|
|
|
theme.border_color_active = theme.bg_focus
|
|
|
|
theme.border_color_marked = xrdb.color10
|
2015-05-14 22:57:22 +02:00
|
|
|
|
|
|
|
-- There are other variable sets
|
|
|
|
-- overriding the default one when
|
|
|
|
-- defined, the sets are:
|
2017-01-08 05:07:52 +01:00
|
|
|
-- taglist_[bg|fg]_[focus|urgent|occupied|empty|volatile]
|
2015-05-14 22:57:22 +02:00
|
|
|
-- tasklist_[bg|fg]_[focus|urgent]
|
|
|
|
-- titlebar_[bg|fg]_[normal|focus]
|
|
|
|
-- tooltip_[font|opacity|fg_color|bg_color|border_width|border_color]
|
|
|
|
-- Example:
|
|
|
|
--theme.taglist_bg_focus = "#ff0000"
|
|
|
|
|
2016-07-06 14:15:29 +02:00
|
|
|
theme.tooltip_fg = theme.fg_normal
|
|
|
|
theme.tooltip_bg = theme.bg_normal
|
|
|
|
|
2015-05-14 22:57:22 +02:00
|
|
|
-- Variables set for theming the menu:
|
|
|
|
-- menu_[bg|fg]_[normal|focus]
|
|
|
|
-- menu_[border_color|border_width]
|
2017-01-14 04:09:54 +01:00
|
|
|
theme.menu_submenu_icon = themes_path.."default/submenu.png"
|
2015-05-14 22:57:22 +02:00
|
|
|
theme.menu_height = dpi(16)
|
|
|
|
theme.menu_width = dpi(100)
|
|
|
|
|
|
|
|
-- You can add as many variables as
|
|
|
|
-- you wish and access them by using
|
|
|
|
-- beautiful.variable in your rc.lua
|
|
|
|
--theme.bg_widget = "#cc0000"
|
|
|
|
|
2017-07-02 19:36:26 +02:00
|
|
|
-- Recolor Layout icons:
|
2015-08-02 20:50:31 +02:00
|
|
|
theme = theme_assets.recolor_layout(theme, theme.fg_normal)
|
2015-05-14 22:57:22 +02:00
|
|
|
|
2017-07-02 19:36:26 +02:00
|
|
|
-- Recolor titlebar icons:
|
|
|
|
--
|
|
|
|
local function darker(color_value, darker_n)
|
|
|
|
local result = "#"
|
|
|
|
for s in color_value:gmatch("[a-fA-F0-9][a-fA-F0-9]") do
|
|
|
|
local bg_numeric_value = tonumber("0x"..s) - darker_n
|
|
|
|
if bg_numeric_value < 0 then bg_numeric_value = 0 end
|
|
|
|
if bg_numeric_value > 255 then bg_numeric_value = 255 end
|
|
|
|
result = result .. string.format("%2.2x", bg_numeric_value)
|
|
|
|
end
|
|
|
|
return result
|
|
|
|
end
|
|
|
|
theme = theme_assets.recolor_titlebar(
|
|
|
|
theme, theme.fg_normal, "normal"
|
|
|
|
)
|
|
|
|
theme = theme_assets.recolor_titlebar(
|
|
|
|
theme, darker(theme.fg_normal, -60), "normal", "hover"
|
|
|
|
)
|
|
|
|
theme = theme_assets.recolor_titlebar(
|
|
|
|
theme, xrdb.color1, "normal", "press"
|
|
|
|
)
|
|
|
|
theme = theme_assets.recolor_titlebar(
|
|
|
|
theme, theme.fg_focus, "focus"
|
|
|
|
)
|
|
|
|
theme = theme_assets.recolor_titlebar(
|
|
|
|
theme, darker(theme.fg_focus, -60), "focus", "hover"
|
|
|
|
)
|
|
|
|
theme = theme_assets.recolor_titlebar(
|
|
|
|
theme, xrdb.color1, "focus", "press"
|
|
|
|
)
|
|
|
|
|
2016-11-21 22:38:23 +01:00
|
|
|
-- Define the icon theme for application icons. If not set then the icons
|
2015-05-14 22:57:22 +02:00
|
|
|
-- from /usr/share/icons and /usr/share/icons/hicolor will be used.
|
|
|
|
theme.icon_theme = nil
|
|
|
|
|
2015-08-02 12:56:57 +02:00
|
|
|
-- Generate Awesome icon:
|
2015-08-02 12:34:54 +02:00
|
|
|
theme.awesome_icon = theme_assets.awesome_icon(
|
|
|
|
theme.menu_height, theme.bg_focus, theme.fg_focus
|
|
|
|
)
|
2015-05-14 22:57:22 +02:00
|
|
|
|
2015-08-02 12:56:57 +02:00
|
|
|
-- Generate taglist squares:
|
2015-05-14 22:57:22 +02:00
|
|
|
local taglist_square_size = dpi(4)
|
2015-08-02 12:34:54 +02:00
|
|
|
theme.taglist_squares_sel = theme_assets.taglist_squares_sel(
|
|
|
|
taglist_square_size, theme.fg_normal
|
|
|
|
)
|
|
|
|
theme.taglist_squares_unsel = theme_assets.taglist_squares_unsel(
|
|
|
|
taglist_square_size, theme.fg_normal
|
|
|
|
)
|
|
|
|
|
2015-08-02 12:56:57 +02:00
|
|
|
-- Try to determine if we are running light or dark colorscheme:
|
2015-08-02 12:38:42 +02:00
|
|
|
local bg_numberic_value = 0;
|
|
|
|
for s in theme.bg_normal:gmatch("[a-fA-F0-9][a-fA-F0-9]") do
|
|
|
|
bg_numberic_value = bg_numberic_value + tonumber("0x"..s);
|
|
|
|
end
|
|
|
|
local is_dark_bg = (bg_numberic_value < 383)
|
|
|
|
|
2015-08-02 12:56:57 +02:00
|
|
|
-- Generate wallpaper:
|
2015-08-02 12:34:54 +02:00
|
|
|
local wallpaper_bg = xrdb.color8
|
|
|
|
local wallpaper_fg = xrdb.color7
|
2015-08-02 12:56:57 +02:00
|
|
|
local wallpaper_alt_fg = xrdb.color12
|
2015-08-02 12:34:54 +02:00
|
|
|
if not is_dark_bg then
|
|
|
|
wallpaper_bg, wallpaper_fg = wallpaper_fg, wallpaper_bg
|
2015-05-14 22:57:22 +02:00
|
|
|
end
|
2021-09-12 10:37:51 +02:00
|
|
|
|
|
|
|
local rsvg = pcall(function() return require("lgi").Rsvg end)
|
|
|
|
|
|
|
|
if rsvg then
|
|
|
|
local handle = require("lgi").Rsvg.Handle.new_from_file(
|
|
|
|
themes_path.."xresources/wallpaper.svg"
|
|
|
|
)
|
|
|
|
|
|
|
|
if handle then
|
|
|
|
handle:set_stylesheet([[
|
|
|
|
.normal {
|
|
|
|
fill: ]]..wallpaper_fg..[[;
|
|
|
|
}
|
|
|
|
.background {
|
|
|
|
fill: ]]..wallpaper_bg..[[;
|
|
|
|
stroke: ]]..wallpaper_bg..[[;
|
|
|
|
}
|
|
|
|
.logo {
|
|
|
|
fill: ]]..wallpaper_alt_fg..[[;
|
|
|
|
}
|
|
|
|
]])
|
|
|
|
|
|
|
|
theme.wallpaper = handle
|
|
|
|
end
|
|
|
|
else
|
|
|
|
gdebug.print_warning("Could not load the wallpaper: librsvg is not installed.")
|
2016-04-28 17:47:12 +02:00
|
|
|
end
|
2015-05-14 22:57:22 +02:00
|
|
|
|
2021-09-12 10:37:51 +02:00
|
|
|
if not theme.wallpaper then
|
2022-06-27 09:01:32 +02:00
|
|
|
gdebug.print_warning("Loading fallback wallpaper.")
|
|
|
|
theme.wallpaper = function(s)
|
|
|
|
return theme_assets.wallpaper(wallpaper_bg, wallpaper_fg, wallpaper_alt_fg, s)
|
|
|
|
end
|
2021-09-12 10:37:51 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
theme.wallpaper_bg = wallpaper_bg
|
|
|
|
|
2020-02-16 07:33:45 +01:00
|
|
|
-- Set different colors for urgent notifications.
|
|
|
|
rnotification.connect_signal('request::rules', function()
|
|
|
|
rnotification.append_rule {
|
|
|
|
rule = { urgency = 'critical' },
|
|
|
|
properties = { bg = '#ff0000', fg = '#ffffff' }
|
|
|
|
}
|
|
|
|
end)
|
|
|
|
|
2015-05-14 22:57:22 +02:00
|
|
|
return theme
|
2015-12-12 17:42:33 +01:00
|
|
|
|
2015-05-14 22:57:22 +02:00
|
|
|
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|