Skip to content

Commit 0c68505

Browse files
Merge pull request #970 from nohzafk/master
add lowfi command
2 parents 1fe320e + d8fc64c commit 0c68505

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

commands/media/lowfi/lowfi.sh

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
3+
# Note: lowfi and WezTerm required
4+
#
5+
# Install lowfi at https://github.com/talwat/lowfi
6+
# or by cargo: cargo install lowfi
7+
#
8+
# Install WezTerm at https://wezfurlong.org/wezterm/install/macos.html
9+
# or by homebrew: brew install --cask wezterm
10+
11+
# Required parameters:
12+
# @raycast.schemaVersion 1
13+
# @raycast.title Lowfi
14+
# @raycast.mode compact
15+
# @raycast.packageName Music
16+
17+
# Optional parameters:
18+
# @raycast.icon
19+
20+
export PATH="$HOME/.cargo/bin:$PATH"
21+
22+
# Check if lowfi is already running
23+
if pgrep -f "lowfi$" > /dev/null; then
24+
echo "Found existing lowfi process"
25+
26+
# Use AppleScript to find and focus the lowfi window
27+
osascript -e '
28+
-- First activate WezTerm application
29+
tell application "WezTerm" to activate
30+
31+
-- Then focus the specific window
32+
tell application "System Events"
33+
tell process "wezterm-gui"
34+
-- Get all windows
35+
set allWindows to every window
36+
repeat with w in allWindows
37+
if title of w contains "lowfi" then
38+
-- Try multiple methods to bring window to front
39+
set frontmost to true
40+
set value of attribute "AXMain" of w to true
41+
perform action "AXRaise" of w
42+
set position of w to {0, 40}
43+
-- Click the window to ensure focus
44+
click w
45+
return "Found and focused lowfi window"
46+
end if
47+
end repeat
48+
end tell
49+
end tell
50+
return "Could not find lowfi window"
51+
'
52+
else
53+
echo "Starting new lowfi instance"
54+
/Applications/WezTerm.app/Contents/MacOS/wezterm start -- lowfi &
55+
fi

0 commit comments

Comments
 (0)