feat: switch back to river

nixos
Moritz Böhme 2024-08-20 13:58:45 +02:00
parent c249fab5cb
commit 781d06f3de
Signed by: moritz
GPG Key ID: 970C6E89EB0547A9
4 changed files with 384 additions and 57 deletions

View File

@ -20,10 +20,8 @@
webis.enable = true; webis.enable = true;
impermanence.enable = true; impermanence.enable = true;
}; };
programs.hyprland = { programs.river.enable = true;
enable = true; programs.hyprland.enable = false;
monitors.DP-3.scale = "auto";
};
programs.exercism.enable = true; programs.exercism.enable = true;
}; };

View File

@ -233,17 +233,16 @@ in
alsa.support32Bit = true; alsa.support32Bit = true;
pulse.enable = true; pulse.enable = true;
}; };
xserver = {
enable = true;
displayManager = { displayManager = {
lightdm.enable = true; enable = true;
autoLogin = { autoLogin = {
enable = true; enable = true;
user = "moritz"; user = "moritz";
}; };
defaultSession = "hyprland"; defaultSession = "hyprland";
}; };
}; xserver.enable = true;
xserver.displayManager.lightdm.enable = true;
}; };
security.rtkit.enable = true; security.rtkit.enable = true;

View File

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

View File

@ -0,0 +1,339 @@
* {
/* `otf-font-awesome` is required to be installed for icons */
font-family: FontAwesome, Roboto, Helvetica, Arial, sans-serif;
font-size: 13px;
}
window#waybar {
background-color: rgba(43, 48, 59, 0.5);
border-bottom: 3px solid rgba(100, 114, 125, 0.5);
color: #ffffff;
transition-property: background-color;
transition-duration: .5s;
}
window#waybar.hidden {
opacity: 0.2;
}
/*
window#waybar.empty {
background-color: transparent;
}
window#waybar.solo {
background-color: #FFFFFF;
}
*/
window#waybar.termite {
background-color: #3F3F3F;
}
window#waybar.chromium {
background-color: #000000;
border: none;
}
button {
/* Use box-shadow instead of border so the text isn't offset */
box-shadow: inset 0 -3px transparent;
/* Avoid rounded borders under each button name */
border: none;
border-radius: 0;
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
button:hover {
background: inherit;
box-shadow: inset 0 -3px #ffffff;
}
/* you can set a style on hover for any module like this */
#pulseaudio:hover {
background-color: #a37800;
}
#workspaces button {
padding: 0 5px;
background-color: transparent;
color: #ffffff;
}
#workspaces button:hover {
background: rgba(0, 0, 0, 0.2);
}
#workspaces button.focused {
background-color: #64727D;
box-shadow: inset 0 -3px #ffffff;
}
#workspaces button.urgent {
background-color: #eb4d4b;
}
#mode {
background-color: #64727D;
box-shadow: inset 0 -3px #ffffff;
}
#clock,
#battery,
#cpu,
#memory,
#disk,
#temperature,
#backlight,
#network,
#pulseaudio,
#wireplumber,
#custom-media,
#tray,
#mode,
#idle_inhibitor,
#scratchpad,
#power-profiles-daemon,
#mpd {
padding: 0 10px;
color: #ffffff;
}
#window,
#workspaces {
margin: 0 4px;
}
/* If workspaces is the leftmost module, omit left margin */
.modules-left > widget:first-child > #workspaces {
margin-left: 0;
}
/* If workspaces is the rightmost module, omit right margin */
.modules-right > widget:last-child > #workspaces {
margin-right: 0;
}
#clock {
background-color: #64727D;
}
#battery {
background-color: #ffffff;
color: #000000;
}
#battery.charging, #battery.plugged {
color: #ffffff;
background-color: #26A65B;
}
@keyframes blink {
to {
background-color: #ffffff;
color: #000000;
}
}
/* Using steps() instead of linear as a timing function to limit cpu usage */
#battery.critical:not(.charging) {
background-color: #f53c3c;
color: #ffffff;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: steps(12);
animation-iteration-count: infinite;
animation-direction: alternate;
}
#power-profiles-daemon {
padding-right: 15px;
}
#power-profiles-daemon.performance {
background-color: #f53c3c;
color: #ffffff;
}
#power-profiles-daemon.balanced {
background-color: #2980b9;
color: #ffffff;
}
#power-profiles-daemon.power-saver {
background-color: #2ecc71;
color: #000000;
}
label:focus {
background-color: #000000;
}
#cpu {
background-color: #2ecc71;
color: #000000;
}
#memory {
background-color: #9b59b6;
}
#disk {
background-color: #964B00;
}
#backlight {
background-color: #90b1b1;
}
#network {
background-color: #2980b9;
}
#network.disconnected {
background-color: #f53c3c;
}
#pulseaudio {
background-color: #f1c40f;
color: #000000;
}
#pulseaudio.muted {
background-color: #90b1b1;
color: #2a5c45;
}
#wireplumber {
background-color: #fff0f5;
color: #000000;
}
#wireplumber.muted {
background-color: #f53c3c;
}
#custom-media {
background-color: #66cc99;
color: #2a5c45;
min-width: 100px;
}
#custom-media.custom-spotify {
background-color: #66cc99;
}
#custom-media.custom-vlc {
background-color: #ffa000;
}
#temperature {
background-color: #f0932b;
}
#temperature.critical {
background-color: #eb4d4b;
}
#tray {
background-color: #2980b9;
}
#tray > .passive {
-gtk-icon-effect: dim;
}
#tray > .needs-attention {
-gtk-icon-effect: highlight;
background-color: #eb4d4b;
}
#idle_inhibitor {
background-color: #2d3436;
}
#idle_inhibitor.activated {
background-color: #ecf0f1;
color: #2d3436;
}
#mpd {
background-color: #66cc99;
color: #2a5c45;
}
#mpd.disconnected {
background-color: #f53c3c;
}
#mpd.stopped {
background-color: #90b1b1;
}
#mpd.paused {
background-color: #51a37a;
}
#language {
background: #00b093;
color: #740864;
padding: 0 5px;
margin: 0 5px;
min-width: 16px;
}
#keyboard-state {
background: #97e1ad;
color: #000000;
padding: 0 0px;
margin: 0 5px;
min-width: 16px;
}
#keyboard-state > label {
padding: 0 5px;
}
#keyboard-state > label.locked {
background: rgba(0, 0, 0, 0.2);
}
#scratchpad {
background: rgba(0, 0, 0, 0.2);
}
#scratchpad.empty {
background-color: transparent;
}
#privacy {
padding: 0;
}
#privacy-item {
padding: 0 5px;
color: white;
}
#privacy-item.screenshare {
background-color: #cf5700;
}
#privacy-item.audio-in {
background-color: #1ca000;
}
#privacy-item.audio-out {
background-color: #0069d4;
}
#tags button {
color: black;
}
#tags button.occupied {
color: white;
}
#tags button.focused {
background-color: grey;
}