Skip to content

Instantly share code, notes, and snippets.

@ajkessel
ajkessel / powershellgui.ps1
Created August 21, 2024 21:33
A simple PowerShell GUI clickable form with four buttons
# it is oddly difficult to find good, easy examples of creating PowerShell GUI forms with non-standard buttons
# this is a simple example that displays a four-button form
# you can, of course, customize everything in the <grid>
# and will need to set the window width and height to match the number of buttons and font
# use and adapt freely, subject to unlicense https://choosealicense.com/licenses/unlicense/
[void][System.Reflection.Assembly]::LoadWithPartialName('presentationframework')
[xml]$XAML = @'
<Window
xmlns =
"http://schemas.microsoft.com/winfx/2006/xaml/presentation"
@andyneff
andyneff / cygwin xserver.md
Last active January 17, 2023 21:15
Modified Cygwin startxwin script that syncs X11 with WSL

Using cygwin X in WSL1 and MingW (and others)

Cygwin comes with an X Server that can be useful with tools other than Cygwin itself. With a few modifications, we can add cygwin's X Server support to other shell implementations including cygwin, mingw64 (such as git for windows), msys2, WSL1, WSL2, and others.

With a few minor modifications, we can save the DISPLAY variable to files accessible by any shell. Once the DISPLAY value is accessible, an rc file can load it and it will automatically be used.

Optionally, we can even add a "one click" link to the start menu to start the xserver

TL;DR