mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-05-03 06:46:38 -04:00
feat: add flake support
fix: home-manager options
This commit is contained in:
parent
9b4d8d88b7
commit
2bdd1abc33
9 changed files with 332 additions and 45 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,5 +1,6 @@
|
||||||
/.cache
|
/.cache
|
||||||
/.vscode
|
/.vscode
|
||||||
|
/result
|
||||||
config.h
|
config.h
|
||||||
maomao
|
maomao
|
||||||
maomao.o
|
maomao.o
|
||||||
|
|
|
||||||
74
README.md
74
README.md
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
||||||
Master-Stack Layout
|
Master-Stack Layout
|
||||||
|
|
||||||
|
|
@ -18,7 +18,7 @@ https://github.com/user-attachments/assets/c9bf9415-fad1-4400-bcdc-3ad2d76de85a
|
||||||
|
|
||||||
# Maomaowm
|
# Maomaowm
|
||||||
|
|
||||||
This project is developed based on `dwl(0.5)` ,
|
This project is developed based on `dwl(0.5)` ,
|
||||||
adding many operation that supported in hyprland and a hyprland-like keybinds,
|
adding many operation that supported in hyprland and a hyprland-like keybinds,
|
||||||
niri-like scroll layout and sway-like scratchpad.
|
niri-like scroll layout and sway-like scratchpad.
|
||||||
See below for more features.
|
See below for more features.
|
||||||
|
|
@ -34,10 +34,10 @@ See below for more features.
|
||||||
|
|
||||||
# window open rules
|
# window open rules
|
||||||
## options
|
## options
|
||||||
- appid: type-string if match it or title, the rule match
|
- appid: type-string if match it or title, the rule match
|
||||||
- title: type-string if match it or appid, 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
|
- tags: type-num(1-9) which tags to open the window
|
||||||
- isfloating: type-num(0 or 1)
|
- isfloating: type-num(0 or 1)
|
||||||
- isfullscreen: type-num(0 or 1)
|
- isfullscreen: type-num(0 or 1)
|
||||||
- scroller_proportion: type-float(0.1-1.0)
|
- scroller_proportion: type-float(0.1-1.0)
|
||||||
- animation_type : type-string(zoom,slide)
|
- animation_type : type-string(zoom,slide)
|
||||||
|
|
@ -66,7 +66,7 @@ yay -S rofi foot xdg-desktop-portal-wlr swaybg waybar wl-clip-persist cliphist w
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
# install
|
# install
|
||||||
# wlroots(0.17)
|
# wlroots(0.17)
|
||||||
```
|
```
|
||||||
git clone -b 0.17.4 https://gitlab.freedesktop.org/wlroots/wlroots.git
|
git clone -b 0.17.4 https://gitlab.freedesktop.org/wlroots/wlroots.git
|
||||||
|
|
@ -99,10 +99,70 @@ like `MAOMAOCONFIG=/home/xxx/maomao`
|
||||||
- the fallback config path is in `/etc/maomao/config.conf`, you can find the default config here
|
- the fallback config path is in `/etc/maomao/config.conf`, you can find the default config here
|
||||||
|
|
||||||
|
|
||||||
|
# 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 = [
|
||||||
|
{
|
||||||
|
home-manager = {
|
||||||
|
useGlobalPkgs = true;
|
||||||
|
useUserPackages = true;
|
||||||
|
backupFileExtension = "backup";
|
||||||
|
users."username".imports =
|
||||||
|
[
|
||||||
|
(
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
wayland.windowManager.maomaowm = {
|
||||||
|
enable = true;
|
||||||
|
settings = ''
|
||||||
|
# see config.in
|
||||||
|
'';
|
||||||
|
autostart_sh = ''
|
||||||
|
# see autostart.sh
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
)
|
||||||
|
]
|
||||||
|
++ [
|
||||||
|
# Add maomaowm hm module
|
||||||
|
inputs.maomaowm.hmModules.maomaowm
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
# my dotfile
|
# my dotfile
|
||||||
[maomao-config](https://github.com/DreamMaoMao/dotfile/tree/main/maomao)
|
[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 basal window animaition
|
- https://github.com/dqrk0jeste/owl - for basal window animaition
|
||||||
|
|
||||||
- https://github.com/djpohly/dwl - for basal dwl feature
|
- https://github.com/djpohly/dwl - for basal dwl feature
|
||||||
|
|
|
||||||
79
flake.lock
generated
Normal file
79
flake.lock
generated
Normal 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
|
||||||
|
}
|
||||||
50
flake.nix
Normal file
50
flake.nix
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
{
|
||||||
|
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 { };
|
||||||
|
treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
packages.default = maomaowm;
|
||||||
|
overlayAttrs = {
|
||||||
|
inherit (config.packages) maomaowm;
|
||||||
|
};
|
||||||
|
packages = {
|
||||||
|
inherit maomaowm;
|
||||||
|
};
|
||||||
|
|
||||||
|
formatter = treefmtEval.config.build.wrapper;
|
||||||
|
};
|
||||||
|
systems = [ "x86_64-linux" ];
|
||||||
|
};
|
||||||
|
}
|
||||||
62
meson.build
62
meson.build
|
|
@ -1,38 +1,13 @@
|
||||||
project('maomao', ['c', 'cpp'],
|
project('maomao', ['c', 'cpp'], version: '0.1.5')
|
||||||
version : '0.1.5'
|
|
||||||
)
|
|
||||||
|
|
||||||
subdir('protocols')
|
subdir('protocols')
|
||||||
|
|
||||||
# fs = import('fs')
|
|
||||||
#
|
|
||||||
# # 获取用户的主目录
|
|
||||||
# home_dir = run_command('sh', '-c', 'echo $HOME', check: true).stdout().strip()
|
|
||||||
# config_dir = join_paths(home_dir, '.config', 'maomao')
|
|
||||||
#
|
|
||||||
# # 如果目标目录不存在,则创建它
|
|
||||||
# if not fs.is_dir(config_dir)
|
|
||||||
# run_command('mkdir', '-p', config_dir, check: true)
|
|
||||||
# endif
|
|
||||||
#
|
|
||||||
# # 拷贝 config.conf
|
|
||||||
# config_file = join_paths(config_dir, 'config.conf')
|
|
||||||
# if not fs.exists(config_file)
|
|
||||||
# run_command('cp', 'config.conf', config_file, check: true)
|
|
||||||
# endif
|
|
||||||
#
|
|
||||||
# # 拷贝 autostart.sh
|
|
||||||
# autostart_file = join_paths(config_dir, 'autostart.sh')
|
|
||||||
# if not fs.exists(autostart_file)
|
|
||||||
# run_command('cp', 'autostart.sh', autostart_file, check: true)
|
|
||||||
# endif
|
|
||||||
|
|
||||||
cc = meson.get_compiler('c')
|
cc = meson.get_compiler('c')
|
||||||
libm = cc.find_library('m')
|
libm = cc.find_library('m')
|
||||||
xcb = dependency('xcb', required : get_option('xwayland'))
|
xcb = dependency('xcb', required: get_option('xwayland'))
|
||||||
xlibs = dependency('xcb-icccm', required : get_option('xwayland'))
|
xlibs = dependency('xcb-icccm', required: get_option('xwayland'))
|
||||||
wayland_server_dep = dependency('wayland-server')
|
wayland_server_dep = dependency('wayland-server')
|
||||||
wlroots_dep = dependency('wlroots', version : ['>=0.17.0', '<0.18.0'])
|
wlroots_dep = dependency('wlroots', version: ['>=0.17.0', '<0.18.0'])
|
||||||
xkbcommon_dep = dependency('xkbcommon')
|
xkbcommon_dep = dependency('xkbcommon')
|
||||||
libinput_dep = dependency('libinput')
|
libinput_dep = dependency('libinput')
|
||||||
libwayland_client_dep = dependency('wayland-client')
|
libwayland_client_dep = dependency('wayland-client')
|
||||||
|
|
@ -42,19 +17,20 @@ c_args = [
|
||||||
'-Wno-unused-function',
|
'-Wno-unused-function',
|
||||||
'-DWLR_USE_UNSTABLE',
|
'-DWLR_USE_UNSTABLE',
|
||||||
'-D_POSIX_C_SOURCE=200809L',
|
'-D_POSIX_C_SOURCE=200809L',
|
||||||
'-DVERSION="@0@"'.format(meson.project_version())
|
'-DVERSION="@0@"'.format(meson.project_version()),
|
||||||
]
|
]
|
||||||
|
|
||||||
if xcb.found() and xlibs.found()
|
if xcb.found() and xlibs.found()
|
||||||
c_args += '-DXWAYLAND'
|
c_args += '-DXWAYLAND'
|
||||||
c_args += '-DIM'
|
c_args += '-DIM'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
executable('maomao',
|
executable(
|
||||||
|
'maomao',
|
||||||
'maomao.c',
|
'maomao.c',
|
||||||
'util.c',
|
'util.c',
|
||||||
wayland_sources,
|
wayland_sources,
|
||||||
dependencies : [
|
dependencies: [
|
||||||
libm,
|
libm,
|
||||||
xcb,
|
xcb,
|
||||||
xlibs,
|
xlibs,
|
||||||
|
|
@ -64,12 +40,22 @@ executable('maomao',
|
||||||
libinput_dep,
|
libinput_dep,
|
||||||
libwayland_client_dep,
|
libwayland_client_dep,
|
||||||
],
|
],
|
||||||
install : true,
|
install: true,
|
||||||
c_args : c_args
|
c_args: c_args,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
sysconfdir = get_option('sysconfdir')
|
||||||
prefix = get_option('prefix')
|
prefix = get_option('prefix')
|
||||||
desktop_install_dir = join_paths(prefix, 'share/wayland-sessions')
|
|
||||||
install_data('maomao.desktop', install_dir : desktop_install_dir)
|
|
||||||
install_data('config.conf', install_dir : '/etc/maomao')
|
|
||||||
|
|
||||||
|
config = configuration_data()
|
||||||
|
config.set('sysconfdir', sysconfdir)
|
||||||
|
config.set('prefix', prefix)
|
||||||
|
configure_file(
|
||||||
|
configuration: config,
|
||||||
|
input: 'config.in',
|
||||||
|
output: 'config.conf',
|
||||||
|
install_dir: join_paths(sysconfdir, 'maomao'),
|
||||||
|
)
|
||||||
|
|
||||||
|
desktop_install_dir = join_paths(prefix, 'share/wayland-sessions')
|
||||||
|
install_data('maomao.desktop', install_dir: desktop_install_dir)
|
||||||
|
|
|
||||||
60
nix/default.nix
Normal file
60
nix/default.nix
Normal 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;
|
||||||
|
};
|
||||||
|
}
|
||||||
43
nix/hm-modules.nix
Normal file
43
nix/hm-modules.nix
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
maomaowm = pkgs.callPackage ./. { };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
wayland.windowManager.maomaowm = {
|
||||||
|
enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
settings = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "";
|
||||||
|
};
|
||||||
|
|
||||||
|
autostart_sh = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.wayland.windowManager.maomaowm.enable {
|
||||||
|
home.packages = [ maomaowm ];
|
||||||
|
|
||||||
|
xdg.configFile = {
|
||||||
|
"maomaowm/config.conf" = {
|
||||||
|
text = config.wayland.windowManager.maomaowm.settings;
|
||||||
|
};
|
||||||
|
"maomaowm/autostart.sh" = {
|
||||||
|
text = config.wayland.windowManager.maomaowm.autostart_sh;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
8
treefmt.nix
Normal file
8
treefmt.nix
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
{ ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
projectRootFile = "flake.nix";
|
||||||
|
programs = {
|
||||||
|
nixfmt.enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue