Merge remote-tracking branch 'origin/main' into scenefx

This commit is contained in:
DreamMaoMao 2025-06-18 08:17:19 +08:00
commit 31bd2814d2
10 changed files with 438 additions and 291 deletions

31
.github/workflows/lock.yml vendored Normal file
View file

@ -0,0 +1,31 @@
name: Lock Threads
on:
schedule:
- cron: "30 12 * * *"
workflow_dispatch:
concurrency:
group: lock
jobs:
lock:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
discussions: write
steps:
- uses: dessant/lock-threads@v5
with:
issue-inactive-days: "30"
issue-comment: >
I'm going to lock this issue because it has been closed for _30 days_. ⏳
This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please file a new
issue and complete the issue template so we can capture all the details
necessary to investigate further.
pr-inactive-days: "30"
discussion-inactive-days: "30"
process-only: "issues,prs,discussions"

28
.github/workflows/stale.yml vendored Normal file
View file

@ -0,0 +1,28 @@
name: Close manually marked stale issues
on:
schedule:
- cron: "30 12 * * *" # 每天 UTC 12:30 运行
jobs:
close-issues:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v9
with:
# 禁用自动标记 stale仅手动标记的 issue 会被处理)
days-before-issue-stale: -1
# 手动标记后14 天后关闭
days-before-issue-close: 14
# 使用的标签(必须和你手动添加的标签一致)
stale-issue-label: "stale"
# 自动关闭时自动加上的标签
close-issue-label: "automatic-closing"
# 关闭时的提示信息
close-issue-message: "This issue was closed because it was marked as stale and had no activity for 14 days."
# 禁用 PR 处理
days-before-pr-stale: -1
days-before-pr-close: -1
repo-token: ${{ secrets.GITHUB_TOKEN }}

View file

@ -13,14 +13,13 @@
};
};
outputs =
{
self,
flake-parts,
treefmt-nix,
...
}@inputs:
flake-parts.lib.mkFlake { inherit inputs; } {
outputs = {
self,
flake-parts,
treefmt-nix,
...
} @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} {
imports = [
inputs.flake-parts.flakeModules.easyOverlay
];
@ -30,37 +29,35 @@
nixosModules.maomaowm = import ./nix/nixos-modules.nix self;
};
perSystem =
{
config,
pkgs,
...
}:
let
inherit (pkgs)
callPackage
;
maomaowm = callPackage ./nix {
inherit (inputs.nixpkgs-wayland.packages.${pkgs.system}) wlroots;
inherit (inputs.mmsg.packages.${pkgs.system}) mmsg;
};
shellOverride = old: {
nativeBuildInputs = old.nativeBuildInputs ++ [ ];
buildInputs = old.buildInputs ++ [ ];
};
treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
in
{
packages.default = maomaowm;
overlayAttrs = {
inherit (config.packages) maomaowm;
};
packages = {
inherit maomaowm;
};
devShells.default = maomaowm.overrideAttrs shellOverride;
formatter = treefmtEval.config.build.wrapper;
perSystem = {
config,
pkgs,
...
}: let
inherit
(pkgs)
callPackage
;
maomaowm = callPackage ./nix {
inherit (inputs.nixpkgs-wayland.packages.${pkgs.system}) wlroots;
inherit (inputs.mmsg.packages.${pkgs.system}) mmsg;
};
systems = [ "x86_64-linux" ];
shellOverride = old: {
nativeBuildInputs = old.nativeBuildInputs ++ [];
buildInputs = old.buildInputs ++ [];
};
treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
in {
packages.default = maomaowm;
overlayAttrs = {
inherit (config.packages) maomaowm;
};
packages = {
inherit maomaowm;
};
devShells.default = maomaowm.overrideAttrs shellOverride;
formatter = treefmtEval.config.build.wrapper;
};
systems = ["x86_64-linux"];
};
}

View file

