Description

Imbues workspaces with additional features so they can be treated as individual project areas.

Synopsis

# Overview

Inspired by TopicSpace, DynamicWorkspaces, and WorkspaceDir, DynamicProjects treats workspaces as projects while maintaining compatibility with all existing workspace-related functionality in XMonad.

Instead of using generic workspace names such as 3 or work, DynamicProjects allows you to dedicate workspaces to specific projects and then switch between projects easily.

A project is made up of a name, working directory, and a start-up hook. When you switch to a workspace, DynamicProjects changes the working directory to the one configured for the matching project. If the workspace doesn't have any windows, the project's start-up hook is executed. This allows you to launch applications or further configure the workspace/project.

When using the switchProjectPrompt function, workspaces are created as needed. This means you can create new project spaces (and therefore workspaces) on the fly. (These dynamic projects are not preserved across restarts.)

Additionally, frequently used projects can be configured statically in your XMonad configuration. Doing so allows you to configure the per-project start-up hook.

# Usage

To use DynamicProjects you need to add it to your XMonad configuration and then configure some optional key bindings.

import XMonad.Actions.DynamicProjects

Start by defining some projects:

projects :: [Project]
projects =
[ Project { projectName      = "scratch"
, projectDirectory = "~/"
, projectStartHook = Nothing
}

, Project { projectName      = "browser"
, projectStartHook = Just $do spawn "conkeror" spawn "chromium" } ] Then inject DynamicProjects into your XMonad configuration: main = xmonad$ dynamicProjects projects def

And finally, configure some optional key bindings:

 , ((modm, xK_space), switchProjectPrompt)
, ((modm, xK_slash), shiftToProjectPrompt)

# Types

data Project Source #

Details about a workspace that represents a project.

Constructors

 Project FieldsprojectName :: !ProjectNameWorkspace name.projectDirectory :: !FilePathWorking directory.projectStartHook :: !(Maybe (X ()))Optional start-up hook.

# Hooks

dynamicProjects :: [Project] -> XConfig a -> XConfig a Source #

Add dynamic projects support to the given config.

# Bindings

Prompt for a project name and then switch to it. Automatically creates a project if a new name is returned from the prompt.

Prompts for a project name and then shifts the currently focused window to that project.

Rename the current project.

Change the working directory used for the current project.

NOTE: This will only affect new processed started in this project. Existing processes will maintain the previous working directory.

# Helper Functions

Switch to the given project.

Shift the currently focused window to the given project.

Find a project based on its name.

Fetch the current project (the one being used for the currently active workspace).

Activate a project by updating the working directory and possibly running its start-up hook. This function is automatically invoked when the workspace changes.