From bd88bc8aad3992ce8c2010d3698a0ef0a011819e Mon Sep 17 00:00:00 2001 From: Yappaholic Date: Sat, 21 Jun 2025 23:51:52 +0300 Subject: [PATCH 1/5] nix: update flake cache --- flake.lock | 69 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/flake.lock b/flake.lock index 56be444..5077928 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "flake-compat": { "locked": { - "lastModified": 1717312683, - "narHash": "sha256-FrlieJH50AuvagamEvWMIE6D2OAnERuDboFDYAED/dE=", + "lastModified": 1746162366, + "narHash": "sha256-5SSSZ/oQkwfcAz/o/6TlejlVGqeK08wyREBQ5qFFPhM=", "owner": "nix-community", "repo": "flake-compat", - "rev": "38fd3954cf65ce6faf3d0d45cd26059e059f07ea", + "rev": "0f158086a2ecdbb138cd0429410e44994f1b7e4b", "type": "github" }, "original": { @@ -20,11 +20,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1738453229, - "narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=", + "lastModified": 1749398372, + "narHash": "sha256-tYBdgS56eXYaWVW3fsnPQ/nFlgWi/Z2Ymhyu21zVM98=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd", + "rev": "9305fe4e5c2a6fcf5ba6a3ff155720fbe4076569", "type": "github" }, "original": { @@ -75,11 +75,11 @@ "nixpkgs-lib": "nixpkgs-lib_3" }, "locked": { - "lastModified": 1742732002, - "narHash": "sha256-fznNOUwLtsnaFHIeHfmj1QxOhjiohM2oiGj/54IO+AI=", + "lastModified": 1749989692, + "narHash": "sha256-ojISk2CXljR3qIgwgZh4iNzP3W2H3zGH49xWTJARkoM=", "owner": "nix-community", "repo": "lib-aggregate", - "rev": "00480968bd30f3f43bcd520046bb647833bf2cf2", + "rev": "cae85629e70ce05b968757f3af8f2f2b3923d080", "type": "github" }, "original": { @@ -96,11 +96,11 @@ ] }, "locked": { - "lastModified": 1742777868, - "narHash": "sha256-MdHiygQjBoM22LUJSjeW87t7eDkfRLI2F4Nd64xdLX4=", + "lastModified": 1750505787, + "narHash": "sha256-D57Vl2x9RJP+8pjYGYUf1L/q+G6bsmoVaqJX3m5PtlQ=", "owner": "DreamMaoMao", "repo": "mmsg", - "rev": "6c9dc91e86a0eb89db3ef8f8290530441cb7b658", + "rev": "4dc703aa06ae40d2cf5d3c0122b4d7f7d78fe8bf", "type": "github" }, "original": { @@ -111,11 +111,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1742800061, - "narHash": "sha256-oDJGK1UMArK52vcW9S5S2apeec4rbfNELgc50LqiPNs=", + "lastModified": 1750386251, + "narHash": "sha256-1ovgdmuDYVo5OUC5NzdF+V4zx2uT8RtsgZahxidBTyw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1750f3c1c89488e2ffdd47cab9d05454dddfb734", + "rev": "076e8c6678d8c54204abcb4b1b14c366835a58bb", "type": "github" }, "original": { @@ -127,14 +127,17 @@ }, "nixpkgs-lib": { "locked": { - "lastModified": 1738452942, - "narHash": "sha256-vJzFZGaCpnmo7I6i416HaBLpC+hvcURh/BQwROcGIp8=", - "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz" + "lastModified": 1748740939, + "narHash": "sha256-rQaysilft1aVMwF14xIdGS3sj1yHlI6oKQNBRTF40cc=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "656a64127e9d791a334452c6b6606d17539476e2", + "type": "github" }, "original": { - "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz" + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" } }, "nixpkgs-lib_2": { @@ -154,11 +157,11 @@ }, "nixpkgs-lib_3": { "locked": { - "lastModified": 1742692082, - "narHash": "sha256-s3XOULQj7BVO7myY5V4Sob0tRZ7nRpwEOIzXg/MkD/Q=", + "lastModified": 1749950217, + "narHash": "sha256-qXoEFKOnznVvMAKezJhSXzRKsJ/LHLRY8NCw1mGhwrU=", "owner": "nix-community", "repo": "nixpkgs.lib", - "rev": "a09310bc940f245e51b1ffea68731244ca38f2bd", + "rev": "753176a8605439613fc6dc9911267b9f720a2615", "type": "github" }, "original": { @@ -174,11 +177,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1742870145, - "narHash": "sha256-ik+6+EorpRPqEVazsJhjyP9z7N83Tkq0F/Ky7GKHEso=", + "lastModified": 1750512508, + "narHash": "sha256-gqSQsdLwfEXG076aSG/SLxKwmFzPdi6cfpl6OZhfnfo=", "owner": "nix-community", "repo": "nixpkgs-wayland", - "rev": "b2bfc4d198ca1ff4e9278c0e984f74a6a086b2ee", + "rev": "c020c609f5bbf34ad5b39856caabafae6175b739", "type": "github" }, "original": { @@ -189,11 +192,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1742669843, - "narHash": "sha256-G5n+FOXLXcRx+3hCJ6Rt6ZQyF1zqQ0DL0sWAMn2Nk0w=", + "lastModified": 1750365781, + "narHash": "sha256-XE/lFNhz5lsriMm/yjXkvSZz5DfvKJLUjsS6pP8EC50=", "owner": "nixos", "repo": "nixpkgs", - "rev": "1e5b653dff12029333a6546c11e108ede13052eb", + "rev": "08f22084e6085d19bcfb4be30d1ca76ecb96fe54", "type": "github" }, "original": { @@ -234,11 +237,11 @@ ] }, "locked": { - "lastModified": 1739829690, - "narHash": "sha256-mL1szCeIsjh6Khn3nH2cYtwO5YXG6gBiTw1A30iGeDU=", + "lastModified": 1749194973, + "narHash": "sha256-eEy8cuS0mZ2j/r/FE0/LYBSBcIs/MKOIVakwHVuqTfk=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "3d0579f5cc93436052d94b73925b48973a104204", + "rev": "a05be418a1af1198ca0f63facb13c985db4cb3c5", "type": "github" }, "original": { From 0509728798dd0fa7ac66302b36c9761682cbd0d7 Mon Sep 17 00:00:00 2001 From: Yappaholic Date: Sun, 22 Jun 2025 00:53:38 +0300 Subject: [PATCH 2/5] nix: replace treefmt with alejandra --- flake.lock | 23 +---------------------- flake.nix | 8 +------- treefmt.nix | 8 -------- 3 files changed, 2 insertions(+), 37 deletions(-) delete mode 100644 treefmt.nix diff --git a/flake.lock b/flake.lock index 5077928..5c49420 100644 --- a/flake.lock +++ b/flake.lock @@ -211,8 +211,7 @@ "flake-parts": "flake-parts", "mmsg": "mmsg", "nixpkgs": "nixpkgs", - "nixpkgs-wayland": "nixpkgs-wayland", - "treefmt-nix": "treefmt-nix" + "nixpkgs-wayland": "nixpkgs-wayland" } }, "systems": { @@ -229,26 +228,6 @@ "repo": "default", "type": "github" } - }, - "treefmt-nix": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1749194973, - "narHash": "sha256-eEy8cuS0mZ2j/r/FE0/LYBSBcIs/MKOIVakwHVuqTfk=", - "owner": "numtide", - "repo": "treefmt-nix", - "rev": "a05be418a1af1198ca0f63facb13c985db4cb3c5", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "treefmt-nix", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 6dfc25c..b420722 100644 --- a/flake.nix +++ b/flake.nix @@ -3,10 +3,6 @@ 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"; - inputs.nixpkgs.follows = "nixpkgs"; - }; mmsg = { url = "github:DreamMaoMao/mmsg"; inputs.nixpkgs.follows = "nixpkgs"; @@ -16,7 +12,6 @@ outputs = { self, flake-parts, - treefmt-nix, ... } @ inputs: flake-parts.lib.mkFlake {inherit inputs;} { @@ -46,7 +41,6 @@ nativeBuildInputs = old.nativeBuildInputs ++ []; buildInputs = old.buildInputs ++ []; }; - treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix; in { packages.default = maomaowm; overlayAttrs = { @@ -56,7 +50,7 @@ inherit maomaowm; }; devShells.default = maomaowm.overrideAttrs shellOverride; - formatter = treefmtEval.config.build.wrapper; + formatter = pkgs.alejandra; }; systems = ["x86_64-linux" "aarch64-linux"]; }; diff --git a/treefmt.nix b/treefmt.nix deleted file mode 100644 index e61ce2d..0000000 --- a/treefmt.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ ... }: - -{ - projectRootFile = "flake.nix"; - programs = { - nixfmt.enable = true; - }; -} From f922019aefbb8bf72aba03f86da715990e986b03 Mon Sep 17 00:00:00 2001 From: Yappaholic Date: Sun, 22 Jun 2025 00:54:45 +0300 Subject: [PATCH 3/5] nix: use patched version of wlroots in default.nix --- nix/default.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/nix/default.nix b/nix/default.nix index 205379d..d85d9b6 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -1,5 +1,6 @@ { lib, + fetchFromGitHub, libX11, libinput, libxcb, @@ -20,6 +21,15 @@ mmsg, }: let pname = "maomaowm"; + # Use patched wlroots from github.com/DreamMaoMao/wlroots + wlroots-git = wlroots.overrideAttrs (final: prev: { + src = fetchFromGitHub { + owner = "DreamMaoMao"; + repo = "wlroots"; + rev = "afbb5b7c2b14152730b57aa11119b1b16a299d5b"; + sha256 = "sha256-pVU+CuiqvduMTpsnDHX/+EWY2qxHX2lXKiVzdGtcnYY="; + }; + }); in stdenv.mkDerivation { inherit pname; @@ -46,7 +56,7 @@ in pixman wayland wayland-protocols - wlroots + wlroots-git ] ++ lib.optionals enableXWayland [ libX11 From 2e2e921538113c5de14c6eaf322611f718c73997 Mon Sep 17 00:00:00 2001 From: lambinsea Date: Sun, 22 Jun 2025 03:53:43 -0700 Subject: [PATCH 4/5] docs: fix readme grammar --- README.md | 56 +++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index e4c8e84..5bc023b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Maomaowm -This project is developed based on [dwl](https://codeberg.org/dwl/dwl/), +This project's development is based on [dwl](https://codeberg.org/dwl/dwl/). "Since many people have asked about the meaning of this compositor's name, 'Maomao' is an online alias I've been using for years - it comes from the first two characters of the Chinese word for 'caterpillar' (毛毛虫). You can basically think of it as meaning 'caterpillar'. @@ -8,16 +8,16 @@ This project is developed based on [dwl](https://codeberg.org/dwl/dwl/), - *Maomao* is as lightweight as *dwl*, and its build can be completed within few seconds. Despite this, *maomao* does not compromise on functionality. 2. **Feature Highlights** - - Besides basic WM functionality, maomao provides: - - Base tag not workspace(supports separate window layouts for each tag) - - Smooth and customizable complete animations(window open/move/close, tag enter/leave) - - Excellent input method support(text input v2/v3) - - Flexible window layouts with easy switching(scroller,master,monocle,spiral..etc) - - Rich window states(swallow, minimize, maximize, unglobal, global, fakefullscreen, overlay...etc) + - In addition to basic WM functionality, Maomao provides: + - Base tag not workspace (supports separate window layouts for each tag) + - Smooth and customizable complete animations (window open/move/close, tag enter/leave) + - Excellent input method support (text input v2/v3) + - Flexible window layouts with easy switching (scroller, master, monocle, spiral, etc.) + - Rich window states (swallow, minimize, maximize, unglobal, global, fakefullscreen, overlay, etc.) - Simple yet powerful external configuration - - Sway like scratchpad and named scratchpad + - Sway-like scratchpad and named scratchpad - Minimize window to scratchpad - - Hycov like overview + - Hycov-like overview Master-Stack Layout @@ -36,21 +36,21 @@ https://github.com/user-attachments/assets/c9bf9415-fad1-4400-bcdc-3ad2d76de85a - Spiral - Deck -# install +# Installation -## depend +## Dependencies ```bash yay -S glibc wayland libinput libdrm pixman libxkbcommon git meson ninja wayland-protocols libdisplay-info libliftoff hwdata seatd pcre2 ``` -## arch +## Arch Linux ```bash yay -S maomaowm-git ``` -## other +## Other ```bash # wlroots 0.19.0 release with a fix-patch to avoid crash git clone -b 0.19.0-fix https://github.com/DreamMaoMao/wlroots.git @@ -64,40 +64,40 @@ meson build -Dprefix=/usr sudo ninja -C build install ``` -## suggest tools +## Suggested Tools ``` yay -S rofi foot xdg-desktop-portal-wlr swaybg waybar wl-clip-persist cliphist wl-clipboard wlsunset xfce-polkit swaync ``` -## Some common default key bindings +## Some Common Default Keybindings - alt+return: open foot terminal - alt+q: kill client - alt+left/right/up/down: focus direction - super+m: quit maomao -## My dotfile -- depend +## My Dotfiles +- Dependencies ``` yay -S pamixer lavalauncher-mao-git wlr-dpms sway-audio-idle-inhibit-git swayidle dimland-git brightnessctl swayosd wlr-randr grim slurp satty swaylock-effects-git wlogout ``` -### maomao config +### Maomao Config [maomao-config](https://github.com/DreamMaoMao/dotfile/tree/main/maomao) -#### other +#### Other Tools [foot](https://github.com/DreamMaoMao/dotfile/tree/main/foot) [swaylock](https://github.com/DreamMaoMao/dotfile/tree/main/swaylock) [wlogout](https://github.com/DreamMaoMao/dotfile/tree/main/wlogout) [swaync](https://github.com/DreamMaoMao/dotfile/tree/main/swaync) -## Config document -refer to [wiki](https://github.com/DreamMaoMao/maomaowm/wiki/) +## Config Document +Refer to the [wiki](https://github.com/DreamMaoMao/maomaowm/wiki/) -# NixOS+Home-manager +# NixOS + Home-manager The repo contains a flake that provides a NixOS module and a home-manager module for maomaowm. -Use the NixOS module to install maomaowm with other necessary components of a working wayland environment. +Use the NixOS module to install maomaowm with other necessary components of a working Wayland environment. Use the home-manager module to declare configuration and autostart for maomaowm. Here's an example of using the modules in a flake: @@ -167,12 +167,12 @@ Here's an example of using the modules in a flake: } ``` -# thanks for some refer repo +# Thanks to These Reference Repositories -- https://gitlab.freedesktop.org/wlroots/wlroots - implementation of wayland protocol +- https://gitlab.freedesktop.org/wlroots/wlroots - Implementation of Wayland protocol -- https://github.com/dqrk0jeste/owl - basal window animaition +- https://github.com/dqrk0jeste/owl - Basal window animation -- https://codeberg.org/dwl/dwl - basal dwl feature +- https://codeberg.org/dwl/dwl - Basal dwl feature -- https://github.com/swaywm/sway - sample of wayland protocol +- https://github.com/swaywm/sway - Sample of Wayland protocol From c049e108de1781a48cd939c8d2e57e91356fcb73 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Mon, 23 Jun 2025 19:01:27 +0800 Subject: [PATCH 5/5] opt: optimize scale caculate --- src/maomao.c | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/src/maomao.c b/src/maomao.c index 66374d6..675c72c 100644 --- a/src/maomao.c +++ b/src/maomao.c @@ -147,7 +147,7 @@ struct dvec2 { }; struct ivec2 { - int x, y; + int x, y, width, height; }; typedef struct { @@ -1183,42 +1183,47 @@ struct ivec2 clip_to_hide(Client *c, struct wlr_box *clip_box) { struct ivec2 offset; offset.x = 0; offset.y = 0; + offset.width = 0; + offset.height = 0; if (!ISTILED(c) && !c->animation.tagining && !c->animation.tagouted && !c->animation.tagouting) return offset; + int bottom_out_offset = + GEZERO(c->animation.current.y + c->animation.current.height - + c->mon->m.y - c->mon->m.height); + int right_out_offset = + GEZERO(c->animation.current.x + c->animation.current.width - + c->mon->m.x - c->mon->m.width); + int left_out_offset = GEZERO(c->mon->m.x - c->animation.current.x); + int top_out_offset = GEZERO(c->mon->m.y - c->animation.current.y); + int bw = (int)c->bw; + // // make tagout tagin animations not visible in other monitors if (ISTILED(c) || c->animation.tagining || c->animation.tagouted || c->animation.tagouting) { - if (c->animation.current.x < c->mon->m.x) { - offsetx = c->mon->m.x - c->bw - c->animation.current.x; - offsetx = offsetx < 0 ? 0 : offsetx; + if (left_out_offset > 0) { + offsetx = GEZERO(left_out_offset - bw); clip_box->x = clip_box->x + offsetx; clip_box->width = clip_box->width - offsetx; - } else if (c->animation.current.x + c->animation.current.width > - c->mon->m.x + c->mon->m.width) { - clip_box->width = clip_box->width - (c->animation.current.x + - c->animation.current.width - - c->mon->m.x - c->mon->m.width); + } else if (right_out_offset > 0) { + clip_box->width = clip_box->width - right_out_offset; } - if (c->animation.current.y < c->mon->m.y) { - offsety = c->mon->m.y - c->bw - c->animation.current.y; - offsety = offsety < 0 ? 0 : offsety; + if (top_out_offset > 0) { + offsety = GEZERO(top_out_offset - bw); clip_box->y = clip_box->y + offsety; clip_box->height = clip_box->height - offsety; - } else if (c->animation.current.y + c->animation.current.height > - c->mon->m.y + c->mon->m.height) { - clip_box->height = - clip_box->height - - (c->animation.current.y + c->animation.current.height - - c->mon->m.y - c->mon->m.height); + } else if (bottom_out_offset > 0) { + clip_box->height = clip_box->height - bottom_out_offset; } } offset.x = offsetx; offset.y = offsety; + offset.width = right_out_offset; + offset.height = bottom_out_offset; if ((clip_box->width < 0 || clip_box->height < 0) && (ISTILED(c) || c->animation.tagouting || c->animation.tagining)) { @@ -1247,6 +1252,7 @@ void client_apply_clip(Client *c) { struct wlr_box clip_box; struct ivec2 offset; animationScale scale_data; + int bw = (int)c->bw; if (!animations) { c->animation.running = false; @@ -1291,8 +1297,8 @@ void client_apply_clip(Client *c) { wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip_box); scale_data.should_scale = true; - scale_data.width = clip_box.width - c->bw; - scale_data.height = clip_box.height - c->bw; + scale_data.width = clip_box.width - GEZERO(bw - offset.width); + scale_data.height = clip_box.height - GEZERO(bw - offset.height); scale_data.width_scale = (float)scale_data.width / (geometry.width - offset.x); scale_data.height_scale =