internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: pwr-Solaar/Solaar

Issue:
can't find icons with setuptools `sudo python3 setup.py install`
setuptools changes where data files are relative to the installation for `python3 setup.py install` which means that the icon directory is not found.


Discussion:

Resolving patch:
diff --git a/lib/solaar/ui/icons.py b/lib/solaar/ui/icons.py
--- a/lib/solaar/ui/icons.py
+++ b/lib/solaar/ui/icons.py
@@ -56,9 +56,10 @@ def _look_for_application_icons():
 	local_share = _environ.get('XDG_DATA_HOME', _path.expanduser(_path.join('~', '.local', 'share')))
 	data_dirs = _environ.get('XDG_DATA_DIRS', '/usr/local/share:/usr/share')
 	repo_share = _path.normpath(_path.join(_path.dirname(__file__), '..', '..', '..', 'share'))
+	setuptools_share = _path.normpath(_path.join(_path.dirname(__file__), '..', '..', 'share'))
 	del _sys
 
-	share_solaar = [prefix_share] + list(_path.join(x, 'solaar') for x in [src_share, local_share, repo_share] + data_dirs.split(':'))
+	share_solaar = [prefix_share] + list(_path.join(x, 'solaar') for x in [src_share, local_share, setuptools_share, repo_share] + data_dirs.split(':'))
 	for location in share_solaar:
 		location = _path.join(location, 'icons')
 		if _log.isEnabledFor(_DEBUG):


Test patch:
Repository: pwr-Solaar/Solaar

Issue:
Support for Logitech G613 with receiver id c53d
Apparently solaar v1.0.1 on ubuntu ppa does not support Lightspeed receiver with id c53d . solaar reported that no receiver has been found.

Here is the output of my lsusb

tonny@fenrir:[~]: lsusb
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 005: ID 1b1c:1b65 Corsair 
Bus 003 Device 006: ID 046d:c53d Logitech, Inc. 
Bus 003 Device 003: ID 046d:082b Logitech, Inc. Webcam C170
Bus 003 Device 002: ID 1a40:0101 Terminus Technology Inc. Hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 8087:0aa7 Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub



Discussion:

Resolving patch:
diff --git a/lib/logitech_receiver/base_usb.py b/lib/logitech_receiver/base_usb.py
--- a/lib/logitech_receiver/base_usb.py
+++ b/lib/logitech_receiver/base_usb.py
@@ -112,6 +112,7 @@
 LIGHTSPEED_RECEIVER_C539  = _lightspeed_receiver(0xc539)
 LIGHTSPEED_RECEIVER_C53a  = _lightspeed_receiver(0xc53a)
 LIGHTSPEED_RECEIVER_C53f  = _lightspeed_receiver(0xc53f)
+LIGHTSPEED_RECEIVER_C53d  = _lightspeed_receiver(0xc53d)
 
 del _DRIVER, _unifying_receiver, _nano_receiver, _lenovo_receiver, _lightspeed_receiver
 
@@ -135,6 +136,7 @@
 		LIGHTSPEED_RECEIVER_C539,
 		LIGHTSPEED_RECEIVER_C53a,
 		LIGHTSPEED_RECEIVER_C53f,
+		LIGHTSPEED_RECEIVER_C53d,
 	)
 
 def product_information(usb_id):


Test patch:
Repository: pwr-Solaar/Solaar

Issue:
Logitech receiver not found/Unpairable peripherals
- Solaar version : 1.0.2
- Distribution: Kali Linux
- Kernel version (ex. `uname -srmo`): Linux 5.5.0-kali2-amd64 x86_64 GNU/Linux
- Output of `solaar show`: 
```
OUTPUT HERE
```
 solaar: error: Logitech receiver not found

**Describe the bug**
I'm using a Logitech G915TKL Keyboard along with it's Lightspeed USB receiver. Solaar  doesn't seem to be realizing the G915TKL's receiver other than to allow direct connection from the keyboard (non-bluetooth). I also have unifying and nano receivers. They are recognized by solaar, but won't pick up any other devices than the ones that are connected to each respective receiver by default. If there's a way that I can drop a log please let me know because I'd love to pair my Logitech peripherals.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to Solaar icon
2. Click on the Solaar icon
3. It says no Logitech receiver found


