From f7fc5c13baf17a7c7591adffd4c917b8ade3143e Mon Sep 17 00:00:00 2001 From: Crony Akatsuki Date: Fri, 6 Jun 2025 21:01:20 +0200 Subject: [PATCH 1/2] feat(qutebrowser): don't redirect github links. --- .../home-manager/configs/qutebrowser/pyconfig/redirectors.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/linux/home-manager/configs/qutebrowser/pyconfig/redirectors.py b/modules/linux/home-manager/configs/qutebrowser/pyconfig/redirectors.py index 22868c6..2f62c17 100644 --- a/modules/linux/home-manager/configs/qutebrowser/pyconfig/redirectors.py +++ b/modules/linux/home-manager/configs/qutebrowser/pyconfig/redirectors.py @@ -17,8 +17,6 @@ REDIRECT_MAP = { "www.tiktok.com": operator.methodcaller("setHost", "proxytok.cronyakatsuki.xyz"), "imgur.com": operator.methodcaller("setHost", "rimgo.cronyakatsuki.xyz"), "www.imgur.com": operator.methodcaller("setHost", "rimgo.cronyakatsuki.xyz"), - "github.com": operator.methodcaller("setHost", "gh.cronyakatsuki.xyz"), - "gist.github.com": operator.methodcaller("setHost", "gh.cronyakatsuki.xyz/gist"), } From 3db633e6abd1f62fca283da2b58378bf9fd079fc Mon Sep 17 00:00:00 2001 From: Crony Akatsuki Date: Fri, 6 Jun 2025 22:22:27 +0200 Subject: [PATCH 2/2] feat(desktop): setup river window manager. --- hosts/ymir/configuration.nix | 5 + hosts/ymir/home.nix | 1 + modules/linux/home-manager/default.nix | 2 + modules/linux/home-manager/river.nix | 158 +++++++++++++++++++++++++ modules/linux/home-manager/wayland.nix | 22 ++-- 5 files changed, 174 insertions(+), 14 deletions(-) create mode 100644 modules/linux/home-manager/river.nix diff --git a/hosts/ymir/configuration.nix b/hosts/ymir/configuration.nix index df90265..738cfac 100644 --- a/hosts/ymir/configuration.nix +++ b/hosts/ymir/configuration.nix @@ -104,6 +104,11 @@ # Enable light for image control programs.light.enable = true; + programs.river = { + enable = true; + extraPackages = []; + }; + # Define a user account. Don't forget to set a password with ‘passwd’. users.users.crony = { isNormalUser = true; diff --git a/hosts/ymir/home.nix b/hosts/ymir/home.nix index a390ef2..a8aa349 100644 --- a/hosts/ymir/home.nix +++ b/hosts/ymir/home.nix @@ -30,6 +30,7 @@ crony.gaming.enable = true; crony.flatpak.enable = true; crony.wayland.enable = true; + crony.river.enable = true; # DO NOT CHANGE ALSO home.stateVersion = "24.11"; # Please read the comment before changing. diff --git a/modules/linux/home-manager/default.nix b/modules/linux/home-manager/default.nix index 68f7ded..3fb86ca 100644 --- a/modules/linux/home-manager/default.nix +++ b/modules/linux/home-manager/default.nix @@ -16,8 +16,10 @@ ./xdg-user-dirs.nix ./qutebrowser.nix ./wayland.nix + ./river.nix ]; + crony.river.enable = lib.mkDefault false; crony.wayland.enable = lib.mkDefault false; crony.qutebrowser.enable = lib.mkDefault true; crony.mangohud.enable = lib.mkDefault false; diff --git a/modules/linux/home-manager/river.nix b/modules/linux/home-manager/river.nix new file mode 100644 index 0000000..78114ff --- /dev/null +++ b/modules/linux/home-manager/river.nix @@ -0,0 +1,158 @@ +{ + config, + pkgs, + lib, + ... +}: let + volume-notify = pkgs.writeShellScriptBin "volume-notify" '' + #!/usr/bin/env sh + + volumep="$(wpctl get-volume @DEFAULT_AUDIO_SINK@)" + + case "$volumep" in + *0.0*) volumep="''${volumep##* 0.0}%" ;; + *0.*) volumep="''${volumep##* 0.}%" ;; + *MUTED*) volumep='MUTED' ;; + *) volumep="100%" ;; + esac + + notify-send -h string:x-canonical-private-synchronous:sys-notify "🔊 Volume: ''${volumep}" + ''; + toggle-sound-output = pkgs.writeShellScriptBin "toggle-sound-output" '' + #!/usr/bin/env sh + + speakers="alsa_output.pci-0000_05_00.1.hdmi-stereo" + headphones="alsa_output.usb-Xtrfy_SC1_Xtrfy_SC1-00.analog-stereo" + + current="$(wpctl status -n | grep Audio/Sink | grep -oE '[^ ]+$')" + + if [ "''${current}" = "''${headphones}" ]; then + wpctl set-default "$(pw-cli info $speakers | head -n 1 | awk '{print $2}')" + else + wpctl set-default "$(pw-cli info $headphones | head -n 1 | awk '{print $2}')" + fi + + ''; + power-menu = pkgs.writeShellScriptBin "power-menu" '' + #!/usr/bin/env sh + + case "$(printf "shutdown\\nreboot" | tofi --prompt "Choose your poison")" in + "shutdown") poweroff ;; + "reboot") reboot ;; + esac + ''; +in { + options = { + crony.river.enable = lib.mkEnableOption "Enable and setup river window manager"; + }; + + config = lib.mkIf config.crony.river.enable { + home.packages = with pkgs; [ + playerctl + grim + ]; + + wayland.windowManager.river = { + enable = true; + settings = { + set-repeat = "50 300"; + default-layout = "rivertile"; + keyboard-layout = { + "-options" = { + "'caps:escape,grp:alt_space_toggle'" = "'us,hr'"; + }; + }; + rule-add = { + "-app-id" = { + "'bar'" = "csd"; + "'float*'" = { + "-title" = { + "foo" = "float"; + }; + }; + }; + }; + map = { + normal = { + "Super Return" = "spawn foot"; + "Super Q" = "close"; + "Super+Ctrl E" = "exit"; + "J" = "focus-view next"; + "K" = "focus-view previous"; + "Super+Shift J" = "swap next"; + "Super+Shift K" = "swap previous"; + "Super+Shift Return" = "zoom"; + "Super H" = "send-layout-cmd rivertile 'main-ratio -0.05'"; + "Super L" = "send-layout-cmd rivertile 'main-ratio +0.05'"; + "Super+Shift ." = "send-layout-cmd rivertile 'main-count +1'"; + "Super+Shift ," = "send-layout-cmd rivertile 'main-count -1'"; + "Super+Shift Space" = "toggle-float"; + "Super F" = "toggle-fullscreen"; + "Super D" = "spawn 'tofi-run | xargs riverctl dispatch exec --'"; + "Super+Shift D" = "spawn 'tofi-drun | xargs riverctl dispatch exec --'"; + "Super+Shift L" = "spawn 'hyprlock --immediate'"; + "Super B" = "spawn qutebrowser"; + "Super+Shift B" = "spawn librewolf"; + "Super F1" = "spawn '${toggle-sound-output}/bin/toggle-sound-output'"; + "Super E" = "spawn '${power-menu}/bin/power-menu'"; + "Super F12" = "spawn 'grim ${config.xdg.userDirs.pictures}/screenshots/$(date +%s_grim.png)'"; + "Super V" = "spawn 'cliphist list | tofi --horizontal false --height 380 | cliphist decode | wl-copy'"; + }; + }; + map-pointer = { + normal = { + "Super BTN_LEFT" = "move-view"; + "Super BTN_RIGHT" = "resize-view"; + "Super BTN_MIDDLE" = "toggle-float"; + }; + }; + spawn = [ + "wl-paste --type text --watch cliphist store" # Stores only text data + "wl-paste --type image --watch cliphist store" # Stores only image data + "keepassxc" # Startup my password manager + "waybar" # Start waybar on start + ]; + }; + systemd = { + enable = true; + }; + xwayland.enable = true; + extraConfig = '' + for i in $(seq 1 9) + do + tags=$((1 << ($i - 1))) + + # Super+[1-9] to focus tag [0-8] + riverctl map normal Super $i set-focused-tags $tags + + # Super+Shift+[1-9] to tag focused view with tag [0-8] + riverctl map normal Super+Shift $i set-view-tags $tags + + # Super+Control+[1-9] to toggle focus of tag [0-8] + riverctl map normal Super+Control $i toggle-focused-tags $tags + + # Super+Shift+Control+[1-9] to toggle tag [0-8] of focused view + riverctl map normal Super+Shift+Control $i toggle-view-tags $tags + done + + for mode in normal locked + do + riverctl map $mode None XF86AudioRaiseVolume spawn 'pctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ --limit 1 && ${volume-notify}/bin/volume-notify' + riverctl map $mode None XF86AudioLowerVolume spawn 'wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- --limit 1 && ${volume-notify}/bin/volume-notify' + riverctl map $mode None XF86AudioMute spawn 'wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle && ${volume-notify}/bin/volume-notify' + + riverctl map $mode None XF86AudioMedia spawn 'playerctl play-pause' + riverctl map $mode None XF86AudioPlay spawn 'playerctl play-pause' + riverctl map $mode None XF86AudioPrev spawn 'playerctl previous' + riverctl map $mode None XF86AudioNext spawn 'playerctl next' + + riverctl map $mode None XF86MonBrightnessUp spawn 'light -A 10' + riverctl map $mode None XF86MonBrightnessDown spawn 'light -D 10' + done + + + rivertile -view-padding 6 -outer-padding 6 & + ''; + }; + }; +} diff --git a/modules/linux/home-manager/wayland.nix b/modules/linux/home-manager/wayland.nix index 81857f4..f4056b2 100644 --- a/modules/linux/home-manager/wayland.nix +++ b/modules/linux/home-manager/wayland.nix @@ -137,25 +137,21 @@ padding-left: 10px; } - #workspaces { + #tags { background-color: @base01; margin: 0.25em; border-radius: 1em; } - #workspaces button { + #tags button { padding: 0 0.5em; - color: @base06; - } - - #workspaces button.empty { color: @base03; } - #workspaces button.visible { + #tags button.occupied { color: @base06; } - #workspaces button.active { + #tags button.focused { color: @base0D; } @@ -189,8 +185,8 @@ mainBar = { height = 34; modules-left = [ - "hyprland/workspaces" - "hyprland/window" + "river/tags" + "river/window" ]; modules-center = [ ]; @@ -203,10 +199,8 @@ "clock" "tray" ]; - "hyprland/workspaces" = { - persistent-workspaces = { - "*" = [1 2 3 4 5 6 7 8 9]; - }; + "river/window" = { + max-length = 50; }; disk = { path = "/";