feat: yazi extra shortcuts

# Changes
## docs:
- Add extra tutorial docs
## Features:
- Add `pdf combine` to yazi
- Add `pdf normalization` to yazi
- Add `Markdown to html` to yazi
## Breaking Changes:
- Rename sops secret `wireguard/conf` to `wireguard/wg0.conf`: Make sure
update your `sops-conf.nix` and secrets file.
This commit is contained in:
danny 2025-10-01 15:14:19 +08:00
parent dc8f796e18
commit 54ab4d4181
17 changed files with 266 additions and 34 deletions

View file

@ -13,6 +13,7 @@
- [x] Waybar
- [x] Hyprlock
- [x] Hypridle
- [x] Zen Browser
- [x] Swaync (Notification Center)
- [x] Swww (Wallpaper)
- [x] Ghostty (Terminal)
@ -21,6 +22,12 @@
- [x] Rofi (Application Launcher)
- [x] Stylix
## Manuals
- [Hyprland](./docs/hyprland.md)
- [Yazi Extra Shortcuts](./docs/yazi.md)
- [Fcitx5 Input Method (With Bopomofo Tutorial)](./docs/fcitx.md)
## 🎮️ Game
- Steam
@ -38,7 +45,7 @@
## 🌐 VPN
- Wireguard (You need put your own `wg0.conf` file) .
- Wireguard (You need put your own `wg0.conf` in sops file) .
> NOTE: If import `wireguard.nix` without config file, the Build will fail.
@ -46,10 +53,6 @@
See [Python Cuda Flake](https://github.com/DACHXY/python-cuda-flake)
## 🧱 Wallpaper Engine
- [Linux Wallpaper Engine](https://github.com/Almamu/linux-wallpaperengine)
---
## 💿️ Installation
@ -60,7 +63,7 @@ See [Python Cuda Flake](https://github.com/DACHXY/python-cuda-flake)
### Example
```
```text
system/dev/
├── <your-device-name>
   ├── boot.nix # You can add extra boot options here

8
docs/fcitx.md Normal file
View file

@ -0,0 +1,8 @@
# Fcitx Input Method
## Frist Use
### Enable Bopomofo
Use shortcut `$mod + SPACE` cycle through input methods until Rime. Press
`CTRL + Backtick` and select `注音`.

91
docs/hyprland.md Normal file
View file

@ -0,0 +1,91 @@
# Hyprland
> $mod: Super
## Key Binds
The key binds are defined in [bind.nix](../home/user/hypr/bind.nix).
### Common
| Keys | Description |
| ----------------------- | ----------------------------------- |
| $mod + F | Browser |
| $mod + Return | Terminal |
| CTRL + ALT + T | Terminal |
| $mod + Q | Kill active window |
| $mod + M | System Menu |
| $mod + E | File explorer (Yazi) |
| ALT + SPACE | Application Launcher (rofi) |
| $mod + W | Change wallpaper (Input image link) |
| $mod + X | Notification center |
| CTRL + $mod + SHIFT + L | Lock screen (hyprlock) |
| $mod + C | Visual Code (In case you need :D) |
### Input Method
| Keys | Description |
| ------------ | -------------------------- |
| $mod + SPACE | Cycle input method (fcitx) |
### Window
| Keys | Description |
| --------------------------- | ------------------------------ |
| $mod + V | Toggle float |
| $mod + P | Toggle pseudo #dwindle |
| $mod + S | Toggle split #dwindle |
| $mod + N | Toggle Transparency |
| $mod + SHIFT + C | Center window |
| $mod + (h/j/k/l) | Move focus left/down/up/right |
| $mod + SHIFT + (h/j/k/l) | Move window left/down/up/right |
| ALT + TAB | Cycle next window and focus |
| $mod + (Mouse Right Button) | Resize Window |
| $mod + (Mouse Left Button) | Move Window |
| CTRL + $mod + (h/j/k/l) | Resize Window |
| F11 | Toggle Fullscreen |
### Utilities
| Keys | Description |
| ----------------------- | ------------------------------------ |
| CTRL + $mod + P | Bitwarden Selector |
| $mod + PERIOD | Emoji Selector |
| $mod + SHIFT + S | Screenshot (region) |
| CTRL + SHIFT + S | Screenshot (window) |
| CTRL + SHIFT + $mod + S | Screenshot (monitor) |
| CTRL + ALT + S | Screenshot (Active Window) |
| CTRL + $mod + C | Calculator |
| $mod + SHIFT + P | Color Picker |
| All (Media Keys) | Media keys work just like media keys |
| CTRL + $mod + COMMA | Previous Media |
| CTRL + $mod + PERIOD | Next Media |
---
## Workspaces
> Workspace \[G\] is for \[G\]aming workspace, which binds to workspace 7
| Keys | Description |
| ---------------------------- | ---------------------------------------------- |
| $mod + (1~9) | Switch to workspace (1~9) |
| $mod + SHIFT + (1~9) | Move window to workspace (1~9) |
| $mod + G | Switch to \[G\]aming workspace (7) |
| $mod + (mouse wheel up/down) | Next workspace (workspaces on current monitor) |
### Special Rules
- Workspace is binding to your seperator monitors, for example:
You have `DP-0` and `DP-1` two monitors, and `DP-0` is your main monitor.
Then, workspace \[1 3 5 7 9\] is bind to `DP-0`, and the rest workspaces \[2 4
6 8\] is bind to `DP-1`.
## Window Rules
Window rules are defined in [windowrule.nix](../home/user/hypr/windowrule.nix).
The worth mentioning fules:
- Discord: bind to workspace `4`
- Steam: bind to workspace `7` (which is workspace `G` also)

16
docs/yazi.md Normal file
View file

@ -0,0 +1,16 @@
# Yazi Extra Shortcuts
| Shortcuts | Description |
| --------- | ------------------------------------------------------ |
| gc | Show \[g\]it file \[c\]hanges |
| + | Zoom in image |
| - | Zoom out image |
| M | \[M\]ount manager |
| T | \[T\]oggle preview panel |
| y | Copy to system clipboard while yanking |
| gr | Go back to \[g\]it \[r\]oot |
| cD | Drag and \[D\]rop |
| ! | Start Terminal |
| Fpc | \[F\]ile: \[p\]df \[c\]ombine |
| Fpn | \[F\]ile: \[p\]df \[n\]ormalizing (Convert size to A4) |
| Fmh | \[F\]ile: \[m\]arkdown to \[h\]tml |

View file

@ -4,6 +4,17 @@ let
url = "https://raw.githubusercontent.com/xz/new.css/refs/heads/master/new.css";
hash = "sha256-Xd3AMZOeThsrupQusSLjqv3hbNmcpeTms0ieI9nyxOk=";
};
inlineHeader =
pkgs.writeText "pandoc-inline-header"
# html
''
<style>
h1 { font-size: 1.55em !important; }
h2 { font-size: 1.35em !important; }
h3 { font-size: 1.2em !important; }
h4 { font-size: 1.1em !important; }
</style>
'';
in
pkgs.writeShellScriptBin "md2html" ''
set -e
@ -15,7 +26,8 @@ pkgs.writeShellScriptBin "md2html" ''
HTML_TEMP="''\${BASENAME}.html"
PDF_OUTPUT="''\${BASENAME}.pdf"
${pkgs.pandoc}/bin/pandoc "$INPUT" -s \
${pkgs.pandoc}/bin/pandoc "$INPUT" -f markdown-implicit_figures \
--include-in-header=${inlineHeader} -s \
--to=html5 --embed-resources \
--css=${cssStyle} -o "$HTML_TEMP" "$@"

View file

@ -3,10 +3,6 @@ let
top = "60";
right = "100%-w-10";
notransTag = "notrans";
noTransList = [
"title:(.*)( - YouTube Mozilla Firefox)"
"title:(.*)( - Mozilla Firefox)"
];
in
{
windowrule = [
@ -109,13 +105,7 @@ in
# Disable Tansparent
"opacity 1.0 override 1.0 override, tag:${notransTag}"
"noblur, tag: ^(${notransTag})$"
]
++ (concatLists (
map (w: [
"opacity 1.0 override 1.0 override, ${w}"
"noblur, ${w}"
]) noTransList
));
];
layerrule = [
"blur, waybar"

View file

@ -67,6 +67,7 @@ in
"BlinkCmpBorder",
"BlinkCmpKind",
"WarningMsg",
"ColorColumn",
"ErrorMsg",
"BlinkCmpMenuBorder",
"FzfLuaBackdrop",
@ -407,7 +408,8 @@ in
markdown = {
enable = true;
extensions = {
render-markdown-nvim.enable = true;
render-markdown-nvim.enable = false;
markview-nvim.enable = true;
};
};
html.enable = true;
@ -453,7 +455,6 @@ in
"base16"
"lsp-signature-nvim"
"snacks-nvim"
"render-markdown-nvim"
];
setupOpts.enable_autosnippets = true;
};

View file

@ -1,13 +1,68 @@
{ pkgs, ... }:
let
tex = pkgs.texliveFull.withPackages (
ps: with ps; [
standalone
everysel
preview
doublestroke
msg
setspace
rsfs
relsize
ragged2e
fundus-calligra
microtype
wasysym
physics
dvisvgm
jknapltx
wasy
cm-super
dvisvgm
amstex
babel-english
amsmath
amsfonts
mathtools
amscdx
xcolor
]
);
in
{
programs.nvf.settings.vim = {
keymaps = import ./keymaps.nix;
extraPackages = with pkgs; [ fd ];
extraPackages = with pkgs; [
fd
imagemagick
ghostscript
tex
];
};
programs.nvf.settings.vim.utility.snacks-nvim = {
enable = true;
setupOpts = {
image = {
enabled = false;
doc = {
enabled = true;
};
math = {
enabled = true;
latex = {
font_size = "Large";
packages = [
"amsmath"
"amssymb"
"amsfonts"
"amscd"
"mathtools"
];
};
};
};
bigfile = {
enabled = true;
};

View file

@ -58,13 +58,11 @@ in
(python3.withPackages (python-pkgs: [
python-pkgs.pip
python-pkgs.requests
python-pkgs.weasyprint
]))
# Work stuff
libreoffice-qt
pandoc
texliveSmall
# Bluetooth
blueberry

View file

@ -2,6 +2,7 @@
inputs,
system,
pkgs,
lib,
...
}:
let
@ -11,6 +12,15 @@ let
rev = "main";
hash = "sha256-TUS+yXxBOt6tL/zz10k4ezot8IgVg0/2BbS8wPs9KcE=";
};
md2html = pkgs.callPackage ./../scripts/md2html.nix { };
pdfNormalize = pkgs.writeShellScriptBin "normalize-pdf" ''
# Nomalize pdf to A4 size
${lib.getExe pkgs.ghostscript} -o "normalized_$1" \
-sDEVICE=pdfwrite \
-sPAPERSIZE=a4 \
-dFIXEDMEDIA \
-dPDFFitPage "$1"
'';
in
{
programs = {
@ -62,6 +72,22 @@ in
player = [
{ run = ''mpv --force-window "$@"''; }
];
open = [
{
run = ''xdg-open "$@"'';
desc = "Open";
}
];
};
open = {
prepend_rules = [
{
mime = "application/pdf";
use = "open";
}
];
};
};
@ -107,7 +133,7 @@ in
{
on = "T";
run = "plugin toggle-pane max-preview";
desc = "Show or hide the preview pane";
desc = "Show or hide the preview panel";
}
# Copy selected files to the system clipboard while yanking
{
@ -144,6 +170,38 @@ in
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 -- for path in "$@"; do ${lib.getExe pdfNormalize} "$path"; done'';
}
{
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";
}
];
};
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

