-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
44 lines (35 loc) · 1.7 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import RM
from ulauncher.api.client.Extension import Extension
from ulauncher.api.shared.event import KeywordQueryEvent, ItemEnterEvent
from KeywordQueryEventListener import KeywordQueryEventListener
from ItemEnterEventListener import ItemEnterEventListener
from ulauncher.api.shared.action.DoNothingAction import DoNothingAction
from ulauncher.api.shared.action.ExtensionCustomAction import ExtensionCustomAction
from ulauncher.api.shared.action.RenderResultListAction import RenderResultListAction
from ulauncher.api.shared.action.SetUserQueryAction import SetUserQueryAction
from ulauncher.api.shared.item.ExtensionSmallResultItem import ExtensionSmallResultItem
from ulauncher.api.shared.item.ExtensionResultItem import ExtensionResultItem
class RemovePackageMain(Extension):
def __init__(self):
super(RemovePackageMain, self).__init__()
self.logger.info("Inializing Extension")
self.subscribe(KeywordQueryEvent, KeywordQueryEventListener())
self.subscribe(ItemEnterEvent, ItemEnterEventListener())
def render_main_page(self, action):
repos = self.preferences["repo"]
packageNames = RM.list(repos)
items = []
for package in packageNames:
items.append(
ExtensionSmallResultItem(
icon="images/remove.png",
name=package,
description="Skip current song and go to the next song",
on_enter=ExtensionCustomAction(
{"action": "remove", "package": package}, keep_app_open=True
),
)
)
return RenderResultListAction(items)
if __name__ == "__main__":
RemovePackageMain().run()