Skip to content

Commit

Permalink
another try to hide cmd window on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
dpolakovics committed Dec 14, 2024
1 parent 099cd0c commit 2190d39
Showing 4 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
./fyne-cross
fyne-cross
./soundscape-sync
10 changes: 5 additions & 5 deletions FyneApp.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Details]
Icon = "Icon.png"
Name = "SoundscapeSync"
ID = "com.cloonar.soundscape-sync"
Version = "0.0.1"
Build = 1
Icon = "Icon.png"
Name = "SoundscapeSync"
ID = "com.cloonar.soundscape-sync"
Version = "0.0.1"
Build = 2
8 changes: 6 additions & 2 deletions internal/ui/sysproc_windows.go
Original file line number Diff line number Diff line change
@@ -3,10 +3,14 @@

package ui

import "syscall"
import (
"syscall"
)

const CREATE_NO_WINDOW = 0x08000000

func getSysProcAttr() *syscall.SysProcAttr {
return &syscall.SysProcAttr{
CreationFlags: syscall.CREATE_NO_WINDOW,
CreationFlags: CREATE_NO_WINDOW,
}
}
3 changes: 1 addition & 2 deletions internal/ui/windows.go
Original file line number Diff line number Diff line change
@@ -20,8 +20,6 @@ import (
var bmcPng []byte

// tryLinuxNativeFolderDialog attempts to open a native OS folder selection dialog on Linux.
// It first tries zenity (common on GNOME), then kdialog (common on KDE).
// If neither works, it returns an empty string.
func tryLinuxNativeFolderDialog() string {
cmd := exec.Command("zenity", "--file-selection", "--directory")
out, err := cmd.Output()
@@ -56,6 +54,7 @@ func tryNativeFolderDialog() string {
"$ofd.FileName = 'Folder Selection.'; "+
"if ($ofd.ShowDialog() -eq 'OK') { Split-Path $ofd.FileName }")

// Set SysProcAttr for Windows to hide window
if runtime.GOOS == "windows" {
cmd.SysProcAttr = getSysProcAttr()
}

0 comments on commit 2190d39

Please sign in to comment.