abiosoft / autoplank

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

Autoplank not doing anything #10

Open Simbaclaws opened 4 years ago

Simbaclaws commented 4 years ago

Hi,

I'm on manjaro with XFCE and I'm trying to move my plank from my left monitor (DP-0) to my right (HDMI-0) and back. But for some reason my plank dock doesn't move at all. It won't go to the other monitor.

I've tried starting autoplank from the terminal but it displays no information it just sits idle, even if I try to change my mouse to the other monitor and go to the bottom of it.

Do you perhaps know how I can debug this?

Yours grateful, Simbaclaws

raduburla commented 4 years ago

Hi,

I had a similar issue on Pop!_OS 19.10 running Plank 0.11.89. Plank was not moving, it just printed in the terminal "attempting to move plank to ..." so i did a minor modification to the code.

This is a quick fix to get you going, I am not a GO developer, just debugged a little and noticed that when i change offset, plank moves to the other monitor.

Above function movePlankTo add this:

const dconfPlankOffset = "/net/launchpad/plank/docks/dock1/offset"

And inside the function movePlankTo replace

return exec.Command("dconf", "write", dconfPlank, value).Run()

With

cmdOffset := exec.Command("dconf", "read", dconfPlankOffset)
offsOut, offsErr := cmdOffset.Output()
if offsErr != nil {
    return offsErr
}
exec.Command("dconf", "write", dconfPlank, value).
    Run()

if strings.TrimSpace(string(offsOut)) == "0" {
    return exec.Command("dconf", "write", dconfPlankOffset, "1").
    Run()
}

return exec.Command("dconf", "write", dconfPlankOffset, "0").
    Run()

After this, rebuild and run/restart autoplank

Simbaclaws commented 4 years ago

Thanks a lot!! I haven't tested it yet, but will try so as soon as possible. This would really make my life easier. Greatly appreciated.

Simbaclaws commented 4 years ago

This seems to work, can this be merged with master? I'll make a fork just in case...

lord-kyron commented 4 years ago

Hi guys, I using elementary os 5.1 and trying to use autoplank, but it does nothing and starting from cli gives me: panic: runtime error: index out of range

goroutine 5 [running]: main.fetchDisplays(0x0, 0x0, 0x0, 0x0, 0x0) /root/autoplank/main.go:193 +0x742 main.watchDisplays() /root/autoplank/main.go:109 +0x26 created by main.eventLoop /root/autoplank/main.go:272 +0x4a

I've tried to implement the changes you mentioned, but nothing changes. Can you help me please?