Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ jobs:
GOTESTFLAGS='-race -timeout 300s -p 1 -coverprofile=coverage.out'

- uses: codecov/codecov-action@v4
# The action still exits 1 on a TLS handshake failure to the upload
# host even when fail_ci_if_error is false. Coverage upload is not
# the test gate; the Test step above is.
continue-on-error: true
with:
files: coverage.out
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
25 changes: 23 additions & 2 deletions .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,32 @@ jobs:
go-version-file: go.mod
cache: true

- name: Install MinGW
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: false
install: mingw-w64-x86_64-gcc
path-type: inherit

- name: Build GUI binary
shell: bash
run: |
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 \
go build -tags=ebitensinglethread -o bin/rune.exe ./cmd/rune
gcc --version
go mod download github.com/unstablebuild/rune-go-sdk@v0.2.0
mod="$(go env GOMODCACHE)/github.com/unstablebuild/rune-go-sdk@v0.2.0"
if command -v cygpath >/dev/null 2>&1; then
mod="$(cygpath -u "$mod")"
fi
client="$mod/api/workspaceapi/workspacerpc/client.go"
# rune-go-sdk v0.2.0 reads Unix-only SysProcAttr.Setsid/Setctty
# and parses D:\ paths as file-URL hosts. No published release
# fixes either. Patch the module cache before compiling.
if ! grep -q 'func sessionFlags' "$client"; then
chmod -R u+w "$mod/api/workspaceapi/workspacerpc"
patch -d "$mod" -p1 --forward --batch < scripts/rune-go-sdk-windows.patch
fi
CGO_ENABLED=1 go build -tags=ebitensinglethread -o bin/rune.exe ./cmd/rune

