|
| 1 | +from rofi_menu.menu import NestedMenu, Menu |
| 2 | +from .shell import ShellItem |
| 3 | + |
| 4 | + |
| 5 | +class SecondMonitorMenu(Menu): |
| 6 | + prompt = "Second monitor" |
| 7 | + secod_monitor_options = [ |
| 8 | + { |
| 9 | + "text": '<span background="green"><b>Off</b></span>', |
| 10 | + "command": "xrandr --output {mon1} --auto --output {mon2} --off", |
| 11 | + }, |
| 12 | + { |
| 13 | + "text": '<span background="blue"><b>Mirror</b></span>', |
| 14 | + "command": "xrandr --output {mon1} --auto --output {mon2} --auto --same-as {mon1}", |
| 15 | + }, |
| 16 | + { |
| 17 | + "text": '<span background="gray"><b>Above</b></span>', |
| 18 | + "command": "xrandr --output {mon1} --auto --output {mon2} --auto --above {mon1}", |
| 19 | + }, |
| 20 | + { |
| 21 | + "text": '<span background="gray"><b>Left</b></span>', |
| 22 | + "command": "xrandr --output {mon1} --auto --output {mon2} --auto --left-of {mon1}", |
| 23 | + }, |
| 24 | + { |
| 25 | + "text": '<span background="gray"><b>Right</b></span>', |
| 26 | + "command": "xrandr --output {mon1} --auto --output {mon2} --auto --right-of {mon1}", |
| 27 | + }, |
| 28 | + { |
| 29 | + "text": '<span background="gray"><b>Below</b></span>', |
| 30 | + "command": "xrandr --output {mon1} --auto --output {mon2} --auto --below {mon1}", |
| 31 | + }, |
| 32 | + ] |
| 33 | + |
| 34 | + def __init__( |
| 35 | + self, |
| 36 | + prompt="Second monitor", |
| 37 | + primary_monitor="eDP1", |
| 38 | + secondary_monitor="HDMI1", |
| 39 | + ): |
| 40 | + items = [ |
| 41 | + ShellItem( |
| 42 | + text=option["text"].format( |
| 43 | + mon1=primary_monitor, mon2=secondary_monitor |
| 44 | + ), |
| 45 | + command=option["command"].format( |
| 46 | + mon1=primary_monitor, mon2=secondary_monitor |
| 47 | + ), |
| 48 | + ) |
| 49 | + for option in self.secod_monitor_options |
| 50 | + ] |
| 51 | + super().__init__(prompt=prompt, items=items) |
0 commit comments