Skip to content

Commit 9ccec62

Browse files
committed
add plugin
1 parent ba67b81 commit 9ccec62

File tree

6 files changed

+97
-2
lines changed

6 files changed

+97
-2
lines changed

.github/workflows/Publish Release.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Publish Release
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ main ]
7+
paths-ignore:
8+
- .github/workflows/*
9+
10+
jobs:
11+
publish:
12+
runs-on: ubuntu-latest
13+
env:
14+
python_ver: 3.8
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Set up Python ${{ matrix.python-version }}
19+
uses: actions/setup-python@v2
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
- name: get version
23+
id: version
24+
uses: notiz-dev/github-action-json-property@release
25+
with:
26+
path: 'plugin.json'
27+
prop_path: 'Version'
28+
- run: echo ${{steps.version.outputs.prop}}
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install -r ./requirements.txt -t ./lib
33+
zip -r <NAME-OF-YOUR-PLUGIN>.zip . -x '*.git*'
34+
- name: Publish
35+
if: success() && github.ref == 'refs/heads/main'
36+
uses: softprops/action-gh-release@v1
37+
with:
38+
files: '<NAME-OF-YOUR-PLUGIN>.zip'
39+
tag_name: "v${{steps.version.outputs.prop}}"
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Images/app.png

5.57 KB
Loading

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
# Flow.Launcher.Plugin.HelloWorldPython
2-
This is a Python Hello World example plugin
1+
This is an example Python plugin project which demonstrates the interaction of request from Flow and then call back to the plugin.
2+
3+
You can install this plugin via `pm install Hello World Python`

main.py

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# -*- coding: utf-8 -*-
2+
3+
import sys,os
4+
parent_folder_path = os.path.abspath(os.path.dirname(__file__))
5+
sys.path.append(parent_folder_path)
6+
sys.path.append(os.path.join(parent_folder_path, 'lib'))
7+
sys.path.append(os.path.join(parent_folder_path, 'plugin'))
8+
9+
from flowlauncher import FlowLauncher
10+
11+
12+
class HelloWorld(FlowLauncher):
13+
14+
def query(self, query):
15+
return [
16+
{
17+
"Title": "Hello World, this is where title goes. {}".format(('Your query is: ' + query , query)[query == '']),
18+
"SubTitle": "This is where your subtitle goes",
19+
"IcoPath": "Images/app.png",
20+
"JsonRPCAction": {
21+
"method": "do_something_for_query",
22+
"parameters": [param1, param2]
23+
}
24+
}
25+
]
26+
27+
def context_menu(self, data):
28+
return [
29+
{
30+
"Title": "Context menu entry",
31+
"SubTitle": "Data: {}".format(data),
32+
"IcoPath": "Images/app.ico",
33+
}
34+
]
35+
36+
def do_something_for_query(self, param1, param2):
37+
pass
38+
39+
if __name__ == "__main__":
40+
HelloWorld()

plugin.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"ID": "2f4e384e-76ce-45c3-aea2-b16f5e5c328f",
3+
"ActionKeyword": "hp",
4+
"Name": "Hello World Python",
5+
"Description": "Python Hello World example plugin",
6+
"Author": "Flow Launcher",
7+
"Version": "1.0.0",
8+
"Language": "python",
9+
"Website": "https://github.com/Flow-Launcher/Flow.Launcher.Plugin.HelloWorldPython",
10+
"IcoPath": "Images\\app.png",
11+
"ExecuteFileName": "main.py"
12+
}

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
flowlauncher

0 commit comments

Comments
 (0)