Add MangoWM configuration and scripts for window management on scrolling layout
This commit is contained in:
208
mango/home.nix
Normal file
208
mango/home.nix
Normal file
@ -0,0 +1,208 @@
|
||||
{
|
||||
pkgs,
|
||||
inputs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
# ── External scripts ──
|
||||
resizeScript = pkgs.writeShellScriptBin "resize.sh" (builtins.readFile ./scripts/resize.sh);
|
||||
layoutCmdScript = pkgs.writeShellScriptBin "layout-cmd.sh" (builtins.readFile ./scripts/layout-cmd.sh);
|
||||
|
||||
# Helper to get the bin path
|
||||
resizePath = "${resizeScript}/bin/resize.sh";
|
||||
layoutCmdPath = "${layoutCmdScript}/bin/layout-cmd.sh";
|
||||
|
||||
tagBinds = lib.concatLists (
|
||||
builtins.genList (i: let
|
||||
n = toString (i + 1);
|
||||
in [
|
||||
"SUPER,${n},view,${n}"
|
||||
"SUPER+CTRL,${n},tag,${n}"
|
||||
])
|
||||
9
|
||||
);
|
||||
|
||||
# All key bindings
|
||||
defaultBinds =
|
||||
# --- Common/Session ---
|
||||
[
|
||||
"SUPER+SHIFT,E,quit"
|
||||
#"SUPER+CTRL,R,reload_config"
|
||||
"SUPER+CTRL,R,spawn_shell,mmsg dispatch reload_config && notify-send -u low -t 500 \"MangoWM\" \"Reloaded ✓\""
|
||||
]
|
||||
# --- Screenshot ---
|
||||
++ [
|
||||
"SUPER+SHIFT,S,spawn,noctalia msg screenshot-region"
|
||||
]
|
||||
# --- Launchers ---
|
||||
++ [
|
||||
"SUPER,T,spawn,kitty" # Mod+T → terminal
|
||||
"SUPER,D,spawn,noctalia msg panel-toggle launcher" # Mod+D → launcher
|
||||
#"SUPER+SHIFT,L,spawn,noctalia msg session lock" # Super+L → lock
|
||||
"SUPER+SHIFT,L,spawn,hyprlock"
|
||||
]
|
||||
# --- Media keys ---
|
||||
++ [
|
||||
"NONE,XF86AudioRaiseVolume,spawn,noctalia msg volume-up"
|
||||
"NONE,XF86AudioLowerVolume,spawn,noctalia msg volume-down"
|
||||
"NONE,XF86AudioMute,spawn,noctalia msg volume-mute"
|
||||
"NONE,XF86AudioMicMute,spawn,noctalia msg mic-mute"
|
||||
"NONE,XF86AudioPlay,spawn,playerctl play-pause"
|
||||
"NONE,XF86AudioStop,spawn,playerctl stop"
|
||||
"NONE,XF86AudioPrev,spawn,playerctl previous"
|
||||
"NONE,XF86AudioNext,spawn,playerctl next"
|
||||
]
|
||||
# --- Brightness ---
|
||||
++ [
|
||||
"NONE,XF86MonBrightnessUp,spawn,noctalia msg brightness-up"
|
||||
"NONE,XF86MonBrightnessDown,spawn,noctalia msg brightness-down"
|
||||
]
|
||||
# --- Focus (directional) ---
|
||||
++ [
|
||||
"SUPER,Left,focusdir,left"
|
||||
"SUPER,Down,focusdir,down"
|
||||
"SUPER,Up,focusdir,up"
|
||||
"SUPER,Right,focusdir,right"
|
||||
# vim bindings
|
||||
"SUPER,H,focusdir,left"
|
||||
"SUPER,J,focusdir,down"
|
||||
"SUPER,K,focusdir,up"
|
||||
"SUPER,L,focusdir,right"
|
||||
]
|
||||
# --- Move windows (swap with neighbor) ---
|
||||
++ [
|
||||
"SUPER+CTRL,Left,exchange_client,left"
|
||||
"SUPER+CTRL,Down,exchange_client,down"
|
||||
"SUPER+CTRL,Up,exchange_client,up"
|
||||
"SUPER+CTRL,Right,exchange_client,right"
|
||||
# vim bindings
|
||||
"SUPER+CTRL,H,exchange_client,left"
|
||||
"SUPER+CTRL,J,exchange_client,down"
|
||||
"SUPER+CTRL,K,exchange_client,up"
|
||||
"SUPER+CTRL,L,exchange_client,right"
|
||||
]
|
||||
# --- Tags (workspaces) 1-9 ---
|
||||
++ tagBinds # Generated list of binds for tags 1-9
|
||||
++ [
|
||||
"SUPER,U,viewtoleft_have_client"
|
||||
"SUPER,I,viewtoright_have_client"
|
||||
"SUPER+SHIFT,U,tagtoleft"
|
||||
"SUPER+SHIFT,I,tagtoright"
|
||||
]
|
||||
# --- Close window ---
|
||||
++ [
|
||||
"SUPER,Q,killclient"
|
||||
]
|
||||
# --- Layout / sizing ---
|
||||
++ [
|
||||
"SUPER+SHIFT,R,switch_layout" # Cycle layouts
|
||||
"SUPER,F,spawn_shell,${layoutCmdPath} 'S:${resizePath} fullscreen' 'mmsg dispatch togglemaximizescreen'"
|
||||
"SUPER+SHIFT,F,togglefullscreen"
|
||||
"SUPER,C,centerwin" # Center floating window
|
||||
|
||||
# For Scroller
|
||||
"SUPER,ssharp,spawn_shell,${layoutCmdPath} 'S:${resizePath} down' 'notify-send \"Title\" \"Down\"'"
|
||||
#"SUPER,ssharp,spawn_shell,${resizePath} down"
|
||||
"SUPER,dead_acute,spawn_shell,${layoutCmdPath} 'S:${resizePath} up' 'notify-send \"Title\" \"Up\"'"
|
||||
#"SUPER,dead_acute,spawn_shell,${resizePath} up"
|
||||
]
|
||||
# --- Floating ---
|
||||
++ [
|
||||
"SUPER,V,togglefloating"
|
||||
]
|
||||
# --- Power off monitors ---
|
||||
++ [
|
||||
"SUPER+SHIFT,P,spawn,mmsg dispatch toggle_monitor,eDP-1"
|
||||
];
|
||||
|
||||
# Extra config for settings that don't have structured Nix attrs
|
||||
extraConf = ''
|
||||
# ── Input ──
|
||||
xkb_rules_layout=de
|
||||
numlockon=1
|
||||
mouse_accel_profile=1
|
||||
mouse_accel_speed=-0.4
|
||||
|
||||
# ── Appearance / Theming ──
|
||||
focuscolor=0xffc87faa
|
||||
bordercolor=0x505050ff
|
||||
urgentcolor=0x9b0000ff
|
||||
borderpx=2
|
||||
|
||||
# ── Blur ──
|
||||
blur=1
|
||||
|
||||
blur_params_num_passes=2
|
||||
blur_params_radius=5
|
||||
blur_params_noise=0.02
|
||||
blur_params_brightness=1
|
||||
blur_params_contrast=1
|
||||
blur_params_saturation=1
|
||||
|
||||
# window-rule geometry-corner-radius 12
|
||||
border_radius=12
|
||||
|
||||
# Opacity
|
||||
focused_opacity=1.0
|
||||
unfocused_opacity=0.95
|
||||
|
||||
# ── Layout ──
|
||||
gappih=10
|
||||
gappiv=10
|
||||
gappoh=10
|
||||
gappov=10
|
||||
|
||||
# Master-stack settings (tile layout)
|
||||
default_mfact=0.5
|
||||
default_nmaster=1
|
||||
new_is_master=1
|
||||
|
||||
# Scroller
|
||||
scroller_default_proportion=0.5
|
||||
scroller_focus_center=0
|
||||
scroller_default_proportion_single=1.0
|
||||
|
||||
# Layout cycling order (Mod+R)
|
||||
circle_layout=scroller,tile,center_tile,grid
|
||||
|
||||
# ── Monitor ──
|
||||
monitorrule=name:^eDP-1$,width:2880,height:1920,refresh:120,x:0,y:0,scale:2
|
||||
|
||||
# ── Autostart ──
|
||||
exec-once=noctalia
|
||||
exec-once=lxpolkit
|
||||
exec-once = ${pkgs.kdePackages.kwallet-pam}/libexec/pam_kwallet_init
|
||||
|
||||
exec-once="rm -rf ''${XDG_RUNTIME_DIR:-/tmp}/mango-resize"
|
||||
|
||||
tagrule=id:1,layout_name:scroller
|
||||
tagrule=id:2,layout_name:scroller
|
||||
tagrule=id:3,layout_name:scroller
|
||||
tagrule=id:4,layout_name:scroller
|
||||
tagrule=id:5,layout_name:scroller
|
||||
tagrule=id:6,layout_name:scroller
|
||||
tagrule=id:7,layout_name:scroller
|
||||
tagrule=id:8,layout_name:scroller
|
||||
tagrule=id:9,layout_name:scroller
|
||||
'';
|
||||
in {
|
||||
imports = [
|
||||
inputs.mangowm.hmModules.mango
|
||||
../modules/noctalia/home.nix
|
||||
];
|
||||
|
||||
wayland.windowManager.mango = {
|
||||
enable = true;
|
||||
|
||||
# Additional autostart (most handled in extraConfig exec-once)
|
||||
autostart_sh = "";
|
||||
|
||||
settings = {
|
||||
# Key bindings (flat list; keymode for submaps below if needed)
|
||||
bind = defaultBinds;
|
||||
};
|
||||
|
||||
# Raw config lines for options without structured Nix attrs
|
||||
extraConfig = extraConf;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user