@ -18,51 +18,53 @@
ninja,
wlroots,
mmsg,
}:
let
}: let
pname = "maomaowm";
in
stdenv.mkDerivation {
inherit pname;
version = "nightly";
stdenv.mkDerivation {
inherit pname;
version = "nightly";
src = ../.;
src = builtins.path {
path = ../.;
name = "source";
};
nativeBuildInputs = [
meson
ninja
pkg-config
wayland-scanner
];
buildInputs =
[
libinput
libxcb
libxkbcommon
pcre2
pixman
wayland
wayland-protocols
wlroots
]
++ lib.optionals enableXWayland [
libX11
xcbutilwm
xwayland
nativeBuildInputs = [
meson
ninja
pkg-config
wayland-scanner
];
passthru = {
providedSessions = [ "maomao" ];
inherit mmsg;
};
buildInputs =
[
libinput
libxcb
libxkbcommon
pcre2
pixman
wayland
wayland-protocols
wlroots
]
++ lib.optionals enableXWayland [
libX11
xcbutilwm
xwayland
];
meta = {
mainProgram = "maomao";
description = "A streamlined but feature-rich Wayland compositor";
homepage = "https://github.com/DreamMaoMao/maomaowm";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ ];
platforms = lib.platforms.unix;
};
}
passthru = {
providedSessions = ["maomao"];
inherit mmsg;
};
meta = {
mainProgram = "maomao";
description = "A streamlined but feature-rich Wayland compositor";
homepage = "https://github.com/DreamMaoMao/maomaowm";
license = lib.licenses.mit;
maintainers = [];
platforms = lib.platforms.unix;
};
}

View file