Discussion:
It is entirely possible that Solaar does not know about this receiver.  Can you provide output of `lsusb`?  

To find out whether Solaar can handle this receiver directory, clone Solaar and edit lib/logitech_receiver/base_usb.py, adding the usb ID for the receiver.  Two lines need to be added - see the C539 receiver for an example.   Then run Solaar as root with debugging turned on (`sudo bin/solaar -dd`) and see whether the receiver shows up. 

To complete the implementation of this receiver you also need to edit rules/42-logitech-unify-permissions.rules, adding your receiver, and install the rule file - see "Installing Solaar’s udev rule" in https://pwr-solaar.github.io/Solaar/installation for more information.
**C:\lib\logitech_receiver>** lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 258a:6a99 HK-ZYYK-US-A1-02-00 USB KEYBOARD
Bus 001 Device 003: ID 8087:0a2a Intel Corp. 
Bus 001 Device 016: ID 046d:c545 Logitech, Inc. USB Receiver
Bus 001 Device 002: ID 0079:18d6 DragonRise Inc. Mouse for Windows
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub


Resolving patch:
diff --git a/lib/logitech_receiver/base_usb.py b/lib/logitech_receiver/base_usb.py
--- a/lib/logitech_receiver/base_usb.py
+++ b/lib/logitech_receiver/base_usb.py
@@ -127,6 +127,7 @@
 LIGHTSPEED_RECEIVER_C53a = _lightspeed_receiver(0xc53a)
 LIGHTSPEED_RECEIVER_C53f = _lightspeed_receiver(0xc53f)
 LIGHTSPEED_RECEIVER_C53d = _lightspeed_receiver(0xc53d)
+LIGHTSPEED_RECEIVER_C545 = _lightspeed_receiver(0xc545)
 
 del _DRIVER, _unifying_receiver, _nano_receiver, _lenovo_receiver, _lightspeed_receiver
 
@@ -150,6 +151,7 @@
     LIGHTSPEED_RECEIVER_C53a,
     LIGHTSPEED_RECEIVER_C53f,
     LIGHTSPEED_RECEIVER_C53d,
+    LIGHTSPEED_RECEIVER_C545,
 )
 
 


Test patch:
Repository: pwr-Solaar/Solaar

Issue:
Logitech VX revolution is not recognized

- Solaar version: 1.0.1
- Distribution: Ubuntu 20.04.1 LTS
- Kernel version: Linux 5.4.0-42-generic x86_64 GNU/Linux
- Output of `solaar show`:
$ solaar show
Unifying Receiver
  Device path  : /dev/hidraw1
  USB id       : 046d:c518
  Serial       : 5F29CD09
    Firmware   : 42.04.B0044
  Has 1 paired device(s) out of a maximum of 0.
  Notifications: wireless (0x000100)

**Describe the bug**
Logitech VX revolution is not recognized

**To Reproduce**
Solaar always reports that "No device paired"



Discussion:
It looks as if the problem is that Solaar does not correctly support your receiver.  Have you used Solaar successfully in the past?  I think that the fix is very easy, so expect a PR for you to test soon.

