Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
635 additions
and
97 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
local theme,path = ... | ||
local surface = require( "gears.surface" ) | ||
local blind = require( "blind" ) | ||
local shape = require( "blind.common.shape" ) | ||
local color = require( "gears.color" ) | ||
local cairo = require( "lgi" ).cairo | ||
local pixmap = require( "blind.common.pixmap") | ||
|
||
local active = theme.titlebar_icon_active or theme.titlebar_icon_fg or theme.fg_normal | ||
local height = theme.titlebar_height | ||
local base_square = {} | ||
|
||
local square = nil | ||
|
||
local function get_cols(state) | ||
return color(theme["titlebar_bg_"..state]),color(theme["titlebar_border_color_"..state]) | ||
end | ||
|
||
local function gen_squares() | ||
for _,v in ipairs {"inactive","active", "hover", "pressed"} do | ||
local bg,border = get_cols(v) | ||
local img = cairo.ImageSurface.create(cairo.Format.ARGB32, height-2, height) | ||
local cr = cairo.Context(img) | ||
if square then | ||
cr:append_path(square) | ||
else | ||
shape.draw_round_rect(cr,2,2,height-7,height-7,3) | ||
square = cr:copy_path() | ||
end | ||
cr:set_source(bg) | ||
cr:fill_preserve() | ||
cr:set_source(border) | ||
cr:set_line_width(2) | ||
cr:stroke() | ||
base_square[v] = img | ||
print(v) | ||
end | ||
end | ||
gen_squares() | ||
|
||
local function add_icon(state,type,icon_path) | ||
local img = cairo.ImageSurface.create(cairo.Format.ARGB32, height-2, height) | ||
local cr = cairo.Context(img) | ||
cr:set_source_surface(base_square[state]) | ||
cr:paint() | ||
cr:set_source_surface(surface(icon_path or (path .."Icon/titlebar/".. type .."_normal_inactive.png"))) | ||
cr:paint() | ||
return pixmap(img) : shadow() : to_img() | ||
end | ||
|
||
local close = base_square.active | ||
local ontop = base_square.active | ||
local sticky = base_square.active | ||
local floating = base_square.active | ||
local maximized = base_square.active | ||
|
||
theme.titlebar = blind { | ||
close_button = blind { | ||
normal = add_icon("active","close",path .."Icon/titlebar/close_focus_inactive.png"), | ||
focus = add_icon("hover","close",path .."Icon/titlebar/close_focus_inactive.png"), | ||
}, | ||
|
||
ontop_button = blind { | ||
normal_inactive = add_icon("inactive","ontop"), | ||
focus_inactive = add_icon("inactive","ontop"), | ||
normal_active = add_icon("active","ontop"), | ||
focus_active = add_icon("active","ontop"), | ||
}, | ||
|
||
sticky_button = blind { | ||
normal_inactive = add_icon("inactive","sticky"), | ||
focus_inactive = add_icon("inactive","sticky"), | ||
normal_active = add_icon("active","sticky"), | ||
focus_active = add_icon("active","sticky"), | ||
}, | ||
|
||
floating_button = blind { | ||
normal_inactive = add_icon("inactive","floating"), | ||
focus_inactive = add_icon("inactive","floating"), | ||
normal_active = add_icon("active","floating"), | ||
focus_active = add_icon("active","floating"), | ||
}, | ||
|
||
maximized_button = blind { | ||
normal_inactive = add_icon("inactive","maximized"), | ||
focus_inactive = add_icon("inactive","maximized"), | ||
normal_active = add_icon("active","maximized"), | ||
focus_active = add_icon("active","maximized"), | ||
}, | ||
|
||
resize = add_icon("active","maximized",path .."Icon/titlebar/resize.png"), | ||
tag = add_icon("active","maximized",path .."Icon/titlebar/tag.png"), | ||
title_align = "left", | ||
bg_alternate= "#00000000" | ||
} |
Oops, something went wrong.