Skip to content

Commit c0010bc

Browse files
committed
update code
1 parent 1e716b2 commit c0010bc

File tree

8 files changed

+24
-12
lines changed

8 files changed

+24
-12
lines changed

.github/workflows/publish_release.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v2
1616

17-
- name: Set up Python ${{ matrix.python-version }}
17+
- name: Set up Python ${{ env.python_ver }}
1818
uses: actions/setup-python@v2
1919
with:
20-
python-version: ${{ matrix.python-version }}
20+
python-version: ${{ env.python_ver }}
2121

2222
- name: get version
2323
id: version
@@ -39,5 +39,4 @@ jobs:
3939
uses: softprops/action-gh-release@v2
4040
with:
4141
files: '${{ github.event.repository.name }}.zip'
42-
tag_name: "v${{steps.version.outputs.prop}}"
43-
body_path: 'CHANGELOG.txt
42+
tag_name: "v${{steps.version.outputs.prop}}"

assets/get_brightness.png

15.3 KB
Loading

assets/set_brightness.png

6.72 KB
Loading

main.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
sys.path.append(parent_folder_path)
66
sys.path.append(os.path.join(parent_folder_path, "lib"))
77
sys.path.append(os.path.join(parent_folder_path, "venv", "lib", "site-packages"))
8+
sys.path.append(os.path.join(parent_folder_path, "venv", "lib", "site-packages", "win32", "lib"))
9+
sys.path.append(os.path.join(parent_folder_path, "venv", "lib", "site-packages", "win32"))
10+
sys.path.append(os.path.join(parent_folder_path, "lib", "win32", "lib"))
11+
sys.path.append(os.path.join(parent_folder_path, "lib", "win32"))
812

913
from plugin.plugin import ScreenBrightnessPlugin
1014

plugin/handlers/get.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ def __init__(self):
1212
async def callback(self, query: Query):
1313
assert self.plugin
1414

15-
return Result("", sub=f"Brightness: {self.plugin.brightness}%", icon="assets/app.png", progress_bar=ProgressBar(self.plugin.brightness, "#f7f309"))
15+
for value, monitor in self.plugin.get_brightnesses():
16+
yield Result("", sub=f"Monitor: {monitor} | Brightness: {value}%", icon="assets/app.png", progress_bar=ProgressBar(value, "#f7f309"))

plugin/handlers/set.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def __init__(self, value: int, kw: str, **kwargs: Unpack[ResultConstructorArgs])
1717
async def callback(self):
1818
assert self.plugin
1919

20-
self.plugin.brightness = self.value
20+
self.plugin.set_brightness(self.value)
2121
await self.plugin.api.show_notification("ScreenBrightness", f"Successfully set screen brightness to {self.value}%.")
2222
await self.plugin.api.change_query(f"{self.kw} ")
2323

plugin/plugin.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from flogin import Plugin
22

33
from .settings import ScreenBrightnessSettings
4+
from typing import Iterable
45
import screen_brightness_control as sbc
56

67
class ScreenBrightnessPlugin(Plugin[ScreenBrightnessSettings]):
@@ -13,10 +14,8 @@ def __init__(self) -> None:
1314

1415
self.register_search_handlers(SetBrightnessHandler(), GetBrightnessHandler(), InvalidSetBrightnessHandler())
1516

16-
@property
17-
def brightness(self) -> int:
18-
return sbc.get_brightness()[0]
17+
def get_brightnesses(self) -> Iterable[tuple[int, str]]:
18+
return zip(sbc.get_brightness(), sbc.list_monitors())
1919

20-
@brightness.setter
21-
def brightness(self, value: int) -> None:
20+
def set_brightness(self, value: int) -> None:
2221
sbc.set_brightness(value)

readme.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,11 @@
11
# Flow.Launcher.Plugin.ScreenBrightness
2-
Lets you easily and quickly the brightness of all of your monitors
2+
Lets you easily and quickly the brightness of all of your monitors
3+
4+
**Coming Soon**: Setting the brightness of individual monitors. I am hung up on the design, so it will come eventually.
5+
6+
## Useage
7+
8+
An empty query will get you the current brightness levels. From there, type in the new value, and click on the option.
9+
10+
![alt text](assets/get_brightness.png)
11+
![alt text](assets/set_brightness.png)

0 commit comments

Comments
 (0)