File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,18 @@ import time
3434import xcffib
3535from xcffib import xproto
3636
37- ICON_MAX_SIZE = 256
37+ ICON_MAX_SIZE = 1024
38+ # Chronological order of preferred icon sizes based on certified HW and defaults
39+ ICON_PREFERRED_SIZES = (
40+ (128 , 128 ),
41+ (96 , 96 ),
42+ (64 , 64 ),
43+ (48 , 48 ),
44+ (256 , 256 ),
45+ (512 , 512 ),
46+ (32 , 32 ),
47+ )
48+
3849IconPixmapHint = 0b1 << 2
3950IconMaskHint = 0b1 << 5
4051
@@ -247,7 +258,13 @@ class IconRetriever(object):
247258 def describe_icon (self , w ):
248259 try :
249260 icons = self .get_icons (w )
250- chosen_size = sorted (icons .keys ())[- 1 ]
261+ # Override the largest icon with our preferred sizes (if possible)
262+ for size in ICON_PREFERRED_SIZES :
263+ if size in icons .keys ():
264+ chosen_size = size
265+ break
266+ else :
267+ chosen_size = sorted (icons .keys ())[- 1 ]
251268
252269 data = b''
253270 data += "{}\n " .format (w ).encode ('ascii' )
You can’t perform that action at this time.
0 commit comments