add unminimize.

This commit is contained in:
Miroslav Šedivý
2023-04-22 17:06:35 +02:00
parent 466185fc24
commit c70c8217de
5 changed files with 33 additions and 1 deletions

View File

@ -12,6 +12,8 @@ import (
type Desktop struct {
Display string
Unminimize bool
ScreenWidth int
ScreenHeight int
ScreenRate int16
@ -23,6 +25,11 @@ func (Desktop) Init(cmd *cobra.Command) error {
return err
}
cmd.PersistentFlags().Bool("desktop.unminimize", true, "automatically unminimize window when it is minimized")
if err := viper.BindPFlag("desktop.unminimize", cmd.PersistentFlags().Lookup("desktop.unminimize")); err != nil {
return err
}
return nil
}
@ -30,6 +37,8 @@ func (s *Desktop) Set() {
// Display is provided by env variable
s.Display = os.Getenv("DISPLAY")
s.Unminimize = viper.GetBool("desktop.unminimize")
s.ScreenWidth = 1280
s.ScreenHeight = 720
s.ScreenRate = 30

View File

@ -45,6 +45,7 @@ func (manager *DesktopManagerCtx) Start() {
Str("screen_size", fmt.Sprintf("%dx%d@%d", width, height, rate)).
Msgf("setting initial screen size")
xevent.Unminimize = manager.config.Unminimize
go xevent.EventLoop(manager.config.Display)
// In case it was opened