增加主分支项目配置

This commit is contained in:
DreamMaoMao 2025-02-28 17:50:07 +08:00
parent 229f654b94
commit d4a06fced6
7 changed files with 514 additions and 32 deletions

210
README.md
View file

@ -1,32 +1,70 @@
#
https://github.com/user-attachments/assets/da80c6d1-b9a5-44c4-b738-6421365e6aa5 Master-Stack Layout
# feature https://github.com/user-attachments/assets/a9d4776e-b50b-48fb-94ce-651d8a749b8a
- dwl ipc support
- maxmize fullscreen
- swap window by direction
- swith to next not empty-workspace/workspace Scroller Layout
- move window to next not empty-workspace/workspace
- swith focus by direction
- wheel/button + mod key bind https://github.com/user-attachments/assets/c9bf9415-fad1-4400-bcdc-3ad2d76de85a
# Maomaowm
This project is developed based on `dwl(0.5)` ,
adding many operation that supported in hyprland and a hyprland-like keybinds,
niri-like scroll layout and sway-like scratchpad.
See below for more features.
# separate window layout for each workspace(tags), with separate workspace parameters
## support layout
- tile(master)
- scroller
- monocle
- grid
- dwindle
- spiral
# window open rules
## options
- appid: type-string if match it or title, the rule match
- title: type-string if match it or appid, the rule match
- tags: type-num(1-9) which tags to open the window
- isfloating: type-num(0 or 1)
- isfullscreen: type-num(0 or 1)
- scroller_proportion: type-float(0.1-1.0)
- animation_type : type-string(zoom,slide)
- isnoborder : type-num(0 or 1)
- monitor : type-num(0-99999)
- width : type-num(0-9999)
- height : type-num(0-9999)
# some special feature
- hycov like overview - hycov like overview
- numlock state pre-set in config
- portal fix for obs(use hyprland-portal)
- master layout support new_on_top
- foreign-toplevel support(dunst,waybar wlr taskbar) - foreign-toplevel support(dunst,waybar wlr taskbar)
- acitve on focus/urgent support - minimize window to waybar(like hych)
- hide empty button in waybar - sway scratchpad support (minimize window to scratchpad)
- support minimize window by click waybar
- support minimize window by keyboard
- sway scratchpad support
- window pin mode support - window pin mode support
- text-input-v2 - text-input-v2/v3 for fcitx5
- window move/open animaition - window move/open animaition
- workspace switch animaition - workspace switch animaition
- fade in animation
- alt-tab switch window like gnome
- niri like scroller layout
- fadeout animation
## suggest tools
```
yay -S rofi foot xdg-desktop-portal-wlr swaybg waybar wl-clip-persist cliphist wl-clipboard wlsunset
```
# install # install
# wlroots(0.17) # wlroots(0.17)
@ -36,28 +74,136 @@ cd wlroots
meson build -Dprefix=/usr meson build -Dprefix=/usr
sudo ninja -C build install sudo ninja -C build install
git clone https://github.com/DreamMaoMao/maomao.git git clone https://github.com/DreamMaoMao/maomaowm.git
cd maomao cd maomaowm
meson build -Dprefix=/usr meson build -Dprefix=/usr
sudo ninja -C build install sudo ninja -C build install
``` # set your autostart app ih this
# dependcy mkdir -p ~/.config/maomao/
## tools
```
yay -S wofi foot
``` ```
# waybar (must use this waybar)
# config
you can use `MAOMAOCONFIG` env to set the config-folder-path and the autostart-folder-patch
like `MAOMAOCONFIG=/home/xxx/maomao`
- the only default keybinds is ctrl+alt+[F1-F12] to change tty
- the default config path is `~/.config/maomao/config.conf`
- the default autostart path is `~/.config/maomao/autostart.sh`
- the fallback config path is in `/etc/maomao/config.conf`, you can find the default config here
# keybinds notice
All mod keys(alt,ctrl,shift,super) are case insensitive, in addition to other key names are case sensitive, the name follows the xkb standard name, you can use the `xev` command to get the key name of the key you want, note that if your mod key contains the shift key, then it may not be the key name displayed on the keyboard. Real name Refer to the name displayed in the `xev` command.
for example:
### this is wrong:
``` ```
git clone https://gitee.com/DreamMaoMao/Waybar.git bind=alt+shift,2,quit
cd Waybar
meson build -Dprefix=/usr
sudo ninja -C build install
``` ```
### this is right:
```
bind=alt+shift,at,quit
```
because your keybinds contain shift, the `2` cover to `at`
![swappy-20250227-182157](https://github.com/user-attachments/assets/c4bca146-d1d7-42b1-aea5-a7e7e19e874b)
# custom animation
```
animation_curve_open=0.46,1.0,0.29,1.1
animation_curve_move=0.46,1.0,0.29,1
animation_curve_tag=0.46,1.0,0.29,1
```
notice: close and move animations are the same curve.
You can design your animaition curve in:
[here, on cssportal.com](https://www.cssportal.com/css-cubic-bezier-generator/),
or you can just choice a curve in:
[easings.net](https://easings.net).
# NixOS+Home-manager
```nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-parts.url = "github:hercules-ci/flake-parts";
maomaowm.url = "github:DreamMaoMao/maomaowm";
};
outputs =
inputs@{ self, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
debug = true;
systems = [ "x86_64-linux" ];
flake = {
nixosConfigurations = {
hostname = inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
inputs.home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "backup";
users."username".imports =
[
(
{ ... }:
{
wayland.windowManager.maomaowm = {
enable = true;
settings = ''
# see config.conf
'';
autostart_sh = ''
# see autostart.sh
# Note: here no need to add shebang
'';
};
}
)
]
++ [
# Add maomaowm hm module
inputs.maomaowm.hmModules.maomaowm
];
};
}
];
};
};
};
};
}
```
# my dotfile
[maomao-config](https://github.com/DreamMaoMao/dotfile/tree/main/maomao)
# thanks for some refer repo # thanks for some refer repo
https://github.com/dqrk0jeste/owl - for window animation implementation code - https://github.com/dqrk0jeste/owl - for basal window animaition
https://github.com/djpohly/dwl - for base dwl code
- https://github.com/djpohly/dwl - for basal dwl feature
- https://github.com/guyuming76/dwl - for text-input
- https://github.com/swaywm/sway - for foreign-toplevel

View file

@ -65,6 +65,10 @@ urgentcolor=0xad401fff
scratchpadcolor=0x516c93ff scratchpadcolor=0x516c93ff
globalcolor=0xb153a7ff globalcolor=0xb153a7ff
# layout circle limit
# if not set, it will circle all layout
# circle_layout=spiral,scroller
# tags rule # tags rule
# layout support: tile,scroller,grid,monocle,spiral,dwindle # layout support: tile,scroller,grid,monocle,spiral,dwindle
tags=id:1,layout_name:tile tags=id:1,layout_name:tile

79
flake.lock generated Normal file
View file

@ -0,0 +1,79 @@
{
"nodes": {
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1738453229,
"narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1740019556,
"narHash": "sha256-vn285HxnnlHLWnv59Og7muqECNMS33mWLM14soFIv2g=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "dad564433178067be1fbdfcce23b546254b6d641",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1738452942,
"narHash": "sha256-vJzFZGaCpnmo7I6i416HaBLpC+hvcURh/BQwROcGIp8=",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz"
}
},
"root": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs",
"treefmt-nix": "treefmt-nix"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1739829690,
"narHash": "sha256-mL1szCeIsjh6Khn3nH2cYtwO5YXG6gBiTw1A30iGeDU=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "3d0579f5cc93436052d94b73925b48973a104204",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

54
flake.nix Normal file
View file

@ -0,0 +1,54 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
flake-parts,
treefmt-nix,
...
}@inputs:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.flake-parts.flakeModules.easyOverlay
];
flake.hmModules.maomaowm = import ./nix/hm-modules.nix;
perSystem =
{
config,
pkgs,
...
}:
let
inherit (pkgs)
callPackage
;
maomaowm = callPackage ./nix { };
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" ];
};
}

60
nix/default.nix Normal file
View file

@ -0,0 +1,60 @@
{
lib,
libX11,
libinput,
libxcb,
libxkbcommon,
pixman,
pkg-config,
stdenv,
wayland,
wayland-protocols,
wayland-scanner,
wlroots_0_17,
xcbutilwm,
xwayland,
enableXWayland ? true,
meson,
ninja,
}:
let
pname = "maomaowm";
in
stdenv.mkDerivation {
inherit pname;
version = "nightly";
src = ../.;
nativeBuildInputs = [
meson
ninja
pkg-config
wayland-scanner
];
buildInputs =
[
libinput
libxcb
libxkbcommon
pixman
wayland
wayland-protocols
wlroots_0_17
]
++ 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;
};
}

131
nix/hm-modules.nix Normal file
View file

@ -0,0 +1,131 @@
{
lib,
config,
pkgs,
...
}:
let
maomaowm = pkgs.callPackage ./. { };
cfg = config.wayland.windowManager.maomaowm;
variables = lib.concatStringsSep " " cfg.systemd.variables;
extraCommands = lib.concatStringsSep " && " cfg.systemd.extraCommands;
systemdActivation = ''${pkgs.dbus}/bin/dbus-update-activation-environment --systemd ${variables}; ${extraCommands}'';
autostart_sh = pkgs.writeShellScript "autostart.sh" ''
${lib.optionalString cfg.systemd.enable systemdActivation}
${cfg.autostart_sh}
'';
in
{
options = {
wayland.windowManager.maomaowm = with lib; {
enable = mkOption {
type = types.bool;
default = false;
};
systemd = {
enable = mkOption {
type = types.bool;
default = pkgs.stdenv.isLinux;
example = false;
description = ''
Whether to enable {file}`maomao-session.target` on
maomao startup. This links to
{file}`graphical-session.target`.
Some important environment variables will be imported to systemd
and dbus user environment before reaching the target, including
* {env}`DISPLAY`
* {env}`WAYLAND_DISPLAY`
* {env}`XDG_CURRENT_DESKTOP`
* {env}`XDG_SESSION_TYPE`
* {env}`NIXOS_OZONE_WL`
You can extend this list using the `systemd.variables` option.
'';
};
variables = mkOption {
type = types.listOf types.str;
default = [
"DISPLAY"
"WAYLAND_DISPLAY"
"XDG_CURRENT_DESKTOP"
"XDG_SESSION_TYPE"
"NIXOS_OZONE_WL"
"XCURSOR_THEME"
"XCURSOR_SIZE"
];
example = [ "--all" ];
description = ''
Environment variables imported into the systemd and D-Bus user environment.
'';
};
extraCommands = mkOption {
type = types.listOf types.str;
default = [
"systemctl --user reset-failed"
"systemctl --user start maomao-session.target"
];
description = ''
Extra commands to run after D-Bus activation.
'';
};
xdgAutostart = mkEnableOption ''
autostart of applications using
{manpage}`systemd-xdg-autostart-generator(8)`
'';
};
settings = mkOption {
description = "maomaowm config content";
type = types.str;
default = "";
example = ''
# menu and terminal
bind=Alt,space,spawn,rofi -show drun
bind=Alt,Return,spawn,foot
'';
};
autostart_sh = mkOption {
description = "WARRNING: This is a shell script, but no need to add shebang";
type = types.str;
default = "";
example = ''
waybar &
'';
};
};
};
config = lib.mkIf cfg.enable {
home.packages = [ maomaowm ];
home.activation =
lib.optionalAttrs (cfg.autostart_sh != "") {
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" ] ''
cat > $HOME/.config/maomao/config.conf <<EOF
${cfg.settings}
EOF
'';
}
// {
clearMaomaoConfig = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
rm -rf $HOME/.config/maomao
mkdir -p $HOME/.config/maomao
'';
};
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" ];
Before = lib.optional cfg.systemd.xdgAutostart "xdg-desktop-autostart.target";
};
};
};
}

8
treefmt.nix Normal file
View file

@ -0,0 +1,8 @@
{ ... }:
{
projectRootFile = "flake.nix";
programs = {
nixfmt.enable = true;
};
}