After

Width:  |  Height:  |  Size: 3.1 MiB

Before After
Before After

View file

@ -1,7 +1,7 @@
{
sops = {
secrets = {
"wireguard/conf" = { };
"wireguard/wg0.conf" = { };
};
};
}

View file

@ -1,5 +1,5 @@
wireguard:
conf: ENC[AES256_GCM,data:ozLdARKsxx5WNxyDgNttKW+FC9/4xEZ0UYmayf04IYNwzzps5Njdtwz1M8/sJoFKoqR7FlQ8eEz1RLCHl9nFwwLkcd14Qm3Du/8Rujw2ZiGJWxO1H71tnJwZBNg0Hr0ex5j4aCs7A38yWA+Grj4FOPvfyMt/zTzUZfu2PYWfPuwMmxR6EU8AMTSDaHUhf26ZwpWg5TG3QjiEJHKnJPzjUo8Imff7XnMENmVMbRSgxCe7CDyrKIAkxQ568sqJpNIovtEXRdEtdLnzI3wUW8WEEnRrfpPwACBsxJxyXLvkr2KIboA4caKiqcFNnx0dzVbDbbWOcgipN3b/ztzNU+mp,iv:p+ITGhlXfDsbx4V+1+P0wKy4OCMXxQZb4loflzFUcrw=,tag:bJuOcphL/K9pBHs/CLQ8rA==,type:str]
wg0.conf: ENC[AES256_GCM,data:AL5GVljm3Ta9Deb2SiUNEvtTSL1L9E5lcMhE6szjXCCfBnOpK8RiVe/b6JGC9RzE6DFiiQdZoKBWLy7rcrIjrDA09bCaQO5Gjjl2YtEkI0FULcMI8PuIQ8j2sYgjk0FAXRsmNy5U/v6afIum5wN2iTsYL1y3DObeRoNrsQNhBYDQBE0ZmcJxgtQYihUuGuEYcDLhzhFXfYKZrG1Grwqpcn0KK8K5A3qPgtq8fn86KuMZ6i4MHAiG7OJgXMpgTHjmWpJ819qsswjkpF1RgjgpET28IiNza9FIbxiflIXXagSZeigtLIJ6dOZwBgt0f5dgfr41dN/hT5SEHFADdXIa,iv:OsB8mf+WB9C/kvGzTs/LxqjimPISDGhU2P2GjbkYEbc=,tag:lCxtFVViYejQhZUfmdkGrg==,type:str]
dovecot:
openldap: ENC[AES256_GCM,data:U3YYreEqoh+F0Mrli52jgQowrUqIUPmdQps=,iv:vTjHBFsue+89GOCDigVIktgGSZNZv8A2e3GM80o6TXc=,tag:GGh+hsT+yV/I12meXxflbQ==,type:str]
nextcloud:
@ -33,7 +33,7 @@ sops:
MEdmWkFwNXZoR1ZVRnQ0aWlkYzZwSmsK0EFecUIdqlDKX08oRCoDQQ3QCX1wzb8w
lghDJhWlfuKr+X24GoE4UK04aJVLqVMRRI4BJW+LQXeHS+dWKu3mQA==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2025-09-26T14:45:30Z"
mac: ENC[AES256_GCM,data:RAxzEJsfAY9UA15ln+uqEGoVli2oQEVP/8DrPEluQCfMYjMacbTlhIWfGXvUhFHZbY1/M0Q1IC/elY7iWqKn7Qc2VE+elTNHj+MTzp23pHUaHRo2h0kqcqnjdU1SeLNLJ5CDMp/wYyKKSeqde1UcQkhpE2sa5gnpVOd+JAJxCas=,iv:uD0qIHrI5uecUPGfOMvvcgr0NrbtTbHHxbdOX9dfDfw=,tag:FmnDi3opIobtIFI2rl+kWw==,type:str]
lastmodified: "2025-10-01T05:31:13Z"
mac: ENC[AES256_GCM,data:a3CkOEZUYSeRa6Zj+2EQnusgkOu2xHvGXhW9Pr5ny9sEiUF+S9jLQeS9vZpDNnQc5F/BRf/r0K7BTSwyoaAGZn3vsm3ruTGpajqV43Ji8PzG8BEApV0USwAn+gM8K4mMAEU9AjiqQ6k4Zf/dbYzv/rDtxVTdSbwcpM8KjIBv//Q=,iv:aCk+M3wigrbhCEHtf1K9vwByIYnTxBi7VD1XEIYgiL8=,tag:PtJN8KlPZbed0bgEcgSY0w==,type:str]
unencrypted_suffix: _unencrypted
version: 3.10.2

View file

@ -5,7 +5,7 @@ in
{
sops = {
secrets = {
"wireguard/conf" = { };
"wireguard/wg0.conf" = { };
"nextcloud/adminPassword" = mkIf config.services.nextcloud.enable {
owner = "nextcloud";
group = "nextcloud";

View file

@ -1,5 +1,5 @@
wireguard:
conf: ENC[AES256_GCM,data:ldBpfxIMARPsMyjwv6S3PxgprtprM8r2seYLUdjzQqQiXql4XzbuAkL1+JEXz9lZYfaFx/TdB6MhM8V/C24xAWUsYKPzK4AEanWfBQ4c9Qb1LlzNPm/nDy+4+X9GlmInd8oPPPj73BTgxIG26Wgi/gNsDBsZdZI/hD0Mz6s66y9QHYM1zM43RnlcqV/U9Hp0Q1Oxu5ljbvdt1K5Biuy/SnhRAVS0Qc3bwAnOX68ltZeF6k8J1/kNFBfSurBNJDktLxobAGBb9N6Aaq0q0l7VBB61GBglr3z+a8UiidPtWvqyVJAcWU+3v4uIeeMD3hMx216ypmVMpw5dPN33VrKW,iv:eZawtC2H+xcK1Ssr34ud31wHh/dOSlC6ntSd3OzKG1E=,tag:wwZsFfAbscEfpVvK0z7TzA==,type:str]
wg0.conf: ENC[AES256_GCM,data:6+FDJQiL+h0lOk74oBmE4yhav9fYMHxetTGkl8B9guqt1qe0l+K2xPzO4QETVCQl/AVs7Y8lnM1ucGCP6JScaiQONq0+cl5Am4+HJr6VhxEooPkt33qYtm6yzPqj/skyAMTsBE8NSmQ0W0nC6JSfl4IWiyksEkybotfClnFA7M5HCVm7pJ+/OXXM/UdiHHD2SanEfU1klA1pQrbxTOUHV/OUpt+d/upP21SGKBgvvm7P67qDeI+3bj9b+Og+Oz2P9YF1K1lcsC+xcdT50NOQ83p9UpUMYMaUGoPh6DcCVrDD2yr5CG01CbnP0SYqiY3vY5YfRDCEIeHFEk3clog3,iv:xQLcrm7Bj2Yoij8PkLIaWH7n81lF2IUGvhKmG3PGCAQ=,tag:YGCasXRmkv8QRgMGgfteiA==,type:str]
sops:
age:
- recipient: age1ar5h06qv72pduau043r04kschwcq0x0lm33wqvxzdh9grmp3cq3sy0ngnz
@ -20,7 +20,7 @@ sops:
SFlTZ1BoanoyRTB2ZkJWSHRpcnZwZDQKZ+KF6Jh3zRPr+bDmpeVqdo0qW7vnyFtv
V5K8QYFEq9ZEz2u2DEZtyzBYBtTvF3TZz+DL63NHGH7vUVU4cpzxYg==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2025-09-17T14:41:59Z"
mac: ENC[AES256_GCM,data:EozsnOxOJIydSKoMaoa1vcZBgmbWLHCnN73nSdhwaaVz5aW8YZi5rvVH0XwSLC/ZUolfSDYEe1RMhtM1pzfme9Ji5vu3OKHfUL65rp3fXgUzd6gfSoSyE5w+WIYREENkvM+bjUJUnhJYnSYqrugSjM9GBxVQRqWyYLFNB0Do/dM=,iv:EXKejICx3fLn8QLJlrCknm6e+BK5STo1Qsk/AiZZXVc=,tag:XPx1VaFxL04AfTVKviA/xQ==,type:str]
lastmodified: "2025-10-01T05:33:09Z"
mac: ENC[AES256_GCM,data:DJzfOk3BSHFdhVbW1WUOfHVw0qt1VlLKAkavtwcerd4Mb6HmY3IE9XSAapmcgDjeAdonDlOOTZCArcymkjT8q1lvqkhNsCbR2BYyZTzOcbI52pqoKGfaYE9kUtg2i1bNnQAuNF6oTqJEoJv3zVUUP0NgdUMtOa9QJio+mJyJ3F0=,iv:KaBis+WF8AuQV7wThQ3OrhFZUl+CF4OZ8D5otSIJRrg=,tag:EjjGdYisgWztKK8yfdXBcg==,type:str]
unencrypted_suffix: _unencrypted
version: 3.10.2

View file

@ -2,7 +2,7 @@
{
sops = {
secrets = {
"wireguard/conf" = { };
"wireguard/wg0.conf" = { };
};
};
}

View file

@ -7,6 +7,6 @@
firewall = {
allowedUDPPorts = [ 51820 ];
};
wg-quick.interfaces.wg0.configFile = config.sops.secrets."wireguard/conf".path;
wg-quick.interfaces.wg0.configFile = config.sops.secrets."wireguard/wg0.conf".path;
};
}