Example #1
0
func (c *Client) unmanage() {
	wm.X.Grab()
	defer wm.X.Ungrab()

	go func() {
		c.frames.destroy()
		c.prompts.destroy()
	}()

	logger.Message.Printf("Unmanaging client: %s", c)

	c.frame.Unmap()
	c.win.Detach()
	icccm.WmStateSet(wm.X, c.Id(), &icccm.WmState{State: icccm.StateWithdrawn})
	focus.Remove(c)
	wm.FocusFallback()
	stack.Remove(c)
	c.workspace.Remove(c)
	wm.RemoveClient(c)
	c.attnStop()
	xproto.ChangeSaveSetChecked(
		wm.X.Conn(), xproto.SetModeDelete, c.Id()).Check()

	if c.hadStruts {
		wm.Heads.ApplyStruts(wm.Clients)
	}
}
Example #2
0
func (c *Client) manage() {
	c.refreshName()
	logger.Message.Printf("Managing new client: %s", c)

	promptDone := make(chan struct{}, 0)
	go func() {
		c.prompts = c.newClientPrompts()
		promptDone <- struct{}{}
	}()

	c.fetchXProperties()
	c.setPrimaryType()
	c.setInitialLayer()

	// Determine whether the client should start iconified or not.
	c.iconified = c.nhints.Flags&icccm.HintState > 0 &&
		c.hints.InitialState == icccm.StateIconic

	// newClientFrames sets c.frame.
	c.frames = c.newClientFrames()
	c.states = c.newClientStates()

	presumedWorkspace := c.findPresumedWorkspace()

	c.moveToProperHead(presumedWorkspace)
	c.maybeInitPlace(presumedWorkspace)
	wm.AddClient(c)
	c.maybeAddToFocusStack()
	c.Raise()
	c.attachEventCallbacks()
	c.maybeApplyStruts()

	if _, ok := presumedWorkspace.(*workspace.Sticky); ok {
		c.stick()
	} else {
		presumedWorkspace.Add(c)
	}

	c.updateInitStates()
	ewmh.WmAllowedActionsSet(wm.X, c.Id(), allowedActions)

	err := xproto.ChangeSaveSetChecked(
		wm.X.Conn(), xproto.SetModeInsert, c.Id()).Check()
	if err != nil {
		logger.Warning.Printf(
			"Could not add client '%s' to SaveSet. This may be problematic "+
				"if you try to replace Wingo with another window manager: %s",
			c, err)
	}

	<-promptDone
}
Example #3
0
func (c *Client) unmanage() {
	wm.X.Grab()
	defer wm.X.Ungrab()

	go func() {
		c.frames.destroy()
		c.prompts.destroy()
	}()

	logger.Message.Printf("Unmanaging client: %s", c)

	infoWorkspace := c.workspace.String()
	infoClass := c.Class().Class
	infoInstance := c.Class().Instance
	infoName := c.Name()

	c.frame.Unmap()
	c.win.Detach()
	icccm.WmStateSet(wm.X, c.Id(), &icccm.WmState{State: icccm.StateWithdrawn})
	focus.Remove(c)
	wm.FocusFallback()
	stack.Remove(c)
	c.workspace.Remove(c)
	wm.RemoveClient(c)
	c.attnStop()
	xproto.ChangeSaveSetChecked(
		wm.X.Conn(), xproto.SetModeDelete, c.Id()).Check()

	if c.hadStruts {
		wm.Heads.ApplyStruts(wm.Clients)
	}

	event.Notify(event.UnmanagedClient{
		Id:        c.Id(),
		Name:      infoName,
		Workspace: infoWorkspace,
		Class:     infoClass,
		Instance:  infoInstance,
	})
}