/devcomrade

DevComrade - A copy/paste/run productivity improvement utility for developers

Primary LanguageC#Apache License 2.0Apache-2.0

What is it?

#DevComrade is a free and open-source Windows copy/paste/run productivity improvement tool for developers.

What's new

  • Simply use Ctrl+V for pasting plain, formatting-stripped text into any Windows application, system-wide. Or any other common shortcut for pasting from the Clipboard (like Shift+Ins, right click/Paste, etc).

    By default, DevComrade now monitors Windows Clipboard for text with rich formatting (coming from HTML, RTF, PDF, Word documents etc.) and seamlessly replaces it with plain text, ready to be pasted anywhere. To achieve this, DevComrade uses Win32 Clipboard Monitoring API. This behavior can be switched on/off with Win+F10 menu or via the .config file.

  • The new built-in Clipboard Notepad:

    • Press Alt+Ins to edit the clipboard text with DevComrade's built-in Notepad.
    • Press Control+Enter to close the built-in Notepad and save its content into the Clipboard.
    • Press Esc to close it without saving.
  • Win+Ins to paste as unformatted single-line text (with line breaks removed, for pasting into CLI).

  • Win+Alt+Ins to paste as unformatted multi-line text.

  • Shift+Win+Alt+Ins to paste only a number (e.g., a credit card or bank account number).

  • Ctrl+Win+Ins to wrap the clipboard text with <pre> tag, e.g. for pasting code into Microsoft Teams' chat as HTML (sometimes nothing else really works).

Introduction

Copy-pasting from the online docs, StackOverflow or numerous blogs can be a tedious and sometimes even a dangerous task. Does the following sound familiar: you paste some text from a web page into a Terminal command line, and it gets executed immediately, before you even have a chance to edit it? Only because there was a CR/LF character at the end of the clipboard text.

Or, have you ever been annoyed with some broken formatting, indentation, inconsistent tabs/spaces when you paste a piece of code into Visual Studio Code editor, a blog post or an email message? A typical workaround for that is to use the good old Notepad.exe as a buffer.

Now I have two dedicated hotkeys for that, Win+Ins (paste as single line) and Win+Alt+Ins (paste as multiple lines), which uniformly work across all apps and browsers.

Launch other applications with a custom hotkey

One other source of disappointment for me has always been how custom keyboard hotkeys work with Windows Shell shortcuts. It is a common struggle to find a convenient hotkey combination that still can be assigned to start a custom app. E.g., it is impossible to use Win+Shift|Alt|Ctrl+Key combos for that. And when it can be assigned, it may take up to 10 seconds for the program to actually start when the hotkey is pressed.

DevComrade has been made to solve this problem, too. It allows assigning a customizable action to (almost) any hotkey combination, and comes with an extensive set of predefined actions for pasting text and launching apps. By default, it has hotkeys for Windows Terminal and VSCode.

Custom actions and scriptlets

Additional actions can be added as C# scriptlets in the .config file. E.g., generating a GUID:

<hotkey name="InsertGuid" menuItem="Insert &amp;Guid" isScript="true">
    <!-- this is an example of a C# scriptlet handler -->
    <![CDATA[
        await Host.FeedTextAsync(Guid.NewGuid().ToString("B").ToUpper(), Token);
    ]]>
</hotkey>

How does it work?

When it comes to pasting text, DevComrade is different from many similar utilities (e.g., from the still-excellent Puretext) in how it uses Win32 simulated input API to elaborately feed the text into the currently active window, character by character, as though it was typed by a person. For example, it works well with Google's Secure Shell Chrome extension.

Work in progress

DevComrade is a free and open-source software maintained under Apache License 2.0. It's built with .NET 6.0 SDK and uses Windows Forms for its very simple context menu UI.

I consider it stable, but it is still very much work in progress. Eventually, some CI logic for publishing a Chocolatey package (including a code-signed executable) will be implemented. Meanwhile, feel free to build and run it directly from the source code. DevComrade does not collect any kind of telemetry, and never will.

Try it out from the source code (it's super easy):

  • Download and install .NET 6.0 SDK, if you haven't got it installed already. That's the only needed prerequisite tool. Visual Studio or Visual Studio Code aren't required to build this app.

  • Download and unzip the source, or use git to clone the repo to a folder of your choice, e.g.:

    mkdir DevComradeRepo && cd DevComradeRepo
    git clone https://github.com/postprintum/devcomrade .
    
  • Build and run:

    .\Package\make-and-run.bat
    
  • Or do that manually:

    dotnet publish -r win10-x64 -c Release --self-contained .\DevComrade
    
    start .\DevComrade\bin\Release\net6.0-windows\win10-x64\DevComrade.exe 
    

Once started, DevComrade shows up as DevComrade Icon icon in the system tray. Some of the features to try out:

  • Press Win+F10 to see the list of the available shortcuts and actions.
  • Copy some code into the Clipboard and try Alt+Ins, to see it pasted into the instant internal Notepad pop-up window. Press Esc to simply hide it when finished, or Win+Win+N to open it again.
  • Press Win+Alt+E to open Windows Terminal then Win+Ins to paste the Clipboard's content as a single line of text. It won't get executed until your press Enter.
  • Copy any URL into clipboard (e.g., from a console window output, spaces and broken lines are OK), then press Win+Alt+O to open it in your default web browser.

This tool has been working well for my own personal needs, but outside that its future depends on your feedback. Feel free to open an issue or send me a DM on Twitter.


DevComrade Win+F10 Menu


DevComrade Alt+Ins Notepad