forked from mabasic/ulauncher-laravel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
37 lines (26 loc) · 1.2 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
from ulauncher.api.client.Extension import Extension
from ulauncher.api.client.EventListener import EventListener
from ulauncher.api.shared.event import KeywordQueryEvent
from ulauncher.api.shared.item.ExtensionResultItem import ExtensionResultItem
from ulauncher.api.shared.action.RenderResultListAction import RenderResultListAction
from ulauncher.api.shared.action.OpenUrlAction import OpenUrlAction
class LaravelExtension(Extension):
def __init__(self):
super(LaravelExtension, self).__init__()
self.subscribe(KeywordQueryEvent, KeywordQueryEventListener())
class KeywordQueryEventListener(EventListener):
def on_event(self, event, extension):
description = "Type in your query and press Enter..."
url = "https://laravel.com/docs/"
if event.get_argument() != None:
description = url + event.get_argument()
return RenderResultListAction([
ExtensionResultItem(
icon='icons/laravel.svg',
name='Laravel Search',
description=description,
on_enter=OpenUrlAction(url + (event.get_argument() or ''))
)
])
if __name__ == '__main__':
LaravelExtension().run()