modules: add river window manager

This commit is contained in:
Dmitriy Pleshevskiy 2024-04-23 18:17:06 +03:00
parent 522f71411c
commit 55817044e6
Signed by: pleshevskiy
GPG key ID: 17041163DA10A9A2
10 changed files with 152 additions and 9 deletions

View file

@ -248,6 +248,27 @@
"type": "github" "type": "github"
} }
}, },
"home-manager-unstable": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1713818326,
"narHash": "sha256-aw3xbVPJauLk/bbrlakIYxKpeuMWzA2feGrkIpIuXd8=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "67de98ae6eed5ad6f91b1142356d71a87ba97f21",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "master",
"repo": "home-manager",
"type": "github"
}
},
"home-manager_2": { "home-manager_2": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -255,11 +276,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1710888565, "lastModified": 1712386041,
"narHash": "sha256-s9Hi4RHhc6yut4EcYD50sZWRDKsugBJHSbON8KFwoTw=", "narHash": "sha256-dA82pOMQNnCJMAsPG7AXG35VmCSMZsJHTFlTHizpKWQ=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "f33900124c23c4eca5831b9b5eb32ea5894375ce", "rev": "d6bb9f934f2870e5cbc5b94c79e9db22246141ff",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -674,6 +695,7 @@
"flake-utils": "flake-utils_2", "flake-utils": "flake-utils_2",
"hardware": "hardware", "hardware": "hardware",
"home-manager": "home-manager_2", "home-manager": "home-manager_2",
"home-manager-unstable": "home-manager-unstable",
"lan-mouse": "lan-mouse", "lan-mouse": "lan-mouse",
"myneovim": "myneovim", "myneovim": "myneovim",
"nil": "nil", "nil": "nil",

View file

@ -17,6 +17,10 @@
url = "github:nix-community/home-manager/release-23.11"; url = "github:nix-community/home-manager/release-23.11";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
home-manager-unstable = {
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs";
};
wired = { wired = {
url = "github:Toqozz/wired-notify"; url = "github:Toqozz/wired-notify";
@ -140,6 +144,7 @@
./modules/home-manager ./modules/home-manager
inputs.wired.homeManagerModules.default inputs.wired.homeManagerModules.default
inputs.lan-mouse.homeManagerModules.default inputs.lan-mouse.homeManagerModules.default
"${inputs.home-manager-unstable}/modules/services/window-managers/river.nix"
]; ];
} }
]; ];

View file

@ -13,7 +13,7 @@
local.window-manager = { local.window-manager = {
xmonad.enable = false; xmonad.enable = false;
hyprland.enable = true; river.enable = true;
}; };
################################################################################ ################################################################################

View file

@ -9,7 +9,7 @@ in
home-manager.users.jan = { home-manager.users.jan = {
local.window-manager = { local.window-manager = {
hyprland.enable = true; river.enable = true;
polybar.enable = false; polybar.enable = false;
xmonad.enable = false; xmonad.enable = false;

View file

@ -3,7 +3,8 @@
{ {
imports = [ imports = [
./polybar.nix ./polybar.nix
./xmonad
./hyprland ./hyprland
./river
./xmonad
]; ];
} }

View file

@ -7,13 +7,12 @@ let
in in
{ {
options.local.window-manager.hyprland = with lib; { options.local.window-manager.hyprland = with lib; {
enable = mkEnableOption "hyperland window manager"; enable = mkEnableOption "hyprland window manager";
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = with pkgs.unstable; [ home.packages = with pkgs.unstable; [
wl-clipboard wl-clipboard
wlsunset
dmenu-wayland dmenu-wayland
]; ];

View file

@ -0,0 +1,94 @@
{ config, pkgs, lib, ... }:
let
cfg = config.local.window-manager.river;
pow = n: exp:
if exp == 1 then n
else if exp == 0 then 1
else n * pow n (exp - 1);
tile-cmd = c: ''send-layout-cmd rivertile "${c}"'';
in
{
options.local.window-manager.river = with lib; {
enable = mkEnableOption "river window manager";
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs.unstable; [
wl-clipboard
dmenu-wayland
];
wayland.windowManager.river = {
enable = true;
package = pkgs.unstable.river;
systemd.enable = true;
xwayland.enable = true;
settings = {
background-color = "0x002b36";
border-color-focused = "0x93a1a1";
border-color-unfocused = "0x586e75";
set-repeat = "50 300";
map.normal = lib.mkMerge (lib.flatten [
{
"Alt+Shift Return" = "spawn foot";
"Alt P" = "spawn dmenu-wl_run";
"Alt Space" = "toggle-fullscreen";
"Super+Shift C" = "close";
# system
"Super L" = "spawn waylock";
"Super+Shift Q" = "exit";
}
(lib.flip lib.mapAttrsToList { K = "previous"; J = "next"; } (k: d:
{
# focus window
"Alt ${k}" = "focus-view ${d}";
# swap windows
"Alt+Shift ${k}" = "swap ${d}";
}
))
# decrease/increase the main ration
{
"Alt H" = tile-cmd "main-ratio -0.01";
"Alt L" = tile-cmd "main-ratio +0.01";
"Alt Comma" = tile-cmd "main-count +1";
"Alt Period" = tile-cmd "main-count -1";
}
(lib.flip map [ 1 2 3 4 5 6 7 8 9 ] (i:
let wid = i - 1; in
let wtag = pow 2 wid; in
{
"Alt ${toString i}" = "set-focused-tags ${toString wtag}";
# set-view-tags ${wtag}
# toggle-focused-tags ${wtag}
# toggle-view-tags ${wtag}
}
))
]);
};
extraConfig = (
let kb = config.home.keyboard; in ''
riverctl keyboard-layout \
-model ${kb.model} \
-variant ${kb.variant} \
-options ${lib.head kb.options} \
${kb.layout}
riverctl default-layout rivertile
rivertile -view-padding 6 -outer-padding 6 &
''
);
};
};
}

View file

@ -61,7 +61,7 @@ in
color_scheme = "myCoolTheme", color_scheme = "myCoolTheme",
hide_tab_bar_if_only_one_tab = true, hide_tab_bar_if_only_one_tab = true,
-- https://github.com/wez/wezterm/issues/4483 -- https://github.com/wez/wezterm/issues/4483
enable_wayland = false, enable_wayland = true,
} }
''; '';
}; };

View file

@ -3,6 +3,7 @@
{ {
imports = [ imports = [
./hyprland.nix ./hyprland.nix
./river.nix
./xmonad.nix ./xmonad.nix
]; ];

View file

@ -0,0 +1,21 @@
{ config, lib, pkgs, ... }:
let
cfg = config.local.window-manager.river;
in
{
options.local.window-manager.river = with lib; {
enable = mkEnableOption "river window manager";
};
config = lib.mkIf cfg.enable {
programs.river = {
enable = true;
package = pkgs.unstable.river;
};
programs.gnupg.agent.pinentryFlavor = "gtk2";
local.lockscreen.waylock.enable = lib.mkDefault true;
};
}