本文整理汇总了Golang中github.com/BurntSushi/xgbutil/xprop.ChangeProp32函数的典型用法代码示例。如果您正苦于以下问题:Golang ChangeProp32函数的具体用法?Golang ChangeProp32怎么用?Golang ChangeProp32使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ChangeProp32函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: SetRoot
// SetRoot sets the given background as the root window background.
func SetRoot(X *xgbutil.XUtil, bg *xgraphics.Image) error {
root := X.RootWin()
if err := bg.XSurfaceSet(root); err != nil {
return err
}
bg.XDraw()
bg.XPaint(root)
// FIXME: This doesn't set the pixmap persistently. As soon as the program
// exits, the pixmap is destroyed. Find a way to make it persistent.
xprop.ChangeProp32(X, root, "_XROOTPMAP_ID", "PIXMAP", uint(bg.Pixmap))
xprop.ChangeProp32(X, root, "ESETROOT_PMAP_ID", "PIXMAP", uint(bg.Pixmap))
return nil
}
示例2: tryOwner
func (m *TrayManager) tryOwner() bool {
// Make a check, the tray application MUST be 1.
reply, err := m.getSelectionOwner()
if err != nil {
logger.Error(err)
return false
}
if reply.Owner != 0 {
logger.Warning("Another System tray application is running")
return false
}
timeStamp, _ := ewmh.WmUserTimeGet(TrayXU, m.owner)
err = xproto.SetSelectionOwnerChecked(
TrayXU.Conn(),
m.owner,
_NET_SYSTEM_TRAY_S0,
xproto.Timestamp(timeStamp),
).Check()
if err != nil {
logger.Warning("Set Selection Owner failed: ", err)
return false
}
//owner the _NET_SYSTEM_TRAY_Sn
logger.Info("Required _NET_SYSTEM_TRAY_S0 successful")
m.RequireManageTrayIcons()
xprop.ChangeProp32(
TrayXU,
m.owner,
"_NET_SYSTEM_TRAY_VISUAL",
"VISUALID",
uint(TRAYMANAGER.visual),
)
xprop.ChangeProp32(
TrayXU,
m.owner,
"_NET_SYSTEM_TRAY_ORIENTAION",
"CARDINAL",
0,
)
reply, err = m.getSelectionOwner()
if err != nil {
logger.Warning(err)
return false
}
return reply.Owner != 0
}
示例3: DesktopLayoutSet
// _NET_DESKTOP_LAYOUT set
func DesktopLayoutSet(xu *xgbutil.XUtil, orientation, columns, rows,
startingCorner uint) error {
return xprop.ChangeProp32(xu, xu.RootWin(), "_NET_DESKTOP_LAYOUT",
"CARDINAL", orientation, columns, rows,
startingCorner)
}
示例4: WmStateSet
// WM_STATE set
func WmStateSet(xu *xgbutil.XUtil, win xproto.Window, state *WmState) error {
raw := []int{
state.State,
int(state.Icon),
}
return xprop.ChangeProp32(xu, win, "WM_STATE", "WM_STATE", raw...)
}
示例5: WmProtocolsSet
// WM_PROTOCOLS set
func WmProtocolsSet(xu *xgbutil.XUtil, win xproto.Window,
atomNames []string) error {
atoms, err := xprop.StrToAtoms(xu, atomNames)
if err != nil {
return err
}
return xprop.ChangeProp32(xu, win, "WM_PROTOCOLS", "ATOM", atoms...)
}
示例6: SupportedSet
// _NET_SUPPORTED set
// This will create any atoms in the argument if they don't already exist.
func SupportedSet(xu *xgbutil.XUtil, atomNames []string) error {
atoms, err := xprop.StrToAtoms(xu, atomNames)
if err != nil {
return err
}
return xprop.ChangeProp32(xu, xu.RootWin(), "_NET_SUPPORTED", "ATOM",
atoms...)
}
示例7: WmIconSet
// _NET_WM_ICON set
func WmIconSet(xu *xgbutil.XUtil, win xproto.Window, icons []WmIcon) error {
raw := make([]uint, 0, 10000) // start big
for _, icon := range icons {
raw = append(raw, icon.Width, icon.Height)
raw = append(raw, icon.Data...)
}
return xprop.ChangeProp32(xu, win, "_NET_WM_ICON", "CARDINAL", raw...)
}
示例8: WmWindowTypeSet
// _NET_WM_WINDOW_TYPE set
// This will create any atoms used in 'atomNames' if they don't already exist.
func WmWindowTypeSet(xu *xgbutil.XUtil, win xproto.Window,
atomNames []string) error {
atoms, err := xprop.StrToAtoms(xu, atomNames)
if err != nil {
return err
}
return xprop.ChangeProp32(xu, win, "_NET_WM_WINDOW_TYPE", "ATOM", atoms...)
}
示例9: ShowingDesktopSet
// _NET_SHOWING_DESKTOP set
func ShowingDesktopSet(xu *xgbutil.XUtil, show bool) error {
var showInt uint
if show {
showInt = 1
} else {
showInt = 0
}
return xprop.ChangeProp32(xu, xu.RootWin(), "_NET_SHOWING_DESKTOP",
"CARDINAL", showInt)
}
示例10: WmHandledIconsSet
// _NET_WM_HANDLED_ICONS set
func WmHandledIconsSet(xu *xgbutil.XUtil, handle bool) error {
var handled uint
if handle {
handled = 1
} else {
handled = 0
}
return xprop.ChangeProp32(xu, xu.RootWin(), "_NET_WM_HANDLED_ICONS",
"CARDINAL", handled)
}
示例11: FrameExtentsSet
// _NET_FRAME_EXTENTS set
func FrameExtentsSet(xu *xgbutil.XUtil, win xproto.Window,
extents *FrameExtents) error {
raw := make([]uint, 4)
raw[0] = uint(extents.Left)
raw[1] = uint(extents.Right)
raw[2] = uint(extents.Top)
raw[3] = uint(extents.Bottom)
return xprop.ChangeProp32(xu, win, "_NET_FRAME_EXTENTS", "CARDINAL", raw...)
}
示例12: DesktopViewportSet
// _NET_DESKTOP_VIEWPORT set
func DesktopViewportSet(xu *xgbutil.XUtil, viewports []DesktopViewport) error {
coords := make([]uint, len(viewports)*2)
for i, viewport := range viewports {
coords[i*2] = uint(viewport.X)
coords[i*2+1] = uint(viewport.Y)
}
return xprop.ChangeProp32(xu, xu.RootWin(), "_NET_DESKTOP_VIEWPORT",
"CARDINAL", coords...)
}
示例13: WmHintsSet
// WM_HINTS set
// Make sure to set the flags in the Hints struct correctly!
func WmHintsSet(xu *xgbutil.XUtil, win xproto.Window, hints *Hints) error {
raw := []int{
hints.Flags, hints.Input, hints.InitialState,
int(hints.IconPixmap), int(hints.IconWindow),
hints.IconX, hints.IconY,
int(hints.IconMask),
int(hints.WindowGroup),
}
return xprop.ChangeProp32(xu, win, "WM_HINTS", "WM_HINTS", raw...)
}
示例14: WmStrutSet
// _NET_WM_STRUT set
func WmStrutSet(xu *xgbutil.XUtil, win xproto.Window, struts *WmStrut) error {
rawStruts := make([]uint, 4)
rawStruts[0] = struts.Left
rawStruts[1] = struts.Right
rawStruts[2] = struts.Top
rawStruts[3] = struts.Bottom
return xprop.ChangeProp32(xu, win, "_NET_WM_STRUT", "CARDINAL",
rawStruts...)
}
示例15: WmIconSizeSet
// WM_ICON_SIZE set
func WmIconSizeSet(xu *xgbutil.XUtil, win xproto.Window,
icondim *IconSize) error {
raw := []int{
icondim.MinWidth, icondim.MinHeight,
icondim.MaxWidth, icondim.MaxHeight,
icondim.WidthInc, icondim.HeightInc,
}
return xprop.ChangeProp32(xu, win, "WM_ICON_SIZE", "WM_ICON_SIZE", raw...)
}