Resolving patch:
diff --git a/lib/logitech_receiver/descriptors.py b/lib/logitech_receiver/descriptors.py
--- a/lib/logitech_receiver/descriptors.py
+++ b/lib/logitech_receiver/descriptors.py
@@ -625,7 +625,7 @@ def _D(name, codename=None, kind=None, wpid=None, protocol=None, registers=None,
     codename='VX Revolution',
     kind=_DK.mouse,
     protocol=1.0,
-    wpid=('1006', '100D'),
+    wpid=('1006', '100D', '0612'),  # WPID 0612 from Issue #921
     registers=(_R.battery_charge, ),
 )
 _D(
diff --git a/lib/logitech_receiver/receiver.py b/lib/logitech_receiver/receiver.py
--- a/lib/logitech_receiver/receiver.py
+++ b/lib/logitech_receiver/receiver.py
@@ -381,6 +381,8 @@ def __init__(self, handle, device_info):
         if serial_reply:
             self.serial = _strhex(serial_reply[1:5])
             self.max_devices = ord(serial_reply[6:7])
+            if self.max_devices <= 0 or self.max_devices > 6:
+                self.max_devices = product_info.get('max_devices', 1)
             # TODO _properly_ figure out which receivers do and which don't support unpairing
             # This code supposes that receivers that don't unpair support a pairing request for device index 0
             self.may_unpair = self.write_register(_R.receiver_pairing) is None


Test patch:
Repository: pwr-Solaar/Solaar

Issue:
Please create an AppData file for Solaar
Please consider writing and installing an AppData file with the application description and some screenshots, else Solaar looks really bad in the GNOME and KDE Software Centers. We'd love to showcase more applications, but without the extra data file we can't. See http://people.freedesktop.org/~hughsient/appdata/ for details; thanks!

Richard



Discussion:
If someone is interesting in writing this document it should be easy to incorporate into Solaar.

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -24,6 +24,7 @@ def _data_files():
 
     yield 'share/applications', ['share/applications/solaar.desktop']
     yield 'share/solaar/udev-rules.d', ['rules.d/42-logitech-unify-permissions.rules']
+    yield 'share/metainfo/io.github.pwr_solaar.solaar.metainfo.xml', ['share/solaar/metainfo.xml']
 
     del _dirname
 


Test patch:
Repository: pwr-Solaar/Solaar

Issue:
metainfo file installed in the wrong place
**Information**
- Solaar version (`solaar --version` or `git describe --tags` if cloned from this repository): 1.0.4-57-g69f889e
- Distribution: Fedora
- Kernel version (ex. `uname -srmo`): N/A
- Output of `solaar show`:  N/A

**Describe the bug**
The `metainfo.xml` file gets installed into the wrong location, i.e. `/usr/share/metainfo/io.github.pwr_solaar.solaar.metainfo.xml/metainfo.xml`.

**To Reproduce**
Steps to reproduce the behavior (this is part of RPM package build process, hence the `--root xxx` option):
```
...
/usr/bin/python3 setup.py install -O1 --skip-build --root /builddir/build/BUILDROOT/solaar-1.0.4-3.fc33.x86_64
...
running install_data
creating /builddir/build/BUILDROOT/solaar-1.0.4-3.fc33.x86_64/usr/share
...
creating /builddir/build/BUILDROOT/solaar-1.0.4-3.fc33.x86_64/usr/share/metainfo
creating /builddir/build/BUILDROOT/solaar-1.0.4-3.fc33.x86_64/usr/share/metainfo/io.github.pwr_solaar.solaar.metainfo.xml
copying share/solaar/metainfo.xml -> /builddir/build/BUILDROOT/solaar-1.0.4-3.fc33.x86_64/usr/share/metainfo/io.github.pwr_solaar.solaar.metainfo.xml
...
```

**Screenshots**
N/A

**Additional context**
The correct location is: `/usr/share/metainfo/io.github.pwr_solaar.solaar.metainfo.xml` (a file under `/usr/share/metainfo`, not a directory).
The solution is to rename `metainfo.xml` to `io.github.pwr_solaar.solaar.metainfo.xml` and install it under `/usr/share/metainfo` in `setup.py`. I'll send a PR shortly.



Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -24,7 +24,7 @@ def _data_files():
 
     yield 'share/applications', ['share/applications/solaar.desktop']
     yield 'share/solaar/udev-rules.d', ['rules.d/42-logitech-unify-permissions.rules']
-    yield 'share/metainfo/io.github.pwr_solaar.solaar.metainfo.xml', ['share/solaar/metainfo.xml']
+    yield 'share/metainfo', ['share/solaar/io.github.pwr_solaar.solaar.metainfo.xml']
 
     del _dirname
 


Test patch:
Repository: pwr-Solaar/Solaar

Issue:
Running solaar breaks the resolution up/down buttons on G900
Solaar is working fine, but running it in any way, f.eks
`solaar show`
  makes the buttons for resolution up/down stop working.
These are the Button 7 and 8 from ratbag on top of the mouse next to the three led indicators.
To get them working again you have to turn the mouse on and off with the physical button under the mouse. (or start windows and the logitech application)


Discussion:
Linux box 5.3.18-lp152.66-default #1 SMP Tue Mar 2 13:18:19 UTC 2021 (73933a3) x86_64 x86_64 x86_64 GNU/Linux
solaar 1.0.5

Please provide output of `solaar show` to show which devices you have and what settings you have set up.
I think I might know what the problem is.   The G900 likely has onboard profiles and when they are turned off (which Solaar does so that it can easily change the polling rate) the behaviour of your mouse changes.   

PR #1135 add the ability to ignore settings.  Once that PR is merged in it should be easy to upgrade the polling rate setting so that it does not turn off onboard profiles when it is being ignored.

You will have to test this change for it to become part of Solaar.

Resolving patch:
diff --git a/lib/logitech_receiver/settings_templates.py b/lib/logitech_receiver/settings_templates.py
--- a/lib/logitech_receiver/settings_templates.py
+++ b/lib/logitech_receiver/settings_templates.py
@@ -540,9 +540,6 @@ def _feature_adjustable_dpi():
 def _feature_report_rate_callback(device):
     if device.wpid == '408E':
         return None  # host mode borks the function keys on the G915 TKL keyboard
-    # Host mode is required for report rate to be adjustable
-    if _hidpp20.get_onboard_mode(device) != _hidpp20.ONBOARD_MODES.MODE_HOST:
-        _hidpp20.set_onboard_mode(device, _hidpp20.ONBOARD_MODES.MODE_HOST)
     reply = device.feature_request(_F.REPORT_RATE, 0x00)
     assert reply, 'Oops, report rate choices cannot be retrieved!'
     rate_list = []
@@ -553,9 +550,17 @@ def _feature_report_rate_callback(device):
     return _ChoicesV(_NamedInts.list(rate_list), byte_count=1) if rate_list else None
 
 
+class FeatureReortRateRW(_FeatureRW):
+    def write(self, device, data_bytes):
+        # Host mode is required for report rate to be adjustable
+        if _hidpp20.get_onboard_mode(device) != _hidpp20.ONBOARD_MODES.MODE_HOST:
+            _hidpp20.set_onboard_mode(device, _hidpp20.ONBOARD_MODES.MODE_HOST)
+        return super().write(device, data_bytes)
+
+
 def _feature_report_rate():
     """Report Rate feature"""
-    rw = _FeatureRW(_F.REPORT_RATE, read_fnid=0x10, write_fnid=0x20)
+    rw = FeatureReortRateRW(_F.REPORT_RATE, read_fnid=0x10, write_fnid=0x20)
     return _Setting(_REPORT_RATE, rw, callback=_feature_report_rate_callback, device_kind=(_DK.mouse, ))
 
 


Test patch:
Repository: pwr-Solaar/Solaar

Issue:
Update Install Instruction for Fedora
Hi: 

Took me quite a bit of effort to realize that Solaar is available in Fedora without any extra repo (right now it is on 1.0.6), and I think updating README here helps everyone a lot. 


Discussion:

Resolving patch:
diff --git a/lib/solaar/cli/show.py b/lib/solaar/cli/show.py
--- a/lib/solaar/cli/show.py
+++ b/lib/solaar/cli/show.py
@@ -26,6 +26,8 @@
 from logitech_receiver.common import NamedInt as _NamedInt
 from logitech_receiver.common import strhex as _strhex
 
+_F = _hidpp20.FEATURE
+
 
 def _print_receiver(receiver):
     paired_count = receiver.count()
@@ -222,7 +224,7 @@ def _print_device(dev, num=None):
                 else:
                     mode = 'On-Board'
                 print('            Device Mode: %s' % mode)
-            elif feature == _hidpp20.FEATURE.BATTERY_STATUS or feature == _hidpp20.FEATURE.BATTERY_VOLTAGE:
+            elif feature in (_F.BATTERY_STATUS, _F.BATTERY_VOLTAGE, _F.BATTERY_VOLTAGE):
                 print('', end='       ')
                 _battery_line(dev)
             for setting in dev_settings:


Test patch:
Repository: pwr-Solaar/Solaar

Issue:
add_device(): tray.py:372:_add_device:IndexError: list index out of range
**Information**
- Solaar version (`solaar --version` or `git describe --tags` if cloned from this repository): `1.0.6`
- Distribution: `Fedora 34`
- Kernel version (ex. `uname -srmo`): `5.13.14-200.fc34.x86_64`
- Output of `solaar show`: `N/A`

**Describe the bug**
This is a forwarded bug report from Fedora bug tracker. User *was fiddling with solaar in order to change the default behaviour of the multimedia keys on a TK820 keyboard*. Apparently they also had a G900 Gaming Mouse

**To Reproduce**
Steps to reproduce the behavior: `N/A`

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
```
Truncated backtrace:
tray.py:372:_add_device:IndexError: list index out of range

Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/solaar/ui/__init__.py", line 177, in _status_changed
    tray.update(device)
  File "/usr/lib/python3.9/site-packages/solaar/ui/tray.py", line 535, in update
    index = _add_device(device)
  File "/usr/lib/python3.9/site-packages/solaar/ui/tray.py", line 372, in _add_device
    path, number, _ignore, _ignore = _devices_info[index]
IndexError: list index out of range

Local variables in innermost frame:
device: <Device(1,4053,G900 Chaos Spectrum Gaming Mouse,B2194B48)>
receiver_path: '/dev/hidraw7'
index: 0
```


Discussion:
Looks like some sort of timing problem.  It may have been that the receiver was very quickly inserted and removed.   Can you ask the reporter whether this might have been the case and whether the problem is repeatable.  I'll add some defensive checks.
Unfortunately, the reporter said they no longer have access to the hardware, so I'm just throwing this over the fence. Sorry for the incompleteness of the report. It could have been a flaky USB hub for all we know.

Resolving patch:
diff --git a/lib/solaar/ui/tray.py b/lib/solaar/ui/tray.py
--- a/lib/solaar/ui/tray.py
+++ b/lib/solaar/ui/tray.py
@@ -359,15 +359,16 @@ def _add_device(device):
     receiver_path = device.receiver.path if device.receiver is not None else device.path
     # not true for wired devices - assert receiver_path
 
-    index = 0
+    index = None
     for idx, (path, _ignore, _ignore, _ignore) in enumerate(_devices_info):
         if path == receiver_path:
             # the first entry matching the receiver serial should be for the receiver itself
             index = idx + 1
             break
-    # assert index is not None
 
-    if device.receiver:
+    if index is None:
+        index = len(_devices_info)
+    elif device.receiver:
         # proper ordering (according to device.number) for a receiver's devices
         while True:
             path, number, _ignore, _ignore = _devices_info[index]


Test patch:
Repository: pwr-Solaar/Solaar

Issue:
Support for m500s mouse
**Information**
<!-- Please update to Solaar from this repository before asking for a new feature. -->
- Solaar version 1.0.7
- Distribution: Fedora 34
- Kernel version: Linux 5.14.13-200.fc34.x86_64 x86_64 GNU/Linux
- Output of `solaar show` for the target device (if applicable):

**Is your feature request related to a problem? Please describe.**
The Logitech m500s mouse is not detected.
**Describe the solution you'd like**
The ability to adjust the dpi primarily, but any other available features would be nice.
**Additional context**
Here is some output based off the information requested in issue 1225. My logitech mx master 2 works fine and was unplugged for this output. The hidraw appears to give the correct rw permissions when the mouse is plugged and unplugged.
```
lsusb
Bus 001 Device 005: ID 046d:c093 Logitech, Inc. Advanced Corded Mouse M500s

ls -l /dev/hidraw*
crw-------. 1 root root 240, 2 Oct 23 13:44 /dev/hidraw2
crw-------. 1 root root 240, 3 Oct 23 13:24 /dev/hidraw3
crw-------. 1 root root 240, 4 Oct 23 13:24 /dev/hidraw4
crw-rw----+ 1 root root 240, 5 Oct 23 14:28 /dev/hidraw5
crw-rw----+ 1 root root 240, 6 Oct 23 14:28 /dev/hidraw6

solaar -dd show
14:38:09,697    DEBUG [MainThread] logitech_receiver.diversion: rule Key assuming action "pressed" for "Brightness Down"
14:38:09,697    DEBUG [MainThread] logitech_receiver.diversion: rule Key assuming action "pressed" for "Brightness Up"
14:38:09,698    DEBUG [MainThread] solaar.ui.tray: using AppIndicator3
14:38:09,708    DEBUG [MainThread] hidapi.udev: Found device BID 0003 VID 0000046D PID 0000C093 INTERFACE 0 FILTER 2
14:38:09,709    DEBUG [MainThread] hidapi.udev: Found device BID 0003 VID 0000046D PID 0000C093 INTERFACE 1 FILTER 2
solaar: error: Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/solaar/cli/__init__.py", line 203, in run
    raise Exception('No devices found')
Exception: No devices found
```
Please let me know if there is any additional information needed. Thank you.


Discussion:

Resolving patch:
diff --git a/lib/logitech_receiver/descriptors.py b/lib/logitech_receiver/descriptors.py
--- a/lib/logitech_receiver/descriptors.py
+++ b/lib/logitech_receiver/descriptors.py
@@ -580,6 +580,7 @@ def get_btid(btid):
 _D('G903 Lightspeed Gaming Mouse', codename='G903', usbid=0xc086)
 _D('G903 Hero Gaming Mouse', codename='G903 Hero', usbid=0xc091)
 _D('GPro Gaming Mouse', codename='GPro', usbid=0xc088)
+_D('M500S Mouse', codename='M500S', usbid=0xc093, interface=1)
 
 _D(
     'LX5 Cordless Mouse',


Test patch:
Repository: pwr-Solaar/Solaar

Issue:
Problem with icon in top panel
I'm using Ubuntu 20.04 with Gnome 3.36.8. I was using Solaar 1.0.7 (I think), but have just been updated to 1.1.0. Solaar runs automatically when I boot up. With the last version, I had a small battery icon in my top panel representing Solaar. Now, I have a tiny slice of what is obviously a very large battery showing, with blank space on either side, occupying in total some inches on my top panel.

I'd be very grateful if I could be told what to do to get back to an appropriate size icon whenever I boot up.

Thanks,

Leslie


Discussion:
Duplicate of #1351 

Resolving patch:
diff --git a/lib/solaar/gtk.py b/lib/solaar/gtk.py
--- a/lib/solaar/gtk.py
+++ b/lib/solaar/gtk.py
@@ -81,6 +81,7 @@ def _parse_arguments():
         choices=('regular', 'symbolic', 'solaar'),
         help='prefer regular battery / symbolic battery / solaar icons'
     )
+    arg_parser.add_argument('--tray-icon-size', type=int, help='explicit size for tray icons')
     arg_parser.add_argument('-V', '--version', action='version', version='%(prog)s ' + __version__)
     arg_parser.add_argument('--help-actions', action='store_true', help='print help for the optional actions')
     arg_parser.add_argument('action', nargs=argparse.REMAINDER, choices=_cli.actions, help='optional actions to perform')
@@ -96,6 +97,8 @@ def _parse_arguments():
 
     global battery_icons_style
     battery_icons_style = args.battery_icons if args.battery_icons is not None else 'regular'
+    global tray_icon_size
+    tray_icon_size = args.tray_icon_size
 
     import logging
     if args.debug > 0:
diff --git a/lib/solaar/ui/tray.py b/lib/solaar/ui/tray.py
--- a/lib/solaar/ui/tray.py
+++ b/lib/solaar/ui/tray.py
@@ -42,7 +42,7 @@
 # constants
 #
 
-_TRAY_ICON_SIZE = 64  # pixels - make large as downscaling is done but not always upscaling
+_TRAY_ICON_SIZE = 48
 _MENU_ICON_SIZE = Gtk.IconSize.LARGE_TOOLBAR
 _RECEIVER_SEPARATOR = ('~', None, None, None)
 
@@ -174,9 +174,11 @@ def _scroll(tray_icon, event, direction=None):
     # https://bugs.launchpad.net/ubuntu/+source/libappindicator/+bug/1363277
     # Defense against bug that shows up in XFCE 4.16 where icons are not upscaled
     def _icon_file(icon_name):
-        if False and not os.path.isfile(icon_name):
+        if gtk.tray_icon_size is None and not os.path.isfile(icon_name):
             return icon_name
-        icon_info = Gtk.IconTheme.get_default().lookup_icon(icon_name, _TRAY_ICON_SIZE, Gtk.IconLookupFlags.FORCE_SVG)
+        icon_info = Gtk.IconTheme.get_default().lookup_icon(
+            icon_name, gtk.tray_icon_size or _TRAY_ICON_SIZE, Gtk.IconLookupFlags.FORCE_SVG
+        )
         return icon_info.get_filename() if icon_info else icon_name
 
     def _create(menu):


Test patch: