-
Notifications
You must be signed in to change notification settings - Fork 344
Manipulate WindowOptions #360
Comments
Right now this is not possible in GO but adding it is not that complex. I just won't have time to work on this anytime time soon though. If you feel like it, I can describe what has to be done so that you can make a PR |
I think I know what needs to be done.
|
Weird. I tried adding the changes that, to the best of my knowledge, are necessary but end up with a no-op. Any idea what I'm doing wrong? window.go: ...
// Window event names
const (
...
EventNameWindowCmdSetAlwaysOnTop = "window.cmd.set.always.on.top"
EventNameWindowEventAlwaysOnTopChanged = "window.event.always.on.top.changed"
...
func (w *Window) SetAlwaysOnTop(flag bool) (err error) {
if err = w.ctx.Err(); err != nil {
return
}
w.m.Lock()
w.o.AlwaysOnTop = astikit.BoolPtr(flag)
w.m.Unlock()
_, err = synchronousEvent(w.ctx, w, w.w, Event{Name: EventNameWindowCmdSetAlwaysOnTop, TargetID: w.id, WindowOptions: &WindowOptions{AlwaysOnTop: astikit.BoolPtr(flag)}}, EventNameWindowEventAlwaysOnTopChanged)
return
} Appmessage.go package desktop
import (
"github.com/asticode/go-astilectron"
"github.com/asticode/go-astilectron-bootstrap"
)
func HandleMessages(w *astilectron.Window, m bootstrap.MessageIn) (payload interface{}, err error) {
switch m.Name {
case "always_on_top":
w.SetAlwaysOnTop(true)
payload = "AlwaysOnTop set"
return
}
return
} app.js astilectron.sendMessage(
{ name: "always_on_top", payload: "" },
message => {
console.log("received " + message)
}); |
You need to update |
How do I ensure the correct astilectron js is being used? EDIT: NVM. It is being used. |
I'd like to dynamically set
AlwaysOnTop
based on a setting inside my app.Is there a way to access the WindowOptions outside the bootstrapping procedure (I've been unable to find it, or rather direct access is private) or will I have to make-do with
require("electron").remote.BrowserWindow.getFocusedWindow().setAlwaysOnTop(bool_value)
from inside JS? I'd rather like to avoid doing it like this.The text was updated successfully, but these errors were encountered: