Advertisement
constantin-net

theme_gtk3_v084

Dec 28th, 2024
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 18.99 KB | None | 0 0
  1. -----------------------------------
  2. -- GTK colors awesome theme v084 --
  3. -----------------------------------
  4.  
  5. local theme_assets = require("beautiful.theme_assets")
  6. local xresources   = require("beautiful.xresources")
  7. local gears        = require("gears")
  8. local awful        = require("awful")
  9. local dpi          = xresources.apply_dpi
  10. local gtk          = require("beautiful.gtk")
  11.  
  12. local themes_path = config_dir .. "themes/gtk3"
  13. local theme_gtk   = gtk.get_theme_variables()
  14. local theme       = {}
  15.  
  16. local function shadecolor(col1, col2, adj)
  17.     r1 = tonumber(string.sub(col1,2,3),16)
  18.     g1 = tonumber(string.sub(col1,4,5),16)
  19.     b1 = tonumber(string.sub(col1,6,7),16)
  20.     r2 = tonumber(string.sub(col2,2,3),16)
  21.     g2 = tonumber(string.sub(col2,4,5),16)
  22.     b2 = tonumber(string.sub(col2,6,7),16)
  23.     shade_r = math.ceil((r1+r2)/adj) if shade_r > 255 then shade_r = 255 end
  24.     shade_g = math.ceil((g1+g2)/adj) if shade_g > 255 then shade_g = 255 end
  25.     shade_b = math.ceil((b1+b2)/adj) if shade_b > 255 then shade_b = 255 end
  26.     return "#" .. tostring(string.format("%x",shade_r))..tostring(string.format("%x",shade_g))..tostring(string.format("%x",shade_b))
  27. end
  28.  
  29. theme.base_size         = math.ceil(theme_gtk.font_size)
  30. theme.gap_single_client = true
  31.  
  32. -- font
  33. theme.font_name         = theme_gtk.font_family
  34. theme.font              = theme_gtk.font_family .. " " .. theme.base_size
  35. theme.notification_font = theme_gtk.font_family .. " " .. theme.base_size+4
  36.  
  37. -- geometry
  38. theme.systray_icon_spacing = dpi(5)
  39.  
  40. --theme.notification_shape    = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 6) end
  41.  
  42. theme.border_width         = 0 --dpi(theme_gtk.button_border_width)
  43. theme.radius               = dpi(theme_gtk.button_border_radius * 2 + 1)
  44. theme.notification_shape   = function(cr, width, height) gears.shape.partially_rounded_rect(cr, width, height, true, true, false, true, theme.radius-1 ) end
  45.  
  46. theme.menu_height          = dpi(theme.base_size+14)
  47. theme.menu_width           = dpi(theme.base_size*16)
  48.  
  49. theme.useless_gap          = dpi(theme.menu_height+8)
  50.  
  51. -- Light/Dark test
  52. if tonumber(string.sub(theme_gtk.base_color, 2, 7),16) < 10000000 then -- dark theme
  53.     theme.fg_normal         = shadecolor(theme_gtk.fg_color,theme_gtk.wm_border_focused_color,2.9)
  54.     theme.fg_focus          = shadecolor(theme_gtk.fg_color,theme_gtk.wm_border_focused_color,2.1)
  55.     theme.titlebar_fg_focus = shadecolor(theme_gtk.button_fg_color,theme_gtk.wm_border_focused_color,2.1)
  56.     theme.menu_fg_focus     = shadecolor(theme_gtk.bg_color,theme_gtk.wm_border_focused_color,4)
  57.     theme.border_focus      = shadecolor(theme_gtk.wm_border_focused_color,"#888888",2)
  58.     theme.taglist_fg_focus  = shadecolor(theme_gtk.header_button_fg_color,theme_gtk.wm_border_focused_color,3)
  59.     theme.tasklist_fg_focus = shadecolor(theme_gtk.header_button_fg_color,theme_gtk.wm_border_focused_color,3)
  60.     theme.tasklist_shape_border_color_focus = shadecolor(theme_gtk.header_button_border_color,theme_gtk.wm_border_focused_color,3)
  61.  
  62.     theme.layout_fairh      = themes_path.."/layouts/fairhw.png"
  63.     theme.layout_fairv      = themes_path.."/layouts/fairvw.png"
  64.     theme.layout_floating   = themes_path.."/layouts/floatingw.png"
  65.     theme.layout_magnifier  = themes_path.."/layouts/magnifierw.png"
  66.     theme.layout_max        = themes_path.."/layouts/maxw.png"
  67.     theme.layout_fullscreen = themes_path.."/layouts/fullscreenw.png"
  68.     theme.layout_tilebottom = themes_path.."/layouts/tilebottomw.png"
  69.     theme.layout_tileleft   = themes_path.."/layouts/tileleftw.png"
  70.     theme.layout_tile       = themes_path.."/layouts/tilew.png"
  71.     theme.layout_tiletop    = themes_path.."/layouts/tiletopw.png"
  72.     theme.layout_spiral     = themes_path.."/layouts/spiralw.png"
  73.     theme.layout_dwindle    = themes_path.."/layouts/dwindlew.png"
  74.     theme.layout_cornernw   = themes_path.."/layouts/cornernww.png"
  75.     theme.layout_cornerne   = themes_path.."/layouts/cornernew.png"
  76.     theme.layout_cornersw   = themes_path.."/layouts/cornersww.png"
  77.     theme.layout_cornerse   = themes_path.."/layouts/cornersew.png"
  78.    
  79.     theme.titlebar_ontop_button_normal_inactive = themes_path.."/titlebar/ontop_normal_inactive.png"
  80.     theme.titlebar_ontop_button_focus_inactive  = themes_path.."/titlebar/ontop_focus_inactive.png"
  81.     theme.titlebar_ontop_button_normal_active   = themes_path.."/titlebar/ontop_normal_active.png"
  82.     theme.titlebar_ontop_button_focus_active    = themes_path.."/titlebar/ontop_focus_active.png"
  83.    
  84.     theme.titlebar_floating_button_normal_inactive = themes_path.."/titlebar/floating_normal_inactive.png"
  85.     theme.titlebar_floating_button_focus_inactive  = themes_path.."/titlebar/floating_focus_inactive.png"
  86.     theme.titlebar_floating_button_normal_active   = themes_path.."/titlebar/floating_normal_active.png"
  87.     theme.titlebar_floating_button_focus_active    = themes_path.."/titlebar/floating_focus_active.png"
  88.    
  89.     theme.titlebar_sticky_button_normal_inactive = themes_path.."/titlebar/sticky_normal_inactive.png"
  90.     theme.titlebar_sticky_button_focus_inactive  = themes_path.."/titlebar/sticky_focus_inactive.png"
  91.     theme.titlebar_sticky_button_normal_active   = themes_path.."/titlebar/sticky_normal_active.png"
  92.     theme.titlebar_sticky_button_focus_active    = themes_path.."/titlebar/sticky_focus_active.png"
  93.    
  94.     theme.titlebar_maximized_button_normal_inactive       = themes_path.."/titlebar/maximized_normal_inactive.png"
  95.     theme.titlebar_maximized_button_normal_inactive_hover = themes_path.."/titlebar/maximized_normal_inactive.png"
  96.     theme.titlebar_maximized_button_normal_inactive_press = themes_path.."/titlebar/maximized_normal_inactive.png"
  97.     theme.titlebar_maximized_button_focus_inactive        = themes_path.."/titlebar/maximized_focus_inactive.png"
  98.     theme.titlebar_maximized_button_focus_inactive_hover  = themes_path.."/titlebar/maximized_focus_inactive.png"
  99.     theme.titlebar_maximized_button_focus_inactive_press  = themes_path.."/titlebar/maximized_focus_inactive.png"    
  100.  
  101.     theme.titlebar_maximized_button_normal_active       = themes_path.."/titlebar/maximized_normal_active.png"
  102.     theme.titlebar_maximized_button_normal_active_hover = themes_path.."/titlebar/maximized_normal_active.png"
  103.     theme.titlebar_maximized_button_normal_active_press = themes_path.."/titlebar/maximized_normal_active.png"
  104.     theme.titlebar_maximized_button_focus_active        = themes_path.."/titlebar/maximized_focus_active.png"
  105.     theme.titlebar_maximized_button_focus_active_hover  = themes_path.."/titlebar/maximized_focus_active.png"
  106.     theme.titlebar_maximized_button_focus_active_press  = themes_path.."/titlebar/maximized_focus_active.png"
  107.    
  108.     theme.titlebar_minimize_button_normal_inactive = themes_path.."/titlebar/minimize_normal.png"
  109.     theme.titlebar_minimize_button_focus_inactive  = themes_path.."/titlebar/minimize_focus.png"
  110.     theme.titlebar_minimize_button_normal_active   = themes_path.."/titlebar/minimize_normal.png"
  111.     theme.titlebar_minimize_button_focus_active    = themes_path.."/titlebar/minimize_focus.png"
  112.     theme.titlebar_minimize_button_normal_hover    = themes_path.."/titlebar/minimize_normal.png"
  113.     theme.titlebar_minimize_button_focus_hover     = themes_path.."/titlebar/minimize_focus.png"
  114.     theme.titlebar_minimize_button_normal_press    = themes_path.."/titlebar/minimize_focus.png"
  115.     theme.titlebar_minimize_button_focus_press     = themes_path.."/titlebar/minimize_focus.png"
  116.    
  117.     theme.titlebar_close_button_normal_inactive = themes_path.."/titlebar/close_normal.png"
  118.     theme.titlebar_close_button_focus_inactive  = themes_path.."/titlebar/close_normal.png"
  119.     theme.titlebar_close_button_normal_active   = themes_path.."/titlebar/close_normal.png"
  120.     theme.titlebar_close_button_focus_active    = themes_path.."/titlebar/close_normal.png"
  121.     theme.titlebar_close_button_normal_hover    = themes_path.."/titlebar/close_focus.png"
  122.     theme.titlebar_close_button_focus_hover     = themes_path.."/titlebar/close_focus.png"
  123.     theme.titlebar_close_button_normal_press    = themes_path.."/titlebar/close_focus.png"
  124.     theme.titlebar_close_button_focus_press     = themes_path.."/titlebar/close_focus.png"
  125.  
  126.     theme.net_en_off  = config_dir .. "/net_icons/dark/network-unavailable-symbolic.png"
  127.     theme.net_en_on   = config_dir .. "/net_icons/dark/network-wired-symbolic.png"
  128.     theme.net_wl      = config_dir .. "/net_icons/dark/network-wireless-signal-excellent-symbolic.png"
  129.     theme.net_wl_off  = config_dir .. "/net_icons/dark/network-wireless-signal-none-symbolic.png"
  130.     theme.net_wl_none = config_dir .. "/net_icons/dark/network-wireless-signal-none-symbolic.png"
  131.     theme.net_wl_low  = config_dir .. "/net_icons/dark/network-wireless-signal-weak-symbolic.png"
  132.     theme.net_wl_ok   = config_dir .. "/net_icons/dark/network-wireless-signal-ok-symbolic.png"
  133.     theme.net_wl_good = config_dir .. "/net_icons/dark/network-wireless-signal-good-symbolic.png"
  134.     theme.net_wl_full = config_dir .. "/net_icons/dark/network-wireless-signal-excellent-symbolic.png"
  135.  
  136.     theme.awesome_icon = theme_assets.awesome_icon(
  137.         theme.menu_height, theme_gtk.header_button_bg_color, theme.border_focus
  138.     )
  139.     theme.awesome_icon_hover = theme_assets.awesome_icon(
  140.         theme.menu_height, theme.bg_focus, theme.border_focus
  141.     )
  142.     theme.apps_icon = themes_path .. "/icons/drawer-dark.png"
  143.  
  144. else -- light theme
  145.     theme.fg_focus          = shadecolor(theme_gtk.button_fg_color,theme_gtk.wm_border_focused_color,1)
  146.     theme.titlebar_fg_focus = shadecolor(theme_gtk.header_button_fg_color,theme_gtk.wm_border_focused_color,2)
  147.     theme.menu_fg_focus     = shadecolor(theme_gtk.header_button_fg_color,theme_gtk.wm_border_focused_color,1)
  148.     theme.border_focus      = shadecolor(theme_gtk.wm_border_focused_color,"#111111",2)
  149.     theme.taglist_fg_focus  = shadecolor(theme_gtk.header_button_fg_color,theme_gtk.wm_border_focused_color,2)
  150.     theme.fg_normal         = shadecolor(theme_gtk.fg_color,theme_gtk.wm_border_focused_color,2)
  151.     theme.tasklist_fg_focus = shadecolor(theme_gtk.header_button_fg_color,theme_gtk.wm_border_focused_color,2)
  152.     theme.tasklist_shape_border_color_focus = shadecolor(theme_gtk.header_button_border_color,theme_gtk.wm_border_focused_color,2)
  153.  
  154.     theme.layout_fairh      = themes_path.."/layouts/fairh.png"
  155.     theme.layout_fairv      = themes_path.."/layouts/fairv.png"
  156.     theme.layout_floating   = themes_path.."/layouts/floating.png"
  157.     theme.layout_magnifier  = themes_path.."/layouts/magnifier.png"
  158.     theme.layout_max        = themes_path.."/layouts/max.png"
  159.     theme.layout_fullscreen = themes_path.."/layouts/fullscreen.png"
  160.     theme.layout_tilebottom = themes_path.."/layouts/tilebottom.png"
  161.     theme.layout_tileleft   = themes_path.."/layouts/tileleft.png"
  162.     theme.layout_tile       = themes_path.."/layouts/tile.png"
  163.     theme.layout_tiletop    = themes_path.."/layouts/tiletop.png"
  164.     theme.layout_spiral     = themes_path.."/layouts/spiral.png"
  165.     theme.layout_dwindle    = themes_path.."/layouts/dwindle.png"
  166.     theme.layout_cornernw   = themes_path.."/layouts/cornernw.png"
  167.     theme.layout_cornerne   = themes_path.."/layouts/cornerne.png"
  168.     theme.layout_cornersw   = themes_path.."/layouts/cornersw.png"
  169.     theme.layout_cornerse   = themes_path.."/layouts/cornerse.png"
  170.    
  171.     theme.titlebar_ontop_button_normal_inactive = themes_path.."/titlebar/ontop_focus_inactive.png"
  172.     theme.titlebar_ontop_button_focus_inactive  = themes_path.."/titlebar/ontop_normal_inactive.png"
  173.     theme.titlebar_ontop_button_normal_active   = themes_path.."/titlebar/ontop_focus_active.png"
  174.     theme.titlebar_ontop_button_focus_active    = themes_path.."/titlebar/ontop_normal_active.png"
  175.    
  176.     theme.titlebar_floating_button_normal_inactive = themes_path.."/titlebar/floating_focus_inactive.png"
  177.     theme.titlebar_floating_button_focus_inactive  = themes_path.."/titlebar/floating_normal_inactive.png"
  178.     theme.titlebar_floating_button_normal_active   = themes_path.."/titlebar/floating_focus_active.png"
  179.     theme.titlebar_floating_button_focus_active    = themes_path.."/titlebar/floating_normal_active.png"
  180.    
  181.     theme.titlebar_sticky_button_normal_inactive = themes_path.."/titlebar/sticky_focus_inactive.png"
  182.     theme.titlebar_sticky_button_focus_inactive  = themes_path.."/titlebar/sticky_normal_inactive.png"
  183.     theme.titlebar_sticky_button_normal_active   = themes_path.."/titlebar/sticky_focus_active.png"
  184.     theme.titlebar_sticky_button_focus_active    = themes_path.."/titlebar/sticky_normal_active.png"
  185.    
  186.     theme.titlebar_maximized_button_normal_inactive       = themes_path.."/titlebar/maximized_focus_inactive.png"
  187.     theme.titlebar_maximized_button_normal_inactive_hover = themes_path.."/titlebar/maximized_focus_inactive.png"
  188.     theme.titlebar_maximized_button_normal_inactive_press = themes_path.."/titlebar/maximized_focus_inactive.png"
  189.     theme.titlebar_maximized_button_focus_inactive        = themes_path.."/titlebar/maximized_normal_inactive.png"
  190.     theme.titlebar_maximized_button_focus_inactive_hover  = themes_path.."/titlebar/maximized_normal_inactive.png"
  191.     theme.titlebar_maximized_button_focus_inactive_press  = themes_path.."/titlebar/maximized_normal_inactive.png"    
  192.  
  193.     theme.titlebar_maximized_button_normal_active       = themes_path.."/titlebar/maximized_focus_active.png"
  194.     theme.titlebar_maximized_button_normal_active_hover = themes_path.."/titlebar/maximized_focus_active.png"
  195.     theme.titlebar_maximized_button_normal_active_press = themes_path.."/titlebar/maximized_focus_active.png"
  196.     theme.titlebar_maximized_button_focus_active        = themes_path.."/titlebar/maximized_normal_active.png"
  197.     theme.titlebar_maximized_button_focus_active_hover  = themes_path.."/titlebar/maximized_normal_active.png"
  198.     theme.titlebar_maximized_button_focus_active_press  = themes_path.."/titlebar/maximized_normal_active.png"
  199.    
  200.     theme.titlebar_minimize_button_normal_inactive = themes_path.."/titlebar/minimize_focus.png"
  201.     theme.titlebar_minimize_button_focus_inactive  = themes_path.."/titlebar/minimize_normal.png"
  202.     theme.titlebar_minimize_button_normal_active   = themes_path.."/titlebar/minimize_focus.png"
  203.     theme.titlebar_minimize_button_focus_active    = themes_path.."/titlebar/minimize_normal.png"
  204.     theme.titlebar_minimize_button_normal_hover    = themes_path.."/titlebar/minimize_focus.png"
  205.     theme.titlebar_minimize_button_focus_hover     = themes_path.."/titlebar/minimize_normal.png"
  206.     theme.titlebar_minimize_button_normal_press    = themes_path.."/titlebar/minimize_focus.png"
  207.     theme.titlebar_minimize_button_focus_press     = themes_path.."/titlebar/minimize_normal.png"
  208.    
  209.     theme.titlebar_close_button_normal_inactive = themes_path.."/titlebar/close_focus.png"
  210.     theme.titlebar_close_button_focus_inactive  = themes_path.."/titlebar/close_focus.png"
  211.     theme.titlebar_close_button_normal_active   = themes_path.."/titlebar/close_focus.png"
  212.     theme.titlebar_close_button_focus_active    = themes_path.."/titlebar/close_focus.png"
  213.     theme.titlebar_close_button_normal_hover    = themes_path.."/titlebar/close_normal.png"
  214.     theme.titlebar_close_button_focus_hover     = themes_path.."/titlebar/close_normal.png"
  215.     theme.titlebar_close_button_normal_press    = themes_path.."/titlebar/close_normal.png"
  216.     theme.titlebar_close_button_focus_press     = themes_path.."/titlebar/close_normal.png"
  217.  
  218.     theme.net_en_off  = config_dir .. "/net_icons/light/network-unavailable-symbolic.png"
  219.     theme.net_en_on   = config_dir .. "/net_icons/light/network-wired-symbolic.png"
  220.     theme.net_wl      = config_dir .. "/net_icons/light/network-wireless-signal-excellent-symbolic.png"
  221.     theme.net_wl_off  = config_dir .. "/net_icons/light/network-wireless-signal-none-symbolic.png"
  222.     theme.net_wl_none = config_dir .. "/net_icons/light/network-wireless-signal-none-symbolic.png"
  223.     theme.net_wl_low  = config_dir .. "/net_icons/light/network-wireless-signal-weak-symbolic.png"
  224.     theme.net_wl_ok   = config_dir .. "/net_icons/light/network-wireless-signal-ok-symbolic.png"
  225.     theme.net_wl_good = config_dir .. "/net_icons/light/network-wireless-signal-good-symbolic.png"
  226.     theme.net_wl_full = config_dir .. "/net_icons/light/network-wireless-signal-excellent-symbolic.png"
  227.  
  228.     theme.awesome_icon = theme_assets.awesome_icon(
  229.         theme.menu_height, theme.border_focus, theme.menu_fg_focus--theme_gtk.header_button_fg_color
  230.     )
  231.     theme.awesome_icon_hover = theme_assets.awesome_icon(
  232.         theme.menu_height, theme.border_focus, theme.bg_focus
  233.     )
  234.     theme.apps_icon = themes_path .. "/icons/drawer-light.png"
  235. end
  236.  
  237. -- "menu_mod"
  238. theme.menu_shape        = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, theme.radius-1) end
  239. theme.menu_border_width = 2
  240. theme.menu_border_color = theme.border_focus
  241.  
  242. theme.bg_normal   = theme_gtk.base_color
  243. theme.bg_focus    = theme_gtk.button_bg_color
  244. theme.bg_urgent   = theme_gtk.warning_bg_color
  245. theme.bg_minimize = theme_gtk.base_color
  246. theme.bg_systray  = theme.bg_normal
  247.  
  248. theme.fg_urgent   = theme_gtk.warning_fg_color
  249. theme.fg_minimize = theme.fg_color
  250.  
  251. theme.titlebar_bg_focus = string.sub(theme_gtk.header_button_bg_color,1,7)
  252.  
  253. theme.border_normal = theme_gtk.wm_border_unfocused_color
  254. theme.border_marked = theme_gtk.osd_border_color
  255.  
  256. theme.taglist_bg_focus  = theme.bg_normal --theme_gtk.header_button_bg_color
  257. theme.taglist_bg_urgent = theme.taglist_bg_focus -- common urgent bg
  258.  
  259. theme.tooltip_bg = theme_gtk.tooltip_bg_color
  260. theme.tooltip_fg = theme_gtk.tooltip_fg_color
  261.  
  262. theme.tasklist_bg_focus           = theme_gtk.header_button_bg_color
  263. theme.tasklist_shape_border_color = theme_gtk.header_button_bg_color
  264.  
  265. theme.notification_bg           = theme_gtk.osd_bg_color
  266. theme.notification_fg           = theme_gtk.osd_fg_color
  267. theme.notification_border_color = theme_gtk.osd_border_color
  268.  
  269. theme.menu_bg_focus = theme.border_focus
  270.  
  271. -- Generate taglist squares:
  272. --local taglist_square_size = dpi(25)
  273. --theme.taglist_squares_sel = theme_assets.taglist_squares_sel(
  274. --    taglist_square_size, theme.border_normal
  275. --)
  276. --theme.taglist_squares_unsel = theme_assets.taglist_squares_unsel(
  277. --    taglist_square_size, theme.fg_normal
  278. --)
  279.  
  280. -- Define the image to load
  281. theme.menu_submenu_icon = themes_path.."/submenu.png"
  282.  
  283. --theme.wallpaper = themes_path.."/background.jpg"
  284. theme.wallpaper = function(screen)
  285.    local wallpaper = config_dir .. "/wallpapers/" .. tostring(screen.index)
  286.    gears.wallpaper.maximized(wallpaper, screen, false)
  287. end
  288.  
  289. -- defaults for notifications
  290. theme.notification_icon_size      = 100
  291. --theme.notification_[bg|fg]        =
  292. theme.notification_border_width   = 1
  293. theme.notification_border_color   = theme.border_focus
  294. --theme.notification_opacity        =
  295. --theme.notification_margin         =
  296. --theme.notification_[width|height] =
  297. --theme.notification_max_width      = 250
  298. theme.notification_max_height     = 250
  299.  
  300. -- for moc
  301. theme.icon_theme = "Moblin"
  302.  
  303. return theme
  304.  
  305. -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
  306.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement