Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkae committed Nov 3, 2024
1 parent 176f8f0 commit 0fac119
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
6 changes: 5 additions & 1 deletion src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,11 @@ void FilesystemConfiguration::read_workspaces(YAML::Node const& workspaces)
if (!type || type.value() == ContainerType::none)
continue;

options.workspace_configs.push_back({ num, type.value() });
std::string name;
if (!try_parse_value(workspace, "name", name, true))
continue;

options.workspace_configs.push_back({ num, type.value(), name });
}
}

Expand Down
1 change: 1 addition & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ struct WorkspaceConfig
{
int num = -1;
ContainerType layout = ContainerType::leaf;
std::string name;
};

enum class RenderFilter : int
Expand Down
7 changes: 6 additions & 1 deletion src/workspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ class OutputTilingWindowTreeInterface : public TilingWindowTreeInterface
Workspace* workspace;
};

std::string get_name(std::shared_ptr<MiracleConfig> const& config, int workspace)
{
return config->get_workspace_config(workspace).name;
}

}

Workspace::Workspace(
Expand All @@ -75,7 +80,7 @@ Workspace::Workspace(
output { output },
tools { tools },
workspace { workspace },
name {},
name { ::get_name(config, workspace) },
window_controller { window_controller },
state { state },
config { config },
Expand Down
11 changes: 3 additions & 8 deletions src/workspace_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace miracle
{

using miral::Window;
using miral::WindowInfo;
using miral::WindowManagerTools;
using miral::WindowSpecification;

class Output;

/// Keeps track of the available workspaces and maps them to outputs.
class WorkspaceManager
{
public:
explicit WorkspaceManager(
WindowManagerTools const& tools,
miral::WindowManagerTools const& tools,
WorkspaceObserverRegistrar& registry,
std::function<Output const*()> const& get_active_screen);
virtual ~WorkspaceManager() = default;
Expand Down Expand Up @@ -77,7 +73,6 @@ class WorkspaceManager
/// for most situations.
std::shared_ptr<Output> request_focus(int workspace);

static int constexpr NUM_WORKSPACES = 10;
std::array<std::shared_ptr<Output>, NUM_WORKSPACES> const& get_output_to_workspace_mapping() { return output_to_workspace_mapping; }

private:
Expand All @@ -87,7 +82,7 @@ class WorkspaceManager
std::weak_ptr<Output> output;
};

WindowManagerTools tools_;
miral::WindowManagerTools tools_;
WorkspaceObserverRegistrar& registry;
std::function<Output const*()> get_active_screen;
std::array<std::shared_ptr<Output>, NUM_WORKSPACES> output_to_workspace_mapping;
Expand Down

0 comments on commit 0fac119

Please sign in to comment.