- name: Smoke test the built binary
shell: bash
Expand Down
12 changes: 4 additions & 8 deletions cmd/rune/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import (
"github.com/unstablebuild/rune-go-sdk/api/workspaceapi"
"github.com/unstablebuild/rune-go-sdk/term"
"github.com/unstablebuild/rune-go-sdk/tui"
"golang.org/x/sys/unix"
"google.golang.org/grpc"
"unstable.build/rune/auth"
"unstable.build/rune/cmd/rune/crashreport"
Expand Down Expand Up @@ -228,9 +227,10 @@ func startWorkspaceServer() int {
case syscall.SIGKILL:
log.Info("Received SIGKILL signal: exiting")
os.Exit(1)
case syscall.SIGURG:
/* received when socket urgent data is ready to be read */
default:
if ignoredSignal(sig) {
continue
}
log.Debugf("Received unhandled signal: %#v", sig)
}
case <-quitch:
Expand Down Expand Up @@ -350,11 +350,7 @@ func main() {
logPath := crashreport.DefaultLaunchLogPath(*flagDataPath)
f, err := os.OpenFile(logPath, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err == nil {
// syscall.Dup2 isn't defined on linux/arm64 (the
// kernel only exposes Dup3 there); golang.org/x/sys/unix
// papers over the difference.
fd := int(f.Fd())
_ = unix.Dup2(fd, int(os.Stderr.Fd()))
_ = dupStderr(f)
}
flag.Parse()
}
Expand Down
37 changes: 37 additions & 0 deletions cmd/rune/platform_unix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright (C) 2017-2026 The Rune Authors
// SPDX-License-Identifier: GPL-3.0-or-later
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or (at
// your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

//go:build unix

package main

import (
"os"
"syscall"

"golang.org/x/sys/unix"
)

func ignoredSignal(sig os.Signal) bool {
// Raised when socket urgent data is ready. It is not a shutdown.
return sig == syscall.SIGURG
}

func dupStderr(f *os.File) error {
// syscall.Dup2 isn't defined on linux/arm64 (the kernel only exposes
// Dup3 there); golang.org/x/sys/unix papers over the difference.
return unix.Dup2(int(f.Fd()), int(os.Stderr.Fd()))
}
36 changes: 36 additions & 0 deletions cmd/rune/platform_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright (C) 2017-2026 The Rune Authors
// SPDX-License-Identifier: GPL-3.0-or-later
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or (at
// your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

//go:build windows

package main

import (
"os"

"golang.org/x/sys/windows"
)

func ignoredSignal(os.Signal) bool {
return false
}

func dupStderr(f *os.File) error {
// Keep Go's os.Stderr and the process standard-error handle on the
// launch log. Windows has no dup2 in golang.org/x/sys/unix.
os.Stderr = f
return windows.SetStdHandle(windows.STD_ERROR_HANDLE, windows.Handle(f.Fd()))
}
33 changes: 21 additions & 12 deletions docs/windows-graphics.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,31 @@ non-Windows builds.

## Build

This branch includes a `go.work` that temporarily replaces:
`go.mod` pins the fork commits that contain the Windows fixes. Those
commits are on the upstream default branches and are not tagged yet:

- `github.com/hajimehoshi/ebiten/v2` -> `Bell8571/ebiten` @ `windows-inithint` ([unstablebuild/ebiten#1](https://github.com/unstablebuild/ebiten/pull/1))
- `github.com/unstablebuild/tcell/v3` -> `Bell8571/tcell` @ `windows-console-screen` ([unstablebuild/tcell#6](https://github.com/unstablebuild/tcell/pull/6))
- `github.com/hajimehoshi/ebiten/v2` -> `unstablebuild/ebiten` `v2.7.6-0.20260916232601-6f1d59169775` ([unstablebuild/ebiten#1](https://github.com/unstablebuild/ebiten/pull/1)), one commit after `v2.7.5-ub.32`
- `github.com/unstablebuild/tcell/v3` -> `v3.6.6-0.20260919122710-90d3af1d7f12` ([unstablebuild/tcell#6](https://github.com/unstablebuild/tcell/pull/6)), three commits after `v3.6.5`

```bash
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -tags=ebitensinglethread -o rune.exe ./cmd/rune
```

Ebiten on Windows does not need CGO. Drop `go.work` (or its two replace
lines) once those PRs are merged and tagged.
`v2.7.5-ub.27` and `tcell` `v3.6.5` do not contain those fixes, so a
Windows GUI build fails in `ui_glfw.go` (`glfw.InitHint`) and
`console_win.go` (`cScreen`).

## Remaining upstream work
Tree-sitter is cgo, so the GUI binary needs a C compiler (`CGO_ENABLED=1`)
even though ebiten itself is built with `-tags=ebitensinglethread`.
`github.com/unstablebuild/rune-go-sdk@v0.2.0` does not build or start
on Windows as published: `workspacerpc` reads Unix-only
`SysProcAttr.Setsid` and `Setctty`, and `CurrentUserHostURI` turns
`D:\...` into a `file://` URL whose drive letter is a host. No published
SDK tag fixes either. Apply `scripts/rune-go-sdk-windows.patch` to that
module before building.

1. [unstablebuild/ebiten#1](https://github.com/unstablebuild/ebiten/pull/1) — `glfw.InitHint` stub on Windows
2. [unstablebuild/tcell#6](https://github.com/unstablebuild/tcell/pull/6) — missing `Screen` methods on `cScreen`
```bash
go mod download github.com/unstablebuild/rune-go-sdk@v0.2.0
mod="$(go env GOMODCACHE)/github.com/unstablebuild/rune-go-sdk@v0.2.0"
patch -d "$mod" -p1 < scripts/rune-go-sdk-windows.patch
CGO_ENABLED=1 go build -tags=ebitensinglethread -o rune.exe ./cmd/rune
```

Transparent themes (`gui.window_opacity`, `gui.window_blur_radius`)
activate Mica on Windows 11 and Acrylic on Windows 10.
9 changes: 5 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/ernestrc/go-multierror v1.1.2
github.com/ernestrc/sensible v0.4.0
github.com/hajimehoshi/ebiten/v2 v2.7.4
github.com/junegunn/fzf v0.0.0-20201216124428-ab3937ee5a62
github.com/junegunn/fzf v0.73.1
github.com/mattn/go-runewidth v0.0.19 // indirect
github.com/modelcontextprotocol/go-sdk v1.4.1
github.com/openai/openai-go/v2 v2.7.1
Expand All @@ -25,7 +25,7 @@ require (
github.com/spf13/pflag v1.0.10
github.com/stretchr/testify v1.12.1
github.com/unstablebuild/rune-go-sdk v0.2.0
github.com/unstablebuild/tcell/v3 v3.6.5
github.com/unstablebuild/tcell/v3 v3.6.6-0.20260919122710-90d3af1d7f12
go.uber.org/goleak v1.3.0
golang.org/x/crypto v0.56.0
golang.org/x/image v0.45.0
Expand Down Expand Up @@ -82,7 +82,7 @@ require (
golang.org/x/oauth2 v0.36.0
google.golang.org/genai v1.59.0
mvdan.cc/sh/v3 v3.12.0
oras.land/oras-go/v2 v2.6.1
oras.land/oras-go/v2 v2.6.2
tailscale.com v1.102.3
)

Expand Down Expand Up @@ -168,6 +168,7 @@ require (
github.com/jezek/xgb v1.1.1 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jsimonetti/rtnetlink v1.4.1 // indirect
github.com/junegunn/go-shellwords v0.0.0-20250127100254-2aa3b3277741 // indirect
github.com/kevinburke/ssh_config v1.4.0 // indirect
github.com/klauspost/compress v1.19.1 // indirect
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
Expand Down Expand Up @@ -260,4 +261,4 @@ replace github.com/go-git/go-git/v6 => github.com/unstablebuild/go-git/v6 v6.0.1

replace github.com/tree-sitter/go-tree-sitter => github.com/unstablebuild/go-tree-sitter v0.25.0-ub.1

replace github.com/hajimehoshi/ebiten/v2 => github.com/unstablebuild/ebiten/v2 v2.7.5-ub.27
replace github.com/hajimehoshi/ebiten/v2 => github.com/unstablebuild/ebiten/v2 v2.7.6-0.20260916232601-6f1d59169775
Loading
Loading