本文整理匯總了Golang中github.com/BurntSushi/xgb.Conn.Close方法的典型用法代碼示例。如果您正苦於以下問題:Golang Conn.Close方法的具體用法?Golang Conn.Close怎麽用?Golang Conn.Close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/BurntSushi/xgb.Conn
的用法示例。
在下文中一共展示了Conn.Close方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: main
func main() {
/* Loading config */
if err := config.Load(config.ConfigPath()); err != nil {
fmt.Printf("Error when loading config : %v\n", err)
return
}
/* Opening the connection */
var conn *xgb.Conn
if c, err := xgb.NewConn(); err != nil {
fmt.Printf("Error when connecting to x11 server : %v\n", err)
return
} else {
conn = c
}
defer conn.Close()
/* Loading screens configuration */
if err := screens.Load(conn); err != nil {
fmt.Printf("Error while getting screens configuration : %v\n", err)
return
}
/* Loading window manager */
if err := window.Load(conn); err != nil {
fmt.Printf("Error while loading window manager : %v\n", err)
return
}
/* Opening the fifo */
var pipe *fifo.Fifo
if p, err := fifo.Open(); err != nil {
fmt.Printf("Error while opening the fifo : %s\n", err)
return
} else {
pipe = p
}
defer pipe.Close()
cmds := [...]fifo.Command{
&KillCommand{},
&RedrawCommand{},
&CloseCommand{false, false, 0},
&NotifCommand{0, "", ""},
}
for _, cmd := range cmds {
pipe.AddCmd(cmd)
}
/* Opening the queue */
var notifs *queue.Queue
if q, err := queue.Open(conn); err != nil {
fmt.Printf("Error while opening the queue : %s\n", err)
return
} else {
notifs = q
}
/* Main loop */
orders := make(chan types.Order, 10)
go xloop(conn, orders)
go pipe.ReadOrders(orders)
notifs.Run(orders)
}