diff --git a/flake.lock b/flake.lock index 6caf602..dc6a462 100644 --- a/flake.lock +++ b/flake.lock @@ -178,6 +178,42 @@ "inputs": { "nixpkgs-lib": "nixpkgs-lib_2" }, + "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" + } + }, + "flake-parts_3": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_3" + }, + "locked": { + "lastModified": 1741352980, + "narHash": "sha256-+u2UunDA4Cl5Fci3m7S643HzKmIDAe+fiXrLqYsR2fs=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f4330d22f1c5d2ba72d3d22df5597d123fdb60a9", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_4": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_4" + }, "locked": { "lastModified": 1733312601, "narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=", @@ -192,7 +228,7 @@ "type": "github" } }, - "flake-parts_3": { + "flake-parts_5": { "inputs": { "nixpkgs-lib": [ "nixvim", @@ -213,7 +249,7 @@ "type": "github" } }, - "flake-parts_4": { + "flake-parts_6": { "inputs": { "nixpkgs-lib": [ "nur", @@ -234,7 +270,7 @@ "type": "github" } }, - "flake-parts_5": { + "flake-parts_7": { "inputs": { "nixpkgs-lib": [ "stylix", @@ -500,9 +536,52 @@ "type": "github" } }, + "maomaowm": { + "inputs": { + "flake-parts": "flake-parts_2", + "mmsg": "mmsg", + "nixpkgs": "nixpkgs_2", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1742791827, + "narHash": "sha256-R3Z3N/2sRXyIWkfCbCrAzmgJOE0mPoQwBprfiacOuSs=", + "ref": "refs/heads/main", + "rev": "982827cb8e624e59ec3aaf4a888e55b812f689c4", + "revCount": 187, + "type": "git", + "url": "file:///home/eden/Repos/maomaowm-test" + }, + "original": { + "type": "git", + "url": "file:///home/eden/Repos/maomaowm-test" + } + }, + "mmsg": { + "inputs": { + "flake-parts": "flake-parts_3", + "nixpkgs": [ + "maomaowm", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1742777868, + "narHash": "sha256-MdHiygQjBoM22LUJSjeW87t7eDkfRLI2F4Nd64xdLX4=", + "owner": "DreamMaoMao", + "repo": "mmsg", + "rev": "6c9dc91e86a0eb89db3ef8f8290530441cb7b658", + "type": "github" + }, + "original": { + "owner": "DreamMaoMao", + "repo": "mmsg", + "type": "github" + } + }, "nh": { "inputs": { - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_3" }, "locked": { "lastModified": 1741336922, @@ -544,7 +623,7 @@ "inputs": { "niri-stable": "niri-stable", "niri-unstable": "niri-unstable", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_4", "nixpkgs-stable": "nixpkgs-stable", "xwayland-satellite-stable": "xwayland-satellite-stable", "xwayland-satellite-unstable": "xwayland-satellite-unstable" @@ -598,12 +677,12 @@ }, "nixd": { "inputs": { - "flake-parts": "flake-parts_2", + "flake-parts": "flake-parts_4", "flake-root": "flake-root", "nixpkgs": [ "nixpkgs" ], - "treefmt-nix": "treefmt-nix" + "treefmt-nix": "treefmt-nix_2" }, "locked": { "lastModified": 1742568248, @@ -651,6 +730,33 @@ } }, "nixpkgs-lib_2": { + "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" + } + }, + "nixpkgs-lib_3": { + "locked": { + "lastModified": 1740877520, + "narHash": "sha256-oiwv/ZK/2FhGxrCkQkB83i7GnWXPPLzoqFHpDD3uYpk=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "147dee35aab2193b174e4c0868bd80ead5ce755c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs-lib_4": { "locked": { "lastModified": 1733096140, "narHash": "sha256-1qRH7uAUsyQI7R1Uwl4T+XvdNv778H0Nb5njNrqvylY=", @@ -695,6 +801,22 @@ } }, "nixpkgs_2": { + "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_3": { "locked": { "lastModified": 1735563628, "narHash": "sha256-OnSAY7XDSx7CtDoqNh8jwVwh4xNL/2HaJxGjryLWzX8=", @@ -710,22 +832,6 @@ "type": "github" } }, - "nixpkgs_3": { - "locked": { - "lastModified": 1742422364, - "narHash": "sha256-mNqIplmEohk5jRkqYqG19GA8MbQ/D4gQSK0Mu4LvfRQ=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "a84ebe20c6bc2ecbcfb000a50776219f48d134cc", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgs_4": { "locked": { "lastModified": 1742422364, @@ -743,6 +849,22 @@ } }, "nixpkgs_5": { + "locked": { + "lastModified": 1742422364, + "narHash": "sha256-mNqIplmEohk5jRkqYqG19GA8MbQ/D4gQSK0Mu4LvfRQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a84ebe20c6bc2ecbcfb000a50776219f48d134cc", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_6": { "locked": { "lastModified": 1742422364, "narHash": "sha256-mNqIplmEohk5jRkqYqG19GA8MbQ/D4gQSK0Mu4LvfRQ=", @@ -758,7 +880,7 @@ "type": "github" } }, - "nixpkgs_6": { + "nixpkgs_7": { "locked": { "lastModified": 1735554305, "narHash": "sha256-zExSA1i/b+1NMRhGGLtNfFGXgLtgo+dcuzHzaWA6w3Q=", @@ -776,7 +898,7 @@ }, "nixvim": { "inputs": { - "flake-parts": "flake-parts_3", + "flake-parts": "flake-parts_5", "nixpkgs": [ "nixpkgs" ], @@ -798,9 +920,9 @@ }, "nur": { "inputs": { - "flake-parts": "flake-parts_4", - "nixpkgs": "nixpkgs_5", - "treefmt-nix": "treefmt-nix_2" + "flake-parts": "flake-parts_6", + "nixpkgs": "nixpkgs_6", + "treefmt-nix": "treefmt-nix_3" }, "locked": { "lastModified": 1742569316, @@ -818,12 +940,12 @@ }, "nur_2": { "inputs": { - "flake-parts": "flake-parts_5", + "flake-parts": "flake-parts_7", "nixpkgs": [ "stylix", "nixpkgs" ], - "treefmt-nix": "treefmt-nix_3" + "treefmt-nix": "treefmt-nix_4" }, "locked": { "lastModified": 1741693509, @@ -868,16 +990,17 @@ "distrobox4nix": "distrobox4nix", "flake-parts": "flake-parts", "home-manager": "home-manager_2", + "maomaowm": "maomaowm", "nh": "nh", "nil": "nil", "niri": "niri", "nixd": "nixd", - "nixpkgs": "nixpkgs_4", + "nixpkgs": "nixpkgs_5", "nixpkgs-stable": "nixpkgs-stable_2", "nixvim": "nixvim", "nur": "nur", "stylix": "stylix", - "treefmt-nix": "treefmt-nix_4" + "treefmt-nix": "treefmt-nix_5" } }, "rust-overlay": { @@ -1081,6 +1204,27 @@ } }, "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "maomaowm", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1739829690, + "narHash": "sha256-mL1szCeIsjh6Khn3nH2cYtwO5YXG6gBiTw1A30iGeDU=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "3d0579f5cc93436052d94b73925b48973a104204", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, + "treefmt-nix_2": { "inputs": { "nixpkgs": [ "nixd", @@ -1101,7 +1245,7 @@ "type": "github" } }, - "treefmt-nix_2": { + "treefmt-nix_3": { "inputs": { "nixpkgs": [ "nur", @@ -1122,7 +1266,7 @@ "type": "github" } }, - "treefmt-nix_3": { + "treefmt-nix_4": { "inputs": { "nixpkgs": [ "stylix", @@ -1144,9 +1288,9 @@ "type": "github" } }, - "treefmt-nix_4": { + "treefmt-nix_5": { "inputs": { - "nixpkgs": "nixpkgs_6" + "nixpkgs": "nixpkgs_7" }, "locked": { "lastModified": 1742370146, diff --git a/flake.nix b/flake.nix index 1fbefeb..8147335 100644 --- a/flake.nix +++ b/flake.nix @@ -75,5 +75,7 @@ treefmt-nix.url = "github:numtide/treefmt-nix"; agenix.url = "github:ryantm/agenix"; distrobox4nix.url = "github:EdenQwQ/distrobox4nix"; + # maomaowm.url = "github:DreamMaoMao/maomaowm"; + maomaowm.url = "git+file:///home/eden/Repos/maomaowm-test"; }; } diff --git a/home/programs/desktop/default.nix b/home/programs/desktop/default.nix index ed7ddeb..b9323f5 100644 --- a/home/programs/desktop/default.nix +++ b/home/programs/desktop/default.nix @@ -6,6 +6,7 @@ ./mako.nix ./niri ./swhkd.nix + ./maomaowm ]; home.packages = with pkgs; [ swww diff --git a/home/programs/desktop/maomaowm/default.nix b/home/programs/desktop/maomaowm/default.nix new file mode 100644 index 0000000..90bfc6b --- /dev/null +++ b/home/programs/desktop/maomaowm/default.nix @@ -0,0 +1,320 @@ +{ config, user, ... }: +{ + imports = [ + ./swhkd.nix + ./waybar.nix + ]; + + wayland.windowManager.maomaowm = { + enable = true; + settings = with config.lib.stylix.colors; '' + # Animation Configuration + animations=1 + animation_type_open=zoom + animation_type_close=slide + animation_fade_in=1 + zoom_initial_ratio=0.5 + fadein_begin_opacity=0.5 + fadeout_begin_opacity=0.8 + animation_duration_move=500 + animation_duration_open=400 + animation_duration_tag=350 + animation_duration_close=800 + animation_curve_open=0.46,1.0,0.29,1 + animation_curve_move=0.46,1.0,0.29,1 + animation_curve_tag=0.46,1.0,0.29,1 + animation_curve_close=0.08,0.92,0,1 + + # Scroller Layout Setting + scroller_structs=20 + scroller_default_proportion=0.8 + scoller_focus_center=0 + scroller_proportion_preset=0.5,0.8,1.0 + + # Master-Stack Layout Setting (tile,spiral,dwindle) + new_is_master=0 + default_mfact=0.55 + default_nmaster=1 + smartgaps=0 + # only work in spiral and dwindlw + default_smfact=0.5 + + + # Overview Setting + hotarea_size=10 + enable_hotarea=1 + ov_tab_mode=0 + overviewgappi=5 + overviewgappo=30 + + # Misc + axis_bind_apply_timeout=100 + focus_on_activate=1 + bypass_surface_visibility=0 + sloppyfocus=1 + warpcursor=1 + + # keyboard + repeat_rate=25 + repeat_delay=600 + numlockon=1 + + # Trackpad + tap_to_click=1 + tap_and_drag=1 + drag_lock=1 + natural_scrolling=0 + disable_while_typing=1 + left_handed=0 + middle_button_emulation=0 + + # Appearance + gappih=5 + gappiv=5 + gappoh=10 + gappov=10 + borderpx=4 + rootcolor=0x${base00}ff + bordercolor=0x${base02}ff + focuscolor=0x${base0E}ff + maxmizescreencolor=0x${base0C}ff + urgentcolor=0x${base08}ff + scratchpadcolor=0x${base0A}ff + globalcolor=0x${base0D}ff + + # layout circle limit + # if not set, it will circle all layout + # circle_layout=spiral,scroller + + # tags rule + # layout support: tile,scroller,grid,monocle,spiral,dwindle + tags=id:1,layout_name:tile + tags=id:2,layout_name:tile + tags=id:3,layout_name:tile + tags=id:4,layout_name:tile + tags=id:5,layout_name:tile + tags=id:6,layout_name:tile + tags=id:7,layout_name:tile + tags=id:8,layout_name:tile + tags=id:9,layout_name:tile + + # Window Rules + # 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) + # isfloating: type-num(0 or 1) + # isfullscreen: type-num(0 or 1) + # scroller_proportion: type-float(0.1-1.0) + # animation_type_open : type-string(zoom,slide,none) + # animation_type_close : type-string(zoom,slide) + # isnoborder : type-num(0 or 1) + # monitor : type-int(0-99999) + # width : type-num(0-9999) + # height : type-num(0-9999) + # isterm : type-num (0 or 1) -- when new window open, will replace it, and will restore after the sub window exit + # nnoswallow : type-num(0 or 1) -- if enable, this window wll not replace isterm window when it was open by isterm window + # globalkeybinding: type-string(for example-- alt-l or alt+super-l) + + # example + # windowrule=isfloating:1,appid:yesplaymusic + # windowrule=width:1500,appid:yesplaymusic + # windowrule=height:900,appid:yesplaymusic + # windowrule=isfloating:1,title:qxdrag + # windowrule=isfloating:1,appid:Rofi + # windowrule=isfloating:1,appid:wofi + # windowrule=isnoborder:1,appid:wofi + # windowrule=animation_type_open:zoom,appid:wofi + # windowrule=globalkeybinding:ctrl+alt-o,appid:com.obsproject.Studio + # windowrule=globalkeybinding:ctrl+alt-n,appid:com.obsproject.Studio + + + # open in specific tag + # windowrule=tags:4,appid:Google-chrome + # windowrule=tags:3,appid:QQ + # windowrule=tags:5,appid:yesplaymusic + # windowrule=tags:2,appid:mpv + # windowrule=tags:6,appid:obs + + # Monitor Rules + # name|mfact|nmaster|scale|layout|(rotate or reflect)|x|y + # rotate or reflect: + # 0:no transform + # 1:90 degrees counter-clockwise + # 2:180 degrees counter-clockwise + # 3:270 degrees counter-clockwise + # 4:180 degree flip around a vertical axis + # 5:flip and rotate 90 degrees counter-clockwise + # 6:flip and rotate 180 degrees counter-clockwise + # 7:flip and rotate 270 degrees counter-clockwise + + # example + monitorrule=eDP-1,0.55,1,tile,0,1.6,1000,0 + monitorrule=HDMI-A-1,0.55,1,tile,1,1.6,0,0 + + # Key Bindings + # The mod key is not case sensitive, + # but the second key is case sensitive, + # if you use shift as one of the mod keys, + # remember to use uppercase keys + + # reload config + bind=SUPER+SHIFT,R,reload_config + + + # menu and terminal + bind=SUPER,p,spawn,sh -c \$(tofi-run) + bind=SUPER,Return,spawn,kitty + bind=SUPER+SHIFT,C,spawn,/home/${user}/scripts/tofi/colorscheme + bind=SUPER+SHIFT,W,spawn,/home/${user}/scripts/change-wal-wayland + + # exit + bind=SUPER,q,killclient, + + # switch window focus + bind=SUPER,h,focusdir,left + bind=SUPER,l,focusdir,right + bind=SUPER,k,focusdir,up + bind=SUPER,j,focusdir,down + + # swap window + bind=SUPER+SHIFT,K,exchange_client,up + bind=SUPER+SHIFT,J,exchange_client,down + bind=SUPER+SHIFT,H,exchange_client,left + bind=SUPER+SHIFT,L,exchange_client,right + + # switch window status + bind=SUPER,g,toggleglobal, + bind=SUPER,Tab,toggleoverview, + bind=SUPER+SHIFT,space,togglefloating, + bind=SUPER,m,togglemaxmizescreen, + bind=SUPER+SHIFT,F,togglefullscreen, + bind=SUPER,i,minized, + bind=SUPER+SHIFT,I,restore_minized + bind=ALT,z,toggle_scratchpad + + # scroller layout + bind=ALT,e,set_proportion,1.0 + bind=ALT,x,switch_proportion_preset, + + + # tile layout + bind=SUPER,e,incnmaster,1 + bind=SUPER,t,incnmaster,-1 + bind=ALT+CTRL,Left,setmfact,-0.01 + bind=ALT+CTRL,Right,setmfact,+0.01 + bind=ALT+CTRL,Up,setsmfact,-0.01 + bind=ALT+CTRL,Down,setsmfact,+0.01 + bind=ALT,s,zoom, + + + # switch layout + bind=CTRL+SUPER,i,setlayout,tile + bind=CTRL+SUPER,l,setlayout,scroller + bind=SUPER,n,switch_layout + + + # tag switch + bind=SUPER,Left,viewtoleft, + bind=CTRL,Left,viewtoleft_have_client, + bind=SUPER,Right,viewtoright, + bind=CTRL,Right,viewtoright_have_client, + bind=CTRL+SUPER,Left,tagtoleft, + bind=CTRL+SUPER,Right,tagtoright, + + # normal num key is (1-9) + # right-side keyboard num keys is (KP_1-KP_9) + bind=SUPER,1,view,1 + bind=SUPER,2,view,2 + bind=SUPER,3,view,3 + bind=SUPER,4,view,4 + bind=SUPER,5,view,5 + bind=SUPER,6,view,6 + bind=SUPER,7,view,7 + bind=SUPER,8,view,8 + bind=SUPER,9,view,9 + + bind=SUPER+SHIFT,exclam,tag,1 + bind=SUPER+SHIFT,at,tag,2 + bind=SUPER+SHIFT,numbersign,tag,3 + bind=SUPER+SHIFT,dollar,tag,4 + bind=SUPER+SHIFT,percent,tag,5 + bind=SUPER+SHIFT,asciicircum,tag,6 + bind=SUPER+SHIFT,ampersand,tag,7 + bind=SUPER+SHIFT,asterisk,tag,8 + bind=SUPER+SHIFT,parenleft,tag,9 + + bind=SUPER+CTRL+SHIFT,exclam,toggletag,1 + bind=SUPER+CTRL+SHIFT,at,toggletag,2 + bind=SUPER+CTRL+SHIFT,numbersign,toggletag,3 + bind=SUPER+CTRL+SHIFT,dollar,toggletag,4 + bind=SUPER+CTRL+SHIFT,percent,toggletag,5 + bind=SUPER+CTRL+SHIFT,asciicircum,toggletag,6 + bind=SUPER+CTRL+SHIFT,ampersand,toggletag,7 + bind=SUPER+CTRL+SHIFT,asterisk,toggletag,8 + bind=SUPER+CTRL+SHIFT,parenleft,toggletag,9 + + bind=SUPER+CTRL,1,toggleview,1 + bind=SUPER+CTRL,2,toggleview,2 + bind=SUPER+CTRL,3,toggleview,3 + bind=SUPER+CTRL,4,toggleview,4 + bind=SUPER+CTRL,5,toggleview,5 + bind=SUPER+CTRL,6,toggleview,6 + bind=SUPER+CTRL,7,toggleview,7 + bind=SUPER+CTRL,8,toggleview,8 + bind=SUPER+CTRL,9,toggleview,9 + + # monitor switch + bind=SUPER+CTRL,H,focusmon,left + bind=SUPER+CTRL,L,focusmon,right + bind=SUPER+CTRL,bracketleft,tagmon,left + bind=SUPER+CTRL,bracketright,tagmon,right + + # gaps + bind=ALT+SHIFT,X,incgaps,1 + bind=ALT+SHIFT,Z,incgaps,-1 + bind=ALT+SHIFT,R,togglegaps + + #custom app bind example + # spawn_on_empty (if tag 4 is empty , open app in this,otherwise view to tag 4) + # bind=SUPER,Return,spawn_on_empty,google-chrome,4 + # spawn + # bind=CTRL+ALT,Return,spawn,st -e ~/tool/ter-multiplexer.sh + + # Mouse Button Bindings + # NONE mode key only work in ov mode + mousebind=SUPER,btn_left,moveresize,curmove + mousebind=NONE,btn_middle,togglemaxmizescreen,0 + mousebind=ALT,btn_left,moveresize,curresize + mousebind=NONE,btn_left,toggleoverview,-1 + mousebind=NONE,btn_right,killclient,0 + + # Axis Bindings + axisbind=SUPER,UP,viewtoleft_have_client + axisbind=SUPER,DOWN,viewtoright_have_client + ''; + autostart_sh = + let + setWallpaper = monitor: '' + swww img -o ${monitor} ~/Pictures/Wallpapers/generated/$(cat ~/.cache/swww/${monitor} | xargs basename | cut -d'-' -f2- | sd "\-blurred" "") + ''; + in + '' + killall swhkd + killall swhks + swhks & + doas swhkd -c ~/.config/maomao/swhkdrc & + swww kill + swww-daemon & + killall clash-meta + clash-meta -d ~/.config/clash & + wlsunset -s 00:00 -S 00:00 -t 5000 -T 5001 & + killall .waybar-wrapped + waybar -c ~/.config/maomao/waybar/config.jsonc -s ~/.config/maomao/waybar/style.css & + killall .fcitx5-wrapped + fcitx5 -d & + nmapplet & + blueman-applet & + '' + + (builtins.attrNames config.monitors |> map setWallpaper |> builtins.concatStringsSep "\n"); + }; +} diff --git a/home/programs/desktop/maomaowm/swhkd.nix b/home/programs/desktop/maomaowm/swhkd.nix new file mode 100644 index 0000000..c0e6205 --- /dev/null +++ b/home/programs/desktop/maomaowm/swhkd.nix @@ -0,0 +1,7 @@ +{ user, ... }: +{ + xdg.configFile."maomao/swhkdrc".text = '' + include /home/${user}/.config/swhkd/basic.swhkdrc + include /home/${user}/.config/swhkd/tofi.swhkdrc + ''; +} diff --git a/home/programs/desktop/maomaowm/waybar.nix b/home/programs/desktop/maomaowm/waybar.nix new file mode 100644 index 0000000..26b9c49 --- /dev/null +++ b/home/programs/desktop/maomaowm/waybar.nix @@ -0,0 +1,434 @@ +{ config, ... }: +with config.lib.stylix.colors; +let + moduleConfiguration = + # jsonc + '' + // Modules configuration + "dwl/tags": { + "tag-labels": ["", "", "", "", "", "", "", "", ""], + }, + "dwl/window": { + "format": "{}", + "separate-outputs": true, + "icon": true, + "icon-size": 18, + }, + "niri/window": { + "format": "{}", + "separate-outputs": true, + "icon": true, + "icon-size": 18 + }, + "memory": { + "interval": 30, + "format": " {used:0.1f}G/{total:0.1f}G", + "on-click": "kitty --class=htop,htop -e htop" + }, + "backlight": { + "device": "intel_backlight", + "on-scroll-up": "light -A 1", + "on-scroll-down": "light -U 1", + "format": "{icon} {percent}%", + "format-icons": [ + "", + "" + ] + }, + "tray": { + "icon-size": 16, + "spacing": 10 + }, + "clock": { + "format": " {:%a %d %H:%M}", + "tooltip-format": "{:%Y %B}\n{calendar}", + "on-click": "kitty --class=clock,clock --title=clock -o remember_window_size=no -o initial_window_width=600 -o initial_window_height=200 -e tty-clock -s -c -C 5" + }, + "battery": { + "states": { + "warning": 30, + "critical": 15, + }, + "format": "{icon} {capacity}%", + "format-warning": "{icon} {capacity}%", + "format-critical": "{icon} {capacity}%", + "format-charging": "{capacity}%", + "format-plugged": "{capacity}%", + "format-alt": "{icon} {time}", + "format-full": "{capacity}%", + "format-icons": [ + "", + "", + "", + "", + "" + ], + "tooltip-format": "{time}", + "interval": 5 + }, + "network": { + "format-wifi": "󰖩 {essid}", + "format-ethernet": "󰤭 Disconnected", + "format-linked": "{ifname} (No IP) 󱚵", + "format-disconnected": "Disconnected", + "tooltip-format-wifi": "Signal Strenght: {signalStrength}%", + "on-click": "kitty --class nmtui,nmtui --title=nmtui -o remember_window_size=no -o initial_window_width=400 -o initial_window_height=400 -e doas nmtui" + }, + "pulseaudio": { + "on-click": "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle", + "on-scroll-up": "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.01+", + "on-scroll-down": "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.01-", + "format": "{icon} {volume}%", + "format-muted": "Muted", + "format-icons": { + "headphone": "󱡏", + "hands-free": "", + "headset": "󱡏", + "phone": "", + "portable": "", + "car": "", + "default": [ + "󰕿", + "󰖀", + "󰕾", + "󰕾" + ] + } + }, + "group/meters": { + "orientation": "inherit", + "drawer": { + "transition-duration": 500, + "transition-left-to-right": false, + }, + "modules": [ + "battery", + "memory", + "network", + "pulseaudio", + "backlight" + ] + } + ''; + trayBackgroundColor = if config.stylix.polarity == "dark" then "@base00" else "@base05"; + colors = { + inherit (withHashtag) + base00 + base01 + base04 + base05 + base06 + base07 + base08 + base0A + base0D + base0E + base0F + ; + }; +in +{ + programs.waybar = { + enable = true; + systemd = { + enable = true; + target = config.wayland.systemd.target; + }; + }; + home.file = { + ".config/maomao/waybar/config.jsonc".text = + let + otherMonitorsConfig = + map ( + name: + # json + '' + { + "position": "top", + "layer": "top", + "output": "${name}", + "modules-left": [ + "dwl/tags", + "dwl/window" + ], + "modules-right": [ + "tray", + "group/meters" + ], + ${moduleConfiguration} + }, + '') config.lib.monitors.otherMonitorsNames + |> builtins.concatStringsSep "\n"; + in + # json + '' + [ + ${otherMonitorsConfig} + { + "position": "top", + "layer": "top", + "output": "${config.lib.monitors.mainMonitorName}", + "modules-left": [ + "dwl/tags", + "tray", + "dwl/window" + ], + "modules-center": [ + "clock", + "memory" + ], + "modules-right": [ + "network", + "pulseaudio", + "backlight", + "battery", + ], + ${moduleConfiguration} + } + ] + + ''; + ".config/maomao/waybar/colors.css".text = + # css + (builtins.mapAttrs (name: value: "@define-color ${name} ${value};") colors) + |> builtins.attrValues + |> builtins.concatStringsSep "\n"; + ".config/maomao/waybar/tray.css".text = + # css + '' + #tray { + background: shade(alpha(${trayBackgroundColor}, 0.9), 1); + } + ''; + ".config/maomao/waybar/style.css".text = + # css + '' + @import "animation.css"; + @import "colors.css"; + @import "tray.css"; + + * { + /* all: unset; */ + font-size: 14px; + /* font-family: "Comic Mono Nerd Font"; */ + font-family: "Hug Me Tight", "Xiaolai SC"; + min-height: 0; + } + + window#waybar { + /* border-radius: 15px; */ + /* color: @base04; */ + background: transparent; + } + + tooltip { + background: @base01; + border-radius: 5px; + border-width: 2px; + border-style: solid; + border-color: @base07; + } + + #network, + #clock, + #battery, + #pulseaudio, + #workspaces, + #tags, + #backlight, + #memory, + #tray, + #window { + padding: 4px 10px; + background: shade(alpha(@base00, 0.9), 1); + text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.377); + color: @base05; + margin-top: 10px; + margin-bottom: 5px; + margin-left: 5px; + margin-right: 5px; + box-shadow: 1px 2px 2px #101010; + border-radius: 10px; + } + + #workspaces, + #tags { + margin-left: 15px; + font-size: 0px; + padding: 6px 3px; + border-radius: 20px; + } + + #workspaces button { + font-size: 0px; + background-color: @base07; + padding: 0px 1px; + margin: 0px 4px; + border-radius: 20px; + transition: all 0.25s cubic-bezier(0.55, -0.68, 0.48, 1.682); + } + + #tags button { + font-size: 0px; + background-color: @base04; + padding: 0px 1px; + margin: 0px 4px; + border-radius: 20px; + transition: all 0.25s cubic-bezier(0.55, -0.68, 0.48, 1.682); + } + + #tags button.occupied { + font-size: 1px; + background-color: @base07; + } + + #workspaces button.active, + #tags button.focused { + font-size: 1px; + background-color: @base0E; + border-radius: 20px; + min-width: 30px; + background-size: 400% 400%; + } + + #workspaces button.empty { + font-size: 1px; + background-color: @base04; + } + + #window { + color: @base00; + background: radial-gradient(circle, @base05 0%, @base07 100%); + background-size: 400% 400%; + animation: gradient_f 40s ease-in-out infinite; + transition: all 0.3s cubic-bezier(0.55, -0.68, 0.48, 1.682); + } + + window#waybar.empty #window { + background: none; + background-color: transparent; + box-shadow: none; + } + + #battery { + margin-right: 15px; + background: @base0F; + /* background: linear-gradient(118deg, @base07 0%, @base0F 25%, @base07 50%, @base0F 75%, @base07 100%); */ + /* background: linear-gradient(118deg, @base07 5%, @base0F 5%, @base0F 20%, @base07 20%, @base07 40%, @base0F 40%, @base0F 60%, @base07 60%, @base07 80%, @base0F 80%, @base0F 95%, @base07 95%); */ + background: linear-gradient( + 118deg, + @base0B 5%, + @base0F 5%, + @base0F 20%, + @base0B 20%, + @base0B 40%, + @base0F 40%, + @base0F 60%, + @base0B 60%, + @base0B 80%, + @base0F 80%, + @base0F 95%, + @base0B 95% + ); + background-size: 200% 300%; + animation: gradient_f_nh 4s linear infinite; + color: @base01; + } + + #battery.charging, + #battery.plugged { + background: linear-gradient( + 118deg, + @base0E 5%, + @base0D 5%, + @base0D 20%, + @base0E 20%, + @base0E 40%, + @base0D 40%, + @base0D 60%, + @base0E 60%, + @base0E 80%, + @base0D 80%, + @base0D 95%, + @base0E 95% + ); + background-size: 200% 300%; + animation: gradient_rv 4s linear infinite; + } + + #battery.full { + background: linear-gradient( + 118deg, + @base0E 5%, + @base0D 5%, + @base0D 20%, + @base0E 20%, + @base0E 40%, + @base0D 40%, + @base0D 60%, + @base0E 60%, + @base0E 80%, + @base0D 80%, + @base0D 95%, + @base0E 95% + ); + background-size: 200% 300%; + animation: gradient_rv 20s linear infinite; + } + + #tray > .passive { + -gtk-icon-effect: dim; + } + + #tray > .needs-attention { + -gtk-icon-effect: highlight; + } + +''; + ".config/maomao/waybar/animation.css".text = + # css + '' + @keyframes gradient { + 0% { + background-position: 0% 50%; + } + 50% { + background-position: 100% 30%; + } + 100% { + background-position: 0% 50%; + } + } + + @keyframes gradient_f { + 0% { + background-position: 0% 200%; + } + 50% { + background-position: 200% 0%; + } + 100% { + background-position: 400% 200%; + } + } + + @keyframes gradient_f_nh { + 0% { + background-position: 0% 200%; + } + 100% { + background-position: 200% 200%; + } + } + + @keyframes gradient_rv { + 0% { + background-position: 200% 200%; + } + 100% { + background-position: 0% 200%; + } + } + ''; + }; +} diff --git a/hosts/default.nix b/hosts/default.nix index 404d621..f5ca7a6 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -10,6 +10,7 @@ let ../nix inputs.stylix.nixosModules.stylix inputs.niri.nixosModules.niri + inputs.maomaowm.nixosModules.maomaowm ]; sharedHomeModules = [ @@ -22,6 +23,7 @@ let inputs.agenix.homeManagerModules.default ../secrets/age.nix inputs.distrobox4nix.homeManagerModule + inputs.maomaowm.hmModules.maomaowm ] ++ (builtins.attrValues self.homeManagerModules); in { diff --git a/os/programs/default.nix b/os/programs/default.nix index c73f7e3..fe6b55f 100644 --- a/os/programs/default.nix +++ b/os/programs/default.nix @@ -5,5 +5,6 @@ ./niri.nix ./ai.nix ./swhkd.nix + ./maomaowm.nix ]; } diff --git a/os/programs/maomaowm.nix b/os/programs/maomaowm.nix new file mode 100644 index 0000000..fd35ced --- /dev/null +++ b/os/programs/maomaowm.nix @@ -0,0 +1,6 @@ +{ + programs = { + maomaowm.enable = true; + maomaowm.mmsg.enable = true; + }; +} diff --git a/templates/default.nix b/templates/default.nix index 353f7df..bb01c0a 100644 --- a/templates/default.nix +++ b/templates/default.nix @@ -3,4 +3,9 @@ path = ./python-analyze; description = "Python with modules for analyzing data"; }; + + flake-parts-package = { + path = ./flake-parts-package; + description = "Package declaration with flake-parts"; + }; } diff --git a/templates/flake-parts-package/default.nix b/templates/flake-parts-package/default.nix new file mode 100644 index 0000000..588f22c --- /dev/null +++ b/templates/flake-parts-package/default.nix @@ -0,0 +1,15 @@ +{ + stdenv, +}: +stdenv.mkDerivation { + pname = ""; + version = ""; + + src = ./.; + + meta = { + description = ""; + homepage = ""; + license = null; + }; +} diff --git a/templates/flake-parts-package/flake.lock b/templates/flake-parts-package/flake.lock new file mode 100644 index 0000000..66ecda9 --- /dev/null +++ b/templates/flake-parts-package/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1741352980, + "narHash": "sha256-+u2UunDA4Cl5Fci3m7S643HzKmIDAe+fiXrLqYsR2fs=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f4330d22f1c5d2ba72d3d22df5597d123fdb60a9", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1742707865, + "narHash": "sha256-RVQQZy38O3Zb8yoRJhuFgWo/iDIDj0hEdRTVfhOtzRk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "dd613136ee91f67e5dba3f3f41ac99ae89c5406b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1740877520, + "narHash": "sha256-oiwv/ZK/2FhGxrCkQkB83i7GnWXPPLzoqFHpDD3uYpk=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "147dee35aab2193b174e4c0868bd80ead5ce755c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/templates/flake-parts-package/flake.nix b/templates/flake-parts-package/flake.nix new file mode 100644 index 0000000..0327885 --- /dev/null +++ b/templates/flake-parts-package/flake.nix @@ -0,0 +1,26 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; + }; + + outputs = + { + flake-parts, + ... + }@inputs: + flake-parts.lib.mkFlake { inherit inputs; } { + perSystem = + { pkgs, ... }: + let + pname = pkgs.callPackage ./default.nix { }; + in + { + packages = { + inherit pname; + default = pname; + }; + }; + systems = [ "x86_64-linux" ]; + }; +}