abiosoft / autoplank

automatically move Plank to the active monitor
MIT License
51 stars 14 forks source link

Plank position update fix and more #6

Open 7aske opened 5 years ago

7aske commented 5 years ago

Plank didnt seem to update after writing to dconf. My solution was to simple restart the plank process. I added plank to the list of required commands and made it so that it runs on start. Also figured that querying xrandr caused spikes and locking of the screen for about 3 frames which I think is unacceptable so xrandr is only queried at the start of the program. Assumption is that user will not be not be adding/removing/reconfiguring screens all the time. Added a makefile for easier installation/build.

spotlesscoder commented 5 years ago

Tested. Works :)

spotlesscoder commented 5 years ago

When the autoplank executable exits, plank goes away completely. (At least when I test autoplank by manually invoking it from command line and pressing Ctrl+C) I think it should launch a plank instance that stays alive after exit when Ctrl+C signal is sent

7aske commented 5 years ago

Yup just reviewed the changes. There is a leftover exec.Command call

plank, _ := exec.LookPath("plank")
var attr = os.ProcAttr{Dir: ".", Env: os.Environ(), Files: []*os.File{nil, nil, nil, nil}}
process, err := os.StartProcess(plank, []string{}, &attr)
if err != nil {
    fmt.Printf(err.Error())
} else {
    err = process.Release()
    if err != nil {
        fmt.Printf(err.Error())
    }
}

exec.Command("plank")

Will look into it now.

7aske commented 5 years ago

As far I have figured process.Release() doesn't seem to do anything. Child process still dies with parent exits. I kind of don't wanna solve this by calling a external script.