Skip to content

Commit

Permalink
modules: add more missing options to river
Browse files Browse the repository at this point in the history
  • Loading branch information
moni-dz committed Feb 25, 2022
1 parent 3b7694e commit 6b65b07
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 25 deletions.
54 changes: 35 additions & 19 deletions modules/home-manager/wayland/windowManager/river/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,21 @@

/*
TODO:
- Client side decorations config
- csd-filter config
- float-filter config
*/

with lib;

let
cfg = config.wayland.windowManager.river;

genKeybind = mode:
genBind = mode:
let
binds = with cfg.config; zipLists (attrNames keybindings.${mode}) (attrValues keybindings.${mode});
in
toString (forEach binds (x: "riverctl map ${mode} ${x.fst} ${x.snd}\n"));

genMousebind =
let
binds = with cfg.config; zipLists (attrNames keybindings.pointer) (attrValues keybindings.pointer);
in
toString (forEach binds (x: "riverctl map-pointer normal ${x.fst} ${x.snd}\n"));
toString (forEach binds
(x: "riverctl map${optionalString (mode == "pointer") "-pointer"} ${if mode == "pointer" then "normal" else mode} ${x.fst} ${x.snd}\n"));

configFile = pkgs.writeShellScript "init" ''
### This file was generated with Nix. Don't modify this file directly.
Expand All @@ -30,31 +26,33 @@ let
riverctl declare-mode passthrough
# PASSTHROUGH KEYBINDINGS
${genKeybind "passthrough"}
${genBind "passthrough"}
# NORMAL KEYBINDINGS
${genKeybind "normal"}
${genBind "normal"}
# MOUSE BINDINGS
${genMousebind}
${genBind "pointer"}
# LOCKED KEYBINDINGS
${genKeybind "locked"}
${genBind "locked"}
riverctl declare-mode passthrough
# PASSTHROUGH KEYBINDINGS
${genKeybind "passthrough"}
${genBind "passthrough"}
riverctl background-color 0x${cfg.config.backgroundColor}
riverctl border-width ${toString cfg.config.border.width}
riverctl border-color-focused 0x${cfg.config.border.color.focused}
riverctl border-color-unfocused 0x${cfg.config.border.color.unfocused}
riverctl border-color-urgent 0x${cfg.config.border.color.urgent}
riverctl focus-follows-cursor ${if cfg.config.focusFollowsCursor then "normal" else "disabled"}
riverctl set-repeat ${cfg.config.repeatRate}
${cfg.extraConfig}
riverctl default-layout ${cfg.config.layoutGenerator.name}
exec ${cfg.config.layoutGenerator.name} ${cfg.config.layoutGenerator.arguments}
${cfg.extraConfig}
'';
in
{
Expand Down Expand Up @@ -106,13 +104,31 @@ in
default = "586e75";
description = "Unfocused border color.";
};

urgent = mkOption {
type = types.str;
default = "ff0000";
description = "Urgent border color.";
};
};
});
};

width = mkOption {
type = types.int;
default = 2;
description = "Width of the border in pixels.";
};
};
};
};

focusFollowsCursor = mkOption {
type = types.bool;
default = false;
description = "Whether to focus views with the mouse cursor.";
};

layoutGenerator = mkOption {
type = (types.submodule {
options = {
Expand All @@ -139,7 +155,7 @@ in

keybindings = mkOption {
type = types.attrs;

default = {
normal = { };
locked = { };
Expand All @@ -165,7 +181,7 @@ in
};

pointer = {
"Alt BTN_LEFT" = "move-view";
"Alt BTN_LEFT" = "move-view";
};
};
};
Expand Down
20 changes: 14 additions & 6 deletions users/fortuneteller2k/home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -378,20 +378,28 @@
config = with config.colorscheme.colors; {
backgroundColor = base03;

border.color = {
focused = base0D;
unfocused = base00;
border = {
color = {
focused = base0D;
unfocused = base02;
urgent = base08;
};

width = 4;
};

focusFollowsCursor = true;

layoutGenerator.arguments = "-view-padding 8 -outer-padding 8";

keybindings =
let
let
layoutCmd = cmd: "send-layout-cmd ${config.wayland.windowManager.river.config.layoutGenerator.name} '${cmd}'";
in lib.mkOptionDefault {
in
lib.mkOptionDefault {
normal = {
"Alt Return" = "spawn alacritty";
"Alt D" = "spawn bemenu-run ${config.home.sessionVariables.BEMENU_OPTS}";
"Alt D" = ''spawn "bemenu-run ${config.home.sessionVariables.BEMENU_OPTS}"'';
"Alt Q" = "close";
"Alt+Shift Q" = "exit";
"Alt S" = "swap next";
Expand Down

0 comments on commit 6b65b07

Please sign in to comment.