本文整理汇总了Golang中github.com/BurntSushi/wingo/workspace.Workspace类的典型用法代码示例。如果您正苦于以下问题:Golang Workspace类的具体用法?Golang Workspace怎么用?Golang Workspace使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Workspace类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: WorkspaceToHead
func WorkspaceToHead(headIndex int, wrk *workspace.Workspace) {
if headIndex == Heads.VisibleIndex(wrk) {
return
}
// If headIndex is the currently active head, then just activate 'wrk'
// greedily.
if headIndex == Heads.VisibleIndex(Workspace()) {
SetWorkspace(wrk, true)
return
}
// Now we know that we're setting the workspace of a head that isn't
// active. The last special case to check for is whether the workspace
// we're setting is the currently activate workspace. If it is, then we
// simply activate the workspace at headIndex greedily.
if wrk.IsActive() {
Heads.WithVisibleWorkspace(headIndex, func(w *workspace.Workspace) {
SetWorkspace(w, true)
})
return
}
// Finally, we can just swap workspaces now without worrying about the
// active workspace changing.
Heads.WithVisibleWorkspace(headIndex, func(w *workspace.Workspace) {
Heads.SwitchWorkspaces(wrk, w)
})
ewmhVisibleDesktops()
ewmhCurrentDesktop()
Heads.EwmhWorkarea()
}
开发者ID:jsteele31,项目名称:wingo,代码行数:32,代码来源:state.go
示例2: SetWorkspace
func SetWorkspace(wrk *workspace.Workspace, greedy bool) {
old := Workspace()
wrk.Activate(greedy)
if old != Workspace() {
FYI("%s", wrk)
}
ewmhCurrentDesktop()
ewmhVisibleDesktops()
Heads.EwmhWorkarea()
}
开发者ID:yannicklm,项目名称:wingo,代码行数:11,代码来源:state.go
示例3: RenameWorkspace
func RenameWorkspace(wrk *workspace.Workspace, newName string) error {
if len(newName) == 0 {
return fmt.Errorf("workspaces must have a name of length at least one.")
}
if Heads.Workspaces.Find(newName) != nil {
return fmt.Errorf("a workspace with name '%s' already exists.", newName)
}
wrk.Rename(newName)
ewmhDesktopNames()
return nil
}
开发者ID:jsteele31,项目名称:wingo,代码行数:12,代码来源:state.go
示例4: SetWorkspace
func SetWorkspace(wrk *workspace.Workspace, greedy bool) {
mousebind.GrabPointer(X, Root.Id, Root.Id, 0)
old := Workspace()
wrk.Activate(greedy)
if old != Workspace() {
FYI("%s", wrk)
}
ewmhVisibleDesktops()
ewmhCurrentDesktop()
Heads.EwmhWorkarea()
mousebind.UngrabPointer(X)
}
开发者ID:Pursuit92,项目名称:wingo,代码行数:13,代码来源:state.go
示例5: CheckNewWorkspace
func (c *Client) CheckNewWorkspace() {
var newWrk *workspace.Workspace = nil
curWrk := c.Workspace()
if dragGeom := c.DragGeom(); dragGeom != nil {
newWrk = wm.Heads.FindMostOverlap(dragGeom)
} else {
newWrk = wm.Heads.FindMostOverlap(c.frame.Geom())
}
if newWrk == nil || curWrk == newWrk {
return
}
newWrk.Add(c)
// If this is the active window, switch to this workspace too.
if c.IsActive() {
wm.SetWorkspace(newWrk, false)
}
}
开发者ID:flying99999,项目名称:wingo,代码行数:20,代码来源:layout.go
示例6: RemoveWorkspace
func (hds *Heads) RemoveWorkspace(wk *workspace.Workspace) {
// Don't allow it if this would result in fewer workspaces than there
// are active physical heads.
if len(hds.geom) == len(hds.workspaces.Wrks) {
return
}
// There's a bit of complexity in choosing where to move the clients to.
// Namely, if we're removing a hidden workspace, it's a simple matter of
// moving the clients. However, if we're removing a visible workspace,
// we have to make sure to make another workspace that is hidden take
// its place. (Such a workspace is guaranteed to exist because we have at
// least one more workspace than there are active physical heads.)
if !wk.IsVisible() {
moveClientsTo := hds.workspaces.Wrks[len(hds.workspaces.Wrks)-1]
if moveClientsTo == wk {
moveClientsTo = hds.workspaces.Wrks[len(hds.workspaces.Wrks)-2]
}
wk.RemoveAllAndAdd(moveClientsTo)
} else {
// Find the last-most hidden workspace that is not itself.
for i := len(hds.workspaces.Wrks) - 1; i >= 0; i-- {
work := hds.workspaces.Wrks[i]
if work != wk && !work.IsVisible() {
hds.SwitchWorkspaces(wk, work)
wk.RemoveAllAndAdd(work)
break
}
}
}
hds.workspaces.Remove(wk)
}
开发者ID:dlintw,项目名称:wingo,代码行数:32,代码来源:workspace.go
示例7: RemoveWorkspace
func (hds *Heads) RemoveWorkspace(wk *workspace.Workspace) {
// Don't allow it if this would result in fewer workspaces than there
// are active physical heads.
if len(hds.geom) == len(hds.Workspaces.Wrks) {
panic("Cannot have fewer workspaces than active monitors.")
}
// A non-empty workspace cannot be removed.
if len(wk.Clients) > 0 {
panic(fmt.Sprintf("Non-empty workspace '%s' cannot be removed.", wk))
}
if wk.IsVisible() {
// Find the last-most hidden workspace that is not itself and switch.
for i := len(hds.Workspaces.Wrks) - 1; i >= 0; i-- {
work := hds.Workspaces.Wrks[i]
if work != wk && !work.IsVisible() {
hds.SwitchWorkspaces(wk, work)
break
}
}
}
hds.Workspaces.Remove(wk)
}
开发者ID:Pursuit92,项目名称:wingo,代码行数:24,代码来源:workspace.go
示例8: SwitchWorkspaces
func (hds *Heads) SwitchWorkspaces(wk1, wk2 *workspace.Workspace) {
v1, v2 := hds.visibleIndex(wk1), hds.visibleIndex(wk2)
switch {
case v1 > -1 && v2 > -1:
hds.visibles[v1], hds.visibles[v2] = hds.visibles[v2], hds.visibles[v1]
wk1.Place()
wk2.Place()
case v1 > -1 && v2 == -1:
hds.visibles[v1] = wk2
wk1.Hide()
wk2.Show()
case v1 == -1 && v2 > -1:
hds.visibles[v2] = wk1
wk2.Hide()
wk1.Show()
case v1 == -1 && v2 == -1:
// Meaningless
default:
panic("unreachable")
}
}
开发者ID:dlintw,项目名称:wingo,代码行数:21,代码来源:workspace.go
注:本文中的github.com/BurntSushi/wingo/workspace.Workspace类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论