GlazeWM 开源项目教程

GlazeWM 开源项目教程

glazewmGlazeWM is a tiling window manager for Windows inspired by i3 and Polybar.项目地址:https://gitcode.com/gh_mirrors/gla/glazewm

1. 项目的目录结构及介绍

GlazeWM 项目的目录结构如下:

glazewm/
├── .github/
│   └── workflows/
├── assets/
│   └── icons/
├── src/
│   ├── Commands/
│   ├── Config/
│   ├── Containers/
│   ├── Handlers/
│   ├── Services/
│   ├── Utils/
│   ├── GlazeWM.csproj
│   ├── Program.cs
│   └── Startup.cs
├── .gitignore
├── LICENSE
├── README.md
└── glazewm.sln

目录结构介绍

  • .github/workflows/: 包含 GitHub Actions 的工作流配置文件。
  • assets/icons/: 存放项目所需的图标文件。
  • src/: 项目的源代码目录。
    • Commands/: 包含各种命令的实现。
    • Config/: 包含配置相关的文件。
    • Containers/: 包含窗口管理器的容器组件。
    • Handlers/: 包含事件处理程序。
    • Services/: 包含各种服务类。
    • Utils/: 包含实用工具类。
    • GlazeWM.csproj: 项目的 C# 项目文件。
    • Program.cs: 程序的入口点。
    • Startup.cs: 启动配置文件。
  • .gitignore: Git 忽略文件配置。
  • LICENSE: 项目的许可证文件。
  • README.md: 项目的说明文档。
  • glazewm.sln: 项目的解决方案文件。

2. 项目的启动文件介绍

项目的启动文件是 src/Program.cs。这个文件包含了程序的入口点,负责初始化和启动 GlazeWM 窗口管理器。

Program.cs 文件内容概览

using System;
using System.Threading.Tasks;
using GlazeWM.Infrastructure.Common;
using GlazeWM.Infrastructure.Common.Commands;
using GlazeWM.Infrastructure.WindowsApi;
using GlazeWM.Domain.UserConfigs;
using GlazeWM.Domain.Workspaces;
using GlazeWM.Domain.Windows;
using GlazeWM.Infrastructure.Bussing;
using GlazeWM.Infrastructure.Serialization;
using GlazeWM.Infrastructure.Utils;
using GlazeWM.App.Bootstrap;
using GlazeWM.App.Commands;
using GlazeWM.App.Services;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

namespace GlazeWM
{
    public class Program
    {
        public static async Task Main(string[] args)
        {
            var host = CreateHostBuilder(args).Build();
            await host.RunAsync();
        }

        public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .ConfigureServices((context, services) =>
                {
                    services.AddSingleton<Bus>();
                    services.AddSingleton<CommandHandlerService>();
                    services.AddSingleton<UserConfigService>();
                    services.AddSingleton<WorkspaceService>();
                    services.AddSingleton<WindowService>();
                    services.AddSingleton<AppBootstrapper>();
                    services.AddSingleton<AppService>();
                    services.AddSingleton<JsonService>();
                    services.AddSingleton<WindowsEventService>();
                    services.AddSingleton<WindowManagerService>();
                    services.AddSingleton<YamlService>();
                    services.AddSingleton<AppCommands>();
                    services.AddSingleton<AppHandlers>();
                    services.AddSingleton<AppServices>();
                    services.AddSingleton<AppUtils>();
                })
                .ConfigureAppConfiguration((context, config) =>
                {
                    config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
                })
                .UseWindowsService();
    }
}

3. 项目的配置文件介绍

项目的配置文件主要位于 src/Config/ 目录下。这些文件定义了窗口管理器的各种配置,包括布局、快捷键、主题等。

配置文件示例

# config.yaml
general:
  theme: default
  workspaces:
    - name: "1"
      layout: "tiling"
    - name: "2"
      layout: "floating"

glazewmGlazeWM is a tiling window manager for Windows inspired by i3 and Polybar.项目地址:https://gitcode.com/gh_mirrors/gla/glazewm

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

卓融浪Keene

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值