@ -1,11 +1,9 @@
self:
{
self: {
lib,
config,
pkgs,
...
}:
let
}: let
inherit (self.packages.${pkgs.system}) maomaowm;
cfg = config.wayland.windowManager.maomaowm;
variables = lib.concatStringsSep " " cfg.systemd.variables;
@ -15,8 +13,7 @@ let
${lib.optionalString cfg.systemd.enable systemdActivation}
${cfg.autostart_sh}
'';
in
{
in {
options = {
wayland.windowManager.maomaowm = with lib; {
enable = mkOption {
@ -53,7 +50,7 @@ in
"XCURSOR_THEME"
"XCURSOR_SIZE"
];
example = [ "--all" ];
example = ["--all"];
description = ''
Environment variables imported into the systemd and D-Bus user environment.
'';
@ -95,23 +92,23 @@ in
};
config = lib.mkIf cfg.enable {
home.packages = [ maomaowm ];
home.packages = [maomaowm];
home.activation =
lib.optionalAttrs (cfg.autostart_sh != "") {
createMaomaoScript = lib.hm.dag.entryAfter [ "clearMaomaoConfig" ] ''
createMaomaoScript = lib.hm.dag.entryAfter ["clearMaomaoConfig"] ''
cat ${autostart_sh} > $HOME/.config/maomao/autostart.sh
chmod +x $HOME/.config/maomao/autostart.sh
'';
}
// lib.optionalAttrs (cfg.settings != "") {
createMaomaoConfig = lib.hm.dag.entryAfter [ "clearMaomaoConfig" ] ''
createMaomaoConfig = lib.hm.dag.entryAfter ["clearMaomaoConfig"] ''
cat > $HOME/.config/maomao/config.conf <<EOF
${cfg.settings}
EOF
'';
}
// {
clearMaomaoConfig = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
clearMaomaoConfig = lib.hm.dag.entryAfter ["writeBoundary"] ''
rm -rf $HOME/.config/maomao
mkdir -p $HOME/.config/maomao
'';
@ -119,12 +116,14 @@ in
systemd.user.targets.maomao-session = lib.mkIf cfg.systemd.enable {
Unit = {
Description = "maomao compositor session";
Documentation = [ "man:systemd.special(7)" ];
BindsTo = [ "graphical-session.target" ];
Wants = [
"graphical-session-pre.target"
] ++ lib.optional cfg.systemd.xdgAutostart "xdg-desktop-autostart.target";
After = [ "graphical-session-pre.target" ];
Documentation = ["man:systemd.special(7)"];
BindsTo = ["graphical-session.target"];
Wants =
[
"graphical-session-pre.target"
]
++ lib.optional cfg.systemd.xdgAutostart "xdg-desktop-autostart.target";
After = ["graphical-session-pre.target"];
Before = lib.optional cfg.systemd.xdgAutostart "xdg-desktop-autostart.target";
};
};

View file

@ -1,14 +1,11 @@
self:
{
self: {
config,
lib,
pkgs,
...
}:
let
}: let
cfg = config.programs.maomaowm;
in
{
in {
options = {
programs.maomaowm = {
enable = lib.mkEnableOption "maomaowm, a wayland compositor based on dwl";
@ -21,16 +18,22 @@ in
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [
cfg.package
] ++ (if (builtins.hasAttr "mmsg" cfg.package) then [ cfg.package.mmsg ] else [ ]);
environment.systemPackages =
[
cfg.package
]
++ (
if (builtins.hasAttr "mmsg" cfg.package)
then [cfg.package.mmsg]
else []
);
xdg.portal = {
enable = lib.mkDefault true;
wlr.enable = lib.mkDefault true;
configPackages = [ cfg.package ];
configPackages = [cfg.package];
};
security.polkit.enable = lib.mkDefault true;
@ -38,10 +41,9 @@ in
programs.xwayland.enable = lib.mkDefault true;
services = {
displayManager.sessionPackages = [ cfg.package ];
displayManager.sessionPackages = [cfg.package];
graphical-desktop.enable = lib.mkDefault true;
};
};
}

View file

@ -255,6 +255,7 @@ typedef struct {
int single_scratchpad;
int xwayland_persistence;
int syncobj_enable;
struct xkb_rule_names xkb_rules;
} Config;
@ -674,6 +675,8 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value,
func = tagtoright;
} else if (strcmp(func_name, "killclient") == 0) {
func = killclient;
} else if (strcmp(func_name, "focuslast") == 0) {
func = focuslast;
} else if (strcmp(func_name, "setlayout") == 0) {
func = setlayout;
(*arg).v = strdup(arg_value);
@ -700,12 +703,13 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value,
} else if (strcmp(func_name, "focusmon") == 0) {
func = focusmon;
(*arg).i = parse_direction(arg_value);
if((*arg).i == UNDIR) {
if ((*arg).i == UNDIR) {
(*arg).v = strdup(arg_value);
}
} else if (strcmp(func_name, "tagmon") == 0) {
func = tagmon;
(*arg).i = parse_direction(arg_value);
(*arg).ui = atoi(arg_value2);
} else if (strcmp(func_name, "incgaps") == 0) {
func = incgaps;
(*arg).i = atoi(arg_value);
@ -915,6 +919,8 @@ void parse_config_line(Config *config, const char *line) {
config->single_scratchpad = atoi(value);
} else if (strcmp(key, "xwayland_persistence") == 0) {
config->xwayland_persistence = atoi(value);
} else if (strcmp(key, "syncobj_enable") == 0) {
config->syncobj_enable = atoi(value);
} else if (strcmp(key, "no_border_when_single") == 0) {
config->no_border_when_single = atoi(value);
} else if (strcmp(key, "snap_distance") == 0) {
@ -2026,6 +2032,7 @@ void override_config(void) {
// 杂项设置
xwayland_persistence = CLAMP_INT(config.xwayland_persistence, 0, 1);
syncobj_enable = CLAMP_INT(config.syncobj_enable, 0, 1);
axis_bind_apply_timeout =
CLAMP_INT(config.axis_bind_apply_timeout, 0, 1000);
focus_on_activate = CLAMP_INT(config.focus_on_activate, 0, 1);
@ -2165,6 +2172,7 @@ void set_value_default() {
config.focus_cross_tag = focus_cross_tag;
config.single_scratchpad = single_scratchpad;
config.xwayland_persistence = xwayland_persistence;
config.syncobj_enable = syncobj_enable;
config.no_border_when_single = no_border_when_single;
config.snap_distance = snap_distance;
config.drag_tile_to_tile = drag_tile_to_tile;

View file

@ -87,6 +87,7 @@ float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0};
int warpcursor = 1; /* Warp cursor to focused client */
int xwayland_persistence = 1; /* xwayland persistence */
int syncobj_enable = 0;
/* layout(s) */
Layout overviewlayout = {"󰃇", overview, "overview"};

View file

@ -57,4 +57,5 @@ void resizewin(const Arg *arg);
void toggle_named_scratchpad(const Arg *arg);
void toggle_render_border(const Arg *arg);
void create_virtual_output(const Arg *arg);
void destroy_all_virtual_output(const Arg *arg);
void destroy_all_virtual_output(const Arg *arg);
void focuslast(const Arg *arg);

File diff suppressed because it is too large Load diff