2024-07-19 12:00:55 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
2024-07-18 04:08:27 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.modules.river;
|
2024-07-19 12:00:55 +00:00
|
|
|
in
|
|
|
|
{
|
2024-07-18 04:08:27 +00:00
|
|
|
options.modules.river.enable = lib.mkEnableOption "river";
|
|
|
|
|
|
|
|
# osConfig = lib.mkIf cfg.enable {
|
|
|
|
# programs.river.enable = true;
|
|
|
|
# };
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
2024-07-18 23:00:39 +00:00
|
|
|
# Set desktop type to wayland
|
|
|
|
modules.desktop.wayland = true;
|
2024-07-19 12:00:55 +00:00
|
|
|
|
2024-07-19 11:59:26 +00:00
|
|
|
# TODO: Move elsewhere and make keybindings more configurable
|
|
|
|
modules.rofi.enable = true;
|
2024-07-18 23:00:39 +00:00
|
|
|
|
2024-07-31 11:39:09 +00:00
|
|
|
# TODO: Move elsewhere
|
|
|
|
home.packages = with pkgs; [
|
|
|
|
brightnessctl
|
2024-09-02 18:03:39 +00:00
|
|
|
river-filtile
|
2024-07-31 11:39:09 +00:00
|
|
|
# owm
|
2025-01-23 23:28:22 +00:00
|
|
|
|
|
|
|
udiskie # TODO: Move to USB module
|
2024-07-31 11:39:09 +00:00
|
|
|
];
|
|
|
|
|
2024-07-18 04:08:27 +00:00
|
|
|
# Change desktop to execute river
|
|
|
|
modules.desktop.initScript = ''
|
|
|
|
river
|
|
|
|
'';
|
|
|
|
|
2024-12-01 23:52:01 +00:00
|
|
|
modules.desktop.reloadScript = ''
|
|
|
|
${pkgs.river}/bin/riverctl background-color 0x${config.theming.colors.bg}
|
|
|
|
'';
|
|
|
|
|
2024-07-19 01:34:42 +00:00
|
|
|
# Update background after rebuild
|
2024-07-31 11:39:09 +00:00
|
|
|
# home.activation = {
|
|
|
|
# river = lib.hm.dag.entryBetween [ "reloadSystemd" ] [ "installPackages" ] ''
|
|
|
|
# # Close waybar
|
|
|
|
# PATH="${pkgs.procps}/bin:$PATH" $DRY_RUN_CMD pkill waybar
|
2024-07-19 01:34:42 +00:00
|
|
|
|
2024-07-31 11:39:09 +00:00
|
|
|
# # Kill rivertile
|
|
|
|
# PATH="${pkgs.procps}/bin:$PATH" $DRY_RUN_CMD pkill rivertile
|
2024-07-19 01:51:40 +00:00
|
|
|
|
2024-07-31 11:39:09 +00:00
|
|
|
# # Kill glpaper
|
|
|
|
# PATH="${pkgs.procps}/bin:$PATH" $DRY_RUN_CMD pkill glpaper
|
2024-07-20 04:10:56 +00:00
|
|
|
|
2024-07-31 11:39:09 +00:00
|
|
|
# # Restart river
|
|
|
|
# PATH="${pkgs.river}/bin:${pkgs.systemd}/bin:${pkgs.waybar}/bin:$PATH" $DRY_RUN_CMD ~/.config/river/init
|
|
|
|
# '';
|
|
|
|
# };
|
2024-07-19 01:34:42 +00:00
|
|
|
|
2024-07-18 04:08:27 +00:00
|
|
|
# River setup
|
|
|
|
wayland.windowManager.river = {
|
|
|
|
enable = true;
|
|
|
|
xwayland.enable = true;
|
2024-07-19 12:00:55 +00:00
|
|
|
settings =
|
|
|
|
let
|
2024-09-02 18:03:39 +00:00
|
|
|
layout = "filtile";
|
2024-07-19 12:00:55 +00:00
|
|
|
layoutOptions = "-outer-padding ${toString config.theming.layout.windowPadding} -view-padding ${toString config.theming.layout.windowPadding}";
|
|
|
|
modes = [
|
|
|
|
"normal"
|
|
|
|
"locked"
|
|
|
|
];
|
|
|
|
tags = [
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
7
|
|
|
|
8
|
|
|
|
9
|
|
|
|
];
|
2024-07-19 19:54:41 +00:00
|
|
|
waylockOptions = "-init-color 0x${colors.bg} -input-color 0x${colors.border-focused} -fail-color 0x${colors.bg}";
|
2024-07-19 12:00:55 +00:00
|
|
|
|
|
|
|
colors = config.theming.colors;
|
|
|
|
|
|
|
|
# Quick pow function
|
|
|
|
pow2 = power: if power != 0 then 2 * (pow2 (power - 1)) else 1;
|
|
|
|
|
|
|
|
# Modifiers
|
|
|
|
main = "Super";
|
|
|
|
ssm = "Super+Shift";
|
|
|
|
sas = "Super+Alt+Shift";
|
|
|
|
sam = "Super+Alt";
|
|
|
|
scm = "Super+Control";
|
|
|
|
scam = "Super+Control+Alt";
|
|
|
|
ssc = "Super+Shift+Control";
|
|
|
|
in
|
|
|
|
{
|
|
|
|
default-layout = "${layout}";
|
|
|
|
set-repeat = "50 300";
|
|
|
|
xcursor-theme = "BreezeX-RosePine-Linux 24";
|
|
|
|
keyboard-layout = "-options \"caps:escape\" us";
|
|
|
|
|
|
|
|
border-width = toString config.theming.layout.borderSize;
|
|
|
|
background-color = "0x${colors.bg}";
|
|
|
|
border-color-focused = "0x${colors.fg}";
|
2024-07-19 19:54:41 +00:00
|
|
|
border-color-unfocused = "0x${colors.border-unfocused}"; # TODO: Change to use named color;
|
2024-07-19 12:00:55 +00:00
|
|
|
border-color-urgent = "0x${colors.fg}";
|
|
|
|
|
2025-01-23 23:28:22 +00:00
|
|
|
# TODO: Make a desktop options for DE applications
|
2024-07-19 12:00:55 +00:00
|
|
|
spawn = [
|
|
|
|
"\"${layout} ${layoutOptions}\""
|
2024-12-01 23:52:01 +00:00
|
|
|
"waybar" # TODO: Decouple
|
2024-07-20 04:10:56 +00:00
|
|
|
"\"glpaper eDP-1 ${toString config.modules.glpaper.shader}\""
|
2025-01-23 23:28:22 +00:00
|
|
|
"udiskie"
|
2024-07-19 12:00:55 +00:00
|
|
|
];
|
|
|
|
map = (
|
|
|
|
lib.attrsets.recursiveUpdate
|
2024-09-02 18:03:39 +00:00
|
|
|
{
|
2024-07-19 12:00:55 +00:00
|
|
|
normal =
|
|
|
|
{
|
|
|
|
"${main} Q" = "close";
|
|
|
|
"${ssm} E" = "exit";
|
|
|
|
|
|
|
|
# Basic utilities
|
|
|
|
"${main} X " = "spawn \"waylock -fork-on-lock ${waylockOptions}\"";
|
|
|
|
"${ssm} Return" = "spawn foot";
|
|
|
|
"${main} P" = "spawn \"rofi -show drun\"";
|
|
|
|
"${ssm} P" = "spawn rofi-rbw";
|
2025-01-23 23:28:22 +00:00
|
|
|
"${main} S" =
|
|
|
|
"spawn \"grim -g \\\"\\\$(slurp)\\\" ~/Images/Screenshots/\\\$(date +'%s_grim.png')\"";
|
2024-07-19 12:00:55 +00:00
|
|
|
|
|
|
|
# Window focus
|
|
|
|
"${main} J" = "focus-view next";
|
|
|
|
"${main} K" = "focus-view previous";
|
|
|
|
|
|
|
|
# Swap windows
|
|
|
|
"${ssm} J" = "swap next";
|
|
|
|
"${ssm} K" = "swap previous";
|
|
|
|
"${main} Return" = "zoom";
|
|
|
|
|
|
|
|
# Main ratio
|
2024-09-02 18:03:39 +00:00
|
|
|
"${main} H" = "send-layout-cmd ${layout} 'main-ratio -0.05'";
|
|
|
|
"${main} L" = "send-layout-cmd ${layout} 'main-ratio +0.05'";
|
2024-07-19 12:00:55 +00:00
|
|
|
|
|
|
|
# Main count
|
2024-09-02 18:03:39 +00:00
|
|
|
"${ssm} H" = "send-layout-cmd ${layout} 'main-count +1'";
|
|
|
|
"${ssm} L" = "send-layout-cmd ${layout} 'main-count -1'";
|
2024-07-19 12:00:55 +00:00
|
|
|
|
|
|
|
# Tags
|
|
|
|
"${main} 0" = "set-focused-tags ${toString (pow2 32 - 1)}";
|
|
|
|
"${ssm} 0" = "set-view-tags ${toString (pow2 32 - 1)}";
|
|
|
|
|
|
|
|
# Orientation
|
2024-09-02 18:03:39 +00:00
|
|
|
"${main} Up" = "send-layout-cmd ${layout} \"main-location top\"";
|
|
|
|
"${main} Right" = "send-layout-cmd ${layout} \"main-location right\"";
|
|
|
|
"${main} Down" = "send-layout-cmd ${layout} \"main-location bottom\"";
|
|
|
|
"${main} Left" = "send-layout-cmd ${layout} \"main-location left\"";
|
2024-07-19 12:00:55 +00:00
|
|
|
|
|
|
|
# Move floating windows
|
|
|
|
"${sam} H" = "move left 100";
|
|
|
|
"${sam} J" = "move down 100";
|
|
|
|
"${sam} K" = "move up 100";
|
|
|
|
"${sam} L" = "move right 100";
|
|
|
|
|
|
|
|
# Snap floating windows
|
|
|
|
"${scam} H" = "snap left";
|
|
|
|
"${scam} J" = "snap down";
|
|
|
|
"${scam} K" = "snap up";
|
|
|
|
"${scam} L" = "snap right";
|
|
|
|
|
|
|
|
# Resize floating windows
|
|
|
|
"${sas} H" = "resize horizontal -100";
|
|
|
|
"${sas} J" = "resize vertical 100";
|
|
|
|
"${sas} K" = "resize vertical -100";
|
|
|
|
"${sas} L" = "resize horizontal 100";
|
|
|
|
|
|
|
|
# Toggle modes
|
|
|
|
"${main} Space" = "toggle-float";
|
|
|
|
"${main} F" = "toggle-fullscreen";
|
|
|
|
}
|
|
|
|
// builtins.listToAttrs (
|
|
|
|
builtins.concatLists (
|
|
|
|
map (tag: [
|
|
|
|
{
|
|
|
|
name = "${main} ${toString tag}";
|
|
|
|
value = "set-focused-tags ${toString (pow2 (tag - 1))}";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "${ssm} ${toString tag}";
|
|
|
|
value = "set-view-tags ${toString (pow2 (tag - 1))}";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "${scm} ${toString tag}";
|
|
|
|
value = "toggle-focused-tags ${toString (pow2 (tag - 1))}";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "${ssc} ${toString tag}";
|
|
|
|
value = "toggle-view-tags ${toString (pow2 (tag - 1))}";
|
|
|
|
}
|
|
|
|
]) tags
|
|
|
|
)
|
|
|
|
);
|
2024-09-02 18:03:39 +00:00
|
|
|
}
|
2024-07-19 12:00:55 +00:00
|
|
|
(
|
|
|
|
builtins.listToAttrs (
|
|
|
|
map (mode: {
|
|
|
|
name = "${mode}";
|
|
|
|
value = {
|
|
|
|
# Control volume
|
|
|
|
"None XF86AudioRaiseVolume" = "spawn \"pulsemixer --change-volume +5\"";
|
|
|
|
"None XF86AudioLowerVolume" = "spawn \"pulsemixer --change-volume -5\"";
|
|
|
|
"None XF86AudioMute" = "spawn \"pulsemixer --toggle-mute\"";
|
|
|
|
|
|
|
|
# Control brightness
|
|
|
|
"None XF86MonBrightnessUp" = "spawn \"brightnessctl set +5%\"";
|
|
|
|
"None XF86MonBrightnessDown" = "spawn \"brightnessctl set 5%-\"";
|
|
|
|
|
|
|
|
# Control music playback
|
|
|
|
"None XF86Messenger" = "spawn \"playerctl previous\"";
|
|
|
|
"None XF86Go" = "spawn \"playerctl play-pause\"";
|
|
|
|
"None Cancel" = "spawn \"playerctl next\"";
|
|
|
|
};
|
|
|
|
}) modes
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
map-pointer = {
|
|
|
|
normal = {
|
|
|
|
"${main} BTN_LEFT" = "move-view";
|
|
|
|
"${main} BTN_RIGHT" = "resize-view";
|
|
|
|
"${main} BTN_MIDDLE" = "toggle-float";
|
|
|
|
};
|
2024-07-18 04:08:27 +00:00
|
|
|
};
|
2024-07-19 12:00:55 +00:00
|
|
|
input = {
|
|
|
|
"'*'" = {
|
|
|
|
accel-profile = "adaptive";
|
|
|
|
pointer-accel = "0.5";
|
|
|
|
scroll-factor = "0.8";
|
|
|
|
};
|
|
|
|
"'*Synaptics*'" = {
|
|
|
|
natural-scroll = "enabled";
|
|
|
|
};
|
2024-07-18 04:08:27 +00:00
|
|
|
};
|
2024-07-19 12:00:55 +00:00
|
|
|
rule-add = {
|
|
|
|
"-app-id" = {
|
|
|
|
"'bar'" = "csd";
|
|
|
|
"'*'" = "ssd";
|
2024-07-31 11:39:09 +00:00
|
|
|
"'wpa_gui'" = "float";
|
2024-07-19 12:00:55 +00:00
|
|
|
};
|
2024-07-18 04:08:27 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|