From 1e5cc601ac3cd12f745b1f97456c26179f9573f1 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Tue, 25 Mar 2025 20:52:49 +0800 Subject: [PATCH 1/3] fix: reset client foreign toplevel in updatemon --- maomao.c | 6 ++++-- preset_config.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/maomao.c b/maomao.c index 98bff527..ef7ce5f0 100644 --- a/maomao.c +++ b/maomao.c @@ -3487,7 +3487,7 @@ keypress(struct wl_listener *listener, void *data) event->state == WL_KEYBOARD_KEY_STATE_RELEASED && (keycode == 133 || keycode == 37 || keycode == 64 || keycode == 50 || keycode == 134 || keycode == 105 || keycode == 108 || keycode == 62) && - selmon->sel) { + selmon && selmon->sel) { if (selmon->isoverview && selmon->sel) { toggleoverview(&(Arg){.i = -1}); } @@ -6337,8 +6337,10 @@ updatemons(struct wl_listener *listener, void *data) if (selmon && selmon->wlr_output->enabled) { wl_list_for_each(c, &clients, link) { - if (!c->mon && client_surface(c)->mapped) + if (!c->mon && client_surface(c)->mapped) { setmon(c, selmon, c->tags); + reset_foreign_tolevel(c); + } } focusclient(focustop(selmon), 1); if (selmon->lock_surface) { diff --git a/preset_config.h b/preset_config.h index 9073eac6..535655cd 100644 --- a/preset_config.h +++ b/preset_config.h @@ -29,7 +29,7 @@ double default_mfact = 0.55f; // master 窗口比例 double default_smfact = 0.5f; // 第一个stack窗口比例 unsigned int default_nmaster = 1; // 默认master数量 /* logging */ -int log_level = WLR_DEBUG; +int log_level = WLR_ERROR; unsigned int numlockon = 1; // 是否打开右边小键盘 unsigned int capslock = 0; // 是否启用快捷键 From e000a236f6066efce6a7abfa2a1cb94e7260d016 Mon Sep 17 00:00:00 2001 From: EdenQwQ Date: Tue, 25 Mar 2025 21:14:00 +0800 Subject: [PATCH 2/3] fix: use wlroots_0_19 for nix package --- flake.lock | 6 +- nix/default.nix | 5 +- nix/wlroots_0_19.nix | 138 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 144 insertions(+), 5 deletions(-) create mode 100644 nix/wlroots_0_19.nix diff --git a/flake.lock b/flake.lock index 6bce6d69..d3517642 100644 --- a/flake.lock +++ b/flake.lock @@ -59,11 +59,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1740019556, - "narHash": "sha256-vn285HxnnlHLWnv59Og7muqECNMS33mWLM14soFIv2g=", + "lastModified": 1742800061, + "narHash": "sha256-oDJGK1UMArK52vcW9S5S2apeec4rbfNELgc50LqiPNs=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "dad564433178067be1fbdfcce23b546254b6d641", + "rev": "1750f3c1c89488e2ffdd47cab9d05454dddfb734", "type": "github" }, "original": { diff --git a/nix/default.nix b/nix/default.nix index d76f4af3..afe7eba0 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -10,15 +10,16 @@ wayland, wayland-protocols, wayland-scanner, - wlroots_0_17, xcbutilwm, xwayland, enableXWayland ? true, meson, ninja, + callPackage, }: let pname = "maomaowm"; + wlroots_0_19 = callPackage ./wlroots_0_19.nix { }; in stdenv.mkDerivation { inherit pname; @@ -41,7 +42,7 @@ stdenv.mkDerivation { pixman wayland wayland-protocols - wlroots_0_17 + wlroots_0_19 ] ++ lib.optionals enableXWayland [ libX11 diff --git a/nix/wlroots_0_19.nix b/nix/wlroots_0_19.nix new file mode 100644 index 00000000..c12450e2 --- /dev/null +++ b/nix/wlroots_0_19.nix @@ -0,0 +1,138 @@ +{ + lib, + stdenv, + fetchFromGitLab, + meson, + ninja, + pkg-config, + wayland-scanner, + libGL, + wayland, + wayland-protocols, + libinput, + libxkbcommon, + pixman, + libcap, + libgbm, + xorg, + libpng, + ffmpeg, + hwdata, + seatd, + vulkan-loader, + glslang, + libliftoff, + libdisplay-info, + lcms2, + nixosTests, + testers, + cmake, + + enableXWayland ? true, + xwayland ? null, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "wlroots"; + version = "master"; + + inherit enableXWayland; + + src = fetchFromGitLab { + domain = "gitlab.freedesktop.org"; + owner = "wlroots"; + repo = "wlroots"; + rev = "99da6ccc87c2439b19c9298df6b72b29bbab89bb"; + hash = "sha256-mIRUDyZYLrrxTfGq+vlLvgx3wwCbX4ogHESavCZr3TU="; + }; + + # $out for the library and $examples for the example programs (in examples): + outputs = [ + "out" + "examples" + ]; + + strictDeps = true; + depsBuildBuild = [ + pkg-config + ]; + + nativeBuildInputs = [ + meson + ninja + pkg-config + cmake + wayland-scanner + glslang + hwdata + ]; + + buildInputs = [ + ffmpeg + libliftoff + libdisplay-info + libGL + libcap + libinput + libpng + libxkbcommon + libgbm + pixman + seatd + vulkan-loader + wayland + wayland-protocols + xorg.libX11 + xorg.xcbutilerrors + xorg.xcbutilimage + xorg.xcbutilrenderutil + xorg.xcbutilwm + lcms2 + ] ++ lib.optional finalAttrs.enableXWayland xwayland; + + mesonFlags = lib.optional (!finalAttrs.enableXWayland) "-Dxwayland=disabled"; + + postFixup = '' + # Install ALL example programs to $examples: + # screencopy dmabuf-capture input-inhibitor layer-shell idle-inhibit idle + # screenshot output-layout multi-pointer rotation tablet touch pointer + # simple + mkdir -p $examples/bin + cd ./examples + for binary in $(find . -executable -type f -printf '%P\n' | grep -vE '\.so'); do + cp "$binary" "$examples/bin/wlroots-$binary" + done + ''; + + # Test via TinyWL (the "minimum viable product" Wayland compositor based on wlroots): + passthru.tests = { + tinywl = nixosTests.tinywl; + pkg-config = testers.hasPkgConfigModules { + package = finalAttrs.finalPackage; + }; + }; + + meta = { + description = "Modular Wayland compositor library"; + longDescription = '' + Pluggable, composable, unopinionated modules for building a Wayland + compositor; or about 50,000 lines of code you were going to write anyway. + ''; + inherit (finalAttrs.src.meta) homepage; + license = lib.licenses.mit; + platforms = lib.platforms.linux; + maintainers = with lib.maintainers; [ + primeos + synthetica + rewine + ]; + pkgConfigModules = [ + ( + if lib.versionOlder finalAttrs.version "0.18" then + "wlroots" + else + "wlroots-${lib.versions.majorMinor finalAttrs.version}" + ) + ]; + }; +}) From 20176cead636173f9898aa791b1d55444c1ec421 Mon Sep 17 00:00:00 2001 From: EdenQwQ Date: Tue, 25 Mar 2025 21:29:15 +0800 Subject: [PATCH 3/3] use wlroots-master from nixpkgs-wayland --- flake.lock | 119 +++++++++++++++++++++++++++++++++++++ flake.nix | 5 +- nix/default.nix | 5 +- nix/wlroots_0_19.nix | 138 ------------------------------------------- 4 files changed, 125 insertions(+), 142 deletions(-) delete mode 100644 nix/wlroots_0_19.nix diff --git a/flake.lock b/flake.lock index d3517642..56be444e 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,20 @@ { "nodes": { + "flake-compat": { + "locked": { + "lastModified": 1717312683, + "narHash": "sha256-FrlieJH50AuvagamEvWMIE6D2OAnERuDboFDYAED/dE=", + "owner": "nix-community", + "repo": "flake-compat", + "rev": "38fd3954cf65ce6faf3d0d45cd26059e059f07ea", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" @@ -36,6 +51,43 @@ "type": "github" } }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "lib-aggregate": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs-lib": "nixpkgs-lib_3" + }, + "locked": { + "lastModified": 1742732002, + "narHash": "sha256-fznNOUwLtsnaFHIeHfmj1QxOhjiohM2oiGj/54IO+AI=", + "owner": "nix-community", + "repo": "lib-aggregate", + "rev": "00480968bd30f3f43bcd520046bb647833bf2cf2", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "lib-aggregate", + "type": "github" + } + }, "mmsg": { "inputs": { "flake-parts": "flake-parts_2", @@ -100,14 +152,81 @@ "type": "github" } }, + "nixpkgs-lib_3": { + "locked": { + "lastModified": 1742692082, + "narHash": "sha256-s3XOULQj7BVO7myY5V4Sob0tRZ7nRpwEOIzXg/MkD/Q=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "a09310bc940f245e51b1ffea68731244ca38f2bd", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs-wayland": { + "inputs": { + "flake-compat": "flake-compat", + "lib-aggregate": "lib-aggregate", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1742870145, + "narHash": "sha256-ik+6+EorpRPqEVazsJhjyP9z7N83Tkq0F/Ky7GKHEso=", + "owner": "nix-community", + "repo": "nixpkgs-wayland", + "rev": "b2bfc4d198ca1ff4e9278c0e984f74a6a086b2ee", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs-wayland", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1742669843, + "narHash": "sha256-G5n+FOXLXcRx+3hCJ6Rt6ZQyF1zqQ0DL0sWAMn2Nk0w=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "1e5b653dff12029333a6546c11e108ede13052eb", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "flake-parts": "flake-parts", "mmsg": "mmsg", "nixpkgs": "nixpkgs", + "nixpkgs-wayland": "nixpkgs-wayland", "treefmt-nix": "treefmt-nix" } }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "treefmt-nix": { "inputs": { "nixpkgs": [ diff --git a/flake.nix b/flake.nix index 6b52aed6..e0abf5cc 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,7 @@ { inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland"; flake-parts.url = "github:hercules-ci/flake-parts"; treefmt-nix = { url = "github:numtide/treefmt-nix"; @@ -39,7 +40,9 @@ inherit (pkgs) callPackage ; - maomaowm = callPackage ./nix { }; + maomaowm = callPackage ./nix { + wlroots = inputs.nixpkgs-wayland.packages.${pkgs.system}.wlroots; + }; shellOverride = old: { nativeBuildInputs = old.nativeBuildInputs ++ [ ]; buildInputs = old.buildInputs ++ [ ]; diff --git a/nix/default.nix b/nix/default.nix index afe7eba0..6d9bdd67 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -15,11 +15,10 @@ enableXWayland ? true, meson, ninja, - callPackage, + wlroots, }: let pname = "maomaowm"; - wlroots_0_19 = callPackage ./wlroots_0_19.nix { }; in stdenv.mkDerivation { inherit pname; @@ -42,7 +41,7 @@ stdenv.mkDerivation { pixman wayland wayland-protocols - wlroots_0_19 + wlroots ] ++ lib.optionals enableXWayland [ libX11 diff --git a/nix/wlroots_0_19.nix b/nix/wlroots_0_19.nix deleted file mode 100644 index c12450e2..00000000 --- a/nix/wlroots_0_19.nix +++ /dev/null @@ -1,138 +0,0 @@ -{ - lib, - stdenv, - fetchFromGitLab, - meson, - ninja, - pkg-config, - wayland-scanner, - libGL, - wayland, - wayland-protocols, - libinput, - libxkbcommon, - pixman, - libcap, - libgbm, - xorg, - libpng, - ffmpeg, - hwdata, - seatd, - vulkan-loader, - glslang, - libliftoff, - libdisplay-info, - lcms2, - nixosTests, - testers, - cmake, - - enableXWayland ? true, - xwayland ? null, -}: - -stdenv.mkDerivation (finalAttrs: { - pname = "wlroots"; - version = "master"; - - inherit enableXWayland; - - src = fetchFromGitLab { - domain = "gitlab.freedesktop.org"; - owner = "wlroots"; - repo = "wlroots"; - rev = "99da6ccc87c2439b19c9298df6b72b29bbab89bb"; - hash = "sha256-mIRUDyZYLrrxTfGq+vlLvgx3wwCbX4ogHESavCZr3TU="; - }; - - # $out for the library and $examples for the example programs (in examples): - outputs = [ - "out" - "examples" - ]; - - strictDeps = true; - depsBuildBuild = [ - pkg-config - ]; - - nativeBuildInputs = [ - meson - ninja - pkg-config - cmake - wayland-scanner - glslang - hwdata - ]; - - buildInputs = [ - ffmpeg - libliftoff - libdisplay-info - libGL - libcap - libinput - libpng - libxkbcommon - libgbm - pixman - seatd - vulkan-loader - wayland - wayland-protocols - xorg.libX11 - xorg.xcbutilerrors - xorg.xcbutilimage - xorg.xcbutilrenderutil - xorg.xcbutilwm - lcms2 - ] ++ lib.optional finalAttrs.enableXWayland xwayland; - - mesonFlags = lib.optional (!finalAttrs.enableXWayland) "-Dxwayland=disabled"; - - postFixup = '' - # Install ALL example programs to $examples: - # screencopy dmabuf-capture input-inhibitor layer-shell idle-inhibit idle - # screenshot output-layout multi-pointer rotation tablet touch pointer - # simple - mkdir -p $examples/bin - cd ./examples - for binary in $(find . -executable -type f -printf '%P\n' | grep -vE '\.so'); do - cp "$binary" "$examples/bin/wlroots-$binary" - done - ''; - - # Test via TinyWL (the "minimum viable product" Wayland compositor based on wlroots): - passthru.tests = { - tinywl = nixosTests.tinywl; - pkg-config = testers.hasPkgConfigModules { - package = finalAttrs.finalPackage; - }; - }; - - meta = { - description = "Modular Wayland compositor library"; - longDescription = '' - Pluggable, composable, unopinionated modules for building a Wayland - compositor; or about 50,000 lines of code you were going to write anyway. - ''; - inherit (finalAttrs.src.meta) homepage; - license = lib.licenses.mit; - platforms = lib.platforms.linux; - maintainers = with lib.maintainers; [ - primeos - synthetica - rewine - ]; - pkgConfigModules = [ - ( - if lib.versionOlder finalAttrs.version "0.18" then - "wlroots" - else - "wlroots-${lib.versions.majorMinor finalAttrs.version}" - ) - ]; - }; -})