diff --git a/NixOS/modules/hyprland/config.nix b/NixOS/modules/hyprland/config.nix index 700c397..fa3c270 100644 --- a/NixOS/modules/hyprland/config.nix +++ b/NixOS/modules/hyprland/config.nix @@ -14,6 +14,43 @@ alacritty = "${pkgs.alacritty}/bin/alacritty"; swaylock = "${pkgs.swaylock}/bin/swaylock"; rofi = "${pkgs.rofi}/bin/rofi"; + jq = "${pkgs.jq}/bin/jq"; + launch_alacritty = pkgs.writeShellScriptBin "launch_alacritty" '' + RUNNING_WAYPIPE=false + SSH_CLIENT="" + CHILD_PID=$(pgrep -P "$1") + + if [ "$GRAND_CHILD_PID" != "" ]; then + GRAND_CHILD_NAME=$(ps -p "$GRAND_CHILD_PID" -o comm=) + if [ "$GRAND_CHILD_NAME" == "ssh" ]; then + CHILD_PID=$GRAND_CHILD_PID + SSH_CLIENT=$(ps -p "$CHILD_PID" -o args --no-headers | awk '{ print $2 }') + fi + if [ "$GRAND_CHILD_NAME" == "waypipe" ]; then + RUNNING_WAYPIPE=true + CHILD_PID=$(pgrep -P "$GRAND_CHILD_PID") + SSH_CLIENT=$(ps -p "$GRAND_CHILD_PID" -o args --no-headers | awk '{ print $4 }') + fi + fi + + + if [ $RUNNING_WAYPIPE == true ]; then + PREVIOUS_SESSION_ID=$(grep -z "SSH_SESSION_ID" "/proc/$CHILD_PID/environ" | xargs -0 -n 1 | grep -oP "[0-9]*") + SSH_SESSION_ID=$RANDOM + ${alacritty} -e zsh -c "SSH_SESSION_ID=$SSH_SESSION_ID waypipe ssh -t \"$SSH_CLIENT\" env SSH_SESSION_ID=\"$SSH_SESSION_ID\" PREVIOUS_SESSION_ID=\"$PREVIOUS_SESSION_ID\" \"zsh --login\"" + else + if [ "$(ps -p "$1" -o comm=)" == "alacritty" ]; then + CWD=$(readlink -e /proc/"$CHILD_PID"/cwd) + if [ "$CWD" != "" ]; then + ${alacritty} --working-directory "$CWD" + else + ${alacritty} + fi + else + ${alacritty} + fi + fi + ''; in { services.kdeconnect = { enable = true; @@ -27,6 +64,7 @@ in { systemd.enable = true; systemd.enableXdgAutostart = true; xwayland.enable = true; + package = inputs.hyprland.packages.${pkgs.system}.hyprland; plugins = [ inputs.split-monitor-workspaces.packages.${pkgs.system}.split-monitor-workspaces ]; @@ -36,12 +74,16 @@ in { "hyprpaper" "${wl-paste} --type text --watch cliphist store" "${wl-paste} --type image --watch cliphist store" - "${waybar}" + # "${waybar}" ]; env = [ "WLR_NO_HARDWARE_CURSORS,1" "TERMINAL,${alacritty}" + "WLR_RENDERER_ALLOW_SOFTWARE,1" ]; + debug = { + disable_logs = false; + }; windowrulev2 = [ "float, title:^(rofi)(.*)$" "center, title:^(rofi)(.*)$" @@ -62,8 +104,8 @@ in { gaps_in = 1; gaps_out = 5; border_size = 2; - col.active_border = "rgba(002f5fee)"; - col.inactive_border = "rgba(ffffff00)"; + "col.active_border" = "rgba(002f5fee)"; + "col.inactive_border" = "rgba(ffffff00)"; layout = "dwindle"; }; input = { @@ -117,7 +159,7 @@ in { "$mainMod, mouse:273, resizewindow" ]; bind = [ - "$mainMod, return, exec, ${scripts}/launch_alacritty.sh $(hyprctl activewindow -j | jq .pid)" + "$mainMod, return, exec, ${launch_alacritty}/bin/launch_alacritty $(hyprctl activewindow -j | ${jq} .pid)" "$mainMod SHIFT, return, exec, ${alacritty}" "$mainMod, Q, killactive," "$mainMod, A, exec, nautilus" @@ -149,7 +191,6 @@ in { "$mainMod,XF86AudioLowerVolume, exec, ${playerctl} previous" ", Print, exec, grim -g \"$(slurp -d)\" - | wl-copy" - "focus with mainMod + arrow keys" "$mainMod, H, exec, ${scripts}/vim-hypr-nav.sh l" "$mainMod, L, exec, ${scripts}/vim-hypr-nav.sh r" "$mainMod, K, exec, ${scripts}/vim-hypr-nav.sh u"