Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Glance Translate

A DankMaterialShell bar widget for instant text translation.

Select text on screen, click the translate icon in your bar, and get a side-by-side translation in a popout panel — no copy-paste needed.

Glance Translate Screenshot

DMS Plugin Wayland

Features

  • Primary selection auto-read — opens with your highlighted text already translated
  • Side-by-side layout — source and translation displayed in parallel columns
  • Debounced auto-translate — 500ms debounce, translates as you type
  • One-click copy — copy buttons for both source text and translation result
  • Multi-engine — Google, DeepL, Bing, Yandex, Apertium (via translate-shell)
  • Multi-paragraph aware — soft-wrapped lines are joined so paragraphs translate as coherent sentences; blank-line paragraph breaks are preserved
  • Quick language switch — pick the target language from a dropdown in the popout; changes persist and re-translate instantly
  • Configurable — target language (popout dropdown or settings) and engine (settings)
  • Theme-aware — uses native DMS theme colors, adapts to light/dark mode
  • Keyboard shortcut — open via dms ipc call widget toggle glance

Requirements

Dependency Purpose Install
DankMaterialShell Shell framework See upstream docs
translate-shell Translation backend sudo apt install translate-shell
wl-clipboard Clipboard access Already bundled with DMS

Install

From plugin registry (once merged):

dms plugins install glance

Manual:

git clone https://github.com/ChaoXu1997/glance.git
cp -r glance/plugin ~/.config/DankMaterialShell/plugins/glance
dms restart

Then enable in Settings → Plugins → Scan for Plugins → Toggle on.

Configuration

Open plugin settings in DMS (click the gear icon on the Glance widget):

Setting Default Description
Target Language zh-CN BCP-47 language code (ja, en, de, fr, ko...)
Translation Engine google google, deepl, bing, yandex, apertium

💡 You can also switch the target language on the fly from the dropdown in the popout's Translation header — no need to open settings. It offers common languages and remembers your choice; custom codes can still be typed in settings.

Keyboard Shortcut

Add to your niri config (~/.config/niri/config.kdl):

binds {
    Mod+T { spawn "dms" "ipc" "call" "widget" "toggle" "glance"; }
}

Replace Mod+T with your preferred shortcut.

Usage

Just two steps:

  1. Select — highlight any text on screen with your mouse
  2. Translate — click the 🌐 icon in the DMS bar, or press your keyboard shortcut

That's it — the popout opens with your selection already translated. No copy-paste, no context switching.

💡 You can also type or paste text directly into the source field. Translation updates automatically as you edit.

🌐 Switch the target language from the dropdown in the Translation header — it re-translates instantly and remembers your choice.

📄 Copying multi-paragraph text? Soft-wrapped lines are joined automatically so sentences stay coherent; blank-line paragraph breaks are preserved.

📋 Click the copy icon next to either column to copy that text.

Project Structure

glance/
├── plugin/
│   ├── plugin.json           # DMS plugin manifest
│   ├── GlanceWidget.qml      # Main widget (bar pill + popout)
│   ├── GlanceSettings.qml    # Plugin settings panel
│   ├── SelectionReader.qml   # Primary selection reader
│   ├── TranslationEngine.qml # translate-shell wrapper
│   └── README.md             # Plugin-level docs
└── docs/
    └── screenshot.png        # README image

License

MIT

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages