bump to 0.4.8

This commit is contained in:
piotr
2024-06-17 02:01:20 +02:00
parent 9f0f708cae
commit 16be4ff00d

34
main.go
View File

@@ -21,7 +21,7 @@ import (
"github.com/gotk3/gotk3/gtk" "github.com/gotk3/gotk3/gtk"
) )
const version = "0.4.7" const version = "0.4.8"
var ( var (
appDirs []string appDirs []string
@@ -203,9 +203,9 @@ func main() {
// v0.2: we also need to support SIGUSR from now on // v0.2: we also need to support SIGUSR from now on
showWindowChannel := make(chan interface{}, 1) showWindowChannel := make(chan interface{}, 1)
signalChan := make(chan os.Signal, 1) signalChan := make(chan os.Signal, 1)
const ( const (
SIG25 = syscall.Signal(0x25) // Which is SIGRTMIN+3 on Linux, it's not used by the system SIG25 = syscall.Signal(0x25) // Which is SIGRTMIN+3 on Linux, it's not used by the system
) )
signal.Notify(signalChan, syscall.SIGTERM, syscall.SIGUSR1, syscall.SIGUSR2, SIG25) signal.Notify(signalChan, syscall.SIGTERM, syscall.SIGUSR1, syscall.SIGUSR2, SIG25)
go func() { go func() {
for { for {
@@ -214,7 +214,7 @@ func main() {
case syscall.SIGTERM: case syscall.SIGTERM:
log.Info("SIGTERM received, bye bye") log.Info("SIGTERM received, bye bye")
gtk.MainQuit() gtk.MainQuit()
case syscall.SIGUSR1: // toggle drawer case syscall.SIGUSR1: // toggle drawer
if *resident { if *resident {
// As win.Show() called from inside a goroutine randomly crashes GTK, // As win.Show() called from inside a goroutine randomly crashes GTK,
// let's just set e helper variable here. We'll be checking it with glib.TimeoutAdd. // let's just set e helper variable here. We'll be checking it with glib.TimeoutAdd.
@@ -229,19 +229,19 @@ func main() {
log.Info("SIGUSR1 received, and I'm not resident, bye bye") log.Info("SIGUSR1 received, and I'm not resident, bye bye")
gtk.MainQuit() gtk.MainQuit()
} }
case syscall.SIGUSR2: // open drawer case syscall.SIGUSR2: // open drawer
if *resident { if *resident {
log.Debug("SIGUSR2 received, showing the window") log.Debug("SIGUSR2 received, showing the window")
showWindowChannel <- struct{}{} showWindowChannel <- struct{}{}
} else { } else {
log.Info("SIGUSR2 received, and I'm not resident but I'm still here, doing nothing") log.Info("SIGUSR2 received, and I'm not resident but I'm still here, doing nothing")
} }
case SIG25: // colse drawer case SIG25: // colse drawer
if *resident { if *resident {
log.Debug("SIG25 received, hiding the window") log.Debug("SIG25 received, hiding the window")
if win.IsVisible() { if win.IsVisible() {
restoreStateAndHide() restoreStateAndHide()
} }
} else { } else {
log.Info("A signal received, and I'm not resident, bye bye") log.Info("A signal received, and I'm not resident, bye bye")
gtk.MainQuit() gtk.MainQuit()
@@ -267,7 +267,7 @@ func main() {
if *resident { if *resident {
log.Warnf("Resident instance already running (PID %v)", i) log.Warnf("Resident instance already running (PID %v)", i)
} else { } else {
var err error var err error
if *flagDrawerClose { if *flagDrawerClose {
log.Infof("Closing resident instance (PID %v)", i) log.Infof("Closing resident instance (PID %v)", i)
err = syscall.Kill(i, SIG25) err = syscall.Kill(i, SIG25)
@@ -504,7 +504,7 @@ func main() {
win.Connect("key-press-event", func(_ *gtk.Window, event *gdk.Event) bool { win.Connect("key-press-event", func(_ *gtk.Window, event *gdk.Event) bool {
key := &gdk.EventKey{Event: event} key := &gdk.EventKey{Event: event}
switch key.KeyVal() { switch key.KeyVal() {
case gdk.KEY_downarrow, gdk.KEY_Up, gdk.KEY_Down, gdk.KEY_Left, gdk.KEY_Right, gdk.KEY_Tab, case gdk.KEY_downarrow, gdk.KEY_Up, gdk.KEY_Down, gdk.KEY_Left, gdk.KEY_Right, gdk.KEY_Tab,
gdk.KEY_Return, gdk.KEY_Page_Up, gdk.KEY_Page_Down, gdk.KEY_Home, gdk.KEY_End: gdk.KEY_Return, gdk.KEY_Page_Up, gdk.KEY_Page_Down, gdk.KEY_Home, gdk.KEY_End:
return false return false
@@ -517,9 +517,9 @@ func main() {
}) })
/* /*
In case someone REALLY needed to use X11 - for some stupid Zoom meeting or something, this allows In case someone REALLY needed to use X11 - for some stupid Zoom meeting or something, this allows
the drawer to behave properly on Openbox, and possibly somewhere else. For sure not on i3. the drawer to behave properly on Openbox, and possibly somewhere else. For sure not on i3.
This feature is not really supported and will stay undocumented. This feature is not really supported and will stay undocumented.
*/ */
if !wayland() { if !wayland() {
log.Info("Not Wayland, oh really?") log.Info("Not Wayland, oh really?")