From 71e801609414728d2b7f3a1b54ec946178871d38 Mon Sep 17 00:00:00 2001 From: elwrcl Date: Thu, 3 Sep 2026 22:08:55 +0300 Subject: [PATCH] hx --- hosts/copland.ulu.nix | 2 +- modules/home/helix/home-helix-keys.ulu.nix | 43 +++------- modules/home/helix/home-helix-sidebar.ulu.nix | 86 +++++++++++++++++++ modules/home/home-ghostty.ulu.nix | 42 ++++----- modules/home/home-nyi.ulu.nix | 13 +-- modules/home/nu/home-nushell.ulu.nix | 3 +- .../home/zellij/home-zellij-keybinds.ulu.nix | 24 +++++- .../zellij/home-zellij-layout-ide.ulu.nix | 16 +++- 8 files changed, 167 insertions(+), 62 deletions(-) create mode 100644 modules/home/helix/home-helix-sidebar.ulu.nix diff --git a/hosts/copland.ulu.nix b/hosts/copland.ulu.nix index 7ab0297..59e91cb 100644 --- a/hosts/copland.ulu.nix +++ b/hosts/copland.ulu.nix @@ -41,13 +41,13 @@ in config.flake.homeModules.home-nushell-greeting config.flake.homeModules.home-helix config.flake.homeModules.home-helix-keys + config.flake.homeModules.home-helix-sidebar config.flake.homeModules.home-helix-languages config.flake.homeModules.home-helix-language-servers config.flake.homeModules.home-zellij config.flake.homeModules.home-zellij-keybinds config.flake.homeModules.home-zellij-layout-ide config.flake.homeModules.home-zellij-ide-command - # theme: one palette, one module per app it feeds config.flake.homeModules.home-theme config.flake.homeModules.home-theme-kemuri config.flake.homeModules.home-theme-gtk diff --git a/modules/home/helix/home-helix-keys.ulu.nix b/modules/home/helix/home-helix-keys.ulu.nix index e20b39f..713fe2a 100644 --- a/modules/home/helix/home-helix-keys.ulu.nix +++ b/modules/home/helix/home-helix-keys.ulu.nix @@ -1,35 +1,12 @@ { ... }: { flake.homeModules.home-helix-keys = - { config, pkgs, ... }: + { ... }: let float = cmd: ":sh zellij run --floating --close-on-exit -- ${cmd}"; floatKeep = cmd: ":sh zellij run --floating -- ${cmd}"; - pick = pkgs.writeShellApplication { - name = "hx-pick"; - runtimeInputs = [ - pkgs.yazi - config.programs.zellij.finalPackage - pkgs.coreutils - ]; - text = '' - chooser=$(mktemp -t hx-pick.XXXXXX) - trap 'rm -f "$chooser"' EXIT - - yazi "''${1:-.}" --chooser-file="$chooser" - - picked=$(head -n 1 "$chooser") - [ -n "$picked" ] || exit 0 - - zellij action toggle-floating-panes - zellij action write-chars ":open '$picked'" - zellij action write 13 - ''; - }; in { - home.packages = [ pick ]; - programs.helix.settings.keys = { normal = { esc = [ @@ -37,14 +14,16 @@ "keep_primary_selection" ]; + "A-s" = ":sh hx-sidebar-toggle"; + "A-S" = "split_selection_on_newline"; + + "C-f" = "search"; + "C-tab" = "goto_next_buffer"; + "C-S-tab" = "goto_previous_buffer"; + space = { q = ":buffer-close"; Q = ":quit"; - t = float "nu"; - e = float "hx-pick"; - E = float "hx-pick %{buffer_name}"; - n = ":sh zellij action new-tab"; - z = ":sh zellij action toggle-floating-panes"; v = { v = float "lazyjj"; @@ -72,7 +51,6 @@ f = ":toggle auto-format"; }; - # language server l = { r = ":lsp-restart"; s = ":lsp-stop"; @@ -82,6 +60,11 @@ }; }; }; + + insert."C-f" = [ + "normal_mode" + "search" + ]; }; }; } diff --git a/modules/home/helix/home-helix-sidebar.ulu.nix b/modules/home/helix/home-helix-sidebar.ulu.nix new file mode 100644 index 0000000..48a409a --- /dev/null +++ b/modules/home/helix/home-helix-sidebar.ulu.nix @@ -0,0 +1,86 @@ +{ ... }: +{ + flake.homeModules.home-helix-sidebar = + { config, pkgs, ... }: + let + sidebarConfig = pkgs.writeTextDir "yazi.toml" '' + [mgr] + ratio = [ 0, 1, 0 ] + show_hidden = false + show_symlink = false + linemode = "none" + scrolloff = 4 + ''; + + sidebar = pkgs.writeShellApplication { + name = "hx-sidebar"; + runtimeInputs = [ + pkgs.yazi + config.programs.zellij.finalPackage + pkgs.coreutils + ]; + text = '' + cd "''${1:-.}" + + export YAZI_CONFIG_HOME=${sidebarConfig} + + marker="''${XDG_RUNTIME_DIR:-/tmp}/hx-sidebar.''${ZELLIJ_SESSION_NAME:-none}" + chooser=$(mktemp -t hx-sidebar.XXXXXX) + trap 'rm -f "$chooser" "$marker"' EXIT + echo $$ > "$marker" + + while true; do + : > "$chooser" + yazi . --chooser-file="$chooser" + + picked=$(head -n 1 "$chooser") + [ -n "$picked" ] || break + + zellij action move-focus right + zellij action write 27 + zellij action write-chars ":open '$picked'" + zellij action write 13 + done + ''; + }; + + toggle = pkgs.writeShellApplication { + name = "hx-sidebar-toggle"; + runtimeInputs = [ + config.programs.zellij.finalPackage + pkgs.coreutils + ]; + text = '' + if [ -z "''${ZELLIJ_SESSION_NAME:-}" ]; then + echo "hx-sidebar-toggle: not inside a zellij session" >&2 + exit 1 + fi + + marker="''${XDG_RUNTIME_DIR:-/tmp}/hx-sidebar.''${ZELLIJ_SESSION_NAME}" + + if [ -e "$marker" ] && kill -0 "$(cat "$marker")" 2>/dev/null; then + zellij action toggle-fullscreen + else + rm -f "$marker" + + id=$(zellij action new-pane \ + --direction right \ + --name files \ + --close-on-exit \ + -- ${sidebar}/bin/hx-sidebar "$PWD") + + zellij action move-pane --pane-id "$id" left + for _ in 1 2 3 4 5; do + zellij action resize --pane-id "$id" decrease right + done + fi + ''; + }; + in + { + home.packages = [ + sidebar + toggle + ]; + }; +} diff --git a/modules/home/home-ghostty.ulu.nix b/modules/home/home-ghostty.ulu.nix index 0c71a12..fadc0ce 100644 --- a/modules/home/home-ghostty.ulu.nix +++ b/modules/home/home-ghostty.ulu.nix @@ -7,31 +7,32 @@ linuxKeybinds = [ "alt+r=reload_config" - "alt+q=close_surface" - "ctrl+space=new_tab" - "ctrl+page_down=next_tab" - "ctrl+page_up=previous_tab" - "alt+comma=move_tab:-1" - "alt+period=move_tab:1" + "ctrl+shift+q=close_surface" - "alt+1=goto_tab:1" - "alt+2=goto_tab:2" - "alt+3=goto_tab:3" - "alt+4=goto_tab:4" - "alt+5=goto_tab:5" - "alt+6=goto_tab:6" - "alt+7=goto_tab:7" - "alt+8=goto_tab:8" - "alt+9=goto_tab:9" + "ctrl+shift+t=new_tab" + "ctrl+shift+page_down=next_tab" + "ctrl+shift+page_up=previous_tab" + "ctrl+shift+comma=move_tab:-1" + "ctrl+shift+period=move_tab:1" + + "ctrl+shift+1=goto_tab:1" + "ctrl+shift+2=goto_tab:2" + "ctrl+shift+3=goto_tab:3" + "ctrl+shift+4=goto_tab:4" + "ctrl+shift+5=goto_tab:5" + "ctrl+shift+6=goto_tab:6" + "ctrl+shift+7=goto_tab:7" + "ctrl+shift+8=goto_tab:8" + "ctrl+shift+9=goto_tab:9" "ctrl+shift+backslash=new_split:right" "ctrl+shift+minus=new_split:down" - "alt+h=goto_split:left" - "alt+j=goto_split:bottom" - "alt+k=goto_split:top" - "alt+l=goto_split:right" + "ctrl+shift+h=goto_split:left" + "ctrl+shift+j=goto_split:bottom" + "ctrl+shift+k=goto_split:top" + "ctrl+shift+l=goto_split:right" "ctrl+shift+z=toggle_split_zoom" "ctrl+shift+e=equalize_splits" @@ -76,7 +77,7 @@ settings = { font-family = "JetBrainsMono Nerd Font"; - font-size = 11; + font-size = 12; window-padding-x = 10; window-padding-y = 10; @@ -87,7 +88,6 @@ mouse-scroll-multiplier = 2; shell-integration-features = "no-cursor,sudo,no-title"; - # Colors live in home-theme-ghostty, driven by the active palette. cursor-style = "block"; cursor-style-blink = true; adjust-cell-height = "35%"; diff --git a/modules/home/home-nyi.ulu.nix b/modules/home/home-nyi.ulu.nix index 2ba90f5..4153558 100644 --- a/modules/home/home-nyi.ulu.nix +++ b/modules/home/home-nyi.ulu.nix @@ -24,20 +24,23 @@ "disk" "colors" ]; - labelColor = "magenta"; + labelColor = "white"; separator = "-"; - box = false; + box = true; shading = null; shadingMode = "sextants"; logoOuter = null; logoInner = null; - light = "top-left"; - spin = "xy"; + light = "top"; + spin = "y"; speed = null; size = null; height = null; depth = null; - disks = [ ]; + disks = [ + "/mnt/HDD/linuxdata" + "/mnt/HDD/shared" + ]; logo = null; logoDistro = null; extraConfig = ""; diff --git a/modules/home/nu/home-nushell.ulu.nix b/modules/home/nu/home-nushell.ulu.nix index 5d18f94..b74ad5d 100644 --- a/modules/home/nu/home-nushell.ulu.nix +++ b/modules/home/nu/home-nushell.ulu.nix @@ -110,11 +110,10 @@ _ if ($name | str ends-with ".zip") => { ^unzip $file } _ if ($name | str ends-with ".7z") => { ^7z x $file } _ if ($name | str ends-with ".rar") => { ^unrar e $file } - _ => { print $"(ansi red)'($name)' açılamıyor(ansi reset)" } + _ => { print $"(ansi red)'($name)' cannot be extracted(ansi reset)" } } } - # `which`, with canonicalize . def realwhich [...applications: string, --all (-a)] { which --all=$all ...$applications | update path {|row| diff --git a/modules/home/zellij/home-zellij-keybinds.ulu.nix b/modules/home/zellij/home-zellij-keybinds.ulu.nix index e0a581a..6023e98 100644 --- a/modules/home/zellij/home-zellij-keybinds.ulu.nix +++ b/modules/home/zellij/home-zellij-keybinds.ulu.nix @@ -7,6 +7,28 @@ keybinds clear-defaults=true { normal { bind "Ctrl g" { SwitchToMode "Tmux"; } + + // workbench, no prefix: Alt is zellij's layer + bind "Alt Space" { ToggleFloatingPanes; } + bind "Alt g" { + Run "lazyjj" { + floating true + close_on_exit true + name "source control" + } + } + + // tabs + bind "Alt t" { NewTab; } + bind "Alt 1" { GoToTab 1; } + bind "Alt 2" { GoToTab 2; } + bind "Alt 3" { GoToTab 3; } + bind "Alt 4" { GoToTab 4; } + bind "Alt 5" { GoToTab 5; } + bind "Alt 6" { GoToTab 6; } + bind "Alt 7" { GoToTab 7; } + bind "Alt 8" { GoToTab 8; } + bind "Alt 9" { GoToTab 9; } } locked { @@ -62,7 +84,7 @@ bind "[" { SwitchToMode "Scroll"; } bind "/" { SwitchToMode "EnterSearch"; SearchInput 0; } - // tools, as floating panes over the editor + // tools bind "g" { Run "lazyjj" { floating true diff --git a/modules/home/zellij/home-zellij-layout-ide.ulu.nix b/modules/home/zellij/home-zellij-layout-ide.ulu.nix index 8c381cc..1f23f33 100644 --- a/modules/home/zellij/home-zellij-layout-ide.ulu.nix +++ b/modules/home/zellij/home-zellij-layout-ide.ulu.nix @@ -13,8 +13,20 @@ } tab name="edit" focus=true { - pane command="hx" close_on_exit=true { - args "." + pane split_direction="vertical" { + pane size="20%" name="files" command="hx-sidebar" close_on_exit=true { + args "." + } + pane focus=true command="hx" close_on_exit=true + } + + floating_panes { + pane name="terminal" command="nu" { + x "5%" + y "52%" + width "90%" + height "44%" + } } } }