i3-last-scratchpad/main.go

22 lines
631 B
Go
Raw Permalink Normal View History

2024-09-15 21:48:45 -04:00
package main
import "github.com/mdirkse/i3ipc"
import "gitea.ashishdsouza.com/ashish/i3-last-scratchpad/notify"
import "gitea.ashishdsouza.com/ashish/i3-last-scratchpad/scratchpad"
func main() {
var ipcSocket, socketErr = i3ipc.GetIPCSocket()
if socketErr != nil {
notify.SendNotification("Failed to acquire i3 IPC socket", notify.CriticalPriority)
panic(socketErr)
}
var lastScratchpadNode = scratchpad.GetLastScratchpadNode(ipcSocket)
if lastScratchpadNode == nil {
notify.SendNotification("Scratchpad is empty", notify.NormalPriority)
} else {
scratchpad.ShowScratchpadNode(ipcSocket, lastScratchpadNode)
}
}