當前位置: 首頁>>代碼示例>>Golang>>正文


Golang xprop.GetProperty函數代碼示例

本文整理匯總了Golang中github.com/Nightgunner5/xgbutil/xprop.GetProperty函數的典型用法代碼示例。如果您正苦於以下問題:Golang GetProperty函數的具體用法?Golang GetProperty怎麽用?Golang GetProperty使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了GetProperty函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: WmHintsGet

// WM_HINTS get
func WmHintsGet(xu *xgbutil.XUtil,
	win xproto.Window) (hints *Hints, err error) {

	lenExpect := 9
	raw, err := xprop.PropValNums(xprop.GetProperty(xu, win, "WM_HINTS"))
	if err != nil {
		return nil, err
	}
	if len(raw) != lenExpect {
		return nil,
			fmt.Errorf("WmHints: There are %d fields in "+
				"WM_HINTS, but xgbutil expects %d.", len(raw), lenExpect)
	}

	hints = &Hints{}
	hints.Flags = raw[0]
	hints.Input = raw[1]
	hints.InitialState = raw[2]
	hints.IconPixmap = xproto.Pixmap(raw[3])
	hints.IconWindow = xproto.Window(raw[4])
	hints.IconX = int(raw[5])
	hints.IconY = int(raw[6])
	hints.IconMask = xproto.Pixmap(raw[7])
	hints.WindowGroup = xproto.Window(raw[8])

	return hints, nil
}
開發者ID:Nightgunner5,項目名稱:xgbutil,代碼行數:28,代碼來源:icccm.go

示例2: DesktopGeometryGet

// _NET_DESKTOP_GEOMETRY get
func DesktopGeometryGet(xu *xgbutil.XUtil) (*DesktopGeometry, error) {
	geom, err := xprop.PropValNums(xprop.GetProperty(xu, xu.RootWin(),
		"_NET_DESKTOP_GEOMETRY"))
	if err != nil {
		return nil, err
	}

	return &DesktopGeometry{Width: int(geom[0]), Height: int(geom[1])}, nil
}
開發者ID:Nightgunner5,項目名稱:xgbutil,代碼行數:10,代碼來源:ewmh.go

示例3: WmWindowOpacityGet

// _NET_WM_WINDOW_OPACITY get
// This isn't part of the EWMH spec, but is widely used by drop in
// compositing managers (i.e., xcompmgr, cairo-compmgr, etc.).
// This property is typically set not on a client window, but the *parent*
// of a client window in reparenting window managers.
// The float returned will be in the range [0.0, 1.0] where 0.0 is completely
// transparent and 1.0 is completely opaque.
func WmWindowOpacityGet(xu *xgbutil.XUtil, win xproto.Window) (float64, error) {
	intOpacity, err := xprop.PropValNum(
		xprop.GetProperty(xu, win, "_NET_WM_WINDOW_OPACITY"))
	if err != nil {
		return 0, err
	}

	return float64(uint(intOpacity)) / float64(0xffffffff), nil
}
開發者ID:Nightgunner5,項目名稱:xgbutil,代碼行數:16,代碼來源:ewmh.go

示例4: WmHandledIconsGet

// _NET_WM_HANDLED_ICONS get
func WmHandledIconsGet(xu *xgbutil.XUtil, win xproto.Window) (bool, error) {
	reply, err := xprop.GetProperty(xu, win, "_NET_WM_HANDLED_ICONS")
	if err != nil {
		return false, err
	}

	val, err := xprop.PropValNum(reply, nil)
	if err != nil {
		return false, err
	}

	return val == 1, nil
}
開發者ID:Nightgunner5,項目名稱:xgbutil,代碼行數:14,代碼來源:ewmh.go

示例5: ShowingDesktopGet

// _NET_SHOWING_DESKTOP get
func ShowingDesktopGet(xu *xgbutil.XUtil) (bool, error) {
	reply, err := xprop.GetProperty(xu, xu.RootWin(), "_NET_SHOWING_DESKTOP")
	if err != nil {
		return false, err
	}

	val, err := xprop.PropValNum(reply, nil)
	if err != nil {
		return false, err
	}

	return val == 1, nil
}
開發者ID:Nightgunner5,項目名稱:xgbutil,代碼行數:14,代碼來源:ewmh.go

示例6: WmStrutGet

// _NET_WM_STRUT get
func WmStrutGet(xu *xgbutil.XUtil, win xproto.Window) (*WmStrut, error) {
	struts, err := xprop.PropValNums(xprop.GetProperty(xu, win,
		"_NET_WM_STRUT"))
	if err != nil {
		return nil, err
	}

	return &WmStrut{
		Left:   struts[0],
		Right:  struts[1],
		Top:    struts[2],
		Bottom: struts[3],
	}, nil
}
開發者ID:Nightgunner5,項目名稱:xgbutil,代碼行數:15,代碼來源:ewmh.go

示例7: FrameExtentsGet

// _NET_FRAME_EXTENTS get
func FrameExtentsGet(xu *xgbutil.XUtil,
	win xproto.Window) (*FrameExtents, error) {

	raw, err := xprop.PropValNums(xprop.GetProperty(xu, win,
		"_NET_FRAME_EXTENTS"))
	if err != nil {
		return nil, err
	}

	return &FrameExtents{
		Left:   int(raw[0]),
		Right:  int(raw[1]),
		Top:    int(raw[2]),
		Bottom: int(raw[3]),
	}, nil
}
開發者ID:Nightgunner5,項目名稱:xgbutil,代碼行數:17,代碼來源:ewmh.go

示例8: DesktopViewportGet

// _NET_DESKTOP_VIEWPORT get
func DesktopViewportGet(xu *xgbutil.XUtil) ([]DesktopViewport, error) {
	coords, err := xprop.PropValNums(xprop.GetProperty(xu, xu.RootWin(),
		"_NET_DESKTOP_VIEWPORT"))
	if err != nil {
		return nil, err
	}

	viewports := make([]DesktopViewport, len(coords)/2)
	for i, _ := range viewports {
		viewports[i] = DesktopViewport{
			X: int(coords[i*2]),
			Y: int(coords[i*2+1]),
		}
	}
	return viewports, nil
}
開發者ID:Nightgunner5,項目名稱:xgbutil,代碼行數:17,代碼來源:ewmh.go

示例9: WmFullscreenMonitorsGet

// _NET_WM_FULLSCREEN_MONITORS get
func WmFullscreenMonitorsGet(xu *xgbutil.XUtil,
	win xproto.Window) (*WmFullscreenMonitors, error) {

	raw, err := xprop.PropValNums(
		xprop.GetProperty(xu, win, "_NET_WM_FULLSCREEN_MONITORS"))
	if err != nil {
		return nil, err
	}

	return &WmFullscreenMonitors{
		Top:    raw[0],
		Bottom: raw[1],
		Left:   raw[2],
		Right:  raw[3],
	}, nil
}
開發者ID:Nightgunner5,項目名稱:xgbutil,代碼行數:17,代碼來源:ewmh.go

示例10: WmStateGet

// WM_STATE get
func WmStateGet(xu *xgbutil.XUtil, win xproto.Window) (*WmState, error) {
	raw, err := xprop.PropValNums(xprop.GetProperty(xu, win, "WM_STATE"))
	if err != nil {
		return nil, err
	}
	if len(raw) != 2 {
		return nil,
			fmt.Errorf("WmState: Expected two integers in WM_STATE property "+
				"but xgbutil found %d in '%v'.", len(raw), raw)
	}

	return &WmState{
		State: raw[0],
		Icon:  xproto.Window(raw[1]),
	}, nil
}
開發者ID:Nightgunner5,項目名稱:xgbutil,代碼行數:17,代碼來源:icccm.go

示例11: WmIconGeometryGet

// _NET_WM_ICON_GEOMETRY get
func WmIconGeometryGet(xu *xgbutil.XUtil,
	win xproto.Window) (*WmIconGeometry, error) {

	geom, err := xprop.PropValNums(xprop.GetProperty(xu, win,
		"_NET_WM_ICON_GEOMETRY"))
	if err != nil {
		return nil, err
	}

	return &WmIconGeometry{
		X:      int(geom[0]),
		Y:      int(geom[1]),
		Width:  geom[2],
		Height: geom[3],
	}, nil
}
開發者ID:Nightgunner5,項目名稱:xgbutil,代碼行數:17,代碼來源:ewmh.go

示例12: WmClassGet

// WM_CLASS get
func WmClassGet(xu *xgbutil.XUtil, win xproto.Window) (*WmClass, error) {
	raw, err := xprop.PropValStrs(xprop.GetProperty(xu, win, "WM_CLASS"))
	if err != nil {
		return nil, err
	}
	if len(raw) != 2 {
		return nil,
			fmt.Errorf("WmClass: Two string make up WM_CLASS, but "+
				"xgbutil found %d in '%v'.", len(raw), raw)
	}

	return &WmClass{
		Instance: raw[0],
		Class:    raw[1],
	}, nil
}
開發者ID:Nightgunner5,項目名稱:xgbutil,代碼行數:17,代碼來源:icccm.go

示例13: WmStrutPartialGet

// _NET_WM_STRUT_PARTIAL get
func WmStrutPartialGet(xu *xgbutil.XUtil,
	win xproto.Window) (*WmStrutPartial, error) {

	struts, err := xprop.PropValNums(xprop.GetProperty(xu, win,
		"_NET_WM_STRUT_PARTIAL"))
	if err != nil {
		return nil, err
	}

	return &WmStrutPartial{
		Left: struts[0], Right: struts[1], Top: struts[2], Bottom: struts[3],
		LeftStartY: struts[4], LeftEndY: struts[5],
		RightStartY: struts[6], RightEndY: struts[7],
		TopStartX: struts[8], TopEndX: struts[9],
		BottomStartX: struts[10], BottomEndX: struts[11],
	}, nil
}
開發者ID:Nightgunner5,項目名稱:xgbutil,代碼行數:18,代碼來源:ewmh.go

示例14: WmIconSizeGet

// WM_ICON_SIZE get
func WmIconSizeGet(xu *xgbutil.XUtil, win xproto.Window) (*IconSize, error) {
	raw, err := xprop.PropValNums(xprop.GetProperty(xu, win, "WM_ICON_SIZE"))
	if err != nil {
		return nil, err
	}
	if len(raw) != 6 {
		return nil,
			fmt.Errorf("WmIconSize: Expected six integers in WM_ICON_SIZE "+
				"property, but xgbutil found "+"%d in '%v'.", len(raw), raw)
	}

	return &IconSize{
		MinWidth: raw[0], MinHeight: raw[1],
		MaxWidth: raw[2], MaxHeight: raw[3],
		WidthInc: raw[4], HeightInc: raw[5],
	}, nil
}
開發者ID:Nightgunner5,項目名稱:xgbutil,代碼行數:18,代碼來源:icccm.go

示例15: WorkareaGet

// _NET_WORKAREA get
func WorkareaGet(xu *xgbutil.XUtil) ([]Workarea, error) {
	rects, err := xprop.PropValNums(xprop.GetProperty(xu, xu.RootWin(),
		"_NET_WORKAREA"))
	if err != nil {
		return nil, err
	}

	workareas := make([]Workarea, len(rects)/4)
	for i, _ := range workareas {
		workareas[i] = Workarea{
			X:      int(rects[i*4]),
			Y:      int(rects[i*4+1]),
			Width:  rects[i*4+2],
			Height: rects[i*4+3],
		}
	}
	return workareas, nil
}
開發者ID:Nightgunner5,項目名稱:xgbutil,代碼行數:19,代碼來源:ewmh.go


注:本文中的github.com/Nightgunner5/xgbutil/xprop.GetProperty函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。