Skip to content

Commit 59efefc

Browse files
committed
add context menu + methods
1 parent 47c7fc8 commit 59efefc

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

main.py

+13-8
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
sys.path.append(os.path.join(parent_folder_path, 'plugin'))
88

99
from flowlauncher import FlowLauncher
10+
import webbrowser
1011

1112

1213
class HelloWorld(FlowLauncher):
@@ -15,26 +16,30 @@ def query(self, query):
1516
return [
1617
{
1718
"Title": "Hello World, this is where title goes. {}".format(('Your query is: ' + query , query)[query == '']),
18-
"SubTitle": "This is where your subtitle goes",
19+
"SubTitle": "This is where your subtitle goes, press enter to open Flow's url",
1920
"IcoPath": "Images/app.png",
2021
"JsonRPCAction": {
21-
"method": "do_something_for_query",
22-
"parameters": [param1, param2]
22+
"method": "open_url",
23+
"parameters": ["https://github.com/Flow-Launcher/Flow.Launcher"]
2324
}
2425
}
2526
]
2627

2728
def context_menu(self, data):
2829
return [
2930
{
30-
"Title": "Context menu entry",
31-
"SubTitle": "Data: {}".format(data),
32-
"IcoPath": "Images/app.ico",
31+
"Title": "Hello World Python's Context menu",
32+
"SubTitle": "Press enter to open Flow the plugin's repo in GitHub",
33+
"IcoPath": "Images/app.png",
34+
"JsonRPCAction": {
35+
"method": "open_url",
36+
"parameters": ["https://github.com/Flow-Launcher/Flow.Launcher.Plugin.HelloWorldPython"]
37+
}
3338
}
3439
]
3540

36-
def do_something_for_query(self, param1, param2):
37-
pass
41+
def open_url(self, url):
42+
webbrowser.open(url)
3843

3944
if __name__ == "__main__":
4045
HelloWorld()

0 commit comments

Comments
 (0)