mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-11 05:39:45 +08:00
Compare commits
4 Commits
06a56786cd
...
9616ecb55e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9616ecb55e | ||
|
|
41c5b9677a | ||
|
|
116be8badd | ||
|
|
23e8881147 |
2
.github/workflows/dependencies.yml
vendored
2
.github/workflows/dependencies.yml
vendored
@ -13,7 +13,7 @@ jobs:
|
||||
contents: write # this is needed to push commits and branches
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
|
||||
4
.github/workflows/installer.yml
vendored
4
.github/workflows/installer.yml
vendored
@ -26,7 +26,7 @@ jobs:
|
||||
- macos-latest
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
@ -47,7 +47,7 @@ jobs:
|
||||
- test
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
|
||||
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@ -24,7 +24,7 @@ jobs:
|
||||
if: github.repository == 'ohmyzsh/ohmyzsh'
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
|
||||
2
.github/workflows/project.yml
vendored
2
.github/workflows/project.yml
vendored
@ -17,7 +17,7 @@ jobs:
|
||||
if: github.repository == 'ohmyzsh/ohmyzsh'
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
with:
|
||||
egress-policy: audit
|
||||
- name: Authenticate as @ohmyzsh
|
||||
|
||||
4
.github/workflows/scorecard.yml
vendored
4
.github/workflows/scorecard.yml
vendored
@ -36,7 +36,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1
|
||||
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
@ -60,6 +60,6 @@ jobs:
|
||||
retention-days: 5
|
||||
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@b20883b0cd1f46c72ae0ba6d1090936928f9fa30 # v4.32.0
|
||||
uses: github/codeql-action/upload-sarif@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # v4.32.2
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
|
||||
@ -9,6 +9,7 @@ plugins=(... macos)
|
||||
```
|
||||
|
||||
## Supported Terminals
|
||||
|
||||
- [iTerm](https://iterm.sourceforge.net/)
|
||||
- [iTerm2](https://iterm2.com/)
|
||||
- [Hyper](https://hyper.is/)
|
||||
@ -17,28 +18,33 @@ plugins=(... macos)
|
||||
|
||||
## Commands
|
||||
|
||||
| Command | Description |
|
||||
| :------------ | :------------------------------------------------------- |
|
||||
| `tab` | Open the current directory in a new tab |
|
||||
| `split_tab` | Split the current terminal tab horizontally |
|
||||
| `vsplit_tab` | Split the current terminal tab vertically |
|
||||
| `ofd` | Open passed directories (or $PWD by default) in Finder |
|
||||
| `pfd` | Return the path of the frontmost Finder window |
|
||||
| `pfs` | Return the current Finder selection |
|
||||
| `cdf` | `cd` to the current Finder directory |
|
||||
| `pushdf` | `pushd` to the current Finder directory |
|
||||
| `pxd` | Return the current Xcode project directory |
|
||||
| `cdx` | `cd` to the current Xcode project directory |
|
||||
| `quick-look` | Quick-Look a specified file |
|
||||
| `man-preview` | Open man pages in Preview app |
|
||||
| `showfiles` | Show hidden files in Finder |
|
||||
| `hidefiles` | Hide the hidden files in Finder |
|
||||
| `itunes` | _DEPRECATED_. Use `music` from macOS Catalina on |
|
||||
| `music` | Control Apple Music. Use `music -h` for usage details |
|
||||
| `spotify` | Control Spotify and search by artist, album, track… |
|
||||
| `rmdsstore` | Remove .DS_Store files recursively in a directory |
|
||||
| `btrestart` | Restart the Bluetooth daemon |
|
||||
| `freespace` | Erases purgeable disk space with 0s on the selected disk |
|
||||
| Command | Description |
|
||||
| :------------ | :------------------------------------------------------------- |
|
||||
| `tab` | Open the current directory in a new tab |
|
||||
| `split_tab` | Split the current terminal tab horizontally |
|
||||
| `vsplit_tab` | Split the current terminal tab vertically |
|
||||
| `ofd` | Open passed directories (or $PWD by default) in Finder |
|
||||
| `pfd` | Return the path of the frontmost Finder window |
|
||||
| `pfs` | Return the current Finder selection |
|
||||
| `cdf` | `cd` to the current Finder directory |
|
||||
| `pushdf` | `pushd` to the current Finder directory |
|
||||
| `pxd` | Return the current Xcode project directory |
|
||||
| `cdx` | `cd` to the current Xcode project directory |
|
||||
| `quick-look` | Quick-Look a specified file |
|
||||
| `man-preview` | Open man pages in Preview app |
|
||||
| `showfiles` | Show hidden files in Finder |
|
||||
| `hidefiles` | Hide the hidden files in Finder |
|
||||
| `itunes` | _DEPRECATED_. Use `music` from macOS Catalina on |
|
||||
| `music` | Control Apple Music. Use `music -h` for usage details |
|
||||
| `spotify` | Control Spotify and search by artist, album, track… |
|
||||
| `lpm` | Toggle Low Power Mode. Use `lpm on\|off\|status` (macOS 12.0+) |
|
||||
| `lpm-on` | Enable Low Power Mode (macOS 12.0+) |
|
||||
| `lpm-off` | Disable Low Power Mode (macOS 12.0+) |
|
||||
| `lpm-status` | Check the current Low Power Mode status (macOS 12.0+) |
|
||||
| `lpm-toggle` | Toggle the current Low Power Mode status (macOS 12.0+) |
|
||||
| `rmdsstore` | Remove .DS_Store files recursively in a directory |
|
||||
| `btrestart` | Restart the Bluetooth daemon |
|
||||
| `freespace` | Erases purgeable disk space with 0s on the selected disk |
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
|
||||
68
plugins/macos/lpm
Normal file
68
plugins/macos/lpm
Normal file
@ -0,0 +1,68 @@
|
||||
function lpm() {
|
||||
local sw_vers=$(sw_vers -productVersion 2>/dev/null)
|
||||
|
||||
autoload is-at-least
|
||||
if [[ -z "$sw_vers" ]] || ! is-at-least 12.0 $sw_vers; then
|
||||
echo "Error: Low Power Mode requires macOS 12.0 (Monterey) or later" >&2
|
||||
echo "Current version: ${sw_vers:-unknown}" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
local action="${1:-}"
|
||||
|
||||
# Helper function to get current status (returns 0, 1, or empty string)
|
||||
local get_status() {
|
||||
pmset -g | grep lowpowermode | awk '{print $2}'
|
||||
}
|
||||
|
||||
case "${action}" in
|
||||
on)
|
||||
sudo pmset -a lowpowermode 1
|
||||
;;
|
||||
off)
|
||||
sudo pmset -a lowpowermode 0
|
||||
;;
|
||||
status)
|
||||
local lpm_status=$(get_status)
|
||||
if [[ "$lpm_status" == "1" ]]; then
|
||||
echo "enabled"
|
||||
elif [[ "$lpm_status" == "0" ]]; then
|
||||
echo "disabled"
|
||||
else
|
||||
echo "unknown" >&2
|
||||
return 3
|
||||
fi
|
||||
;;
|
||||
toggle)
|
||||
local lpm_status=$(get_status)
|
||||
if [[ "$lpm_status" == "1" ]]; then
|
||||
sudo pmset -a lowpowermode 0
|
||||
elif [[ "$lpm_status" == "0" ]]; then
|
||||
sudo pmset -a lowpowermode 1
|
||||
else
|
||||
echo "Unable to determine current status to toggle" >&2
|
||||
return 3
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "usage: lpm on|off|status|toggle" >&2
|
||||
return 2
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function lpm-off() {
|
||||
lpm off
|
||||
}
|
||||
|
||||
function lpm-on() {
|
||||
lpm on
|
||||
}
|
||||
|
||||
function lpm-status() {
|
||||
lpm status
|
||||
}
|
||||
|
||||
function lpm-toggle() {
|
||||
lpm toggle
|
||||
}
|
||||
@ -314,3 +314,6 @@ source "${0:h:A}/music"
|
||||
|
||||
# Spotify control function
|
||||
source "${0:h:A}/spotify"
|
||||
|
||||
# low power mode toggle-switch function
|
||||
source "${0:h:A}/lpm"
|
||||
Loading…
Reference in New Issue
Block a user