t-wissmann / barpyrus

A python wrapper for lemonbar
Other
33 stars 7 forks source link

Add support for xrandr module #19

Closed ecks closed 1 year ago

ecks commented 2 years ago

Hello,

I have been using this module for a while. I have based it off a similar module in py3status:

https://github.com/ultrabug/py3status/blob/master/py3status/modules/xrandr.py

Let me know if there might be any interested into merging this module. The idea is that if you have a laptop display and you plug in an extra monitor, and for instance you have 'eDP1' and 'DP2-1' available, the script will show up an enumeration of:

['eDP1', 'DP2-1', 'eDP1+DP2-1', 'eDP1=DP2-1']

and you can cycle the enumeration with your left mouse. Then when you want to "commit" that xrandr property, you right click with the mouse and it executes the xrandr command to make it happen. So if you want to extend eDP1 and DP2-1, it is 'eDP1+DP2-1', and if you want to mirror them it is 'eDP1=DP2-1'. Or you can choose to either display eDP1 or DP2-1 only.

Here is an example of how I am currently using it in config file:

https://github.com/ultrabug/py3status/blob/master/py3status/modules/xrandr.py (wrong link, sorry, please see answer below)

I am also willing to work on making the module better, I have not tested it much.

t-wissmann commented 1 year ago

Hi, sorry for the late answer! Do I understand it correctly that you don't use barpyrus itself? Though I appreciate the effort you made, I'm very reluctant to add code to the repository that has not been requested by a user. The reason for that is that merging code always creates effort on my side (reading the code and then maintaining it afterwards), because I feel responsible for the modules I ship together with barpyrus.

ecks commented 1 year ago

oops i am sorry about that, the second link was meant to go my config file as an example of how I am using the xrandr module. I am definitely using barpyrus directly. here is how I am using the module in my config file:

https://github.com/ecks/dotfiles/commit/576dc2519fa4f14054e46dd337a8533e44411f40?diff=split#diff-952be5741a828cf89a7e92a6dcbc0c3e884ffe48a581e6abb784670d4d7ec27e

Only config.py here is relevant, the rest of the diff is not relevant at all to this PR. I used to have this module directly implemented in config.py, but have changed it so that in config.py it just calls the module.

I understand your reluctance in accepting this change, and it is perfectly okay. Just sharing this out there in case it might be useful to someone that uses xrandr / arandr for their monitor setup. To be honest, I have not tested this code well and have only used it for me personally. Another useful feature, I think, is the ToggleButton Widget, this allows you to click on an area and cycle through different things (in this case the different monitor configurations). I have thought of some other ways that the ToggleButton could be useful, but havent had time to implement yet.