Skip to content

Commit a606ab7

Browse files
committed
feat(longshot): add longshot protocol launcher support
1 parent b6b4644 commit a606ab7

File tree

19 files changed

+442
-0
lines changed

19 files changed

+442
-0
lines changed

.changeset/chatty-jars-fry.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'protocol-launcher': minor
3+
---
4+
5+
feat(longshot): add longshot protocol launcher support

apps/docs/.vitepress/config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export default defineConfig({
4646
'en/apps/kaleidoscope.md': 'apps/kaleidoscope.md',
4747
'en/apps/kiro.md': 'apps/kiro.md',
4848
'en/apps/lingma.md': 'apps/lingma.md',
49+
'en/apps/longshot.md': 'apps/longshot.md',
4950
'en/apps/macos.md': 'apps/macos.md',
5051
'en/apps/macvim.md': 'apps/macvim.md',
5152
'en/apps/microsoft-edge.md': 'apps/microsoft-edge.md',
@@ -155,6 +156,7 @@ export default defineConfig({
155156
{ text: 'Kaleidoscope', link: '/apps/kaleidoscope' },
156157
{ text: 'Kiro', link: '/apps/kiro' },
157158
{ text: 'Lingma', link: '/apps/lingma' },
159+
{ text: 'Longshot', link: '/apps/longshot' },
158160
{ text: 'macOS', link: '/apps/macos' },
159161
{ text: 'MacVim', link: '/apps/macvim' },
160162
{ text: 'Microsoft Edge', link: '/apps/microsoft-edge' },
@@ -269,6 +271,7 @@ export default defineConfig({
269271
{ text: 'Kaleidoscope', link: '/apps/kaleidoscope' },
270272
{ text: 'Kiro', link: '/apps/kiro' },
271273
{ text: 'Lingma', link: '/apps/lingma' },
274+
{ text: 'Longshot', link: '/apps/longshot' },
272275
{ text: 'macOS', link: '/apps/macos' },
273276
{ text: 'MacVim', link: '/apps/macvim' },
274277
{ text: 'Microsoft Edge', link: '/apps/microsoft-edge' },
@@ -349,6 +352,7 @@ export default defineConfig({
349352
{ text: 'Kaleidoscope', link: '/zh/apps/kaleidoscope' },
350353
{ text: 'Kiro', link: '/zh/apps/kiro' },
351354
{ text: 'Lingma', link: '/zh/apps/lingma' },
355+
{ text: 'Longshot', link: '/zh/apps/longshot' },
352356
{ text: 'macOS', link: '/zh/apps/macos' },
353357
{ text: 'MacVim', link: '/zh/apps/macvim' },
354358
{ text: 'Microsoft Edge', link: '/zh/apps/microsoft-edge' },
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
export const snipParams = {
2+
func: 'start',
3+
}
4+
5+
export const recordParams = {
6+
func: 'startArea',
7+
}
8+
9+
export const ocrParams = {
10+
func: 'start',
11+
}
12+
13+
export const ruleParams = {
14+
func: 'start',
15+
}
16+
17+
export const prefParams = {
18+
page: 'shortcuts',
19+
}

apps/docs/en/apps/longshot.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
---
2+
layout: doc
3+
---
4+
5+
<script setup lang="ts">
6+
import { ref, computed } from 'vue';
7+
import VPLink from 'vitepress/dist/client/theme-default/components/VPLink.vue';
8+
import { ocr, pref, record, rule, snip } from 'protocol-launcher/longshot';
9+
import { SelectInstallationMethod } from '../../.vitepress/components';
10+
import { ocrParams, prefParams, recordParams, ruleParams, snipParams } from '../../.vitepress/constants/longshot';
11+
12+
const currentMethod = ref('On-Demand');
13+
const importPath = computed(() => currentMethod.value === 'On-Demand' ? 'protocol-launcher/longshot' : 'protocol-launcher');
14+
</script>
15+
16+
# Longshot
17+
18+
[Longshot](https://longshot.chitaner.com/) is a powerful screenshot and screen recording tool for macOS. **Protocol Launcher** allows you to generate deep links to trigger actions like screenshot, recording, OCR, and more in Longshot.
19+
20+
## Usage
21+
22+
There are two ways to use this library:
23+
24+
- On-Demand import from subpaths enables tree-shaking and keeps bundles small.
25+
- Full Import from the root package is convenient but includes all app modules.
26+
27+
Pick On-Demand for production builds; Full Import is fine for quick scripts or demos.
28+
29+
<SelectInstallationMethod v-model="currentMethod" />
30+
31+
### Start Screenshot
32+
33+
```ts-vue [{{currentMethod}}]
34+
import { {{ currentMethod === 'On-Demand' ? 'snip' : 'longshot' }} } from '{{ importPath }}'
35+
36+
const url = {{currentMethod === 'On-Demand' ? '' : 'longshot.'}}snip({
37+
func: 'start',
38+
})
39+
```
40+
41+
<div class="flex justify-center">
42+
<VPLink :href="snip(snipParams)" target="_self">
43+
Start Screenshot
44+
</VPLink>
45+
</div>
46+
47+
### Start Area Recording
48+
49+
```ts-vue [{{currentMethod}}]
50+
import { {{ currentMethod === 'On-Demand' ? 'record' : 'longshot' }} } from '{{ importPath }}'
51+
52+
const url = {{currentMethod === 'On-Demand' ? '' : 'longshot.'}}record({
53+
func: 'startArea',
54+
})
55+
```
56+
57+
<div class="flex justify-center">
58+
<VPLink :href="record(recordParams)" target="_self">
59+
Start Area Recording
60+
</VPLink>
61+
</div>
62+
63+
### Start OCR
64+
65+
```ts-vue [{{currentMethod}}]
66+
import { {{ currentMethod === 'On-Demand' ? 'ocr' : 'longshot' }} } from '{{ importPath }}'
67+
68+
const url = {{currentMethod === 'On-Demand' ? '' : 'longshot.'}}ocr({
69+
func: 'start',
70+
})
71+
```
72+
73+
<div class="flex justify-center">
74+
<VPLink :href="ocr(ocrParams)" target="_self">
75+
Start OCR
76+
</VPLink>
77+
</div>
78+
79+
### Start Screen Measurement
80+
81+
```ts-vue [{{currentMethod}}]
82+
import { {{ currentMethod === 'On-Demand' ? 'rule' : 'longshot' }} } from '{{ importPath }}'
83+
84+
const url = {{currentMethod === 'On-Demand' ? '' : 'longshot.'}}rule({
85+
func: 'start',
86+
})
87+
```
88+
89+
<div class="flex justify-center">
90+
<VPLink :href="rule(ruleParams)" target="_self">
91+
Start Screen Measurement
92+
</VPLink>
93+
</div>
94+
95+
### Open Preferences
96+
97+
```ts-vue [{{currentMethod}}]
98+
import { {{ currentMethod === 'On-Demand' ? 'pref' : 'longshot' }} } from '{{ importPath }}'
99+
100+
const url = {{currentMethod === 'On-Demand' ? '' : 'longshot.'}}pref({
101+
page: 'shortcuts',
102+
})
103+
```
104+
105+
<div class="flex justify-center">
106+
<VPLink :href="pref(prefParams)" target="_self">
107+
Open Preferences
108+
</VPLink>
109+
</div>

apps/docs/en/guide/getting-started.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ For detailed usage instructions for each application, please refer to their resp
146146
- [Kaleidoscope](../apps/kaleidoscope.md)
147147
- [Kiro](../apps/kiro.md)
148148
- [Lingma](../apps/lingma.md)
149+
- [Longshot](../apps/longshot.md)
149150
- [macOS](../apps/macos.md)
150151
- [MacVim](../apps/macvim.md)
151152
- [Microsoft Edge](../apps/microsoft-edge.md)

apps/docs/en/guide/what-is-it.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ Currently, we support the following applications:
4949
- [Kaleidoscope](../apps/kaleidoscope.md)
5050
- [Kiro](../apps/kiro.md)
5151
- [Lingma](../apps/lingma.md)
52+
- [Longshot](../apps/longshot.md)
5253
- [macOS](../apps/macos.md)
5354
- [MacVim](../apps/macvim.md)
5455
- [Microsoft Edge](../apps/microsoft-edge.md)

apps/docs/zh/apps/longshot.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
---
2+
layout: doc
3+
---
4+
5+
<script setup lang="ts">
6+
import { ref, computed } from 'vue';
7+
import VPLink from 'vitepress/dist/client/theme-default/components/VPLink.vue';
8+
import { ocr, pref, record, rule, snip } from 'protocol-launcher/longshot';
9+
import { SelectInstallationMethod } from '../../.vitepress/components';
10+
import { ocrParams, prefParams, recordParams, ruleParams, snipParams } from '../../.vitepress/constants/longshot';
11+
12+
const currentMethod = ref('On-Demand');
13+
const importPath = computed(() => currentMethod.value === 'On-Demand' ? 'protocol-launcher/longshot' : 'protocol-launcher');
14+
</script>
15+
16+
# Longshot
17+
18+
[Longshot](https://longshot.chitaner.com/) 是一款强大的 macOS 截图和录屏工具。**Protocol Launcher** 允许您生成深度链接以在 Longshot 中触发截图、录屏、OCR 等操作。
19+
20+
## 使用方式
21+
22+
有两种使用此库的方式:
23+
24+
- 按需导入(On-Demand):从子路径导入支持 tree-shaking,保持较小的打包体积。
25+
- 完整导入(Full Import):从根包导入更方便,但会包含所有应用模块。
26+
27+
生产构建建议选择按需导入;快速脚本或演示可以使用完整导入。
28+
29+
<SelectInstallationMethod v-model="currentMethod" />
30+
31+
### 开始截图
32+
33+
```ts-vue [{{currentMethod}}]
34+
import { {{ currentMethod === 'On-Demand' ? 'snip' : 'longshot' }} } from '{{ importPath }}'
35+
36+
const url = {{currentMethod === 'On-Demand' ? '' : 'longshot.'}}snip({
37+
func: 'start',
38+
})
39+
```
40+
41+
<div class="flex justify-center">
42+
<VPLink :href="snip(snipParams)" target="_self">
43+
开始截图
44+
</VPLink>
45+
</div>
46+
47+
### 开始区域录屏
48+
49+
```ts-vue [{{currentMethod}}]
50+
import { {{ currentMethod === 'On-Demand' ? 'record' : 'longshot' }} } from '{{ importPath }}'
51+
52+
const url = {{currentMethod === 'On-Demand' ? '' : 'longshot.'}}record({
53+
func: 'startArea',
54+
})
55+
```
56+
57+
<div class="flex justify-center">
58+
<VPLink :href="record(recordParams)" target="_self">
59+
开始区域录屏
60+
</VPLink>
61+
</div>
62+
63+
### 开始 OCR 文字识别
64+
65+
```ts-vue [{{currentMethod}}]
66+
import { {{ currentMethod === 'On-Demand' ? 'ocr' : 'longshot' }} } from '{{ importPath }}'
67+
68+
const url = {{currentMethod === 'On-Demand' ? '' : 'longshot.'}}ocr({
69+
func: 'start',
70+
})
71+
```
72+
73+
<div class="flex justify-center">
74+
<VPLink :href="ocr(ocrParams)" target="_self">
75+
开始 OCR 文字识别
76+
</VPLink>
77+
</div>
78+
79+
### 开始屏幕测量
80+
81+
```ts-vue [{{currentMethod}}]
82+
import { {{ currentMethod === 'On-Demand' ? 'rule' : 'longshot' }} } from '{{ importPath }}'
83+
84+
const url = {{currentMethod === 'On-Demand' ? '' : 'longshot.'}}rule({
85+
func: 'start',
86+
})
87+
```
88+
89+
<div class="flex justify-center">
90+
<VPLink :href="rule(ruleParams)" target="_self">
91+
开始屏幕测量
92+
</VPLink>
93+
</div>
94+
95+
### 打开偏好设置
96+
97+
```ts-vue [{{currentMethod}}]
98+
import { {{ currentMethod === 'On-Demand' ? 'pref' : 'longshot' }} } from '{{ importPath }}'
99+
100+
const url = {{currentMethod === 'On-Demand' ? '' : 'longshot.'}}pref({
101+
page: 'shortcuts',
102+
})
103+
```
104+
105+
<div class="flex justify-center">
106+
<VPLink :href="pref(prefParams)" target="_self">
107+
打开偏好设置
108+
</VPLink>
109+
</div>

apps/docs/zh/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export default defineAdditionalConfig({
5858
{ text: 'Kaleidoscope', link: '/zh/apps/kaleidoscope' },
5959
{ text: 'Kiro', link: '/zh/apps/kiro' },
6060
{ text: 'Lingma', link: '/zh/apps/lingma' },
61+
{ text: 'Longshot', link: '/zh/apps/longshot' },
6162
{ text: 'macOS', link: '/zh/apps/macos' },
6263
{ text: 'MacVim', link: '/zh/apps/macvim' },
6364
{ text: 'Microsoft Edge', link: '/zh/apps/microsoft-edge' },

apps/docs/zh/guide/getting-started.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ import { cherryStudio, cursor, githubDesktop } from 'protocol-launcher'
146146
- [Kaleidoscope](../apps/kaleidoscope.md)
147147
- [Kiro](../apps/kiro.md)
148148
- [Lingma](../apps/lingma.md)
149+
- [Longshot](../apps/longshot.md)
149150
- [macOS](../apps/macos.md)
150151
- [MacVim](../apps/macvim.md)
151152
- [Microsoft Edge](../apps/microsoft-edge.md)

apps/docs/zh/guide/what-is-it.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ layout: doc
4949
- [Kaleidoscope](../apps/kaleidoscope.md)
5050
- [Kiro](../apps/kiro.md)
5151
- [Lingma](../apps/lingma.md)
52+
- [Longshot](../apps/longshot.md)
5253
- [macOS](../apps/macos.md)
5354
- [MacVim](../apps/macvim.md)
5455
- [Microsoft Edge](../apps/microsoft-edge.md)

0 commit comments

Comments
 (0)