Skip to content

Commit

Permalink
update readme and notify(support open url)
Browse files Browse the repository at this point in the history
  • Loading branch information
Benature committed Dec 1, 2020
1 parent 5039355 commit 3dc866a
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
29 changes: 26 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,39 @@
<a href="https://flomoapp.com/"><img src="./logo-192x192.png" height="100" align="right"></a>

# Afred + [flomo](https://flomoapp.com/)
# [flomo](https://flomoapp.com/)

一个非官方的 API 玩具盒

- 【播客】[小宇宙url 👉 flomo memo](./xyz2flomo.py)
- Alfred + flomo ([demo 视频](https://m.okjike.com/originalPosts/5fc1e8f0c5e485001882a2be?s=ewoidSI6ICI1ZWUxZDQ1OGY5MmZiYzAwMTc3NWMwZTgiCn0=))
- [send a new flomo memo](./flomo.py)
- [ ] 模板

# Usage 使用

`config_sample.py` 更名为 `config.py`
## Cookies

[`config_sample.py`](./config_sample.py) 更名为 `config.py`

<p align="center">
<a href="#"><img src="https://s3.us-west-2.amazonaws.com/secure.notion-static.com/df9f58b6-0e3d-4bc4-86fa-0140afa6c203/Untitled.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAT73L2G45O3KS52Y5%2F20201201%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20201201T165601Z&X-Amz-Expires=86400&X-Amz-Signature=838775cb2a76b8e8e496931c1d0b20cc3347b0d713c7b6d5ff1e852adb83c510&X-Amz-SignedHeaders=host&response-content-disposition=filename%20%3D%22Untitled.png%22" width="70%"/></a>
</p>

[...待补充](https://www.notion.so/benature/flomo-0061a1c4d4b643c58a9855aa8a28e0fb)

## Alfred

...待补充

## About Notification 关于通知

<https://github.com/julienXX/terminal-notifier>
(macOS)有以下两种通知方法来实现:
- apple script
- [terminal-notifier](https://github.com/julienXX/terminal-notifier)

推荐后者,优点在于
- 设置了 logo
- 可自定系统提示音
- 支持点击通知后跳转到 flomo app
- 跳转到 Chrome app
- 跳转到 [flomoapp.com](https://flomoapp.com/) 网页
2 changes: 2 additions & 0 deletions config_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@
notify_config = {
'sound': 'Hero',
'activate': 'com.google.Chrome.app.xxxxxxxx',
'open': '', # 如不需打开网页请设置为空字符串 ''
'app_path': '/usr/local/Cellar/terminal-notifier/2.0.0/terminal-notifier.app/Contents/MacOS/terminal-notifier',
}
6 changes: 4 additions & 2 deletions notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

def notify(title, message,
subtitle='', sound=nc['sound'],
open=nc['open'],
activate=nc['activate'],
icon=icon_path):
'''https://github.com/julienXX/terminal-notifier'''
Expand All @@ -18,9 +19,10 @@ def notify(title, message,
icon = f'-appIcon "{icon}"'
activate = f'-activate "{activate}"'
sound = f'-sound "{sound}"'
open = '' if open == '' else f'-open "{open}"'

cmd = '/usr/local/Cellar/terminal-notifier/2.0.0/terminal-notifier.app/Contents/MacOS/terminal-notifier {} '.format(
' '.join([m, t, s, icon, activate, sound]))
cmd = '{} {} '.format(nc['app_path'],
' '.join([m, t, s, icon, activate, open, sound]))
os.system(cmd)


Expand Down

0 comments on commit 3dc866a

Please sign in to comment.