Hyprland shortcut to copy your current VS Code repo's diff(also saves to ~/git_diff.md, overwrites each time)
It's a lightweight, user-space tool. The script is useful for workflows that include VSCode + an LLM chat.
Single liner install
curl -sSL https://raw.githubusercontent.com/iyiolacak/dropgitdiff-hyprland/refs/heads/main/install-get_git_diff.sh | bashIt installs the script to ~/.local/bin/gitdiffdrop and adds a Hyprland keybind:
SUPER + SHIFT + D → run dropgitdiffNo root required.
- Focus a VS Code / VSCodium / Code - OSS window.
- Press SUPER + SHIFT + D.
-
Generate a git diff of the active repository.
-
Save it as ~/git_diff.md.
-
Copy the file object (file:///home/you/git_diff.md) to your clipboard.
-
Show a notification confirming the action.
Git Diff — Copied file: /home/you/git_diff.md -
You can now paste the file URI into:
-
File managers → opens the file.
-
Editors or chat(i.e. ChatGPT, Gemini, Claude, ... ) apps → pastes the file reference.
wl-paste → shows file:///.../git_diff.md.
Script is useful for anyone but installer is focused for Hyprland, so I recommend to tweaking it before, if you are NOT a Hyprland user.
After some magic, this is how script copies the git diff as a file: wl-copy --type text/uri-list "file://$OUTFILE"
You're coding, some debugging and stuff. You'll ask for
You open terminal and enter git diff > ~/git_diff.md
Open your file manager(i.e. Dolphin/Nautilus)
Drag and drop it into browser
Focus VSCode, SUPER+SHIFT+D, CTRL+V to the browser.
Should work on any Wayland compositor with Hyprland's hyprctl tool available.
| Issue | Likely Cause / Fix |
|---|---|
| Notification: “No active window info (hyprctl)” | Hyprland not running or hyprctl missing |
| “Focused window is not VS Code” | Wrong window focused — only VS Code or VSCodium are valid |
| No clipboard copy | Install wl-clipboard |
| No diff output | The project is not a Git repository |
| Script doesn’t trigger | Check bind = SUPER SHIFT, D in your Hyprland config |
| Dependency | Purpose |
|---|---|
hyprctl |
Query focused window, apply bind |
jq |
Parse JSON output from Hyprland |
git |
Generate diff |
notify-send |
Display desktop notifications |
wl-copy (optional) |
Copy file object URI |
zoxide (optional) |
Smart directory resolution |
code / codium / code-oss |
Identify active VS Code workspace |
Queries the focused window with:
hyprctl activewindow -jExtracts window title, class, and PID.
Verifies that the focused app is VS Code or VSCodium.
Resolves the correct project path using several fallbacks:
-
zoxide (preferred exact match)
-
code --status by PID
-
$HOME/Projects, $HOME/work, etc.
Fallback bounded find for .git dirs Runs:
git diff > ~/git_diff.mdCopies the file object, not text:
wl-copy --type text/uri-list "file://$HOME/git_diff.md"Sends a desktop notification.
bash install-get_git_diff.sh --uninstallThis removes:
-
~/.local/bin/dropgitdiff
-
Any associated Hyprland bind block or conf snippet
-
Leaves your backup at ~/.config/hypr/hyprland.conf.bak.dropgitdiff
Script is mostly created with GPT 5 with my directive.
MIT - modify, share, or repurpose freely.