From 4b6183f0ec6a1f0a04b750cc86b080058af797cd Mon Sep 17 00:00:00 2001 From: danny Date: Wed, 26 Nov 2025 14:47:19 +0800 Subject: [PATCH] fix: yazi keymap arguments --- flake.lock | 6 +- home/scripts/rofiwall.nix | 5 + home/user/config.nix | 6 +- home/user/hypr/windowrule.nix | 4 +- home/user/yazi.nix | 261 ++++++++++++++---------------- home/user/zellij.nix | 4 +- system/dev/dn-pre7780/default.nix | 4 +- 7 files changed, 143 insertions(+), 147 deletions(-) diff --git a/flake.lock b/flake.lock index 8fa99ce..0120d67 100644 --- a/flake.lock +++ b/flake.lock @@ -2531,11 +2531,11 @@ "nixpkgs": "nixpkgs_9" }, "locked": { - "lastModified": 1763775611, - "narHash": "sha256-AmgDr9n3JAUwwG3b28oArHaDv5pDMos53D1uZFDl8os=", + "lastModified": 1764136401, + "narHash": "sha256-7BiCmuCODADZxP/Ln/pkVY0V6ortpvEFLaaqgIqIbKM=", "owner": "dachxy", "repo": "zen-browser-flake", - "rev": "bff2ec6219c2574fa9818b709a0b1e68eef42a6d", + "rev": "96c4f000c7b73fb0fe989c8128761ef46918f865", "type": "github" }, "original": { diff --git a/home/scripts/rofiwall.nix b/home/scripts/rofiwall.nix index 48a50ae..2aa7bd5 100644 --- a/home/scripts/rofiwall.nix +++ b/home/scripts/rofiwall.nix @@ -3,6 +3,11 @@ let mkWall = import ./mkWall.nix { inherit pkgs config; }; rofiWall = pkgs.writeShellScript "rofiWall" '' url=$(rofi -i -dmenu -config ~/.config/rofi/config.rasi -p "URL") + + if [ -z "$url" ]; then + exit 0 + fi + ${mkWall}/bin/setWall "$url" ''; in diff --git a/home/user/config.nix b/home/user/config.nix index a450bbb..2fd88bc 100644 --- a/home/user/config.nix +++ b/home/user/config.nix @@ -1,4 +1,8 @@ -{ lib, config, ... }: +{ + lib, + config, + ... +}: let configDir = ../config; browser = "zen.desktop"; diff --git a/home/user/hypr/windowrule.nix b/home/user/hypr/windowrule.nix index 7faaf2d..8e2e52a 100644 --- a/home/user/hypr/windowrule.nix +++ b/home/user/hypr/windowrule.nix @@ -63,14 +63,12 @@ let "match:class error" "match:class splash" "match:class confirmreset" - "match:class pavucontrol-qt" - "match:class pavucontrol" "match:class file-roller" "match:class ^(it.mijorus.smile)" "match:class ^(xdg-desktop-portal-gtk)$" "match:class ^(vesktop)$, match:title ^(Discord Popout)$" "match:class ^(steam)$, match:title ^(Friends List)$" - "match:title Open File" + "match:title (Open File)" "match:title branchdialog" "match:title wlogout" "match:title ^(Media viewer)$" diff --git a/home/user/yazi.nix b/home/user/yazi.nix index af8bed1..1e33a45 100644 --- a/home/user/yazi.nix +++ b/home/user/yazi.nix @@ -26,6 +26,10 @@ let -dPDFFitPage "$path" done ''; + + pdfCombine = pkgs.writeShellScriptBin "combine-pdf" '' + ${lib.getExe pkgs.pdftk} "$@" cat output combined_$(date +%Y%m%d_%H%M%S).pdf + ''; in { programs = { @@ -50,11 +54,6 @@ in name = "*"; run = "git"; } - { - id = "git"; - name = "*/"; - run = "git"; - } ]; input = { @@ -62,32 +61,25 @@ in }; opener = { - set-wallpaper = [ - { - run = ''${config.services.swww.package}/bin/awww img "$1" --transition-fps 45 --transition-duration 1 --transition-type random''; - for = "linux"; - desc = "Set as wallpaper"; - } - ]; edit = [ { - run = ''''\${EDITOR:=nvim} "$@"''; + run = ''''\${EDITOR:=nvim} "$0"''; desc = "$EDITOR"; block = true; } { - run = ''code "$@"''; + run = ''code "$0"''; orphan = true; } ]; player = [ - { run = ''mpv --force-window "$@"''; } + { run = ''mpv --force-window "$0"''; } ]; open = [ { - run = ''xdg-open "$@"''; + run = ''xdg-open "$0"''; desc = "Open"; } ]; @@ -104,126 +96,123 @@ in }; keymap = { - mgr = { - prepend_keymap = [ - # Set Wallpaper - { - on = [ - "g" - "w" - ]; - run = ''shell -- ${config.services.swww.package}/bin/awww img "$1" --transition-fps 45 --transition-duration 1 --transition-type random''; - desc = "Set as wallpaper"; - } - # Git Changes - { - on = [ - "g" - "c" - ]; - run = "plugin vcs-files"; - desc = "Show Git file changes"; - } - # Image zoom - { - on = "+"; - run = "plugin zoom 1"; - desc = "Zoom in hovered file"; - } - { - on = "-"; - run = "plugin zoom -1"; - desc = "Zoom out hovered file"; - } - # Mount Manager - { - on = "M"; - run = "plugin mount"; - desc = "Launch mount manager"; - # Usage - # Key binding Alternate key Action - # q - Quit the plugin - # k ↑ Move up - # j ↓ Move down - # l → Enter the mount point - # m - Mount the partition - # u - Unmount the partition - # e - Eject the disk - } - # Toggle Maximize Preview - { - on = "T"; - run = "plugin toggle-pane max-preview"; - desc = "Show or hide the preview panel"; - } - # Copy selected files to the system clipboard while yanking - { - on = "y"; - run = [ - ''shell -- for path in "$@"; do echo "file://$path"; done | wl-copy -t text/uri-list'' - "yank" - ]; - } - # cd back to the root of the current Git repository - { - on = [ - "g" - "r" - ]; - run = ''shell -- ya emit cd "$(git rev-parse --show-toplevel)"''; - desc = "Go to git root"; - } - # Drag and Drop - { - on = [ - "c" - "D" - ]; - run = ''shell 'ripdrag "$0" "$@" -x 2>/dev/null &' --confirm''; - desc = "Drag the file"; - } - # Start terminal - { - on = [ "!" ]; - for = "unix"; - run = ''shell "$SHELL" --block''; - desc = "Open $SHELL here"; - } - # Combine PDF - { - on = [ - "F" # file - "p" # pdf - "c" # combine - ]; - for = "unix"; - run = ''shell '${lib.getExe pkgs.pdftk} "$@" cat output combined_$(date +%Y%m%d_%H%M%S).pdf 2>/dev/null &' ''; - desc = "Combine selected pdf"; - } - { - on = [ - "F" # file - "p" # pdf - "n" # normalize - ]; - for = "unix"; - run = ''shell -- ${lib.getExe pdfNormalize} "$@" 2>/dev/null & ''; - desc = "Normalize PDF to A4 size"; - } - { - on = [ - "F" # file - "M" # markdown - "H" # html - ]; - for = "unix"; - run = [ - ''shell -- for path in "$@"; do ${lib.getExe md2html} "$path"; done'' - ]; - desc = "Convert Markdown to HTML"; - } - ]; - }; + mgr.prepend_keymap = [ + # Set Wallpaper + { + on = [ + "g" + "w" + ]; + run = ''shell -- ${config.services.swww.package}/bin/awww img "$0" --transition-fps 45 --transition-duration 1 --transition-type random''; + desc = "Set as wallpaper"; + } + # Git Changes + { + on = [ + "g" + "c" + ]; + run = "plugin vcs-files"; + desc = "Show Git file changes"; + } + # Image zoom + { + on = "+"; + run = "plugin zoom 1"; + desc = "Zoom in hovered file"; + } + { + on = "-"; + run = "plugin zoom -1"; + desc = "Zoom out hovered file"; + } + # Mount Manager + { + on = "M"; + run = "plugin mount"; + desc = "Launch mount manager"; + # Usage + # Key binding Alternate key Action + # q - Quit the plugin + # k ↑ Move up + # j ↓ Move down + # l → Enter the mount point + # m - Mount the partition + # u - Unmount the partition + # e - Eject the disk + } + # Toggle Maximize Preview + { + on = "T"; + run = "plugin toggle-pane max-preview"; + desc = "Show or hide the preview panel"; + } + # Copy selected files to the system clipboard while yanking + { + on = "y"; + run = [ + ''shell -- for path in "$0" "$@"; do echo "file://$path"; done | wl-copy -t text/uri-list'' + "yank" + ]; + } + # cd back to the root of the current Git repository + { + on = [ + "g" + "r" + ]; + run = ''shell -- ya emit cd "$(git rev-parse --show-toplevel)"''; + desc = "Go to git root"; + } + # Drag and Drop + { + on = [ + "c" + "D" + ]; + run = ''shell 'ripdrag "$0" "$@" -x 2>/dev/null &' --confirm''; + desc = "Drag the file"; + } + # Start terminal + { + on = [ "!" ]; + for = "unix"; + run = ''shell "$SHELL" --block''; + desc = "Open $SHELL here"; + } + # Combine PDF + { + on = [ + "F" # file + "p" # pdf + "c" # combine + ]; + for = "unix"; + run = ''shell -- ${lib.getExe pdfCombine} "$0" "$@"''; + desc = "Combine selected pdf"; + } + { + on = [ + "F" # file + "p" # pdf + "n" # normalize + ]; + for = "unix"; + run = ''shell -- ${lib.getExe pdfNormalize} "$0" "$@" 2>/dev/null''; + desc = "Normalize PDF to A4 size"; + } + { + on = [ + "F" # file + "H" # html + ]; + for = "unix"; + run = [ + ''shell -- for path in "$0" "$@"; do ${lib.getExe md2html} "$path"; done'' + ]; + desc = "Convert Markdown to HTML"; + } + ]; }; initLua = diff --git a/home/user/zellij.nix b/home/user/zellij.nix index 587d822..c8e40ff 100644 --- a/home/user/zellij.nix +++ b/home/user/zellij.nix @@ -54,7 +54,7 @@ in pane_frames = false; show_startup_tips = false; session_serialization = false; - default_layout = "default"; + default_layout = "default-com"; }; extraConfig = '' @@ -269,7 +269,7 @@ in } ''; layouts = { - default = { + default-com = { layout = { _children = [ { diff --git a/system/dev/dn-pre7780/default.nix b/system/dev/dn-pre7780/default.nix index f259dff..d5476a1 100644 --- a/system/dev/dn-pre7780/default.nix +++ b/system/dev/dn-pre7780/default.nix @@ -19,12 +19,12 @@ in monitors = [ { desc = "ASUSTek COMPUTER INC ASUS VG32VQ1B 0x00002271"; - output = "DP-5"; + output = "DP-2"; props = "2560x1440@165, 0x0, 1"; } { desc = "Acer Technologies XV272U V3 1322131231233"; - output = "DP-6"; + output = "DP-3"; props = "2560x1440@180, -1440x-600, 1, transform, 1"; } ];