Thoughts, Dynamics 365, random business ideas, etc.

Making my OneNote window semi-transparent

A screenshot of two overlapping Windows programs. The topmost one is semi-transparent and you can see the bottommost program through it.

I have two monitors, but I don’t like moving my head around. Especially when I’m on a Teams call – I like to have OneNote available to take notes, but don’t like not being able to look at someone and see them when I’m taking notes. Switching back and forth using Alt+Tab is annoying.

What you’ll need:

AutoHotKey

AutoHotKey is a free and opensource scripting language and tool that allows a user to program a macro and then use hotkeys to activate it. It seems like something that you should be able to do with PowerToys, but ChatGPT suggested this.

You can download it here – AutoHotKey. It’s very easy to install and setup.

Once you install and setup AutoHotKey, you can open “AutoHotKey Dash” from your Start menu.

The next thing you need is a script.

AutoHotKey script to make windows transparent

I mean, I didn’t figure any of this out, of course – ChatGPT did most of it for me. I asked it this:

After pointing me to AutoHotKey and a couple of iterations on the script, I got this:

#Requires AutoHotkey v2.0
global transparencyStates := Map()

^!t:: { ; Ctrl+Alt+T toggles transparency
    hwnd := WinGetID("A")
    id := "ahk_id " hwnd

    ; Get current state or assume opaque
    current := transparencyStates.Has(hwnd) ? transparencyStates[hwnd] : 255

    newValue := (current = 255) ? 180 : 255
    WinSetTransparent(newValue, id)
    transparencyStates[hwnd] := newValue
}

^!a:: { ; Ctrl+Alt+A toggles always-on-top
    hwnd := WinGetID("A")
    id := "ahk_id " hwnd
    style := WinGetExStyle(id)
    isTopmost := (style & 0x00000008) != 0 ; WS_EX_TOPMOST
    WinSetAlwaysOnTop(!isTopmost, id)
}

To use this, from the AutoHotKey Dash, click the “New script” button, give it a name, select “Empty” and paste in the above.

The scripting language makes sense, if you understand the syntax. This script sets up two hotkeys – Alt+Ctrl+T to toggle a window’s transparency and Alt+Ctrl+A to make it appear always on top.

Once the script is running, select the window you want and press Alt+Ctrl+T to make it semi-transparent. If you want it to always remain on top, you can press Alt+Ctrl+A. Pressing the Alt+Ctrl+T hotkey will toggle the transparency as much as you’d like.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Comments

One response to “Making my OneNote window semi-transparent”

  1. Whatever this is, this is my love language.