<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Eric</title>
    <description>The latest articles on Forem by Eric (@augiefra).</description>
    <link>https://forem.com/augiefra</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3648098%2F7b5615b8-b08b-4bc1-96f5-e11fceaa88cf.png</url>
      <title>Forem: Eric</title>
      <link>https://forem.com/augiefra</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/augiefra"/>
    <language>en</language>
    <item>
      <title>How I used macOS Accessibility API to fix my VSCode workflow</title>
      <dc:creator>Eric</dc:creator>
      <pubDate>Fri, 05 Dec 2025 14:26:26 +0000</pubDate>
      <link>https://forem.com/augiefra/how-i-used-macos-accessibility-api-to-fix-my-vscode-workflow-23a9</link>
      <guid>https://forem.com/augiefra/how-i-used-macos-accessibility-api-to-fix-my-vscode-workflow-23a9</guid>
      <description>&lt;p&gt;There is something that used to break my "flow" daily as a developer, and I bet it happens to you too.&lt;/p&gt;

&lt;p&gt;You are deep in debugging mode. You find a suspicious line of code in an obscure file. You take a screenshot (&lt;code&gt;Cmd+Shift+4&lt;/code&gt;) to send it to a colleague on Slack or to attach it to a Jira ticket.&lt;/p&gt;

&lt;p&gt;Two minutes later, the inevitable question arrives:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;"Which file is this in?"&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And boom. You have to switch back to your editor, find the file again, copy the relative path (&lt;code&gt;src/components/utils/helper.ts&lt;/code&gt;), switch back to Slack, and paste it.&lt;/p&gt;

&lt;p&gt;It’s a 10-second friction, but repeated 20 times a day, it becomes a useless mental load.&lt;/p&gt;

&lt;p&gt;I looked for tools to solve this. &lt;strong&gt;Shottr&lt;/strong&gt; is great but doesn't read context. &lt;strong&gt;CleanShot X&lt;/strong&gt; is powerful but too expensive and complex for this simple need.&lt;/p&gt;

&lt;p&gt;So, as any stubborn developer would do... I decided to code my own solution.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Technical Challenge: Reading VSCode's Mind
&lt;/h2&gt;

&lt;p&gt;I wanted a simple tool: I capture an area, and boom, the file path and line number are copied to my clipboard, ready to be pasted with the image.&lt;/p&gt;

&lt;p&gt;But how do you get that path from outside the editor?&lt;/p&gt;

&lt;p&gt;The answer lies in a misunderstood (and sometimes tricky) macOS API: &lt;strong&gt;The Accessibility API&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Most modern code editors (VSCode, Zed, Cursor) display the active file path in the window title. Using Swift and the &lt;code&gt;ApplicationServices&lt;/code&gt; framework, I built a small "parser" that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Detects the active application at the moment of the screenshot.&lt;/li&gt;
&lt;li&gt; Queries the &lt;code&gt;kAXTitleAttribute&lt;/code&gt; of the window.&lt;/li&gt;
&lt;li&gt; Cleans the string to properly extract the path and filename.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The result is &lt;strong&gt;PastScreen&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg8iiekf2kktr62q54zlt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg8iiekf2kktr62q54zlt.png" alt=" " width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Open Source by Conviction, Paid for Convenience
&lt;/h2&gt;

&lt;p&gt;I coded this tool for myself, in native Swift to keep it ultra-lightweight (no Electron here!).&lt;/p&gt;

&lt;p&gt;I decided on a hybrid distribution model, inspired by the "Fair Code" movement:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;The Code is 100% Open Source:&lt;/strong&gt; Everything is on GitHub. If you are a developer, you can audit the code, see how I use the capture API, and even compile the app yourself for free. That’s my contribution to the community.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;The App Store for Convenience:&lt;/strong&gt; For those who want to support the project, get automatic updates, and have a signed/notarized app without the hassle, I put it on the Mac App Store for the price of a coffee ($2.99).&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Why try it?
&lt;/h2&gt;

&lt;p&gt;If you use &lt;strong&gt;VSCode&lt;/strong&gt;, &lt;strong&gt;Zed&lt;/strong&gt;, or &lt;strong&gt;Cursor&lt;/strong&gt;, PastScreen will change how you document bugs.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;📸 Capture an area.&lt;/li&gt;
&lt;li&gt;📋 Paste into GitHub/Jira/Slack.&lt;/li&gt;
&lt;li&gt;✅ The image appears &lt;strong&gt;AND&lt;/strong&gt; the file path is written right below it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No more "Which file is this?". No more lost context.&lt;/p&gt;

&lt;p&gt;The project is young, and I'm constantly adding support for new IDEs. I would love your technical feedback or Pull Requests on GitHub!&lt;/p&gt;




&lt;h3&gt;
  
  
  🔗 Links
&lt;/h3&gt;

&lt;p&gt;👉 &lt;strong&gt;Check the code on GitHub:&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://github.com/augiefra/PastScreen" rel="noopener noreferrer"&gt;https://github.com/augiefra/PastScreen&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;Get it on the Mac App Store:&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://apps.apple.com/fr/app/pastscreen/id6755425479" rel="noopener noreferrer"&gt;https://apps.apple.com/fr/app/pastscreen/id6755425479&lt;/a&gt;&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>tooling</category>
      <category>vscode</category>
      <category>automation</category>
    </item>
  </channel>
</rss>
