From 8c2a220eb180e6cf56644e69c8b30b671a8ac6b8 Mon Sep 17 00:00:00 2001 From: Liam Malone Date: Fri, 1 Aug 2025 11:10:43 +0100 Subject: [PATCH] Switch default compositor to river --- configs/ghostty/config | 2 +- configs/river/init | 141 ++++++++++++++++++++++++++++++++++ flake.lock | 14 ++-- flake.nix | 2 +- hosts/darp8/configuration.nix | 10 ++- hosts/darp8/file.nix | 5 ++ hosts/darp8/pkgs.nix | 5 +- 7 files changed, 168 insertions(+), 11 deletions(-) create mode 100755 configs/river/init diff --git a/configs/ghostty/config b/configs/ghostty/config index 1de48e5..c5db5b0 100644 --- a/configs/ghostty/config +++ b/configs/ghostty/config @@ -11,7 +11,7 @@ keybind = ctrl+shift+o=ignore background-opacity=0.9 confirm-close-surface = false window-theme = dark -window-decoration = false +window-decoration = true # Linux Specific gtk-wide-tabs = true diff --git a/configs/river/init b/configs/river/init new file mode 100755 index 0000000..be2b141 --- /dev/null +++ b/configs/river/init @@ -0,0 +1,141 @@ +#!/usr/bin/env bash + +function execs() { + systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP + dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=river && systemctl --user restart xdg-desktop-portal xdg-desktop-portal-wlr + rivertile -view-padding 1 -outer-padding 2 & + swww-daemon & + swaync & + quickshell & + wl-clipboard-history -t & + wl-paste -p --watch wl-copy -p '' & +} + + +# Inputs + +# Inputs :: Touchpad Settings +function touchpad_apply_rules() { + touchpad=$1 + + riverctl input "$touchpad" drag-lock disabled + riverctl input "$touchpad" drag enabled + riverctl input "$touchpad" tap enabled + riverctl input "$touchpad" natural-scroll enabled + riverctl input "$touchpad" middle-emulation enabled + riverctl input "$touchpad" scroll-method two-finger + riverctl input "$touchpad" tap-button-map left-right-middle + riverctl input "$touchpad" click-method click-finger + riverctl input "$touchpad" accel-profile flat + riverctl input "$touchpad" disable-while-typing disabled + riverctl input "$touchpad" scroll-factor 0.6 + riverctl input "$touchpad" pointer-accel 0.3 + riverctl input "$touchpad" scroll-method two-finger +} + +# Inputs :: General +function inputs() { + riverctl keyboard-layout us + + touchpads=$(riverctl list-inputs | grep '^pointer-.*Touchpad' | awk '{print $1}') + for touchpad in $touchpads + do + touchpad_apply_rules $touchpad + done +} + +# Layout +function layout() { + riverctl default-layout rivertile +} + +# Binds +function binds() { + mod="Super" + lock="hyprlock" + + # Binds :: Modes + mode_reset="riverctl enter-mode normal" + riverctl declare-mode browser_select + riverctl map normal $mod B enter-mode browser_select + riverctl map browser_select None B spawn "$mode_reset && brave" + riverctl map browser_select None Escape spawn "$mode_reset" + + # Binds :: Progams + discord="discord --enable-blink-features=MiddleClickAutoscroll" + hyprpicker="hyprpicker -a" + screenshot="grim - | wl-copy" + screenshotarea="grim -g \"\$(slurp)\" - | wl-copy" + riverctl map normal Alt Return spawn ghostty + riverctl map normal $mod+Shift D spawn "$discord" + riverctl map normal $mod Space spawn fuzzel + riverctl map normal $mod P spawn "$hyprpicker" + riverctl map normal None Print spawn "$screenshotarea" + riverctl map normal Shift Print spawn "$screenshot" + + # Binds :: Controls + reload="$NIX_CONFIG_DIR/configs/river/init noexec" + riverctl map normal $mod C close + riverctl map normal $mod+Control Q spawn "$lock" + riverctl map normal $mod+Shift R spawn "$reload" + riverctl map normal $mod F4 exit + + # Binds :: Controls :: Floating Windows + riverctl map normal $mod F toggle-float # Toggle floating mode + riverctl map normal $mod+Shift Space zoom # Focus the main window + riverctl map-pointer normal $mod BTN_LEFT move-view # Move floating windows + riverctl map-pointer normal $mod BTN_RIGHT resize-view # Resize floating windows + + # Binds :: Controls :: rivertile :: Layout Adjustments + riverctl map normal $mod H send-layout-cmd rivertile "main-ratio -0.05" # Decrease main window size + riverctl map normal $mod L send-layout-cmd rivertile "main-ratio +0.05" # Increase main window size + riverctl map normal $mod+Shift H send-layout-cmd rivertile "main-count +1" # Increase number of main windows + riverctl map normal $mod+Shift L send-layout-cmd rivertile "main-count -1" # Decrease number of main windows + + # Binds :: Controls :: Multimedia + # Binds :: Controls :: Multimedia :: Commands + brightness="$NIX_CONFIG_DIR/scripts/progress-notify.sh brightness" + brightness_up="brightnessctl set 10%+ && $brightness" + brightness_down="brightnessctl set 10%- && $brightness" + audio="$NIX_CONFIG_DIR/scripts/progress-notify.sh audio" + volume_up="pamixer -i 5 && $audio" + volume_down="pamixer -d 5 && $audio" + mute="$NIX_CONFIG_DIR/scripts/progress-notify.sh mute" + mute_toggle="pamixer -t && $mute" + + riverctl map -repeat normal None XF86MonBrightnessUp spawn "sh -c '$brightness_up'" + riverctl map -repeat normal None XF86MonBrightnessDown spawn "sh -c '$brightness_down'" + riverctl map -repeat normal None XF86AudioRaiseVolume spawn "sh -c '$volume_up'" + riverctl map -repeat normal None XF86AudioLowerVolume spawn "sh -c '$volume_down'" + riverctl map normal None XF86AudioMute spawn "sh -c '$mute_toggle'" + + # Binds :: Controls :: Navigation + riverctl map normal $mod J focus-view next + riverctl map normal $mod K focus-view previous + riverctl map normal $mod+Shift J swap next + riverctl map normal $mod+Shift K swap previous + + # Binds :: Controls :: Tags + for i in $(seq 1 9) + do + tags=$((1 << ($i - 1))) + riverctl map normal $mod $i set-focused-tags $tags # Focus tag + riverctl map normal $mod+Shift $i set-view-tags $tags # Assign tag to window + done +} + +function colors() { + # Set border colors (focused and unfocused windows) + riverctl border-color-focused 0x93C863 # Green for focused windows + riverctl border-color-unfocused 0x333333 # Gray for unfocused windows +} + +# Process Script Args +for arg in "$@"; do declare $arg='1'; done + +# Run Sections +inputs +layout +colors +binds +if ! [ -v noexec ]; then execs ; fi diff --git a/flake.lock b/flake.lock index 646eeba..4a28bc2 100644 --- a/flake.lock +++ b/flake.lock @@ -165,11 +165,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1752873617, - "narHash": "sha256-OyYkFTgk5WuiwCPMhO9nwgplr+qh8Hva/VPON7wK2+0=", + "lastModified": 1753971789, + "narHash": "sha256-V0yPyFMBdOt0c3QIUlO18bHDI7vXKqOixtLuBZZjrBI=", "owner": "hyprwm", - "repo": "hyprland", - "rev": "ae3cc48f223386b057137400354ed0ca1f7a8b1a", + "repo": "Hyprland", + "rev": "a907ecd4ff736a3a09410532b405a437eb48033c", "type": "github" }, "original": { @@ -342,11 +342,11 @@ ] }, "locked": { - "lastModified": 1752252310, - "narHash": "sha256-06i1pIh6wb+sDeDmWlzuPwIdaFMxLlj1J9I5B9XqSeo=", + "lastModified": 1753800567, + "narHash": "sha256-W0xgXsaqGa/5/7IBzKNhf0+23MqGPymYYfqT7ECqeTE=", "owner": "hyprwm", "repo": "hyprutils", - "rev": "bcabcbada90ed2aacb435dc09b91001819a6dc82", + "rev": "c65d41d4f4e6ded6fdb9d508a73e2fe90e55cdf7", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 3ea5bb2..4fa4c4e 100644 --- a/flake.nix +++ b/flake.nix @@ -25,7 +25,7 @@ let system = "x86_64-linux"; # pkgs = nixpkgs.legacyPackages.${system}; - pkgs = import nixpkgs { + pkgs = import nixpkgs.legacyPackages { inherit system; overlays = [ # Hyprland & Plugins Overlays diff --git a/hosts/darp8/configuration.nix b/hosts/darp8/configuration.nix index c225d8a..444891e 100644 --- a/hosts/darp8/configuration.nix +++ b/hosts/darp8/configuration.nix @@ -82,7 +82,7 @@ in restart = true; settings = { default_session = { - command = "${pkgs.greetd.tuigreet}/bin/tuigreet --cmd Hyprland"; + command = "${pkgs.greetd.tuigreet}/bin/tuigreet --cmd river"; }; }; }; @@ -105,6 +105,7 @@ in etc = { "greetd/environments".text = '' Hyprland + river ''; # "hyprland/plugins.conf" = { # mode = "0444"; @@ -189,6 +190,12 @@ in # pkgs.hyprlandPlugins.hyprexpo ]; }; + + river = { + enable = true; + xwayland.enable = true; + }; + gnupg.agent = { enable = true; enableSSHSupport = true; @@ -198,6 +205,7 @@ in dconf.enable = true; nix-ld.enable = true; mtr.enable = true; + uwsm.enable = true; }; lib.inputMethod.fcitx5.waylandFrontend = true; diff --git a/hosts/darp8/file.nix b/hosts/darp8/file.nix index e520d82..f697d25 100644 --- a/hosts/darp8/file.nix +++ b/hosts/darp8/file.nix @@ -26,6 +26,11 @@ in outOfStoreSymlink = true; recursive = true; }; + ".config/river" = { + source = ../../configs/river; + outOfStoreSymlink = true; + recursive = true; + }; ".config/waybar" = { source = ../../configs/waybar; outOfStoreSymlink = true; diff --git a/hosts/darp8/pkgs.nix b/hosts/darp8/pkgs.nix index 4f4682d..e32d1c9 100644 --- a/hosts/darp8/pkgs.nix +++ b/hosts/darp8/pkgs.nix @@ -6,7 +6,7 @@ { # BEGIN PACKAGES home.packages = with pkgs; [ - audacity + # audacity android-studio bat brave @@ -19,9 +19,11 @@ fastfetch filezilla floorp + fuzzel fzf genymotion gimp + grim gtk4 gvfs grimblast @@ -48,6 +50,7 @@ pywal qbittorrent signal-desktop + slurp swaynotificationcenter swww texliveFull