Skip to content

iyiolacak/dropgitdiff-hyprland

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

git diff of the currently focused VSCode Git project > Clipboard.

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.

1. Quick start:

Single liner install

curl -sSL https://raw.githubusercontent.com/iyiolacak/dropgitdiff-hyprland/refs/heads/main/install-get_git_diff.sh | bash

What does installer do:

It installs the script to ~/.local/bin/gitdiffdrop and adds a Hyprland keybind:

SUPER + SHIFT + D  →  run dropgitdiff

No root required.

2. Use

  1. Focus a VS Code / VSCodium / Code - OSS window.
  2. Press SUPER + SHIFT + D.

The script will:

  • 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:

  1. File managers → opens the file.

  2. 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"

What does it replace?

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


With this script:

Focus VSCode, SUPER+SHIFT+D, CTRL+V to the browser.

Environment

Should work on any Wayland compositor with Hyprland's hyprctl tool available.

Troubleshooting

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

Dependencies

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

How it works

Queries the focused window with:

hyprctl activewindow -j

Extracts 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.md

Copies the file object, not text:

wl-copy --type text/uri-list "file://$HOME/git_diff.md"

Sends a desktop notification.

Uninstall

bash install-get_git_diff.sh --uninstall

This 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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages