river: now uses theme module and has (almost) parity with sway

This commit is contained in:
Aly Raffauf 2024-05-05 16:44:02 -04:00
parent 1a8db1b959
commit ab713e2c2f
2 changed files with 83 additions and 68 deletions

View file

@ -9,6 +9,16 @@
options = { options = {
alyraffauf.desktop.river.enable = alyraffauf.desktop.river.enable =
lib.mkEnableOption "Enable riverwm with extra apps."; lib.mkEnableOption "Enable riverwm with extra apps.";
alyraffauf.desktop.river.autoSuspend = lib.mkOption {
description = "Whether to autosuspend on idle.";
default = true;
type = lib.types.bool;
};
alyraffauf.desktop.river.gtkBorderFix = lib.mkOption {
description = "Fix GTK borders.";
default = false;
type = lib.types.bool;
};
}; };
config = lib.mkIf config.alyraffauf.desktop.river.enable { config = lib.mkIf config.alyraffauf.desktop.river.enable {
@ -43,61 +53,61 @@
xfce.xfce4-taskmanager xfce.xfce4-taskmanager
]; ];
xdg.configFile."xfce4/helpers.rc".text = ''
TerminalEmulator=alacritty
FileManager=thunar
WebBrowser=firefox
'';
xdg.portal = { xdg.portal = {
enable = true; enable = true;
configPackages = [pkgs.xdg-desktop-portal-wlr]; configPackages = [pkgs.xdg-desktop-portal-wlr];
extraPortals = [pkgs.xdg-desktop-portal-wlr]; extraPortals = [pkgs.xdg-desktop-portal-wlr];
}; };
gtk.gtk3.extraCss = '' # gtk.gtk3.extraCss =
/* No (default) title bar on wayland */ # if config.alyraffauf.desktop.river.gtkBorderFix
headerbar.default-decoration { # then ''
/* You may need to tweak these values depending on your GTK theme */ # /* No (default) title bar on wayland */
margin-bottom: 50px; # headerbar.default-decoration {
margin-top: -100px; # /* You may need to tweak these values depending on your GTK theme */
# margin-bottom: 50px;
# margin-top: -100px;
background: transparent; # background: transparent;
padding: 0; # padding: 0;
border: 0; # border: 0;
min-height: 0; # min-height: 0;
font-size: 0; # font-size: 0;
box-shadow: none; # box-shadow: none;
} # }
/* rm -rf window shadows */ # /* rm -rf window shadows */
window.csd, /* gtk4? */ # window.csd, /* gtk4? */
window.csd decoration { /* gtk3 */ # window.csd decoration { /* gtk3 */
box-shadow: none; # box-shadow: none;
} # }
''; # ''
# else "/* */";
gtk.gtk4.extraCss = '' # gtk.gtk4.extraCss =
/* No (default) title bar on wayland */ # if config.alyraffauf.desktop.river.gtkBorderFix
headerbar.default-decoration { # then ''
/* You may need to tweak these values depending on your GTK theme */ # /* No (default) title bar on wayland */
margin-bottom: 50px; # headerbar.default-decoration {
margin-top: -100px; # /* You may need to tweak these values depending on your GTK theme */
# margin-bottom: 50px;
# margin-top: -100px;
background: transparent; # background: transparent;
padding: 0; # padding: 0;
border: 0; # border: 0;
min-height: 0; # min-height: 0;
font-size: 0; # font-size: 0;
box-shadow: none; # box-shadow: none;
} # }
/* rm -rf window shadows */ # /* rm -rf window shadows */
window.csd, /* gtk4? */ # window.csd, /* gtk4? */
window.csd decoration { /* gtk3 */ # window.csd decoration { /* gtk3 */
box-shadow: none; # box-shadow: none;
} # }
''; # ''
# else "/* */";
programs.waybar.settings = { programs.waybar.settings = {
mainBar = { mainBar = {
@ -119,29 +129,25 @@
bar = pkgs.waybar + "/bin/waybar"; bar = pkgs.waybar + "/bin/waybar";
launcher = pkgs.fuzzel + "/bin/fuzzel"; launcher = pkgs.fuzzel + "/bin/fuzzel";
notifyd = pkgs.mako + "/bin/mako"; notifyd = pkgs.mako + "/bin/mako";
wallpaperd = pkgs.swaybg + "/bin/swaybg -i ~/.local/share/backgrounds/jr-korpa-9XngoIpxcEo-unsplash.jpg"; wallpaperd = pkgs.swaybg + "/bin/swaybg -i ${config.alyraffauf.desktop.theme.wallpaper}";
logout = pkgs.wlogout + "/bin/wlogout"; logout = pkgs.wlogout + "/bin/wlogout";
lock = pkgs.swaylock + "/bin/swaylock -l -f -c 303446 --indicator-idle-visible --font 'Noto SansM Nerd Font Regular' --ring-color ca9ee6 --inside-color 303446"; lock = pkgs.swaylock + "/bin/swaylock";
idled = idled =
if osConfig.networking.hostName == "mauville" if config.alyraffauf.desktop.river.autoSuspend
then '' then ''
${pkgs.swayidle}/bin/swayidle -w \ ${pkgs.swayidle}/bin/swayidle -w \
timeout 240 '${pkgs.brightnessctl}/bin/brightnessctl -s set 10' \ timeout 240 '${pkgs.brightnessctl}/bin/brightnessctl -s set 10' \
resume '${pkgs.brightnessctl}/bin/brightnessctl -r' \ resume '${pkgs.brightnessctl}/bin/brightnessctl -r' \
timeout 300 '${lock} \ timeout 300 '${lock}' \
timeout 330 '${config.wayland.windowManager.sway.package}/bin/swaymsg "output * dpms off"' \
resume '${config.wayland.windowManager.sway.package}/bin/swaymsg "output * dpms on"' \
before-sleep '${lock}' '' before-sleep '${lock}' ''
else '' else ''
${pkgs.swayidle}/bin/swayidle -w \ ${pkgs.swayidle}/bin/swayidle -w \
timeout 240 '${pkgs.brightnessctl}/bin/brightnessctl -s set 10' \ timeout 240 '${pkgs.brightnessctl}/bin/brightnessctl -s set 10' \
resume '${pkgs.brightnessctl}/bin/brightnessctl -r' \ resume '${pkgs.brightnessctl}/bin/brightnessctl -r' \
timeout 300 '${lock}' \ timeout 300 '${lock}' \
timeout 330 '${config.wayland.windowManager.sway.package}/bin/swaymsg "output * dpms off"' \
resume '${config.wayland.windowManager.sway.package}/bin/swaymsg "output * dpms on"' \
timeout 900 '${pkgs.systemd}/bin/systemctl suspend' \ timeout 900 '${pkgs.systemd}/bin/systemctl suspend' \
before-sleep '${lock}' ''; before-sleep '${lock}' '';
riverctl = pkgs.river + "/bin/riverctl"; riverctl = "${config.wayland.windowManager.river.package}/bin/riverctl";
brightness = "${pkgs.swayosd}/bin/swayosd-client"; brightness = "${pkgs.swayosd}/bin/swayosd-client";
brightness_up = "${brightness} --brightness=raise"; brightness_up = "${brightness} --brightness=raise";
@ -156,18 +162,13 @@
media_next = "${media} next"; media_next = "${media} next";
media_previous = "${media} previous"; media_previous = "${media} previous";
screenshot = "${pkgs.grim}/bin/grim"; screenshot = "${pkgs.shotman}/bin/shotman";
screenshot_folder = "~/pics/screenshots"; # screenshot_folder = "~/pics/screenshots";
screenshot_screen = "${screenshot} ${screenshot_folder}/$(date +'%s_grim.png')"; # screenshot_screen = "${screenshot} ${screenshot_folder}/$(date +'%s_grim.png')";
# screenshot_region = "${screenshot} -m region -o ${screenshot_folder}"; # screenshot_region = "${screenshot} -m region -o ${screenshot_folder}";
screenshot_screen = "${screenshot} --capture output";
screenshot_region = "${screenshot} --capture region";
# Color, themes, scaling
colorText = "#FAFAFA";
colorPrimary = "#CA9EE6EE";
colorSecondary = "#99D1DBEE";
colorInactive = "#303446AA";
drop_shadow = "#1A1A1AEE";
cursor_size = "24";
qt_platform_theme = "gtk2"; qt_platform_theme = "gtk2";
gdk_scale = "1.5"; gdk_scale = "1.5";
in '' in ''
@ -323,8 +324,8 @@
# Set background and border color # Set background and border color
${riverctl} background-color 0x00000000 ${riverctl} background-color 0x00000000
${riverctl} border-color-focused 0x${colorPrimary} ${riverctl} border-color-focused 0x${config.alyraffauf.desktop.theme.colors.primary}
${riverctl} border-color-unfocused 0x${colorSecondary} ${riverctl} border-color-unfocused 0x${config.alyraffauf.desktop.theme.colors.secondary}
# Set keyboard repeat rate # Set keyboard repeat rate
${riverctl} set-repeat 50 300 ${riverctl} set-repeat 50 300

View file

@ -5,14 +5,28 @@
... ...
}: let }: let
swaybg-random = pkgs.writeShellScriptBin "swaybg-random" '' swaybg-random = pkgs.writeShellScriptBin "swaybg-random" ''
kill `pidof swaybg`
OLD_PIDS=()
directory=${config.home.homeDirectory}/.local/share/backgrounds directory=${config.home.homeDirectory}/.local/share/backgrounds
if [ -d "$directory" ]; then if [ -d "$directory" ]; then
while true; do while true; do
kill `pidof swaybg` NEW_PIDS=()
random_background=$(ls $directory/*.{png,jpg} | shuf -n 1) random_background=$(ls $directory/*.{png,jpg} | shuf -n 1)
swaybg -i $random_background & ${pkgs.swaybg}/bin/swaybg -i $random_background &
sleep 300 NEW_PIDS+=($!)
sleep 5
for pid in ''${OLD_PIDS[@]}; do
kill $pid
done
OLD_PIDS=$NEW_PIDS
sleep 895
done done
fi fi
''; '';