fix: yazi keymap arguments

This commit is contained in:
danny 2025-11-26 14:47:19 +08:00
parent c540e9cc73
commit 4b6183f0ec
7 changed files with 143 additions and 147 deletions

6
flake.lock generated
View file

@ -2531,11 +2531,11 @@
"nixpkgs": "nixpkgs_9" "nixpkgs": "nixpkgs_9"
}, },
"locked": { "locked": {
"lastModified": 1763775611, "lastModified": 1764136401,
"narHash": "sha256-AmgDr9n3JAUwwG3b28oArHaDv5pDMos53D1uZFDl8os=", "narHash": "sha256-7BiCmuCODADZxP/Ln/pkVY0V6ortpvEFLaaqgIqIbKM=",
"owner": "dachxy", "owner": "dachxy",
"repo": "zen-browser-flake", "repo": "zen-browser-flake",
"rev": "bff2ec6219c2574fa9818b709a0b1e68eef42a6d", "rev": "96c4f000c7b73fb0fe989c8128761ef46918f865",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -3,6 +3,11 @@ let
mkWall = import ./mkWall.nix { inherit pkgs config; }; mkWall = import ./mkWall.nix { inherit pkgs config; };
rofiWall = pkgs.writeShellScript "rofiWall" '' rofiWall = pkgs.writeShellScript "rofiWall" ''
url=$(rofi -i -dmenu -config ~/.config/rofi/config.rasi -p "URL") url=$(rofi -i -dmenu -config ~/.config/rofi/config.rasi -p "URL")
if [ -z "$url" ]; then
exit 0
fi
${mkWall}/bin/setWall "$url" ${mkWall}/bin/setWall "$url"
''; '';
in in

View file

@ -1,4 +1,8 @@
{ lib, config, ... }: {
lib,
config,
...
}:
let let
configDir = ../config; configDir = ../config;
browser = "zen.desktop"; browser = "zen.desktop";

View file

@ -63,14 +63,12 @@ let
"match:class error" "match:class error"
"match:class splash" "match:class splash"
"match:class confirmreset" "match:class confirmreset"
"match:class pavucontrol-qt"
"match:class pavucontrol"
"match:class file-roller" "match:class file-roller"
"match:class ^(it.mijorus.smile)" "match:class ^(it.mijorus.smile)"
"match:class ^(xdg-desktop-portal-gtk)$" "match:class ^(xdg-desktop-portal-gtk)$"
"match:class ^(vesktop)$, match:title ^(Discord Popout)$" "match:class ^(vesktop)$, match:title ^(Discord Popout)$"
"match:class ^(steam)$, match:title ^(Friends List)$" "match:class ^(steam)$, match:title ^(Friends List)$"
"match:title Open File" "match:title (Open File)"
"match:title branchdialog" "match:title branchdialog"
"match:title wlogout" "match:title wlogout"
"match:title ^(Media viewer)$" "match:title ^(Media viewer)$"

View file

@ -26,6 +26,10 @@ let
-dPDFFitPage "$path" -dPDFFitPage "$path"
done done
''; '';
pdfCombine = pkgs.writeShellScriptBin "combine-pdf" ''
${lib.getExe pkgs.pdftk} "$@" cat output combined_$(date +%Y%m%d_%H%M%S).pdf
'';
in in
{ {
programs = { programs = {
@ -50,11 +54,6 @@ in
name = "*"; name = "*";
run = "git"; run = "git";
} }
{
id = "git";
name = "*/";
run = "git";
}
]; ];
input = { input = {
@ -62,32 +61,25 @@ in
}; };
opener = { 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 = [ edit = [
{ {
run = ''''\${EDITOR:=nvim} "$@"''; run = ''''\${EDITOR:=nvim} "$0"'';
desc = "$EDITOR"; desc = "$EDITOR";
block = true; block = true;
} }
{ {
run = ''code "$@"''; run = ''code "$0"'';
orphan = true; orphan = true;
} }
]; ];
player = [ player = [
{ run = ''mpv --force-window "$@"''; } { run = ''mpv --force-window "$0"''; }
]; ];
open = [ open = [
{ {
run = ''xdg-open "$@"''; run = ''xdg-open "$0"'';
desc = "Open"; desc = "Open";
} }
]; ];
@ -104,126 +96,123 @@ in
}; };
keymap = { keymap = {
mgr = { mgr.prepend_keymap = [
prepend_keymap = [ # Set Wallpaper
# Set Wallpaper {
{ on = [
on = [ "g"
"g" "w"
"w" ];
]; run = ''shell -- ${config.services.swww.package}/bin/awww img "$0" --transition-fps 45 --transition-duration 1 --transition-type random'';
run = ''shell -- ${config.services.swww.package}/bin/awww img "$1" --transition-fps 45 --transition-duration 1 --transition-type random''; desc = "Set as wallpaper";
desc = "Set as wallpaper"; }
} # Git Changes
# Git Changes {
{ on = [
on = [ "g"
"g" "c"
"c" ];
]; run = "plugin vcs-files";
run = "plugin vcs-files"; desc = "Show Git file changes";
desc = "Show Git file changes"; }
} # Image zoom
# Image zoom {
{ on = "+";
on = "+"; run = "plugin zoom 1";
run = "plugin zoom 1"; desc = "Zoom in hovered file";
desc = "Zoom in hovered file"; }
} {
{ on = "-";
on = "-"; run = "plugin zoom -1";
run = "plugin zoom -1"; desc = "Zoom out hovered file";
desc = "Zoom out hovered file"; }
} # Mount Manager
# Mount Manager {
{ on = "M";
on = "M"; run = "plugin mount";
run = "plugin mount"; desc = "Launch mount manager";
desc = "Launch mount manager"; # Usage
# Usage # Key binding Alternate key Action
# Key binding Alternate key Action # q - Quit the plugin
# q - Quit the plugin # k ↑ Move up
# k ↑ Move up # j ↓ Move down
# j ↓ Move down # l → Enter the mount point
# l → Enter the mount point # m - Mount the partition
# m - Mount the partition # u - Unmount the partition
# u - Unmount the partition # e - Eject the disk
# e - Eject the disk }
} # Toggle Maximize Preview
# Toggle Maximize Preview {
{ on = "T";
on = "T"; run = "plugin toggle-pane max-preview";
run = "plugin toggle-pane max-preview"; desc = "Show or hide the preview panel";
desc = "Show or hide the preview panel"; }
} # Copy selected files to the system clipboard while yanking
# Copy selected files to the system clipboard while yanking {
{ on = "y";
on = "y"; run = [
run = [ ''shell -- for path in "$0" "$@"; do echo "file://$path"; done | wl-copy -t text/uri-list''
''shell -- for path in "$@"; do echo "file://$path"; done | wl-copy -t text/uri-list'' "yank"
"yank" ];
]; }
} # cd back to the root of the current Git repository
# cd back to the root of the current Git repository {
{ on = [
on = [ "g"
"g" "r"
"r" ];
]; run = ''shell -- ya emit cd "$(git rev-parse --show-toplevel)"'';
run = ''shell -- ya emit cd "$(git rev-parse --show-toplevel)"''; desc = "Go to git root";
desc = "Go to git root"; }
} # Drag and Drop
# Drag and Drop {
{ on = [
on = [ "c"
"c" "D"
"D" ];
]; run = ''shell 'ripdrag "$0" "$@" -x 2>/dev/null &' --confirm'';
run = ''shell 'ripdrag "$0" "$@" -x 2>/dev/null &' --confirm''; desc = "Drag the file";
desc = "Drag the file"; }
} # Start terminal
# Start terminal {
{ on = [ "!" ];
on = [ "!" ]; for = "unix";
for = "unix"; run = ''shell "$SHELL" --block'';
run = ''shell "$SHELL" --block''; desc = "Open $SHELL here";
desc = "Open $SHELL here"; }
} # Combine PDF
# Combine PDF {
{ on = [
on = [ "F" # file
"F" # file "p" # pdf
"p" # pdf "c" # combine
"c" # combine ];
]; for = "unix";
for = "unix"; run = ''shell -- ${lib.getExe pdfCombine} "$0" "$@"'';
run = ''shell '${lib.getExe pkgs.pdftk} "$@" cat output combined_$(date +%Y%m%d_%H%M%S).pdf 2>/dev/null &' ''; desc = "Combine selected pdf";
desc = "Combine selected pdf"; }
} {
{ on = [
on = [ "F" # file
"F" # file "p" # pdf
"p" # pdf "n" # normalize
"n" # normalize ];
]; for = "unix";
for = "unix"; run = ''shell -- ${lib.getExe pdfNormalize} "$0" "$@" 2>/dev/null'';
run = ''shell -- ${lib.getExe pdfNormalize} "$@" 2>/dev/null & ''; desc = "Normalize PDF to A4 size";
desc = "Normalize PDF to A4 size"; }
} {
{ on = [
on = [ "F" # file
"F" # file "H" # html
"M" # markdown ];
"H" # html for = "unix";
]; run = [
for = "unix"; ''shell -- for path in "$0" "$@"; do ${lib.getExe md2html} "$path"; done''
run = [ ];
''shell -- for path in "$@"; do ${lib.getExe md2html} "$path"; done'' desc = "Convert Markdown to HTML";
]; }
desc = "Convert Markdown to HTML"; ];
}
];
};
}; };
initLua = initLua =

View file

@ -54,7 +54,7 @@ in
pane_frames = false; pane_frames = false;
show_startup_tips = false; show_startup_tips = false;
session_serialization = false; session_serialization = false;
default_layout = "default"; default_layout = "default-com";
}; };
extraConfig = '' extraConfig = ''
@ -269,7 +269,7 @@ in
} }
''; '';
layouts = { layouts = {
default = { default-com = {
layout = { layout = {
_children = [ _children = [
{ {

View file

@ -19,12 +19,12 @@ in
monitors = [ monitors = [
{ {
desc = "ASUSTek COMPUTER INC ASUS VG32VQ1B 0x00002271"; desc = "ASUSTek COMPUTER INC ASUS VG32VQ1B 0x00002271";
output = "DP-5"; output = "DP-2";
props = "2560x1440@165, 0x0, 1"; props = "2560x1440@165, 0x0, 1";
} }
{ {
desc = "Acer Technologies XV272U V3 1322131231233"; desc = "Acer Technologies XV272U V3 1322131231233";
output = "DP-6"; output = "DP-3";
props = "2560x1440@180, -1440x-600, 1, transform, 1"; props = "2560x1440@180, -1440x-600, 1, transform, 1";
} }
]; ];