Skip to content

Reimplementation of meld with electron and monaco

Notifications You must be signed in to change notification settings

Sixzero/monaco-meld

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

monaco-meld

A drop in replacement for meld with monaco diff. A lightweight Electron based app for fast diffing 2 files.

Monaco Meld Demo

Features

  • Hopefully lightweight, so fast start
  • Arrow based navigation
    • ⌥ Alt + ⬆︎: Navigate to previous change
    • ⌥ Alt + ⬇︎: Navigate to next change
    • ⌥ Alt + ⬅︎: Accept current change from right to left
  • Editor switching
    • Ctrl + ⬆︎: Switch to previous editor
    • Ctrl + ⬇︎: Switch to next editor
  • Syntax highlighting with Monaco

Installation

# Install electron globally first (required)
npm install -g electron

# Install dependencies and install globally
npm install
npm run install-global

Usage

Basic file comparison:

monacomeld file1.js file2.js

Compare file with stdin content:

echo "modified content" | ./monacomeld file1.js -

Compare with multiline content:

monacomeld file1.js - <<'EOF'
new content here
with multiple lines
EOF

Web Mode Usage

In web mode, you can also send diffs via HTTP:

curl -X POST http://localhost:3000/diff \
  -H "Content-Type: application/json" \
  -d '{
    "leftPath": "examples/file1.js",
    "rightPath": "examples/file2.js"
  }'

Or with direct content:

curl -X POST http://localhost:3000/diff \
  -H "Content-Type: application/json" \
  -d '{
    "leftContent": "original content",
    "rightContent": "modified content",
    "leftPath": "file1.js",
    "rightPath": "file2.js"
  }'

To only start the UI in case you would want to connect to a remote server:

monacomeld --no-server

Requirements

Some might need to run .appImages on Ubuntu 24.04:

sudo apt install libfuse2

Or if you want to build from source:

git clone https://github.com/SixZero/monaco-meld cd monaco-meld npm install npm run build npm install -g .

Running

Building

npm install
npm run build

Requirements

Some might need to run .appImages on Ubuntu 24.04.

sudo apt install libfuse2

Troubleshooting

As mentioned in the reference documentation, the problem is that Ubuntu 24.04 implemented new restrictions for AppImage apps, which restricts the use of sandboxes.

If you encounter sandbox-related errors like:

FATAL:setuid_sandbox_host.cc(163)] The SUID sandbox helper binary was found...

You can either:

  1. Run with the --no-sandbox flag (less secure but works everywhere):
monacomeld --no-sandbox
  1. Or properly configure the sandbox (recommended for production):
sudo sysctl -w kernel.unprivileged_userns_clone=1

Known Issues

  • You might see a harmless warning about mime.cache in the console. This is a known Electron/Chromium issue on some Linux systems and doesn't affect functionality.

Remote Usage Options

Option 1: Web Mode (Better Performance)

  1. Start the app in web mode on the remote server:
monacomeld --web
  1. Set up SSH port forwarding from your local machine:
ssh -L 3000:localhost:3000 user@remote-host
  1. Open in your local browser:
http://localhost:3000

You can specify a different port with the PORT environment variable:

PORT=8080 monacomeld --web

About

Reimplementation of meld with electron and monaco

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published