Skip to content

Commit

Permalink
[add] quicklook for mac
Browse files Browse the repository at this point in the history
  • Loading branch information
AIboy996 committed Dec 8, 2024
1 parent 4e79803 commit 3047041
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 2 deletions.
14 changes: 14 additions & 0 deletions docs/Note/Mac/applescript.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
tags:
- Mac
- Shell
---

# AppleScript
Expand Down Expand Up @@ -28,6 +29,7 @@ Generic Scripting System

当然你也可以使用[JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript)作为脚本语言。不过我们这里主要使用AppleScript,因为它会提供很多独特、便捷的关键字函数。

## 例子
一个最简单的AppleScript例子是:

<div class='console'>
Expand All @@ -36,6 +38,18 @@ Generic Scripting System
$ osascript -e 'get current date'
date 2024年9月11日 星期三 15:29:30

```

</div>

再比如你可以通过AppleScript来查询软件的包名(Bundle ID)
<div class='console'>

```console
$ osascript -e 'id of app "wechat"'
com.tencent.xinWeChat


```

</div>
Binary file added docs/Note/Mac/assets/2024-12-08-16-32-08.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Note/Mac/assets/2024-12-08-16-36-47.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Note/Mac/assets/2024-12-08-16-39-57.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
116 changes: 116 additions & 0 deletions docs/Note/Mac/quicklook.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
---
tags:
- Mac
---

# QuickLook

QuickLook(快速预览)是Mac上最好用的功能之一。

比如说你可以快速查看、编辑图片:

<figure markdown>

![](https://help.apple.com/assets/6716DCA9E121372173069823/6716DCAAD224F0859301B7BA/en_GB/d40e831955745b154cab7d8b7c3c44e0.png){width=400}

</figure>


然而它还不够好用,很多文件格式都不支持QuickLook。这时我们可以通过扩展插件来支持特定的文件格式。

## Markdown文件

我最常用的文档格式之一,使用qlmarkdown插件即可预览:

<figure markdown>

[![toland/qlmarkdown - GitHub](https://gh-card.dev/repos/toland/qlmarkdown.svg?fullname=)](https://github.com/toland/qlmarkdown)

</figure>

安装方法:
```bash
brew install --cask qlmarkdown
```

效果:
![](assets/2024-12-08-16-32-08.png)

> 主题可以自选,我这里选择了GitHub的主题
## 压缩文件
Mac上我使用的是[Keka](https://www.keka.io/en/)来压缩、解压缩文件。很好用,但是它不提供对压缩包的预览。qlZipInfo可以解决这个问题:

<figure markdown>

[![srirangav/qlZipInfo - GitHub](https://gh-card.dev/repos/srirangav/qlZipInfo.svg?fullname=)](https://github.com/srirangav/qlZipInfo)

</figure>

安装方法:

1. Create the directory ~/Library/QuickLook if it doesn't
exist

2. Copy qlZipInfo.qlgenerator to ~/Library/QuickLook

3. Restart QuickLook:

/usr/bin/qlmanage -r
/usr/bin/qlmanage -r cache

4. Wait a minute or two for QuickLook to properly load
or reload qlZipInfo.qlgenerator

效果:
![](assets/2024-12-08-16-36-47.png)

## 无后缀纯文本文件

例如LISCENSE、INSTALL、MAKEFILE等无后缀纯文本文件,可以使用qlstephen来预览:

<figure markdown>

[![whomwah/qlstephen - GitHub](https://gh-card.dev/repos/whomwah/qlstephen.svg?fullname=)](https://github.com/whomwah/qlstephen)

</figure>

安装方法:
```bash
brew install --cask qlstephen
```

效果:
![](assets/2024-12-08-16-39-57.png)

## 其他

暂时我就安装了这三个插件。

更多插件可以参考:

<figure markdown>

[![haokaiyang/Mac-QuickLook - GitHub](https://gh-card.dev/repos/haokaiyang/Mac-QuickLook.svg?fullname=)](https://github.com/haokaiyang/Mac-QuickLook)

</figure>

这个仓库列举了很多QuickLook plugins

以及:

[加强你的「一指禅」:Mac QuickLook「快速预览」兼容性扩展教程](https://sspai.com/post/31927)

这篇文章也介绍了好几个插件。

你甚至可以自己写一个简单的插件,我猜想并不复杂。

例如支持zip文件预览的小插件:

<figure markdown>

[![richie5um/QLZip - GitHub](https://gh-card.dev/repos/richie5um/QLZip.svg?fullname=)](https://github.com/richie5um/QLZip)

</figure>

代码量很小。
7 changes: 7 additions & 0 deletions docs/Note/Reading/summer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
tags:
- 电影
---

# 和Summer的五百天

6 changes: 4 additions & 2 deletions nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ nav:
- Note:
- Note/index.md
- Note/software.md
- 读书:
- Note/Reading/wuyingdeng.md
- 爬虫:
- Note/Spider/antispider.md
- 复旦:
Expand All @@ -22,12 +20,16 @@ nav:
- Note/Fudan/fdulife.md
- Note/Fudan/script.md
- Note/Fudan/stuvpn.md
- 书影音:
- Note/Reading/wuyingdeng.md
- Note/Reading/summer.md
- 我用Mac:
- Note/Mac/index.md
- Note/Mac/zsh.md
- Note/Mac/sketchybar.md
- Note/Mac/hammerspoon.md
- Note/Mac/applescript.md
- Note/Mac/quicklook.md
- Docker:
- Note/Docker/docker_intro.md
- Note/Docker/docker_basic.md
Expand Down

0 comments on commit 3047041

Please sign in to comment.