feat: switch back to river

This commit is contained in:
Moritz Böhme 2024-08-20 13:58:45 +02:00
parent c249fab5cb
commit 781d06f3de
No known key found for this signature in database
GPG key ID: 970C6E89EB0547A9
4 changed files with 384 additions and 57 deletions

View file

@ -1,12 +1,13 @@
{ config
, lib
, pkgs
, inputs
, ...
} @ args:
}:
with lib;
let
inherit (lib) mkEnableOption mkIf mkOption types;
cfg = config.my.programs.river;
in
{
@ -15,7 +16,7 @@ in
keyboardLayouts = mkOption {
type = types.listOf types.str;
description = "list of keyboard layouts";
default = [ "de" "us" ];
default = [ "us" ];
};
nvidiaSupport = mkEnableOption "nvidiaSupport";
};
@ -25,7 +26,7 @@ in
my = {
programs = {
wallpaper.enable = true;
foot.enable = true;
kitty.enable = true;
tofi.enable = true;
};
wallpapers.enable = true;
@ -49,22 +50,6 @@ in
};
wayland.windowManager.river = {
enable = true;
package = pkgs.river.overrideAttrs (old: {
src = inputs.river;
version = lib.my.mkVersionInput inputs.river;
# HACK: to change wlroots to 0.17.x
buildInputs = with pkgs; [
libGL
libevdev
libinput
libxkbcommon
pixman
udev
wayland-protocols
wlroots_0_17
xorg.libX11
];
});
settings = {
border-width = 2;
declare-mode = [
@ -75,8 +60,7 @@ in
map = {
normal = {
"Super Q" = "close";
"Super Return" = ''spawn "systemctl --user is-active --quiet foot && footclient --no-wait || foot"'';
"Super+Shift Return" = "spawn foot";
"Super Return" = "spawn kitty";
"Super R" = ''spawn 'exec $(tofi-run --fuzzy-match=true)' '';
"Super W" = ''spawn "pkill -USR1 waybar"'';
"Super+Shift R" = "spawn ~/.config/river/init";
@ -100,11 +84,13 @@ in
# bump in layout stack
"Super Z" = "zoom";
# lock screen
"Super+Alt L" = ''spawn "loginctl lock-session"'';
} //
# tags
(
let
numbers = range 1 9;
numbers = lib.range 1 9;
toTag = num: "$((1 << (${toString num} - 1)))";
mkMappings = num:
@ -114,14 +100,14 @@ in
in
[
# Super+Control+[1-9] to toggle focus of tag [0-8]
{ name = "Super ${numStr}"; value = "toggle-focused-tags ${tag}"; }
{ name = "Super ${numStr}"; value = "set-focused-tags ${tag}"; }
# Super+Shift+Control+[1-9] to toggle tag [0-8] of focused view
{ name = "Super+Shift ${numStr}"; value = "toggle-view-tags ${tag}"; }
];
mappings = flatten (map mkMappings numbers);
mappings = lib.flatten (map mkMappings numbers);
in
listToAttrs mappings
lib.listToAttrs mappings
);
};
map-pointer = {
@ -139,6 +125,7 @@ in
when-typing = "enabled";
};
set-cursor-warp = "on-focus-change";
keyboard-layout = "-options grp:win_space_toggle,caps:escape ${lib.concatStringsSep "," cfg.keyboardLayouts}";
};
extraConfig = /* bash */ ''
rivercarro_pid="$(pidof rivercarro)"
@ -151,6 +138,14 @@ in
# add waybar as a status bar
programs.waybar = {
enable = true;
package = pkgs.waybar.overrideAttrs (old: {
patches = old.patches or [ ] ++ [
(pkgs.fetchpatch {
url = "https://gitlab.archlinux.org/archlinux/packaging/packages/waybar/-/raw/0306af03fcb6de6aee1e288f42b0bf1b223513bd/a544f4b2cdcf632f1a4424b89f6e3d85ef5aaa85.patch";
sha256 = "sha256-S/1oUj9Aj6BElNTsDY8CTcKtS1j7Gl54JFgCywH05pg=";
})
];
});
# start using systemd service
systemd = {
@ -169,11 +164,7 @@ in
modules-right = [ "network" "memory" "cpu" "battery" "clock" ];
};
};
style = ''
#tags button.focused {
color: #ffffff
}
'';
style = lib.readFile ./style.css;
};
# lock screen after timeout
@ -188,11 +179,11 @@ in
events = [
{
event = "before-sleep";
command = "${getExe pkgs.swaylock} -fF";
command = "${lib.getExe pkgs.swaylock} -fF";
}
{
event = "lock";
command = "${getExe pkgs.swaylock} -fF";
command = "${lib.getExe pkgs.swaylock} -fF";
}
];
timeouts =
@ -239,7 +230,7 @@ in
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
QT_QPA_PLATFORMTHEME = "qt5ct";
_JAVA_AWT_WM_NONEREPARENTING = "1";
} // (optionalAttrs cfg.nvidiaSupport
} // (lib.optionalAttrs cfg.nvidiaSupport
{
GBM_BACKEND = "nvidia-drm";
GDK_BACKEND = "wayland";
@ -263,16 +254,16 @@ in
alsa.support32Bit = true;
pulse.enable = true;
};
displayManager = {
autoLogin = {
enable = true;
user = "moritz";
};
defaultSession = "river";
};
xserver = {
enable = true;
displayManager = {
lightdm.enable = true;
autoLogin = {
enable = true;
user = "moritz";
};
defaultSession = "river";
};
displayManager.lightdm.enable = true;
};
};
security.rtkit.enable = true;
@ -287,7 +278,7 @@ in
};
};
in
genAttrs units mkAfter;
lib.genAttrs units mkAfter;
systemd.user.services =
let
@ -297,6 +288,6 @@ in
wants = [ "river-session.target" ];
};
in
genAttrs units mkAfter;
lib.genAttrs units mkAfter;
};
}