Repository: pwr-Solaar/Solaar

Issue:
1200x800 support for small devices such as Steam Deck
**Information**
<!-- Please update to Solaar from this repository before asking for a new feature. -->
- Solaar version (`solaar --version` and `git describe --tags`): solaar 1.1.5
- Distribution: SteamOS Holo 3.3.2
- Kernel version (ex. `uname -srmo`): Linux 5.13.0-valve21.3-1-neptune x86_64 GNU/Linux
- Output of `solaar show` for the target device (if applicable):
- Arch Linux [package](https://archlinux.org/packages/community/any/solaar/) used

<details>

```
Solaar version 1.1.5

USB and Bluetooth Devices

  1: MX Keys Mini
     Device path  : /dev/hidraw5
     USB id       : 046d:B369
     Codename     : MX Keys Mini
     Kind         : ?
     Protocol     : HID++ 4.5
     Serial number: 
     Model ID:      B36900000000
     Unit ID:       D7699AF0
        Bootloader: BL1 53.01.B0006
          Firmware: RBK 73.01.B0006
             Other: 
     Supports 31 HID++ 2.0 features:
         0: ROOT                   {0000} V0     
         1: FEATURE SET            {0001} V0     
         2: DEVICE FW VERSION      {0003} V4     
            Firmware: Bootloader BL1 53.01.B0006 B369FD70F4
            Firmware: Firmware RBK 73.01.B0006 B369FD70F4
            Firmware: Other   
            Unit ID: D7699AF0  Model ID: B36900000000  Transport IDs: {'btleid': 'B369'}
         3: DEVICE NAME            {0005} V0     
            Name: MX Keys Mini
            Kind: keyboard
         4: WIRELESS DEVICE STATUS {1D4B} V0     
         5: RESET                  {0020} V0     
         6: DEVICE FRIENDLY NAME   {0007} V0     
            Friendly Name: MX Keys Mini
         7: UNIFIED BATTERY        {1004} V2     
            Battery: 95%, discharging.
         8: REPROG CONTROLS V4     {1B04} V5     
            Key/Button Diversion (saved): {Backlight Down:Regular, Backlight Up:Regular, Play/Pause Fn:Regular, Mute Fn:Regular, Volume Down Fn:Regular, Volume Up Fn:Regular, Voice Dictation:Diverted, Open Emoji Panel:Diverted, Snipping Tool:Regular, Delete:Regular, Mute Microphone:Regular}
            Key/Button Diversion        : {Backlight Down:Regular, Backlight Up:Regular, Play/Pause Fn:Regular, Mute Fn:Regular, Volume Down Fn:Regular, Volume Up Fn:Regular, Voice Dictation:Diverted, Open Emoji Panel:Diverted, Snipping Tool:Regular, Delete:Regular, Mute Microphone:Regular}
         9: CHANGE HOST            {1814} V1     
            Change Host        : 2:steamdeck
        10: HOSTS INFO             {1815} V1     
            Host 0 (unpaired): 
            Host 1 (paired): steamdeck
            Host 2 (unpaired): 
        11: BACKLIGHT2             {1982} V1     
            Backlight (saved): True
            Backlight        : True
        12: K375S FN INVERSION     {40A3} V0     
            Swap Fx function (saved): False
            Swap Fx function        : False
        13: LOCK KEY STATE         {4220} V0     
        14: KEYBOARD DISABLE KEYS  {4521} V0     
            Disable keys (saved): {Caps Lock:False, Insert:False, Win:False}
            Disable keys        : {Caps Lock:False, Insert:False, Win:False}
        15: MULTIPLATFORM          {4531} V1     
            Set OS (saved): Windows
            Set OS        : Windows
        16: DFUCONTROL             {00C3} V0     
        17: DEVICE RESET           {1802} V0    internal, hidden, unknown:000010 
        18: unknown:1803           {1803} V0    internal, hidden, unknown:000010 
        19: CONFIG DEVICE PROPS    {1806} V8    internal, hidden, unknown:000010 
        20: unknown:1816           {1816} V0    internal, hidden, unknown:000010 
        21: OOBSTATE               {1805} V0    internal, hidden 
        22: unknown:1830           {1830} V0    internal, hidden, unknown:000010 
        23: unknown:1891           {1891} V6    internal, hidden, unknown:000008 
        24: unknown:18A1           {18A1} V0    internal, hidden, unknown:000010 
        25: unknown:1E00           {1E00} V0    hidden 
        26: unknown:1E02           {1E02} V0    internal, hidden 
        27: unknown:1602           {1602} V0     
        28: unknown:1EB0           {1EB0} V0    internal, hidden, unknown:000010 
        29: unknown:1861           {1861} V0    internal, hidden, unknown:000010 
        30: unknown:1A20           {1A20} V0    internal, hidden, unknown:000010 
     Has 16 reprogrammable keys:
         0: Host Switch Channel 1     , default: HostSwitch Channel 1        => HostSwitch Channel 1      
             is FN, FN sensitive, analytics key events, pos:1, group:0, group mask:empty
             reporting: default
         1: Host Switch Channel 2     , default: HostSwitch Channel 2        => HostSwitch Channel 2      
             is FN, FN sensitive, analytics key events, pos:2, group:0, group mask:empty
             reporting: default
         2: Host Switch Channel 3     , default: HostSwitch Channel 3        => HostSwitch Channel 3      
             is FN, FN sensitive, analytics key events, pos:3, group:0, group mask:empty
             reporting: default
         3: Backlight Down            , default: Backlight Down              => Backlight Down            
             is FN, FN sensitive, reprogrammable, divertable, analytics key events, pos:4, group:0, group mask:empty
             reporting: default
         4: Backlight Up              , default: Backlight Up                => Backlight Up              
             is FN, FN sensitive, reprogrammable, divertable, analytics key events, pos:5, group:0, group mask:empty
             reporting: default
         5: Voice Dictation           , default: Voice Dictation             => Voice Dictation           
             is FN, FN sensitive, reprogrammable, divertable, analytics key events, pos:6, group:0, group mask:empty
             reporting: diverted
         6: Open Emoji Panel          , default: Open Emoji Panel            => Open Emoji Panel          
             is FN, FN sensitive, reprogrammable, divertable, analytics key events, pos:7, group:0, group mask:empty
             reporting: diverted
         7: Snipping Tool             , default: Snipping Tool               => Snipping Tool             
             is FN, FN sensitive, reprogrammable, divertable, analytics key events, pos:8, group:0, group mask:empty
             reporting: default
         8: Mute Microphone           , default: Mute Microphone             => Mute Microphone           
             is FN, FN sensitive, reprogrammable, divertable, analytics key events, pos:9, group:0, group mask:empty
             reporting: default
         9: Play/Pause Fn             , default: Play/Pause                  => Play/Pause                
             is FN, FN sensitive, reprogrammable, divertable, analytics key events, pos:10, group:0, group mask:empty
             reporting: default
        10: Mute Fn                   , default: Mute                        => Mute                      
             is FN, FN sensitive, reprogrammable, divertable, analytics key events, pos:11, group:0, group mask:empty
             reporting: default
        11: Volume Down Fn            , default: Volume Down                 => Volume Down               
             is FN, FN sensitive, reprogrammable, divertable, analytics key events, pos:12, group:0, group mask:empty
             reporting: default
        12: Volume Up Fn              , default: Volume Up                   => Volume Up                 
             nonstandard, reprogrammable, divertable, analytics key events, pos:13, group:0, group mask:empty
             reporting: default
        13: Delete                    , default: Delete                      => Delete                    
             nonstandard, reprogrammable, divertable, analytics key events, pos:14, group:0, group mask:empty
             reporting: default
        14: F Lock                    , default: Do Nothing One              => Do Nothing One            
             is FN, analytics key events, pos:0, group:0, group mask:empty
             reporting: default
        15: FN Key                    , default: Do Nothing One              => Do Nothing One            
             nonstandard, analytics key events, pos:0, group:0, group mask:empty
             reporting: default
     Battery: 95%, discharging.

```
</details>


**Is your feature request related to a problem? Please describe.**
Solaar Rule Editor window seem to be set to a minimal height of 800, this is very problematic for the Steam Deck device and its screen max resolution 1200x800

**Describe the solution you'd like**
I'd like most app windows to be resizable for less than 1200 in width and 800 in height

**Additional context**
I'm using SteamOS 3.3.2 as read-only, and I installed Arch Linux in `home/deck/CHROOT` to have access all my favorite tools under the official Arch Linux repositories, they all work great but one of them need some cosmetics fix I believe to fit perfectly in this beautiful device :)




Discussion:
Yes, the rule editor window size request is rather large for smaller screens.  I think the minimum (and start) size can be reduced considerably, to about the height of the Solaar main window.



Resolving patch:
diff --git a/lib/solaar/ui/diversion_rules.py b/lib/solaar/ui/diversion_rules.py
--- a/lib/solaar/ui/diversion_rules.py
+++ b/lib/solaar/ui/diversion_rules.py
@@ -117,8 +117,8 @@ def __init__(self):
         window.add(vbox)
 
         geometry = Gdk.Geometry()
-        geometry.min_width = 800
-        geometry.min_height = 800
+        geometry.min_width = 600  # don't ask for so much space
+        geometry.min_height = 400
         window.set_geometry_hints(None, geometry, Gdk.WindowHints.MIN_SIZE)
         window.set_position(Gtk.WindowPosition.CENTER)
 
@@ -192,7 +192,7 @@ def _create_top_panel(self):
         view.connect('button-release-event', self._event_button_released)
         view.get_selection().connect('changed', self._selection_changed)
         sw.add(view)
-        sw.set_size_request(0, 600)
+        sw.set_size_request(0, 300)  # don't ask for so much height
 
         button_box = Gtk.HBox(spacing=20)
         self.save_btn = Gtk.Button.new_from_icon_name('document-save', Gtk.IconSize.BUTTON)


Test patch: