mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-07-23 12:24:38 +02:00
xsecurelock: cast a shadow instead of using an outline
This commit is contained in:
parent
e191460f50
commit
4d350646c0
1 changed files with 9 additions and 10 deletions
|
@ -69,16 +69,15 @@ def on_win_draw(widget, cctx, ctx):
|
||||||
def on_overlay_draw(widget, cctx, ctx):
|
def on_overlay_draw(widget, cctx, ctx):
|
||||||
"""Draw overlay (clock and weather)."""
|
"""Draw overlay (clock and weather)."""
|
||||||
wwidth, wheight = widget.get_parent().get_size()
|
wwidth, wheight = widget.get_parent().get_size()
|
||||||
cctx.set_source_rgb(1, 1, 1)
|
cctx.set_operator(cairo.OPERATOR_OVER)
|
||||||
|
|
||||||
def draw(what, outline=2):
|
def draw(what):
|
||||||
position = cctx.get_current_point()
|
x, y = cctx.get_current_point()
|
||||||
cctx.set_operator(cairo.OPERATOR_EXCLUSION)
|
cctx.set_source_rgba(0, 0, 0, 0.3)
|
||||||
cctx.set_line_width(outline)
|
cctx.move_to(x+2, y+2)
|
||||||
cctx.text_path(what)
|
cctx.show_text(what)
|
||||||
cctx.stroke()
|
cctx.set_source_rgb(1, 1, 1)
|
||||||
cctx.move_to(*position)
|
cctx.move_to(x, y)
|
||||||
cctx.set_operator(cairo.OPERATOR_SOURCE)
|
|
||||||
cctx.show_text(what)
|
cctx.show_text(what)
|
||||||
|
|
||||||
# Clock
|
# Clock
|
||||||
|
@ -92,7 +91,7 @@ def on_overlay_draw(widget, cctx, ctx):
|
||||||
cctx.set_font_size(ctx.clock_font_size)
|
cctx.set_font_size(ctx.clock_font_size)
|
||||||
_, _, twidth, theight, _, _ = cctx.text_extents(re.sub(r"\d", "8", time))
|
_, _, twidth, theight, _, _ = cctx.text_extents(re.sub(r"\d", "8", time))
|
||||||
cctx.move_to(wwidth // 2 - twidth // 2, wheight // 3)
|
cctx.move_to(wwidth // 2 - twidth // 2, wheight // 3)
|
||||||
draw(time, 4)
|
draw(time)
|
||||||
|
|
||||||
# Date
|
# Date
|
||||||
cctx.select_font_face(
|
cctx.select_font_face(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue