Zenity dialogs for Golang, Windows, macOS

Zenity dialogs for Golang, Windows and macOS

PkgGoDev Go Report

This repo includes both a cross-platform Go package providing Zenity-like dialogs (simple dialogs that interact graphically with the user), as well as a “port” of the zenity command to both Windows and macOS based on that library.

This is a work in progress.

Lots of things are missing. For now, these are the only implemented dialogs:

Behavior on Windows, macOS and other Unixes might differ slightly. Some of that is intended (reflecting platform differences), other bits are unfortunate limitations, others still are open to be fixed.

Why?

There are a bunch of other dialog packages for Go.
Why reinvent this particular wheel?

Benefits:

  • no cgo (see benefits, mostly cross-compilation)
  • no main loop (or any other threading or initialization requirements)
  • cancelation through context
  • on Windows:
    • no additional dependencies
      • Explorer shell not required
      • works in Server Core
    • Unicode support
    • WSL/Cygwin/MSYS2 support
  • on macOS:
    • only dependency is osascript
  • on other Unixes:
    • wraps either one of zenity, qarma, matedialog
Comments
  • [macOS] Dialogs don't get focus automatically

    [macOS] Dialogs don't get focus automatically

    Test code:

    package main
    
    import (
    	"fmt"
    	"github.com/ncruces/zenity"
    )
    
    func main() {
    	file, err := zenity.SelectFile(zenity.Title("Test focus on MacOS"))
    	if err != nil {
    		fmt.Println(err)
    	}
    	fmt.Println(file)
    }
    

    Run in iTerm2, the SelectFile dialog does not get focus unless click the title bar. Similar to https://discussions.apple.com/thread/2548172

    Run in native Terminal, the SelectFile dialog get focus with one click. Is it possible to get focus automatically?

  • [macOS] progress doesn't pop up in front since v0.8.8

    [macOS] progress doesn't pop up in front since v0.8.8

    1. Open iTerm2 or Terminal, not full screen.
    2. Steps to reproduce
    git clone https://github.com/ncruces/zenity.git
    cd zenity
    
    git checkout v0.8.7
    go build ./cmd/zenity
    ./zenity --progress
    
    git checkout v0.8.8
    go build ./cmd/zenity
    ./zenity --progress
    

    v0.8.8 doesn't pop up in front without fullscreen.

  • Icon option should specify supported file extension

    Icon option should specify supported file extension

    On the documention, I think it should be specified that PNG files are supported (tested on Windows, haven't checked MacOS).

    Also, do you plan adding support for .ico files? I thinking it would be useful using .ico instead of .png (Or maybe even use the .ico files present on some Windows DLLs like shell32.dll)

  • -notification show nothing in win7  git-for-windows

    -notification show nothing in win7 git-for-windows

    In win7 64bit / v0.7.9 / git-for-windows (in cmder):

    ./zenity.exe --notification --text "Good Morning"
    

    show: nothing


    run powershell gui in cmd:

    powershell -Command "& {Add-Type -AssemblyName System.Windows.Forms; Add-Type -AssemblyName System.Drawing; $notify = New-Object System.Windows.Forms.NotifyIcon; $notify.Icon = [System.Drawing.SystemIcons]::Information; $notify.Visible = $true; $notify.ShowBalloonTip(0, 'Hello world', 'This is called from a batch script.', [System.Windows.Forms.ToolTipIcon]::None)}"
    

    work great: 2021-08-07 14_14_11-Cmder

  • Windows versions don't run in WINE and Proton

    Windows versions don't run in WINE and Proton

    While trying out cross-compiled binaries, I noticed that zenity seems to crash when used in WINE and Proton:

    Unhandled exception: 0xc0150010 in 64-bit code (0x000000007bc25af8).
    Register dump:
     rip:000000007bc25af8 rsp:00000000008bfb70 rbp:000000000009ac80 eflags:00000202 (   - --  I   - - - )
     rax:00000000003e0000 rbx:00000000008bfb90 rcx:00000000008bfb90 rdx:0000000000000000
     rsi:0000000000000000 rdi:0000000000000000  r8:0000000000000000  r9:0000000000000000 r10:0000000000000000
     r11:0000000000030000 r12:000000c0001077d0 r13:0000000000000000 r14:000000c00003a000 r15:0000000000000006
    Stack dump:
    0x00000000008bfb70:  00000000008bfb90 000000007bc353f9
    0x00000000008bfb80:  000000000c0a0049 000000006c891a80
    0x00000000008bfb90:  00000001c0150010 0000000000000000
    0x00000000008bfba0:  000000007bc25af8 0000000000000000
    0x00000000008bfbb0:  0000000000000000 0000dbd40003a000
    0x00000000008bfbc0:  0000000000000006 0000000000650d80
    0x00000000008bfbd0:  000000c0001076f0 00000000003e0000
    0x00000000008bfbe0:  00000000008bfcc0 000000007b600000
    0x00000000008bfbf0:  00000000008bfc30 000000007b61be2f
    0x00000000008bfc00:  0000000000000000 000000006eb0d6e3
    0x00000000008bfc10:  0000000000000000 0000000000000000
    0x00000000008bfc20:  000000000c0a0049 000000007b60c314
    Backtrace:
    =>0 0x000000007bc25af8 (0x000000000009ac80)
    0x000000007bc25af8: jmp	0x000000007bc25af0
    Modules:
    Module	Address					Debug info	Name (41 modules)
    PE	          400000-          6b9000	Deferred        flatpak-integrated-webserver
    ELF	        7d000000-        7d005000	Deferred        <wine-loader>
    ELF	    7fde161bf000-    7fde161c8000	Deferred        libxfixes.so.3
    ELF	    7fde161c8000-    7fde161d5000	Deferred        libxcursor.so.1
    ELF	    7fde161d5000-    7fde161e7000	Deferred        libxi.so.6
    ELF	    7fde161e7000-    7fde161ec000	Deferred        libxcomposite.so.1
    ELF	    7fde161ec000-    7fde161f9000	Deferred        libxrandr.so.2
    ELF	    7fde161f9000-    7fde16206000	Deferred        libxrender.so.1
    ELF	    7fde16206000-    7fde1620d000	Deferred        libxxf86vm.so.1
    ELF	    7fde1620d000-    7fde16212000	Deferred        libxinerama.so.1
    ELF	    7fde16312000-    7fde16318000	Deferred        libxau.so.6
    ELF	    7fde16318000-    7fde16343000	Deferred        libxcb.so.1
    ELF	    7fde16343000-    7fde1648b000	Deferred        libx11.so.6
    ELF	    7fde164a5000-    7fde16566000	Deferred        winex11<elf>
    ELF	    7fde16680000-    7fde16695000	Deferred        libxext.so.6
    ELF	    7fde16695000-    7fde1669b000	Deferred        ws2_32.so
    ELF	    7fde16715000-    7fde16741000	Deferred        liblzma.so.5
    ELF	    7fde16741000-    7fde168ca000	Deferred        libxml2.so.2
    ELF	    7fde168ca000-    7fde16919000	Deferred        libfontconfig.so.1
    ELF	    7fde16919000-    7fde16991000	Deferred        libpcre.so.1
    ELF	    7fde16991000-    7fde169b4000	Deferred        libbrotlicommon.so.1
    ELF	    7fde169b4000-    7fde169d5000	Deferred        libgraphite2.so.3
    ELF	    7fde169d5000-    7fde16b0f000	Deferred        libglib-2.0.so.0
    ELF	    7fde16b0f000-    7fde16b1d000	Deferred        libbrotlidec.so.1
    ELF	    7fde16b1d000-    7fde16bed000	Deferred        libharfbuzz.so.0
    ELF	    7fde16bed000-    7fde16c07000	Deferred        libz.so.1
    ELF	    7fde16c07000-    7fde16c40000	Deferred        libpng16.so.16
    ELF	    7fde16c40000-    7fde16c53000	Deferred        libbz2.so.1
    ELF	    7fde16c53000-    7fde16d17000	Deferred        libfreetype.so.6
    ELF	    7fde16d31000-    7fde16d60000	Deferred        gdi32.so
    ELF	    7fde16d60000-    7fde16ed7000	Dwarf           libwine.so.1
    ELF	    7fde24507000-    7fde24522000	Deferred        libgcc_s.so.1
    ELF	    7fde24522000-    7fde24666000	Deferred        libm.so.6
    ELF	    7fde24666000-    7fde24680000	Deferred        libunwind.so.8
    ELF	    7fde24680000-    7fde2468b000	Deferred        librt.so.1
    ELF	    7fde2468b000-    7fde2475a000	Deferred        ntdll.so
    ELF	    7fde2475d000-    7fde2492c000	Deferred        libc.so.6
    ELF	    7fde2492c000-    7fde24933000	Deferred        libdl.so.2
    ELF	    7fde24933000-    7fde24954000	Deferred        libpthread.so.0
    ELF	    7fde24957000-    7fde2496e000	Deferred        user32.so
    ELF	    7fde24970000-    7fde249a4000	Deferred        ld-linux-x86-64.so.2
    Threads:
    process  tid      prio (all id:s are in hex)
    00000038 services.exe
    	["C:\windows\system32\services.exe"]
    	0000003c    0
    	00000040    0
    	00000080    0
    	000000a0    0
    	000000b8    0
    	000000f0    0
    	00000108    0
    	0000012c    0
    00000068 svchost.exe
    	[C:\windows\system32\svchost.exe -k LocalServiceNetworkRestricted]
    	0000006c    0
    	00000084    0
    	00000088    0
    00000070 MicrosoftEdgeUpdate.exe
    	00000074    0
    	000000c8    0
    	000000cc    0
    	000000d0    0
    	000000d4    0
    00000090 winedevice.exe
    	[C:\windows\system32\winedevice.exe]
    	00000094    0
    	000000a4    0
    	000000a8    0
    	000000ac    0
    000000b0 winedevice.exe
    	[C:\windows\system32\winedevice.exe]
    	000000b4    0
    	000000bc    0
    	000000c0    0
    	000000d8    0
    	000000dc    0
    	000000e0    0
    	000000e4    0
    000000e8 plugplay.exe
    	[C:\windows\system32\plugplay.exe]
    	000000ec    0
    	000000f4    0
    	000000f8    0
    	000000fc    0
    00000100 svchost.exe
    	[C:\windows\system32\svchost.exe -k netsvcs]
    	00000104    0
    	0000010c    0
    	00000110    0
    	00000114    0
    	0000014c    0
    	00000154    0
    	00000568    0
    00000124 rpcss.exe
    	[C:\windows\system32\rpcss.exe]
    	00000128    0
    	00000130    0
    	00000134    0
    	00000138    0
    	0000013c    0
    	00000614    0
    	00000618    0
    	00000654    0
    000005f4 start.exe
    	000005f8    0
    000005fc conhost.exe
    	["C:\windows\system32\conhost.exe" --unix --width 121 --height 23 --server 0xc]
    	00000600    0
    00000604 explorer.exe
    	[C:\windows\system32\explorer.exe /desktop]
    	00000608    0
    	0000060c    0
    	00000610    0
    0000061c (D) Z:\tmp\go-build3797557352\b001\exe\flatpak-integrated-webserver.exe
    	["Z:\tmp\go-build3797557352\b001\exe\flatpak-integrated-webserver.exe" ]
    	00000620    0 <==
    	00000624    0
    	00000628    0
    	0000062c    0
    	00000630    0
    	00000634    0
    	00000640    0
    00000644 explorer.exe
    	[C:\windows\system32\explorer.exe /desktop]
    	00000648    0
    	0000064c    0
    	00000650    0
    System information:
        Wine build: wine-6.16 (Staging)
        Platform: x86_64
        Version: Windows 10
        Host system: Linux
        Host version: 5.13.13-200.fc34.x86_64
    

    The Dialog displays correctly:

    image

    However as soon as it is closed (this is true for all dialogs), it crashes. Using GOARCH=386 gives a bit more info:

    $ GOOS=windows GOARCH=386 go run .
    0380:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
    0394:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
    0398:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
    03e4:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
    03e4:fixme:process:SetProcessPriorityBoost (FFFFFFFF,1): stub
    Exception 0xc0150010 0x20104018 0x85fe58 0x7bc236b8
    PC=0x7bc236b8
    
    runtime.cgocall(0x45cd00, 0x60f61c)
            /usr/local/go/src/runtime/cgocall.go:156 +0x58 fp=0x200b7a94 sp=0x200b7a7c pc=0x4035b8
    syscall.Syscall(0x7b60af68, 0x1, 0x8c33b8, 0x0, 0x0)
            /usr/local/go/src/runtime/syscall_windows.go:479 +0xbb fp=0x200b7ab0 sp=0x200b7a94 pc=0x45a09b
    syscall.(*Proc).Call(0x20100040, {0x2010200c, 0x1, 0x1})
            /usr/local/go/src/syscall/dll_windows.go:183 +0x108 fp=0x200b7b44 sp=0x200b7ab0 pc=0x478d28
    syscall.(*LazyProc).Call(0x2009d638, {0x2010200c, 0x1, 0x1})
            /usr/local/go/src/syscall/dll_windows.go:340 +0x58 fp=0x200b7b68 sp=0x200b7b44 pc=0x47a2b8
    github.com/ncruces/zenity.setup.func2()
            /home/pojntfx/go/pkg/mod/github.com/ncruces/[email protected]/util_windows.go:135 +0xa7 fp=0x200b7b94 sp=0x200b7b68 
    pc=0x4a7077
    github.com/ncruces/zenity.listDlg({0x521f02, 0x21}, {0x2008a7a0, 0x4, 0x4}, 0x0, {0x20088618, 0x0, 0x0, 0x20088630, ...})
            /home/pojntfx/go/pkg/mod/github.com/ncruces/[email protected]/list_windows.go:190 +0x1168 fp=0x200b7dc4 sp=0x200b7b9
    4 pc=0x4a5b68
    github.com/ncruces/zenity.list({0x521f02, 0x21}, {0x2008a7a0, 0x4, 0x4}, {0x20088618, 0x0, 0x0, 0x0, 0x0, ...})
            /home/pojntfx/go/pkg/mod/github.com/ncruces/[email protected]/list_windows.go:9 +0x70 fp=0x200b7e60 sp=0x200b7dc4 pc
    =0x4a4980
    github.com/ncruces/zenity.List({0x521f02, 0x21}, {0x2008a7a0, 0x4, 0x4}, {0x200b7fa4, 0x2, 0x2})
            /home/pojntfx/go/pkg/mod/github.com/ncruces/[email protected]/list.go:8 +0xa0 fp=0x200b7f60 sp=0x200b7e60 pc=0x4a48c
    0
    main.main()
            /home/pojntfx/Projects/multi-browser-electron/flatpak-integrated-webserver/main.go:49 +0x231 fp=0x200b7fc8 sp=0x2
    00b7f60 pc=0x4ef541
    runtime.main()
            /usr/local/go/src/runtime/proc.go:255 +0x23a fp=0x200b7ff0 sp=0x200b7fc8 pc=0x434d9a
    runtime.goexit()
            /usr/local/go/src/runtime/asm_386.s:1319 +0x1 fp=0x200b7ff4 sp=0x200b7ff0 pc=0x45c061
    eax     0x0
    ebx     0x85fd60
    ecx     0x85fe40
    edx     0x8c33b8
    edi     0x0
    esi     0x45bd8e
    ebp     0x85fdd8
    esp     0x85fd54
    eip     0x7bc236b8
    eflags  0x206
    cs      0x23
    fs      0x63
    gs      0x6b
    exit status 2
    

    As a quick workaround, commenting out https://github.com/ncruces/zenity/blob/master/util_windows.go#L135 works (for all dialogs, on amd64 and i386.

    Sadly I don't know much about the Windows-specific call in question; maybe there is an easy way to fix this?

  • Feature: add list command

    Feature: add list command

    I made some improvements:

    1. better error handling in unix zenity:
      • First always handle the no-error case (IMO its nicer to read the code)
      • Then explicitly handle the errors which are meaning full. Exit code 1 especially, all others are not used and counted as pure errror.
      • Report Cancelation or Close (exit code 1, -> with a special error). This is very useful, not so much for message function but for the choose.
    2. Add width /height
    3. Add List command. List selection.

    All changes are so far only for unix. I could not yet understand the osascript code.

    Also: -> The main.go diaptches to an syscall.Exec this gets me into troubles when returning indices in the List command. I would rather remove the whole main.go executable, as it anyway does not wrap zenity (no posix flags) etc... so why is it there, either it provides the same arguments and is a "port". For other users contributing to this, I would remove this or refactor it using cobra with Posix Flags and make it a "port" (just my opinion :-))

    I am not sure if I can continue here, since there is some stuff in misshape. I will probably just wrap my own dialog in
    https://github.com/gabyx/githooks.

  • Printing

    Printing

    This looks like a really clean bring up of Native desktop stuff that lots of project needs.

    Any plans for Printing.

    Saw this: github.com/alexbrainman/printer

    • ONYL works on windows
  • Add an option for using custom dialog icons on MacOS

    Add an option for using custom dialog icons on MacOS

    I want to suggest an extension to the message dialog to allow custom icons, for example:

    zenity.Warning( "Text", zenity.Title("Title"), zenity.CustomIcon("some_icon.icns"))

    The PR outlines the minimal implementation which would address our current needs, and I'm keen to understand your perspective: is that something you'd be willing to accept? If so, what else do I need to cover?

    I'd appreciate any feedback, and thanks for your work on the library.

  • crashes on syscall.Syscall6

    crashes on syscall.Syscall6

    Hi,I've encounter crash on updating zenity.Progress, it happens frequently when fast updating progress dialog value.

    env: windows 2012 server go: 1.18 ui: zenity.progress

    crash stacks:

    Exception 0xc0000005 0x0 0xc00063b8c8 0x7ffe000f4d56 PC=0x7ffe000f4d56

    runtime.cgocall(0x41b9e0, 0xc000066ec0)
    	/opt/homebrew/Cellar/go/1.18.3/libexec/src/runtime/cgocall.go:157 +0x4a fp=0xc0004d9780 sp=0xc0004d9748 pc=0x3b458a
    syscall.SyscallN(0xd45f58?, {0xc00063b818?, 0x41685b?, 0x7ffe000e1970?})
    	/opt/homebrew/Cellar/go/1.18.3/libexec/src/runtime/syscall_windows.go:538 +0x109 fp=0xc0004d97f8 sp=0xc0004d9780 pc=0x416c49
    syscall.Syscall6(0xc00013ca20?, 0x23d7b634e19?, 0x23d7b634e19?, 0x0?, 0xc0004d98f0?, 0x3bdda5?, 0x23d744a0108?, 0xc0004d9908?)
    	/opt/homebrew/Cellar/go/1.18.3/libexec/src/runtime/syscall_windows.go:482 +0x50 fp=0xc0004d9858 sp=0xc0004d97f8 pc=0x4168d0
    github.com/ncruces/zenity/internal/win.MessageLoop(0xc0002f0340?)
    	/Users/test/go/pkg/mod/github.com/ncruces/[email protected]/internal/win/user32.go:307 +0x152 fp=0xc0004d9940 sp=0xc0004d9858 pc=0x703c12
    github.com/ncruces/zenity.(*progressDialog).setup(_, {0xc0001e20c0, 0x0, 0x190, 0xc0001e2100, 0xc0001e2120, 0x0, 0x0, {0x0, 0x0}, ...})
    	/Users/test/go/pkg/mod/github.com/ncruces/[email protected]/progress_windows.go:198 +0x95b fp=0xc0004d9eb0 sp=0xc0004d9940 pc=0x709dfb
    github.com/ncruces/zenity.progress.func1()
    	/Users/test/go/pkg/mod/github.com/ncruces/[email protected]/progress_windows.go:38 +0x58 fp=0xc0004d9fe0 sp=0xc0004d9eb0 pc=0x7090d8
    runtime.goexit()
    	/opt/homebrew/Cellar/go/1.18.3/libexec/src/runtime/asm_amd64.s:1571 +0x1 fp=0xc0004d9fe8 sp=0xc0004d9fe0 pc=0x41a121
    created by github.com/ncruces/zenity.progress
    	/Users/test/go/pkg/mod/github.com/ncruces/[email protected]/progress_windows.go:37 +0x26e
    

    There is similar crash and solution, plz see ref here

    I think a possible solution maybe here for [email protected], hope helps:

    diff --git a/internal/win/kernel32.go b/internal/win/kernel32.go
    index 7f44fe7..aea9658 100644
    --- a/internal/win/kernel32.go
    +++ b/internal/win/kernel32.go
    @@ -45,3 +45,5 @@ func GetSystemDirectory() (string, error) { return windows.GetSystemDirectory()
     //sys GetConsoleWindow() (ret HWND) = kernel32.GetConsoleWindow
     //sys GetModuleHandle(moduleName *uint16) (ret Handle, err error) = kernel32.GetModuleHandleW
     //sys ReleaseActCtx(actCtx Handle) = kernel32.ReleaseActCtx
    +//sys GlobalAlloc(flags uint32, dwBytes uintptr) (ret uintptr) = kernel32.GlobalAlloc
    +//sys GlobalFree(dwBytes uintptr) (ret uintptr) = kernel32.GlobalFree
    diff --git a/internal/win/user32.go b/internal/win/user32.go
    index bf52b0a..c893979 100644
    --- a/internal/win/user32.go
    +++ b/internal/win/user32.go
    @@ -303,20 +303,24 @@ func MessageLoop(wnd HWND) error {
     	isDialogMessage := procIsDialogMessageW.Addr()
     
     	for {
    -		var msg MSG
    -		s, _, err := syscall.Syscall6(getMessage, 4, uintptr(unsafe.Pointer(&msg)), 0, 0, 0, 0, 0)
    +		// var msg MSG
    +		msg := (*MSG)(unsafe.Pointer(GlobalAlloc(0, unsafe.Sizeof(MSG{}))))
    +		s, _, err := syscall.Syscall6(getMessage, 4, uintptr(unsafe.Pointer(msg)), 0, 0, 0, 0, 0)
     		if int32(s) == -1 {
    +			GlobalFree(uintptr(unsafe.Pointer(msg)))
     			return err
     		}
     		if s == 0 {
    +			GlobalFree(uintptr(unsafe.Pointer(msg)))
     			return nil
     		}
     
    -		s, _, _ = syscall.Syscall(isDialogMessage, 2, uintptr(wnd), uintptr(unsafe.Pointer(&msg)), 0)
    +		s, _, _ = syscall.Syscall(isDialogMessage, 2, uintptr(wnd), uintptr(unsafe.Pointer(msg)), 0)
     		if s == 0 {
    -			syscall.Syscall(translateMessage, 1, uintptr(unsafe.Pointer(&msg)), 0, 0)
    -			syscall.Syscall(dispatchMessage, 1, uintptr(unsafe.Pointer(&msg)), 0, 0)
    +			syscall.Syscall(translateMessage, 1, uintptr(unsafe.Pointer(msg)), 0, 0)
    +			syscall.Syscall(dispatchMessage, 1, uintptr(unsafe.Pointer(msg)), 0, 0)
     		}
    +		GlobalFree(uintptr(unsafe.Pointer(msg)))
     	}
     }
     
    diff --git a/internal/win/zsyscall_windows.go b/internal/win/zsyscall_windows.go
    index d28d2ae..69dbd2f 100644
    --- a/internal/win/zsyscall_windows.go
    +++ b/internal/win/zsyscall_windows.go
    @@ -61,6 +61,8 @@ var (
     	procGenerateConsoleCtrlEvent     = modkernel32.NewProc("GenerateConsoleCtrlEvent")
     	procGetConsoleWindow             = modkernel32.NewProc("GetConsoleWindow")
     	procGetModuleHandleW             = modkernel32.NewProc("GetModuleHandleW")
    +	procGlobalAlloc                  = modkernel32.NewProc("GlobalAlloc")
    +	procGlobalFree                   = modkernel32.NewProc("GlobalFree")
     	procReleaseActCtx                = modkernel32.NewProc("ReleaseActCtx")
     	procCoCreateInstance             = modole32.NewProc("CoCreateInstance")
     	procSHBrowseForFolder            = modshell32.NewProc("SHBrowseForFolder")
    @@ -203,6 +205,18 @@ func GetModuleHandle(moduleName *uint16) (ret Handle, err error) {
     	return
     }
     
    +func GlobalAlloc(flags uint32, dwBytes uintptr) (ret uintptr) {
    +	r0, _, _ := syscall.Syscall(procGlobalAlloc.Addr(), 2, uintptr(flags), uintptr(dwBytes), 0)
    +	ret = uintptr(r0)
    +	return
    +}
    +
    +func GlobalFree(dwBytes uintptr) (ret uintptr) {
    +	r0, _, _ := syscall.Syscall(procGlobalFree.Addr(), 1, uintptr(dwBytes), 0, 0)
    +	ret = uintptr(r0)
    +	return
    +}
    +
     func ReleaseActCtx(actCtx Handle) {
     	syscall.Syscall(procReleaseActCtx.Addr(), 1, uintptr(actCtx), 0, 0)
     	return
    
    
  • Collaboration on Swift for Darwin

    Collaboration on Swift for Darwin

    Hi Nuno,

    I thought I drop a note here:

    I was experimenting recently with the fact that Swift is able to compile an NSAlert message box far better than the shitty AppleScript thing we are both doing in our libs.

    I was wondering if we could collaborate on making the dialogs more robust and nicer and more native on macOS. The message box I have already together, the thing would be to run the script with swift or just execute the script if its chmod +x.

    Run the following script with

    swift dialog.swift message info warning "Title here..." "Message here..." Ok Cancel 3 A B C
    

    I have not yet together the NSAlert with NSViewTable where we put all options in, that would be awesome. Maybe we could give a try in hacking together a simple script which makes zenity --list at least with some basic options, basically extending my script above. What do you think =). So far I am far more convinced this is a future proof solution (except the fact that apple changes stuff and it won't compile anymore (so far it works on Big Sur and High Sierra (which is a good thing) (probably needs compiler directives etc which is possible in Swift). Furthermore its not shitty ApplyScript which I have a hard time in understanding...

  • zenity.SelectFileSave adds a \n character

    zenity.SelectFileSave adds a \n character

    Hello!

    This is weird, but when I call zenity.SelectFileSave(), it adds a newline character at the end of the filepath returned by the function, regardless of what I type in for the filename. Here's a quick test:

    package main
    
    import (
    	"fmt"
    
    	"github.com/ncruces/zenity"
    )
    
    func main() {
    
    	filename, err := zenity.SelectFileSave()
    
    	if err != nil {
    		panic(err)
    	}
    
    	fmt.Println(fmt.Sprintf("%q", filename))
    
    }
    
    

    And here's the output with a saved file named test: "/home/solarlune/Documents/Projects/Go/Tests/zenity/test\n"

    This is a fresh project with freshly go getted zenity, Pop OS 20.10, go version 1.16.2.

  • Using keyboard on Windows

    Using keyboard on Windows

    When I run the following example code on Linux:

    package main
    
    import (
    	"github.com/ncruces/zenity"
    )
    
    func main() {
    	zenity.Question("Are you sure you want to proceed?",
    		zenity.Title("Question"),
    		zenity.QuestionIcon)
    }
    

    I am able to use both the mouse and the keyboard.

    However, when I run the same example on Windows, I can use the mouse but not keyboard.

    Is this behavior to be expected or I am doing something wrong?

  • Project status: missing dialogs

    Project status: missing dialogs

    The more useful (IMO) Zenity dialogs are implemented. What's missing, and why?

Qt binding for Go (Golang) with support for Windows / macOS / Linux / FreeBSD / Android / iOS / Sailfish OS / Raspberry Pi / AsteroidOS / Ubuntu Touch / JavaScript / WebAssembly

Introduction Qt is a free and open-source widget toolkit for creating graphical user interfaces as well as cross-platform applications that run on var

Jan 2, 2023
Flutter on Windows, MacOS and Linux - based on Flutter Embedding, Go and GLFW.
Flutter on Windows, MacOS and Linux - based on Flutter Embedding, Go and GLFW.

go-flutter - A package that brings Flutter to the desktop Purpose Flutter allows you to build beautiful native apps on iOS and Android from a single c

Jan 9, 2023
An example desktop system tray application that can launch HTML5 windows. Go source with a build process for Windows, Mac and Linux.

ExampleTrayGUI An example cross-platform (Mac, Windows, Linux) system tray application that can launch HTML5 windows, developed in Go including functi

Dec 3, 2022
An example desktop system tray application that can launch HTML5 windows. Go source with a build process for Windows, Mac and Linux.

ExampleTrayGUI An example cross-platform (Mac, Windows, Linux) system tray application that can launch HTML5 windows, developed in Go including functi

Dec 3, 2022
An example desktop system tray application that can launch HTML5 windows. Go source with a build process for Windows, Mac and Linux.

An example cross-platform (Mac, Windows, Linux) system tray application that can launch HTML5 windows, developed in Go including functional build process. This repository is intended as a quick reference to help others start similar projects using the referenced libraries and will not be actively maintained.

Dec 3, 2022
An example desktop system tray application that can launch HTML5 windows. Go source with a build process for Windows, Mac and Linux.

ExampleTrayGUI An example cross-platform (Mac, Windows, Linux) system tray application that can launch HTML5 windows, developed in Go including functi

Dec 3, 2022
W32find - Find parent windows and their children windows using win32api.

w32find Package w32find provides a set of interface to win32 APIs that can be used to find windows and their controls. Install go get -v github.com/mo

Jan 5, 2022
Tiny cross-platform webview library for C/C++/Golang. Uses WebKit (Gtk/Cocoa) and Edge (Windows)

webview A tiny cross-platform webview library for C/C++/Golang to build modern cross-platform GUIs. Also, there are Rust bindings, Python bindings, Ni

Dec 28, 2022
Windows GUI library for Go (Golang). Comes with a graphical UI designer.

Version 2 Please go to Version 2 of this library for the latest version. Windows GUI Library This is a pure Go library to create native Windows GUIs.

Jan 1, 2023
Golang bindings for XCGUI, Windows GUI library, DirectUI design idea.
Golang bindings for XCGUI, Windows GUI library, DirectUI design idea.

XCGUI 项目文档 帮助文档 程序示例 介绍 English | 简体中文 DirectUI设计思想: 在窗口内没有子窗口,界面元素都是逻辑上的区域(无HWND句柄,安全,灵活), 所有UI元素都是自主开发(不受系统限制), 更加灵活的实现各种程序界面,满足不同用户的需求.

Dec 22, 2022
Tiny cross-platform webview library for C/C++/Golang. Uses WebKit (Gtk/Cocoa) and Edge (Windows)

webview A tiny cross-platform webview library for C/C++/Golang to build modern cross-platform GUIs. Also, there are Rust bindings, Python bindings, Ni

Jan 1, 2023
A Windows GUI toolkit for the Go Programming Language
A Windows GUI toolkit for the Go Programming Language

About Walk Walk is a "Windows Application Library Kit" for the Go Programming Language. Its primarily useful for Desktop GUI development, but there is

Dec 30, 2022
Common library for Go GUI apps on Windows
Common library for Go GUI apps on Windows

winc Common library for Go GUI apps on Windows. It is for Windows OS only. This makes library smaller than some other UI libraries for Go.

Dec 12, 2022
Windows GUI framework for Go.

gform is an easy to use Windows GUI toolkit for Go It provides two approaches to create UI. 1. Pure code. gform.Init() mainWindow := gform.NewForm(ni

Jan 1, 2023
Slice and dice your TMUX windows and panes
Slice and dice your TMUX windows and panes

Chaakoo is a wrapper over TMUX that can create sessions, windows and panes from a grid based layout. The idea here is inspired by the CSS grid template areas.

Nov 1, 2022
Windows API and GUI in idiomatic Go.
Windows API and GUI in idiomatic Go.

Windigo Win32 API and GUI in idiomatic Go. Overview The UI library is divided in the following packages: Package Description ui High-level UI wrappers

Dec 27, 2022
Wmi - One hot Go WMI package. Package wmi provides an interface to WMI. (Windows Management Instrumentation)

wmi Package wmi provides an interface to WMI. (Windows Management Instrumentation) Install go get -v github.com/moonchant12/wmi Import import "github.

Apr 22, 2022
Proof-of-concept Windows-like clipboard manager for Linux in Go

Goclip Simple Windows-like clipboard manager for linux. This application is just a proof-of-concept and might be highly unstable. Features Clipboard t

Jan 28, 2022
Native Go (golang) Graphical Interface system (2D and 3D), built on GoKi tree framework
Native Go (golang) Graphical Interface system (2D and 3D), built on GoKi tree framework

GoGi is part of the GoKi Go language (golang) full strength tree structure system (ki = 木 = tree in Japanese) package gi is a scenegraph-based 2D and

Dec 25, 2022