Skip to content

jayf0x/majic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mejic

Menu bar app that installs custom right-click actions into macOS Services — no signing, no app extensions, no Xcode required.

Build

swift build -c release

Binary lands at .build/release/Mejic.

Run

.build/release/Mejic

A terminal icon appears in the menu bar. Click it to open the command editor.

Add to Login Items

So Mejic launches automatically on login:

  1. Open System Settings → General → Login Items & Extensions
  2. Click + under "Open at Login"
  3. Navigate to .build/release/Mejic and add it

Or from the terminal (macOS 13+):

osascript -e 'tell application "System Events" to make login item at end with properties {path:"/path/to/.build/release/Mejic", hidden:false}'

How It Works

Mejic reads ~/.config/mejic/commands.yaml and writes one Automator .workflow bundle per enabled command into ~/Library/Services/. macOS Services appear natively in Finder's right-click menu — no daemon, no Finder extension, no code signing.

Hitting Save in the popover:

  1. Writes the updated YAML
  2. Deletes old Mejic workflows from ~/Library/Services/
  3. Writes new ones
  4. Calls pbs -update to refresh the Services cache immediately

Writing Commands

Config lives at ~/.config/mejic/commands.yaml:

- label: Copy Path
  command: echo {file} | pbcopy
  enabled: true

- label: Open in VS Code
  command: open -a 'Visual Studio Code' {file}
  enabled: true

- label: Make Executable
  command: chmod +x {file}
  enabled: true

- label: Compress Video
  command: ffmpeg -i {file} -crf 28 {file}_compressed.mp4
  enabled: true

{file} is replaced with the selected file's full path, double-quoted: "${f}". For commands that reference {file} multiple times, each occurrence is substituted independently.

Quoting tip: do not wrap {file} in single quotes — it already gets double-quoted. Shell-escape other arguments normally.

The generated bash wrapper:

for f in "$@"
do
    YOUR COMMAND WITH "${f}"
done

Multi-select in Finder runs the command once per file.

Examples

What Command
Copy path echo {file} | pbcopy
Open in Sublime open -a 'Sublime Text' {file}
SHA256 checksum shasum -a 256 {file} | pbcopy
Move to Desktop mv {file} ~/Desktop/
New Terminal here open -a Terminal {file}
Word count wc -l {file} | pbcopy

Project Structure

Sources/Mejic/
  main.swift          — NSApplication entry, menu bar + popover
  ConfigStore.swift   — YAML read/write, ObservableObject
  WorkflowWriter.swift — generates .workflow bundles
  ContentView.swift   — SwiftUI editor UI
Resources/
  commands.yaml       — example config (copied to ~/.config/mejic/ on first launch)

Help

To add more items to Finder Right-click context menu: defaults write -g NSServicesMinimumItemCountForContextSubmenu -int 999

About

Right-click front-end for personal scripts. Macos Util.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors