{ config, pkgs, ... }: let shell = "${pkgs.dash}/bin/dash"; default_master_ratio = "0.6"; up_layout = "Up ((h: v v) 1 ${default_master_ratio} 0)"; down_layout = "Down ((h: v v) 1 ${default_master_ratio} 1)"; left_layout = "Left ((v: h h) 1 ${default_master_ratio} 0)"; right_layout = "Right ((v: h h) 1 ${default_master_ratio} 1)"; deck_layout = "Deck deck"; full_layout = "Full full"; wide_layout = "Wide ((v: h h h) 1 0.5 1)"; column_layout = "Cols (v: v)"; default_layout = left_layout; riverctl = "${pkgs.river}/bin/riverctl"; kile = "${pkgs.kile-wl}/bin/kile"; kile_namespace = "kile"; in { systemd.user.services.kile-wl = { Unit = { Description = "kile layout generator"; BindsTo = [ "river-session.target" ]; }; Service = { Type = "simple"; ExecStart = "${kile} --namespace ${kile_namespace} --layout '${default_layout}'"; }; Install = { WantedBy = [ "river-session.target" ]; }; }; xdg.dataFile.init-kile = { executable = true; target = "${config.xdg.configHome}/river/init-kile"; text = '' #!${shell} # Super+H and Super+L to decrease/increase the main ratio ${riverctl} map -repeat normal Super Equal send-layout-cmd ${kile_namespace} "mod_main_ratio +0.01" ${riverctl} map -repeat normal Super Minus send-layout-cmd ${kile_namespace} "mod_main_ratio -0.01" # Super+Comma and Super+Period. to increment/decrement the main count ${riverctl} map normal Super Comma send-layout-cmd ${kile_namespace} "mod_main_amount +1" ${riverctl} map normal Super Period send-layout-cmd ${kile_namespace} "mod_main_amount -1" # Super+{Up,Right,Down,Left} to change layout orientation ${riverctl} map normal Super+Control K send-layout-cmd ${kile_namespace} "focused ${up_layout}" ${riverctl} map normal Super+Control J send-layout-cmd ${kile_namespace} "focused ${down_layout}" ${riverctl} map normal Super+Control H send-layout-cmd ${kile_namespace} "focused ${left_layout}" ${riverctl} map normal Super+Control L send-layout-cmd ${kile_namespace} "focused ${right_layout}" ${riverctl} map normal Super+Control D send-layout-cmd ${kile_namespace} "focused ${deck_layout}" ${riverctl} map normal Super+Control F send-layout-cmd ${kile_namespace} "focused ${full_layout}" ${riverctl} map normal Super+Control W send-layout-cmd ${kile_namespace} "focused ${wide_layout}" ${riverctl} map normal Super+Control C send-layout-cmd ${kile_namespace} "focused ${column_layout}" ${riverctl} map normal Super+Shift Space send-layout-cmd ${kile_namespace} "focused ${default_layout}" ${riverctl} default-layout ${kile_namespace} ''; }; }