mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-07-07 16:54:21 +02:00
xss-dimmer: handle HiDPI screens
This commit is contained in:
parent
f25552e4cb
commit
0106eddaff
1 changed files with 7 additions and 3 deletions
|
@ -56,14 +56,18 @@ def on_draw(widget, event, options, background, elapsed):
|
|||
opacity = delta * current + options.start_opacity
|
||||
|
||||
# Background
|
||||
cctx.set_operator(cairo.OPERATOR_SOURCE)
|
||||
if not background:
|
||||
cctx.set_source_rgba(0, 0, 0, opacity)
|
||||
cctx.set_operator(cairo.OPERATOR_SOURCE)
|
||||
cctx.paint()
|
||||
else:
|
||||
bg = background.new_subpixbuf(x, y, wwidth, wheight)
|
||||
scale = widget.get_scale_factor()
|
||||
bg = background.new_subpixbuf(x, y, wwidth*scale, wheight*scale)
|
||||
cctx.save()
|
||||
cctx.scale(1/scale, 1/scale)
|
||||
Gdk.cairo_set_source_pixbuf(cctx, bg, 0, 0)
|
||||
cctx.paint_with_alpha(opacity)
|
||||
cctx.restore()
|
||||
|
||||
# Remaining time
|
||||
remaining = str(round(options.delay - elapsed[0]))
|
||||
|
@ -113,7 +117,7 @@ if __name__ == "__main__":
|
|||
if options.background:
|
||||
try:
|
||||
background = GdkPixbuf.Pixbuf.new_from_file(options.background)
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Setup dimmer windows on each monitor
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue