home: added initial riverwm config

This commit is contained in:
Aly Raffauf 2024-04-13 16:44:22 -04:00
parent 6d180fcd74
commit a521544cda
6 changed files with 410 additions and 273 deletions

View file

@ -4,7 +4,8 @@
pkgs,
...
}: {
imports = [./gnome ./hypr ./sway];
imports = [./gnome ./hypr ./sway ./river];
desktopEnv.hyprland.enable = lib.mkDefault true;
desktopEnv.river.enable = lib.mkDefault true;
}

View file

@ -1,270 +0,0 @@
# See https://wiki.hyprland.org/Configuring/Monitors/
# For lavaridge.
monitor=desc:BOE 0x0BCA,preferred,auto,1.566667
monitor=desc:BOE 0x095F,preferred,auto,1.566667
# For mauville.
monitor=desc:LG Electronics LG ULTRAWIDE 311NTAB5M720,preferred,auto,1.25,vrr,2
# For rustboro.
monitor=desc:LG Display 0x0569,preferred,auto,1.2
# For petalburg.
monitor=desc:Samsung Display Corp. 0x4152,preferred,auto,2
# Workshop monitor.
monitor=desc:Guangxi Century Innovation Display Electronics Co. Ltd 27C1U-D 0000000000001,preferred,-2560x0,1.5
# Use best settings for all other monitors.
monitor=,preferred,auto,auto
# unscale XWayland
xwayland {
force_zero_scaling = true
}
# toolkit-specific scale
env = GDK_SCALE,1.5
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
# Basic apps
$terminal = alacritty
$fileManager = thunar
$browser = firefox
$editor = codium
# Shell utilities
$bar = waybar
$launcher = fuzzel
$notifications = mako
$wallpaper = hyprpaper
# Some default env vars.
env = XCURSOR_SIZE,24
# env = QT_QPA_PLATFORMTHEME,gtk
# Execute your favorite apps at launch
exec-once = dbus-update-activation-environment --systemd HYPRLAND_INSTANCE_SIGNATURE
exec-once = hyprshade auto
exec-once = $wallpaper
exec-once = $bar
exec-once = $notifications
exec-once = wl-paste --type text --watch cliphist store #Stores only text data
exec-once = wl-paste --type image --watch cliphist store #Stores only image data
exec-once = hypridle
# Source a file (multi-file configs)
# source = ~/.config/hypr/myColors.conf
# For all categories, see https://wiki.hyprland.org/Configuring/Variables/
input {
kb_layout = us
follow_mouse = 1
touchpad {
clickfinger_behavior = true
drag_lock = true
middle_button_emulation = true
natural_scroll = yes
tap-to-click = true
}
sensitivity = 0 # -1.0 to 1.0, 0 means no modification.
}
general {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
gaps_in = 5
gaps_out = 10
border_size = 2
col.active_border = rgba(99d1dbee) rgba(ca9ee6ee) 45deg
col.inactive_border = rgba(303446aa)
layout = dwindle
# Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on
allow_tearing = false
}
decoration {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
rounding = 10
blur {
enabled = true
size = 8
passes = 1
}
drop_shadow = yes
shadow_range = 4
shadow_render_power = 3
col.shadow = rgba(1a1a1aee)
dim_special = 0.5
layerrule = blur, $bar
layerrule = ignorezero, $bar
layerrule = blur, launcher
layerrule = blur, notifications
layerrule = ignorezero, notifications
layerrule = blur, logout_dialog
}
animations {
enabled = yes
# Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more
bezier = myBezier, 0.05, 0.9, 0.1, 1.05
animation = windows, 1, 7, myBezier
animation = windowsOut, 1, 7, default, popin 80%
animation = border, 1, 10, default
animation = borderangle, 1, 8, default
animation = fade, 1, 7, default
animation = workspaces, 1, 6, default
animation = specialWorkspace, 1, 6, default, slidevert
}
dwindle {
# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
preserve_split = yes # you probably want this
}
master {
# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
new_is_master = false
always_center_master = true
}
gestures {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
workspace_swipe = true
}
misc {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
disable_splash_rendering = true
disable_hyprland_logo = true
vfr = true
focus_on_activate = true
}
# Example windowrule v1
# windowrule = float, ^(kitty)$
# Example windowrule v2
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
windowrulev2 = suppressevent maximize, class:.* # You'll probably like this.
# PavuControl, nmtui, and blueberry float.
windowrulev2 = float,class:(pavucontrol)
windowrulev2 = center(1),class:(pavucontrol)
windowrulev2 = float,class:(nmtui)
windowrulev2 = center(1),class:(nmtui)
windowrulev2 = float,class:(blueberry.py)
windowrulev2 = center(1),class:(blueberry.py)
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
$mainMod = SUPER
# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
bind = $mainMod, T, exec, $terminal
bind = $mainMod, F, exec, $fileManager
bind = $mainMod, B, exec, $browser
bind = $mainMod, E, exec, $editor
bind = $mainMod, R, exec, $launcher
# Manage session.
bind = $mainMod, C, killactive,
bind = $mainMod, M, exec, wlogout
bind = $mainMod, L, exec, hyprlock --immediate
# Basic window management.
bind = $mainMod SHIFT, W, fullscreen
bind = $mainMod SHIFT, V, togglefloating,
bind = $mainMod SHIFT, P, pseudo, # dwindle
bind = $mainMod SHIFT, J, togglesplit, # dwindle
# Move focus with mainMod + arrow keys
bind = $mainMod, left, movefocus, l
bind = $mainMod, right, movefocus, r
bind = $mainMod, up, movefocus, u
bind = $mainMod, down, movefocus, d
# Gnome-like workspaces.
bind = $mainMod, 1, exec, hyprnome --previous
bind = $mainMod, 2, exec, hyprnome
bind = $mainMod SHIFT, 1, exec, hyprnome --previous --move
bind = $mainMod SHIFT, 2, exec, hyprnome --move
# # Switch workspaces with mainMod + [0-9]
# bind = $mainMod, 1, workspace, 1
# bind = $mainMod, 2, workspace, 2
# bind = $mainMod, 3, workspace, 3
# bind = $mainMod, 4, workspace, 4
# bind = $mainMod, 5, workspace, 5
# bind = $mainMod, 6, workspace, 6
# bind = $mainMod, 7, workspace, 7
# bind = $mainMod, 8, workspace, 8
# bind = $mainMod, 9, workspace, 9
# bind = $mainMod, 0, workspace, 10
# # Move active window to a workspace with mainMod + SHIFT + [0-9]
# bind = $mainMod SHIFT, 1, movetoworkspace, 1
# bind = $mainMod SHIFT, 2, movetoworkspace, 2
# bind = $mainMod SHIFT, 3, movetoworkspace, 3
# bind = $mainMod SHIFT, 4, movetoworkspace, 4
# bind = $mainMod SHIFT, 5, movetoworkspace, 5
# bind = $mainMod SHIFT, 6, movetoworkspace, 6
# bind = $mainMod SHIFT, 7, movetoworkspace, 7
# bind = $mainMod SHIFT, 8, movetoworkspace, 8
# bind = $mainMod SHIFT, 9, movetoworkspace, 9
# bind = $mainMod SHIFT, 0, movetoworkspace, 10
# Example special workspace (scratchpad)
bind = $mainMod, S, togglespecialworkspace, magic
bind = $mainMod SHIFT, S, movetoworkspace, special:magic
# Scroll through existing workspaces with mainMod + scroll
bind = $mainMod, mouse_down, workspace, e+1
bind = $mainMod, mouse_up, workspace, e-1
# Move/resize windows with mainMod + LMB/RMB and dragging
bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow
# Adjust display brightness.
bindle = , xf86monbrightnessup, exec, brightnessctl set 5%+
bindle = , xf86monbrightnessdown, exec, brightnessctl set 5%-
# Adjust volume and play/pause.
bindle = , xf86audioraisevolume, exec, wpctl set-volume -l 1.0 @DEFAULT_SINK@ 5%+
bindle = , xf86audiolowervolume, exec, wpctl set-volume -l 1.0 @DEFAULT_SINK@ 5%-
bindl = , xf86audiomute, exec, wpctl set-mute @DEFAULT_SINK@ toggle
bindl = , xf86audioplay, exec, playerctl play-pause
bindl = , xf86audioprev, exec, playerctl previous
bindl = , xf86audionext, exec, playerctl next
# Extra bindings for petalburg.
bind = , xf86launch4, exec, pp-adjuster
# bind = ,xf86launch1, exec, cs-adjuster
bind = , xf86launch2, exec, playerctl play-pause
# Screenshot with hyprshot.
bind = , PRINT, exec, hyprshot -m output -o ~/Pictures/Screenshots
# Show/hide waybar.
bind = $mainMod, F11, exec, pkill -SIGUSR1 $bar

View file

@ -0,0 +1,328 @@
{
pkgs,
lib,
config,
...
}: {
options = {
desktopEnv.river.enable =
lib.mkEnableOption "Enable riverwm with extra apps.";
};
config = lib.mkIf config.desktopEnv.river.enable {
# Basic apps needed to run a hyprland desktop.
guiApps.waybar.enable = lib.mkDefault true;
guiApps.mako.enable = lib.mkDefault true;
guiApps.fuzzel.enable = lib.mkDefault true;
guiApps.wlogout.enable = lib.mkDefault true;
guiApps.alacritty.enable = lib.mkDefault true;
guiApps.firefox.enable = lib.mkDefault true;
# Packages that should be installed to the user profile.
home.packages = with pkgs; [
# brightnessctl
# hyprnome
celluloid
evince
gnome.eog
gnome.file-roller
kanshi
kdePackages.polkit-kde-agent-1
networkmanagerapplet
playerctl
swayosd
trayscale
xfce.exo
xfce.thunar
xfce.thunar-archive-plugin
xfce.thunar-media-tags-plugin
xfce.thunar-volman
xfce.tumbler
xfce.xfce4-settings
xfce.xfce4-taskmanager
xfce.xfconf
];
services.cliphist.enable = lib.mkDefault true;
services.kanshi.enable = true;
services.kanshi.profiles.framework = {
outputs = [
{
status = "enable";
criteria = "BOE 0x095F";
scale = 1.5;
}
];
};
xdg.configFile."xfce4/helpers.rc".text = ''
TerminalEmulator=alacritty
FileManager=thunar
WebBrowser=firefox
'';
xdg.portal = {
enable = true;
configPackages = [pkgs.xdg-desktop-portal-hyprland];
extraPortals = [pkgs.xdg-desktop-portal-hyprland];
};
gtk.gtk3.extraCss = ''
/* No (default) title bar on wayland */
headerbar.default-decoration {
/* You may need to tweak these values depending on your GTK theme */
margin-bottom: 50px;
margin-top: -100px;
background: transparent;
padding: 0;
border: 0;
min-height: 0;
font-size: 0;
box-shadow: none;
}
/* rm -rf window shadows */
window.csd, /* gtk4? */
window.csd decoration { /* gtk3 */
box-shadow: none;
}
'';
gtk.gtk4.extraCss = ''
/* No (default) title bar on wayland */
headerbar.default-decoration {
/* You may need to tweak these values depending on your GTK theme */
margin-bottom: 50px;
margin-top: -100px;
background: transparent;
padding: 0;
border: 0;
min-height: 0;
font-size: 0;
box-shadow: none;
}
/* rm -rf window shadows */
window.csd, /* gtk4? */
window.csd decoration { /* gtk3 */
box-shadow: none;
}
'';
wayland.windowManager.river.enable = true;
wayland.windowManager.river.extraConfig = let
modifier = "Super";
# Default apps
browser = pkgs.firefox + "/bin/firefox";
fileManager = pkgs.xfce.thunar + "/bin/thunar";
editor = pkgs.vscodium + "/bin/codium";
terminal = pkgs.alacritty + "/bin/alacritty";
# Hyprland desktop utilities
bar = pkgs.waybar + "/bin/waybar";
launcher = pkgs.fuzzel + "/bin/fuzzel";
notifyd = pkgs.mako + "/bin/mako";
# wallpaperd = pkgs.hyprpaper + "/bin/hyprpaper";
# idle = pkgs.hypridle + "/bin/hypridle";
logout = pkgs.wlogout + "/bin/wlogout";
# lock = pkgs.hyprlock + "/bin/hyprlock --immediate";
brightness = "${pkgs.swayosd}/bin/swayosd-client";
brightness_up = "${brightness} --brightness=raise";
brightness_down = "${brightness} --brightness=lower";
volume = "${pkgs.swayosd}/bin/swayosd-client";
volume_up = "${volume} --output-volume=raise";
volume_down = "${volume} --output-volume=lower";
volume_mute = "${volume} --output-volume=mute-toggle";
mic_mute = "${volume} --input-volume=mute-toggle";
media = "${pkgs.playerctl}/bin/playerctl";
media_play = "${media} play-pause";
media_next = "${media} next";
media_previous = "${media} previous";
# screenshot = "${pkgs.hyprshot}/bin/hyprshot";
# screenshot_folder = "~/pics/screenshots";
# screenshot_screen = "${screenshot} -m output -o ${screenshot_folder}";
# screenshot_region = "${screenshot} -m region -o ${screenshot_folder}";
# Color, themes, scaling
border_primary = "ca9ee6ee";
border_secondary = "99d1dbee";
border_inactive = "303446aa";
drop_shadow = "1a1a1aee";
cursor_size = "24";
qt_platform_theme = "gtk2";
gdk_scale = "1.5";
in ''
touchpad=`riverctl list-inputs|grep -i touchpad`
for t in ''${touchpad[@]}; do
riverctl input $t natural-scroll enabled
riverctl input $t click-method clickfinger
riverctl input $t tap enabled
riverctl input $t disable-while-typing enabled
done
riverctl focus-follows-cursor always
riverctl map normal ${modifier} T spawn ${terminal}
riverctl map normal ${modifier} R spawn ${launcher}
riverctl map normal ${modifier} B spawn ${browser}
riverctl map normal ${modifier} E spawn ${editor}
riverctl map normal ${modifier} F spawn ${fileManager}
riverctl map normal ${modifier} M spawn ${logout}
# ${modifier}+C to close the focused view
riverctl map normal ${modifier} C close
# ${modifier}+Shift+E to exit river
riverctl map normal ${modifier}+Shift E exit
# ${modifier}+J and ${modifier}+K to focus the next/previous view in the layout stack
riverctl map normal ${modifier} J focus-view next
riverctl map normal ${modifier} K focus-view previous
# ${modifier}+Shift+J and ${modifier}+Shift+K to swap the focused view with the next/previous
# view in the layout stack
riverctl map normal ${modifier}+Shift J swap next
riverctl map normal ${modifier}+Shift K swap previous
# ${modifier}+Period and ${modifier}+Comma to focus the next/previous output
riverctl map normal ${modifier} Period focus-output next
riverctl map normal ${modifier} Comma focus-output previous
# ${modifier}+Shift+{Period,Comma} to send the focused view to the next/previous output
riverctl map normal ${modifier}+Shift Period send-to-output next
riverctl map normal ${modifier}+Shift Comma send-to-output previous
# ${modifier}+Return to bump the focused view to the top of the layout stack
riverctl map normal ${modifier} Return zoom
# ${modifier}+H and ${modifier}+L to decrease/increase the main ratio of rivertile(1)
riverctl map normal ${modifier} H send-layout-cmd rivertile "main-ratio -0.05"
riverctl map normal ${modifier} L send-layout-cmd rivertile "main-ratio +0.05"
# ${modifier}+Shift+H and ${modifier}+Shift+L to increment/decrement the main count of rivertile(1)
riverctl map normal ${modifier}+Shift H send-layout-cmd rivertile "main-count +1"
riverctl map normal ${modifier}+Shift L send-layout-cmd rivertile "main-count -1"
# ${modifier}+Alt+{H,J,K,L} to move views
riverctl map normal ${modifier}+Alt H move left 100
riverctl map normal ${modifier}+Alt J move down 100
riverctl map normal ${modifier}+Alt K move up 100
riverctl map normal ${modifier}+Alt L move right 100
# ${modifier}+Alt+Control+{H,J,K,L} to snap views to screen edges
riverctl map normal ${modifier}+Alt+Control H snap left
riverctl map normal ${modifier}+Alt+Control J snap down
riverctl map normal ${modifier}+Alt+Control K snap up
riverctl map normal ${modifier}+Alt+Control L snap right
# ${modifier}+Alt+Shift+{H,J,K,L} to resize views
riverctl map normal ${modifier}+Alt+Shift H resize horizontal -100
riverctl map normal ${modifier}+Alt+Shift J resize vertical 100
riverctl map normal ${modifier}+Alt+Shift K resize vertical -100
riverctl map normal ${modifier}+Alt+Shift L resize horizontal 100
# ${modifier} + Left Mouse Button to move views
riverctl map-pointer normal ${modifier} BTN_LEFT move-view
# ${modifier} + Right Mouse Button to resize views
riverctl map-pointer normal ${modifier} BTN_RIGHT resize-view
# ${modifier} + Middle Mouse Button to toggle float
riverctl map-pointer normal ${modifier} BTN_MIDDLE toggle-float
for i in $(seq 1 8)
do
tags=$((1 << ($i - 1)))
# ${modifier}+[1-9] to focus tag [0-8]
riverctl map normal ${modifier} $i set-focused-tags $tags
# ${modifier}+Shift+[1-9] to tag focused view with tag [0-8]
riverctl map normal ${modifier}+Shift $i set-view-tags $tags
# ${modifier}+Control+[1-9] to toggle focus of tag [0-8]
riverctl map normal ${modifier}+Control $i toggle-focused-tags $tags
# ${modifier}+Shift+Control+[1-9] to toggle tag [0-8] of focused view
riverctl map normal ${modifier}+Shift+Control $i toggle-view-tags $tags
done
# ${modifier}+0 to focus all tags
# ${modifier}+Shift+0 to tag focused view with all tags
all_tags=$(((1 << 32) - 1))
riverctl map normal ${modifier} 0 set-focused-tags $all_tags
riverctl map normal ${modifier}+Shift 0 set-view-tags $all_tags
# ${modifier}+Space to toggle float
riverctl map normal ${modifier} V toggle-float
# ${modifier}+F to toggle fullscreen
riverctl map normal ${modifier} W toggle-fullscreen
# ${modifier}+{Up,Right,Down,Left} to change layout orientation
riverctl map normal ${modifier} Up send-layout-cmd rivertile "main-location top"
riverctl map normal ${modifier} Right send-layout-cmd rivertile "main-location right"
riverctl map normal ${modifier} Down send-layout-cmd rivertile "main-location bottom"
riverctl map normal ${modifier} Left send-layout-cmd rivertile "main-location left"
# Declare a passthrough mode. This mode has only a single mapping to return to
# normal mode. This makes it useful for testing a nested wayland compositor
riverctl declare-mode passthrough
# ${modifier}+F11 to enter passthrough mode
riverctl map normal ${modifier} F11 enter-mode passthrough
# ${modifier}+F11 to return to normal mode
riverctl map passthrough ${modifier} F11 enter-mode normal
# Various media key mapping examples for both normal and locked mode which do
# not have a modifier
for mode in normal locked
do
# Eject the optical drive (well if you still have one that is)
riverctl map $mode None XF86Eject spawn 'eject -T'
# Control pulse audio volume with pamixer (https://github.com/cdemoulins/pamixer)
riverctl map $mode None XF86AudioRaiseVolume spawn '${volume_up}'
riverctl map $mode None XF86AudioLowerVolume spawn '${volume_down}'
riverctl map $mode None XF86AudioMute spawn '${volume_mute}'
# Control MPRIS aware media players with playerctl (https://github.com/altdesktop/playerctl)
riverctl map $mode None XF86AudioMedia spawn '${media_play}'
riverctl map $mode None XF86AudioPlay spawn '${media_play}'
riverctl map $mode None XF86AudioPrev spawn '${media_previous}'
riverctl map $mode None XF86AudioNext spawn '${media_next}'
# Control screen backlight brightness with brightnessctl (https://github.com/Hummer12007/brightnessctl)
riverctl map $mode None XF86MonBrightnessUp spawn '${brightness_up}'
riverctl map $mode None XF86MonBrightnessDown spawn '${brightness_down}'
done
# Set background and border color
riverctl background-color 0x${border_secondary}
riverctl border-color-focused 0x${border_primary}
riverctl border-color-unfocused 0x${border_inactive}
# Set keyboard repeat rate
riverctl set-repeat 50 300
# Set the default layout generator to be rivertile and start it.
# River will send the process group of the init executable SIGTERM on exit.
riverctl default-layout rivertile
rivertile -view-padding 6 -outer-padding 6 &
pkill -f kanshi && kanshi &
thunar --daemon &
pkill -f waybar && waybar &
pkill -f nm-applet && nm-applet &
pkill -f mako && mako
pkill -f swayosd-server && swayosd-server &
'';
};
}

View file

@ -0,0 +1,68 @@
{
pkgs,
lib,
config,
...
}: {
options = {
desktopEnv.hyprland.theme.enable =
lib.mkEnableOption "Hyprland GTK and Qt themes.";
};
config = lib.mkIf config.desktopEnv.hyprland.theme.enable {
home.pointerCursor = {
gtk.enable = true;
x11.enable = true;
package = pkgs.catppuccin-cursors.frappeDark;
name = "Catppuccin-Frappe-Dark-Cursors";
size = 24;
};
qt = {
enable = true;
platformTheme = "gtk";
style.name = "gtk2";
};
gtk = {
enable = true;
theme = {
package = pkgs.catppuccin-gtk.override {
accents = ["mauve"];
size = "compact";
variant = "frappe";
tweaks = ["normal"];
};
name = "Catppuccin-Frappe-Compact-Mauve-Dark";
};
iconTheme = {
package = pkgs.catppuccin-papirus-folders.override {
flavor = "frappe";
accent = "mauve";
};
name = "Papirus-Dark";
};
font = {
name = "NotoSans Nerd Font Regular";
package = pkgs.nerdfonts.override {fonts = ["Noto"];};
size = 11;
};
gtk3.extraConfig = {gtk-application-prefer-dark-theme = 1;};
gtk4.extraConfig = {gtk-application-prefer-dark-theme = 1;};
};
dconf.settings = {
"org/gnome/desktop/interface" = {
gtk-theme = "Catppuccin-Frappe-Compact-Mauve-Dark";
color-scheme = "prefer-dark";
cursor-theme = "Catppuccin-Frappe-Dark-Cursors";
cursor-size = 24;
};
};
};
}

View file

@ -24,8 +24,8 @@
output = ["*"];
position = "top";
reload_style_on_change = true;
modules-left = ["hyprland/workspaces" "hyprland/submap"];
modules-center = ["hyprland/window"];
modules-left = ["hyprland/workspaces" "river/tags" "hyprland/submap"];
modules-center = ["hyprland/window" "river/window"];
modules-right = [
"tray"
"bluetooth"

View file

@ -21,6 +21,16 @@ window#waybar {
color: #ca9ee6;
}
#tags button {
padding: 0px 5px;
margin: 0 0px;
color: #FAFAFA;
}
#tags button.focused {
color: #ca9ee6;
}
#clock,
#battery,
#bluetooth,