mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-07-08 01:04: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
|
opacity = delta * current + options.start_opacity
|
||||||
|
|
||||||
# Background
|
# Background
|
||||||
|
cctx.set_operator(cairo.OPERATOR_SOURCE)
|
||||||
if not background:
|
if not background:
|
||||||
cctx.set_source_rgba(0, 0, 0, opacity)
|
cctx.set_source_rgba(0, 0, 0, opacity)
|
||||||
cctx.set_operator(cairo.OPERATOR_SOURCE)
|
|
||||||
cctx.paint()
|
cctx.paint()
|
||||||
else:
|
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)
|
Gdk.cairo_set_source_pixbuf(cctx, bg, 0, 0)
|
||||||
cctx.paint_with_alpha(opacity)
|
cctx.paint_with_alpha(opacity)
|
||||||
|
cctx.restore()
|
||||||
|
|
||||||
# Remaining time
|
# Remaining time
|
||||||
remaining = str(round(options.delay - elapsed[0]))
|
remaining = str(round(options.delay - elapsed[0]))
|
||||||
|
@ -113,7 +117,7 @@ if __name__ == "__main__":
|
||||||
if options.background:
|
if options.background:
|
||||||
try:
|
try:
|
||||||
background = GdkPixbuf.Pixbuf.new_from_file(options.background)
|
background = GdkPixbuf.Pixbuf.new_from_file(options.background)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Setup dimmer windows on each monitor
|
# Setup dimmer windows on each monitor
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue