• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang xprop.PropValStr函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/BurntSushi/xgbutil/xprop.PropValStr函数的典型用法代码示例。如果您正苦于以下问题:Golang PropValStr函数的具体用法?Golang PropValStr怎么用?Golang PropValStr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了PropValStr函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: GetMatches

func (rs RunningSource) GetMatches(inp string, ct *CommandTray) []Command {
	cmds := make([]Command, 0)

	if ct.X == nil {
		return []Command{}
	}

	clis, err := ewmh.ClientListGet(ct.X)

	if err != nil {
		return cmds
	}

	for _, xwin := range clis {
		dt, err := ewmh.CurrentDesktopGet(ct.X)

		if err != nil {
			dt = 0xFFFFFFFF
		}

		wdt, err := ewmh.WmDesktopGet(ct.X, xwin)
		if err != nil {
			wdt = dt
		}

		if dt != wdt {
			continue
		}

		name, err := xprop.PropValStr(xprop.GetProperty(ct.X, xwin, "_NET_WM_NAME"))
		if err != nil {
			//print("Err1: ", err.Error(), "\n")
			name, err = xprop.PropValStr(xprop.GetProperty(ct.X, xwin, "WM_NAME"))
			if err != nil {
				//print("Err2: ", err.Error(), "\n")
				name = "Unnamed Window"
			}
		}

		if strings.Contains(strings.ToLower(name), inp) {
			cmds = append(cmds, RunningCommand{X: ct.X, win: xwin, name: name})
		}
	}

	return cmds
}
开发者ID:AmandaCameron,项目名称:gobar,代码行数:46,代码来源:ct_running_apps.go


示例2: updateWmName

func (app *RuntimeApp) updateWmName(xid xproto.Window) {
	if name, err := ewmh.WmNameGet(XU, xid); err == nil && name != "" {
		app.xids[xid].Title = name
		return
	}

	if name, err := xprop.PropValStr(xprop.GetProperty(XU, xid,
		"WM_NAME")); err == nil {
		app.xids[xid].Title = name
	}
}
开发者ID:felixonmars,项目名称:dde-daemon,代码行数:11,代码来源:runtime_apps.go


示例3: Open

func (ams *AppMenuSource) Open(ct *CommandTray) bool {
	ams.app = nil
	ams.menu = nil

	active, err := ewmh.ActiveWindowGet(ct.X)
	if err != nil {
		return false
	}

	uniqName, err := xprop.PropValStr(xprop.GetProperty(ct.X, active, "_GTK_UNIQUE_BUS_NAME"))
	if err != nil {
		return false
	}

	pathMenu, err := xprop.PropValStr(xprop.GetProperty(ct.X, active, "_GTK_APP_MENU_OBJECT_PATH"))
	if err != nil {
		return false
	}

	pathApp, err := xprop.PropValStr(xprop.GetProperty(ct.X, active, "_GTK_APPLICATION_OBJECT_PATH"))
	if err != nil {
		return false
	}

	// Done parsing props! Yay!

	ams.app = &utils.GtkActions{
		ams.Conn.Object(uniqName, dbus.ObjectPath(pathApp)),
	}

	ams.menu = &utils.GtkMenu{
		ams.Conn.Object(uniqName, dbus.ObjectPath(pathMenu)),
	}

	return true
}
开发者ID:AmandaCameron,项目名称:gobar,代码行数:36,代码来源:ct_appmenu.go


示例4: Class

func (icon *Icon) Class() string {
	if icon.classCache != "" {
		return icon.classCache
	}

	val, err := xprop.PropValStr(xprop.GetProperty(icon.Socket.X, icon.Socket.Id, "WM_CLASS"))

	if err != nil {
		println("Error getting property:", err)
		return ""
	}

	icon.classCache = val

	return val
}
开发者ID:AmandaCameron,项目名称:gobar,代码行数:16,代码来源:icon.go


示例5: Run

func (cmd TagGet) Run() gribble.Value {
	if !validTagName.MatchString(cmd.Name) {
		return cmdError("Tag names must match %s.", validTagName.String())
	}

	tval := ""
	withClient(cmd.Client, func(c *xclient.Client) {
		var err error

		tagName := fmt.Sprintf("_WINGO_TAG_%s", cmd.Name)
		tval, err = xprop.PropValStr(xprop.GetProperty(wm.X, c.Id(), tagName))
		if err != nil {
			// Log the error, but give the caller an empty string.
			logger.Warning.Println(err)
		}
	})
	return tval
}
开发者ID:rubiojr,项目名称:wingo,代码行数:18,代码来源:commands.go


示例6: Run

func (cmd TagGet) Run() gribble.Value {
	if !validTagName.MatchString(cmd.Name) {
		return cmdError("Tag names must match %s.", validTagName.String())
	}

	var cid xproto.Window
	tagName := fmt.Sprintf("_WINGO_TAG_%s", cmd.Name)
	if n, ok := cmd.Client.(int); ok && n == 0 {
		cid = wm.Root.Id
	} else {
		withClient(cmd.Client, func(c *xclient.Client) {
			cid = c.Id()
		})
	}
	tval, err := xprop.PropValStr(xprop.GetProperty(wm.X, cid, tagName))
	if err != nil {
		// Log the error, but give the caller an empty string.
		logger.Warning.Println(err)
		return ""
	}
	return tval
}
开发者ID:BurntSushi,项目名称:wingo,代码行数:22,代码来源:commands.go


示例7: find_app_id_by_xid

func find_app_id_by_xid(xid xproto.Window, displayMode DisplayModeType) string {
	var appId string
	if displayMode == DisplayModeModernMode {
		if id, err := xprop.PropValStr(xprop.GetProperty(XU, xid, "_DDE_DOCK_APP_ID")); err == nil {
			appId = getAppIDFromDesktopID(normalizeAppID(id))
			logger.Debug("get app id from _DDE_DOCK_APP_ID", appId)
			return appId
		}
	}
	wmClass, _ := icccm.WmClassGet(XU, xid)
	var wmInstance, wmClassName string
	if wmClass != nil {
		wmInstance = wmClass.Instance
		wmClassName = wmClass.Class
	}
	name, _ := ewmh.WmNameGet(XU, xid)
	pid, err := ewmh.WmPidGet(XU, xid)
	if err != nil {
		logger.Info("get pid failed, ", name)
		if name != "" {
			pid = lookthroughProc(name)
		} else {
			appId = getAppIDFromDesktopID(normalizeAppID(wmClassName))
			logger.Debug("get Pid failed, using wm class name as app id", appId)
			return appId
		}
	}
	iconName, _ := ewmh.WmIconNameGet(XU, xid)
	if pid == 0 {
		appId = normalizeAppID(wmClassName)
		logger.Debug("get window name failed, using wm class name as app id", appId)
		return appId
	} else {
	}
	appId = find_app_id(pid, name, wmInstance, wmClassName, iconName)
	appId = getAppIDFromDesktopID(normalizeAppID(appId))
	logger.Debug(fmt.Sprintf("get appid %q", appId))
	return appId
}
开发者ID:felixonmars,项目名称:dde-daemon,代码行数:39,代码来源:runtime_apps.go


示例8: init

func (s *Setting) init() bool {
	s.core = gio.NewSettings(SchemaId)
	if s.core == nil {
		return false
	}

	s.listenSettingChange(HideModeKey, func(g *gio.Settings, key string) {
		s.hideModeLock.Lock()
		defer s.hideModeLock.Unlock()

		value := HideModeType(g.GetEnum(key))
		s.hideMode = value
		logger.Debug(key, "changed to", key)
		dbus.Emit(s, "HideModeChanged", int32(value))
	})

	s.listenSettingChange(DisplayModeKey, func(g *gio.Settings, key string) {
		s.displayModeLock.Lock()
		defer s.displayModeLock.Unlock()

		value := DisplayModeType(g.GetEnum(key))
		logger.Debug(key, "changed to", value)

		s.displayMode = value

		for _, rApp := range ENTRY_MANAGER.runtimeApps {
			rebuildXids := []xproto.Window{}
			for xid, _ := range rApp.xids {
				if _, err := xprop.PropValStr(
					xprop.GetProperty(
						XU,
						xid,
						"_DDE_DOCK_APP_ID",
					),
				); err != nil {
					continue
				}

				rebuildXids = append(rebuildXids, xid)
				rApp.detachXid(xid)
			}

			l := len(rebuildXids)
			if l == 0 {
				continue
			}

			if len(rApp.xids) == 0 {
				ENTRY_MANAGER.destroyRuntimeApp(rApp)
			}

			newApp := ENTRY_MANAGER.createRuntimeApp(rebuildXids[0])
			for i := 0; i < l; i++ {
				newApp.attachXid(rebuildXids[i])
			}

			activeXid, err := ewmh.ActiveWindowGet(XU)
			if err != nil {
				continue
			}

			for xid, _ := range newApp.xids {
				logger.Debugf("through new app xids")
				if activeXid == xid {
					logger.Debugf("0x%x(a), 0x%x(x)",
						activeXid, xid)
					newApp.setLeader(xid)
					newApp.updateState(xid)
					ewmh.ActiveWindowSet(XU, xid)
					break
				}
			}
		}

		dockProperty.updateDockHeight(value)
		dbus.Emit(s, "DisplayModeChanged", int32(value))
	})
	s.listenSettingChange(ClockTypeKey, func(*gio.Settings, string) {
		s.clockTypeLock.Lock()
		defer s.clockTypeLock.Unlock()
		s.clockType = ClockType(s.core.GetEnum(ClockTypeKey))
		dbus.Emit(s, "ClockTypeChanged", int32(s.clockType))
	})

	s.listenSettingChange(DisplayDateKey, func(*gio.Settings, string) {
		s.displayDateLock.Lock()
		defer s.displayDateLock.Unlock()
		s.displayDate = s.core.GetBoolean(DisplayDateKey)
		dbus.Emit(s, "DisplayDateChanged", s.displayDate)
	})
	s.listenSettingChange(DisplayWeekKey, func(*gio.Settings, string) {
		s.displayWeekLock.Lock()
		defer s.displayWeekLock.Unlock()
		s.displayWeek = s.core.GetBoolean(DisplayWeekKey)
		dbus.Emit(s, "DisplayWeekChanged", s.displayWeek)
	})

	// at least one read operation must be called after signal connected, otherwise,
	// the signal connection won't work from glib 2.43.
	// NB: https://github.com/GNOME/glib/commit/8ff5668a458344da22d30491e3ce726d861b3619
//.........这里部分代码省略.........
开发者ID:felixonmars,项目名称:dde-daemon,代码行数:101,代码来源:settings.go


示例9: WmNameGet

// _NET_WM_NAME get
func WmNameGet(xu *xgbutil.XUtil, win xproto.Window) (string, error) {
	return xprop.PropValStr(xprop.GetProperty(xu, win, "_NET_WM_NAME"))
}
开发者ID:auroralaboratories,项目名称:corona-api,代码行数:4,代码来源:ewmh.go


示例10: WmVisibleIconNameGet

// _NET_WM_VISIBLE_ICON_NAME get
func WmVisibleIconNameGet(xu *xgbutil.XUtil,
	win xproto.Window) (string, error) {

	return xprop.PropValStr(xprop.GetProperty(xu, win,
		"_NET_WM_VISIBLE_ICON_NAME"))
}
开发者ID:auroralaboratories,项目名称:corona-api,代码行数:7,代码来源:ewmh.go


示例11: WmClientMachineGet

// WM_CLIENT_MACHINE get
func WmClientMachineGet(xu *xgbutil.XUtil, win xproto.Window) (string, error) {
	return xprop.PropValStr(xprop.GetProperty(xu, win, "WM_CLIENT_MACHINE"))
}
开发者ID:droundy,项目名称:xgbutil,代码行数:4,代码来源:icccm.go


示例12: StatusGet

func StatusGet(X *xgbutil.XUtil) bool {
	status, err := xprop.PropValStr(xprop.GetProperty(X, X.RootWin(),
		"_WINGO_CMD_STATUS"))

	return err == nil && strings.ToLower(status) == "success"
}
开发者ID:dlintw,项目名称:wingo,代码行数:6,代码来源:cmdusage.go


示例13: CmdGet

func CmdGet(X *xgbutil.XUtil) (string, error) {
	return xprop.PropValStr(xprop.GetProperty(X, X.RootWin(), "_WINGO_CMD"))
}
开发者ID:dlintw,项目名称:wingo,代码行数:3,代码来源:cmdusage.go



注:本文中的github.com/BurntSushi/xgbutil/xprop.PropValStr函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang xrect.New函数代码示例发布时间:2022-05-24
下一篇:
Golang xprop.PropValNums函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap