Skip to content

Commit

Permalink
add context menu + methods
Browse files Browse the repository at this point in the history
  • Loading branch information
jjw24 committed Dec 28, 2021
1 parent 47c7fc8 commit 59efefc
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
sys.path.append(os.path.join(parent_folder_path, 'plugin'))

from flowlauncher import FlowLauncher
import webbrowser


class HelloWorld(FlowLauncher):
Expand All @@ -15,26 +16,30 @@ def query(self, query):
return [
{
"Title": "Hello World, this is where title goes. {}".format(('Your query is: ' + query , query)[query == '']),
"SubTitle": "This is where your subtitle goes",
"SubTitle": "This is where your subtitle goes, press enter to open Flow's url",
"IcoPath": "Images/app.png",
"JsonRPCAction": {
"method": "do_something_for_query",
"parameters": [param1, param2]
"method": "open_url",
"parameters": ["https://github.com/Flow-Launcher/Flow.Launcher"]
}
}
]

def context_menu(self, data):
return [
{
"Title": "Context menu entry",
"SubTitle": "Data: {}".format(data),
"IcoPath": "Images/app.ico",
"Title": "Hello World Python's Context menu",
"SubTitle": "Press enter to open Flow the plugin's repo in GitHub",
"IcoPath": "Images/app.png",
"JsonRPCAction": {
"method": "open_url",
"parameters": ["https://github.com/Flow-Launcher/Flow.Launcher.Plugin.HelloWorldPython"]
}
}
]

def do_something_for_query(self, param1, param2):
pass
def open_url(self, url):
webbrowser.open(url)

if __name__ == "__main__":
HelloWorld()

0 comments on commit 59efefc

Please sign in to comment.