From c20179f1afc29be2ef3ee32011cbc097bc70f771 Mon Sep 17 00:00:00 2001 From: DemonKingSwarn Date: Mon, 20 Apr 2026 14:16:22 +0530 Subject: better organization and tmux --- home/ghostty.nix | 47 +++++ home/git.nix | 80 ++++++++ home/niri.nix | 573 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ home/starship.nix | 55 ++++++ home/tmux.nix | 56 ++++++ home/zsh.nix | 211 ++++++++++++++++++++ 6 files changed, 1022 insertions(+) create mode 100644 home/ghostty.nix create mode 100644 home/git.nix create mode 100644 home/niri.nix create mode 100644 home/starship.nix create mode 100644 home/tmux.nix create mode 100644 home/zsh.nix (limited to 'home') diff --git a/home/ghostty.nix b/home/ghostty.nix new file mode 100644 index 0000000..a8288f2 --- /dev/null +++ b/home/ghostty.nix @@ -0,0 +1,47 @@ +{ ... }: + +{ + programs.ghostty = { + enable = true; + + settings = { + theme = "Catppuccin Mocha"; + #background = "#282a36"; + background-opacity = 0.9; + + #custom-shader = "/home/swarn/.config/ghostty/bettercrt.glsl"; + + window-vsync = true; + + title = "Ghostty"; + class = "ghostty"; + + shell-integration = "zsh"; + + quick-terminal-position = "top"; + quick-terminal-autohide = false; + + font-family = "LythMono Nerd Font"; + font-size = 16; + + cursor-style = "block"; + cursor-style-blink = false; + shell-integration-features = "no-cursor"; + + #gtk-titlebar = false; + window-decoration = "server"; + confirm-close-surface = false; + + window-theme = "ghostty"; + + window-padding-x = 8; + window-padding-y = 2; + window-padding-balance = true; + + keybind = [ + "alt+shift+r=reload_config" + "ctrl+a=toggle_quick_terminal" + ]; + }; + }; +} diff --git a/home/git.nix b/home/git.nix new file mode 100644 index 0000000..4b75f9c --- /dev/null +++ b/home/git.nix @@ -0,0 +1,80 @@ +{ ... }: +{ + xdg.enable = true; + + programs.git = { + enable = true; + + settings = { + user = { + name = "DemonKingSwarn"; + email = "rockingswarn@gmail.com"; + }; + + init = { + defaultBranch = "master"; + }; + + core = { + compression = 4; + whitespace = "error"; + preloadIndex = true; + }; + + advice = { + addEmptyPathspec = false; + pushNonFastForward = false; + statusHints = false; + }; + + status = { + branch = true; + showStash = true; + showUntrackedFiles = "all"; + }; + + diff = { + context = 3; + renames = "copies"; + interHunkContext = 10; + }; + + push = { + autoSetupRemote = true; + default = "current"; + followTags = true; + }; + + pull = { + rebase = true; + }; + + rebase = { + autoStash = true; + missingCommitsCheck = "warn"; + }; + + http = { + sslVerify = false; + version = "HTTP/1.1"; + }; + + gpg.format = "ssh"; + + url = { + "git@github.com:demonkingswarn/" = { + insteadOf = "dks:/"; + }; + "git@github.com:" = { + insteadOf = "gh:"; + }; + }; + + credential = { + "https://github.com".helper = [ "" "!/usr/bin/gh auth git-credential" ]; + "https://gist.github.com".helper = [ "" "!/usr/bin/gh auth git-credential" ]; + }; + + }; + }; +} diff --git a/home/niri.nix b/home/niri.nix new file mode 100644 index 0000000..91b5073 --- /dev/null +++ b/home/niri.nix @@ -0,0 +1,573 @@ +{ config, pkgs, inputs, ... }: + +{ + imports = [ inputs.niri.homeModules.niri ]; + + programs.niri = { + enable = true; + config = '' + environment { + DISPLAY ":0" + + SDL_VIDEODRIVER "wayland" + SDL_AUDIODRIVER "pipewire" + _JAVA_AWT_WM_NONREPARENTING "1" + + XDG_CURRENT_DESKTOP "niri" + XDG_SESSION_DESKTOP "niri" + XDG_CURRENT_SESSION_TYPE "wayland" + + GDK_BACKEND "wayland" + MOZ_ENABLE_WAYLAND "1" + MOZ_DISABLE_RDD_SANDBOX "1" + KITTY_ENABLE_WAYLAND "1" + EGL_PLATFORM "wayland" + GTK_USE_PORTAL "0" + + QT_PLUGIN_PATH "/usr/lib/qt/plugins/" + QT_WAYLAND_DISABLE_WINDOWDECORATION "1" + QT_QPA_PLATFORM "wayland" + QT_QPA_PLATFORMTHEME "gtk3" + + HYPRCURSOR_THEME "Bibata-Modern-Ice" + HYPRCURSOR_SIZE "24" + + __GLX_VENDOR_LIBRARY_NAME "nvidia" + __GL_VRR_ALLOWED "1" + WLR_NO_HARDWARE_CURSORS "1" + LIBVA_DRIVER_NAME "nvidia" + VDPAU_DRIVER "nvidia" + __GL_SYNC_TO_VBLANK "0" + NVD_BACKEND "direct" + } + + binds { + Super+Shift+Slash { show-hotkey-overlay; } + + Super+Return { spawn "wezterm"; } + Alt+Return { spawn "ghostty"; } + //Super+D { spawn "rofi" "-show" "drun"; } + Super+D { spawn "vicinae" "toggle"; } + Super+E { spawn "vicinae" "vicinae://launch/core/search-emojis"; } + Super+Shift+X { spawn "~/.scripts/system/waylock.sh"; } + Print { screenshot-screen; } + Super+Print { screenshot; } + Alt+Print { screenshot-window; } + + // my new keyboard doesnt have print screen + Super+P { screenshot-screen; } + Super+Shift+P { screenshot; } + + Super+N { spawn "nightmode"; } + Super+O { spawn "~/.scripts/0x0/share"; } + Super+W { spawn "~/.scripts/misc/wallmanager"; } + Super+G { spawn "nirifreeze"; } + Super+V { spawn "vicinae" "vicinae://extensions/vicinae/clipboard/history"; } + Alt+C { spawn "colpick"; } + Super+TAB repeat=false { toggle-overview; } + + XF86AudioRaiseVolume { spawn "pamixer" "-i" "5"; } + XF86AudioLowerVolume { spawn "pamixer" "-d" "5"; } + XF86AudioMute { spawn "pamixer" "-t" "mute"; } + + XF86MonBrightnessUp { spawn "brightnessctl" "set" "+5%"; } + XF86MonBrightnessDown { spawn "brightnessctl" "set" "5%-"; } + Super+F1 { spawn "brightnessctl" "set" "+5%"; } + Super+F2 { spawn "brightnessctl" "set" "5%-"; } + + XF86AudioPlay { spawn "playerctl" "play-pause";} + XF86AudioPrev { spawn "playerctl" "previous";} + XF86AudioNext { spawn "playerctl" "next";} + + XF86Explorer { spawn "thunar"; } + XF86Search { spawn "rofi" "-no-lazy-greb" "-show" "file-browser-extended" "-icon-theme" "'Cosmic'"; } + XF86Calculator { spawn "galculator"; } + XF86Tools { spawn "waterfox" "--new-window" "-kiosk" "https://music.youtube.com";} + + Super+I { spawn "wezterm" "-e" "htop"; } + + Super+Shift+Q { close-window; } + + Super+Left { focus-column-left; } + Super+Down { focus-window-down; } + Super+Up { focus-window-up; } + Super+Right { focus-column-right; } + + Super+H { focus-column-left; } + Super+J { focus-window-down; } + Super+K { focus-window-up; } + Super+L { focus-column-right; } + + Super+Shift+Left { move-column-left; } + Super+Shift+Down { move-window-down; } + Super+Shift+Up { move-window-up; } + Super+Shift+Right { move-column-right; } + Super+Shift+H { move-column-left; } + Super+Shift+J { move-window-down; } + Super+Shift+K { move-window-up; } + Super+Shift+L { move-column-right; } + + Super+Home { focus-column-first; } + Super+End { focus-column-last; } + Super+Shift+Home { move-column-to-first; } + Super+Shift+End { move-column-to-last; } + + Super+Page_Down { focus-workspace-down; } + Super+Page_Up { focus-workspace-up; } + Super+U { focus-workspace-down; } + Super+Shift+Page_Down { move-column-to-workspace-down; } + Super+Shift+Page_Up { move-column-to-workspace-up; } + Super+Shift+U { move-column-to-workspace-down; } + Super+Shift+I { move-column-to-workspace-up; } + + Super+1 { focus-workspace 1; } + Super+2 { focus-workspace 2; } + Super+3 { focus-workspace 3; } + Super+4 { focus-workspace 4; } + Super+5 { focus-workspace 5; } + Super+6 { focus-workspace 6; } + Super+7 { focus-workspace 7; } + Super+8 { focus-workspace 8; } + Super+9 { focus-workspace 9; } + + Super+Shift+1 { move-window-to-workspace 1; } + Super+Shift+2 { move-window-to-workspace 2; } + Super+Shift+3 { move-window-to-workspace 3; } + Super+Shift+4 { move-window-to-workspace 4; } + Super+Shift+5 { move-window-to-workspace 5; } + Super+Shift+6 { move-window-to-workspace 6; } + Super+Shift+7 { move-window-to-workspace 7; } + Super+Shift+8 { move-window-to-workspace 8; } + Super+Shift+9 { move-window-to-workspace 9; } + + Super+Comma { consume-window-into-column; } + Super+Period { expel-window-from-column; } + + Super+R { switch-preset-column-width; } + Super+Shift+F { maximize-column; } + Super+F { fullscreen-window; } + Super+C { center-column; } + + Super+Minus { set-column-width "-10%"; } + Super+Equal { set-column-width "+10%"; } + + // Finer height adjustments when in column with other windows. + Super+Shift+Minus { set-window-height "-10%"; } + Super+Shift+Equal { set-window-height "+10%"; } + + Super+Shift+M { quit; } + + Super+Ctrl+Shift+T { toggle-debug-tint; } + } + + input { + + keyboard { + repeat-delay 300 + repeat-rate 69 + xkb { + layout "us" + options "compose:menu" + } + } + + touchpad { + click-method "button-areas" + tap + natural-scroll + scroll-method "two-finger" + middle-emulation + scroll-factor 1 + accel-speed 0.2 + accel-profile "adaptive" + } + + mouse { + accel-speed 0.3 + accel-profile "flat" + //scroll-factor 1.0 + scroll-method "no-scroll" + //scroll-button 274 + //middle-emulation + } + + focus-follows-mouse + warp-mouse-to-focus + workspace-auto-back-and-forth + } + + output "eDP-1" { + scale 1 + + mode "1920x1080@60" + position x=1920 y=0 + } + + + output "HDMI-A-2" { + scale 1 + + mode "1920x1080@74.973" + position x=0 y=0 + } + + animations { + workspace-switch { + // off + spring damping-ratio=0.75 stiffness=600 epsilon=0.001 + } + horizontal-view-movement { + // off + spring damping-ratio=1.0 stiffness=800 epsilon=0.0001 + } + + window-open { + //duration-ms 150 + //curve "ease-out-expo" + //custom-shader "~/.config/niri/shaders/smooth.glsl" + /-custom-shader r" + vec4 open_color(vec3 coords_geo, vec3 size_geo) { + vec3 coords_tex = niri_geo_to_tex * coords_geo; + vec4 color = texture2D(niri_tex, coords_tex.st); + + vec2 size = size_geo.xy; + vec2 coords = (coords_geo.xy - vec2(0.5, 0.5)) * size * 2.0; + + // Some padding for borders and shadows. + float pad = 8.0; + coords = coords + vec2(pad, pad); + size = size + vec2(pad, pad) * 2.0; + + coords = coords / length(size); + float p = niri_clamped_progress; + if (p * p <= dot(coords, coords)) + color = vec4(0.0); + + return color; + } + " + + /-custom-shader r" + vec4 open_color(vec3 coords_geo, vec3 size_geo) { + vec3 coords_tex = niri_geo_to_tex * coords_geo; + vec4 color = texture2D(niri_tex, coords_tex.st); + + return color; + } + " + duration-ms 200 + curve "linear" + } + + window-close { + //duration-ms 150 + //curve "ease-out-quad" + //duration-ms 200 + //curve "ease-out-quad" + + custom-shader r" + mat2 rotate(float angle) { + return mat2(cos(angle), -sin(angle), sin(angle), cos(angle)); + } + + vec4 close_color(vec3 coords_geo, vec3 size_geo) { + float progress = niri_clamped_progress * niri_clamped_progress; + + vec2 coords = (coords_geo.xy - vec2(0.5, 1.0)) * size_geo.xy; + + coords.y -= progress * 200.0; + + float random = (niri_random_seed - 0.5) / 2.0; + random = sign(random) - random; + float max_angle = 0.05 * random; + + float angle = progress * max_angle; + coords = rotate(angle) * coords; + + coords_geo = vec3(coords / size_geo.xy + vec2(0.5, 1.0), 1.0); + + vec3 coords_tex = niri_geo_to_tex * coords_geo; + vec4 color = texture2D(niri_tex, coords_tex.st); + + return color * (1.0 - niri_clamped_progress); + } + " + + /-custom-shader r" + vec4 close_color(vec3 coords_geo, vec3 size_geo) { + vec3 coords_tex = niri_geo_to_tex * coords_geo; + vec4 color = texture2D(niri_tex, coords_tex.st); + + return color; + } + " + } + + overview-open-close { + spring damping-ratio=0.75 stiffness=650 epsilon=0.001 + } + + window-resize { + /-custom-shader r" + vec4 resize_color(vec3 coords_curr_geo, vec3 size_curr_geo) { + vec3 coords_next_geo = niri_curr_geo_to_next_geo * coords_curr_geo; + vec3 coords_prev_geo = niri_curr_geo_to_prev_geo * coords_curr_geo; + + vec3 coords_crop = niri_geo_to_tex_next * coords_next_geo; + vec3 coords_stretch = niri_geo_to_tex_next * coords_curr_geo; + vec3 coords_stretch_prev = niri_geo_to_tex_prev * coords_curr_geo; + + // We can crop if the current window size is smaller than the next window + // size. One way to tell is by comparing to 1.0 the X and Y scaling + // coefficients in the current-to-next transformation matrix. + bool can_crop_by_x = niri_curr_geo_to_next_geo[0][0] <= 1.0; + bool can_crop_by_y = niri_curr_geo_to_next_geo[1][1] <= 1.0; + bool crop = can_crop_by_x && can_crop_by_y; + + vec4 color; + + if (crop) { + // However, when we crop, we also want to crop out anything outside the + // current geometry. This is because the area of the shader is unspecified + // and usually bigger than the current geometry, so if we don't fill pixels + // outside with transparency, the texture will leak out. + if (coords_curr_geo.x < 0.0 || 1.0 < coords_curr_geo.x || + coords_curr_geo.y < 0.0 || 1.0 < coords_curr_geo.y) { + color = vec4(0.0); + } else { + color = texture2D(niri_tex_next, coords_crop.st); + } + } else { + // If we can't crop, then crossfade. + color = texture2D(niri_tex_next, coords_stretch.st); + vec4 color_prev = texture2D(niri_tex_prev, coords_stretch_prev.st); + color = mix(color_prev, color, niri_clamped_progress); + } + + return color; + } + " + } + + screenshot-ui-open { + // off + duration-ms 200 + curve "ease-out-quad" + } + } + + window-rule { + match app-id="waterfox" title=r#"^File Upload$"# + open-floating true + } + + // Godot rules + window-rule { + match app-id="Godot" title="Create New Node" + match app-id="Godot" title="Godot Engine - Project Manager" + open-floating true + default-window-height { fixed 750; } + } + + // terminals + window-rule { + match app-id=r#"^org\.wezfurlong\.wezterm$"# + match app-id=r#"^com\.mitchellh\.ghostty$"# + match app-id=r#"^foot|footclient$"# + + background-effect { + blur { on; } + } + } + + // browser and shit + window-rule { + match app-id=r#"^helium$"# + match app-id=r#"^thunar$"# + opacity 0.95 + background-effect { + blur { on; } + } + } + + window-rule { + match app-id="SuperPacker" + open-floating true + } + + window-rule { + match app-id="" title="Picture-in-Picture" + open-floating true + //default-column-width { fixed 480; } + //default-window-height { fixed 270; } + default-floating-position x=50 y=50 relative-to="top-right" + } + + window-rule { + geometry-corner-radius 20 + clip-to-geometry true + } + + window-rule { + match app-id="vesktop" + block-out-from "screen-capture" + } + + window-rule { + match app-id="waterfox" title=r#"^Whatsapp"# + block-out-from "screen-capture" + } + + window-rule { + match is-window-cast-target=true + + focus-ring { + active-color "#f38ba8" + inactive-color "#7d0d2d" + } + + border { + inactive-color "#7d0d2d" + } + + shadow { + color "#7d0d2d70" + } + + tab-indicator { + active-color "#f38ba8" + inactive-color "#7d0d2d" + } + } + + layer-rule { + match namespace="^wallpaper$" + place-within-backdrop true + } + + layer-rule { + match namespace="waybar" + opacity 0.99 + } + + layer-rule { + match namespace="swaync-notification-window" + block-out-from "screen-capture" + } + + + layer-rule { + match namespace="awww" + geometry-corner-radius 12 + place-within-backdrop true + } + + layer-rule { + match namespace="rofi" + + background-effect { + blur { on; } + } + } + + layout { + preset-column-widths { + proportion 0.25 + proportion 0.33333 + proportion 0.5 + proportion 0.66667 + proportion 0.75 + fixed 1280 + } + + preset-window-heights { + proportion 0.5 + proportion 0.66667 + proportion 1.0 + } + + default-column-width { proportion 1.0; } + + focus-ring { + off + } + border { + width 2 + active-color "#C1CAF5" + inactive-color "transparent" + urgent-color "#9b0000" + } + + shadow { + on + softness 30 + spread 8 + offset x=0 y=5 + color "#00000040" + } + + tab-indicator { + width 8 + gap 8 + length total-proportion=1.0 + position "top" + place-within-column + } + + background-color "transparent" + gaps 6 + } + + screenshot-path "~/pix/ss/shot_%y%m%d_%H-%M-%S.png" + + prefer-no-csd + + hotkey-overlay { + skip-at-startup + } + + cursor { + xcursor-theme "Bibata-Modern-Ice" + + xcursor-size 24 + + hide-when-typing + // hide-after-inactive-ms 1000 + } + + overview { + zoom 0.333 + backdrop-color "#262626" + + workspace-shadow { + off + softness 100 + spread 50 + offset x=20 y=20 + color "#000a" + } + } + + recent-windows { + highlight { + corner-radius 14 + } + + previews { + max-height 320 + } + } + + gestures { + hot-corners { + off + } + } + + switch-events { + lid-close { spawn "systemctl" "suspend-then-hibernate"; } + lid-open { spawn "notify-send" "System resume complete"; } + } + ''; + }; +} diff --git a/home/starship.nix b/home/starship.nix new file mode 100644 index 0000000..500a0cd --- /dev/null +++ b/home/starship.nix @@ -0,0 +1,55 @@ +{ ... }: + +{ + xdg.enable = true; + + programs.starship = { + enable = true; + settings = { + add_newline = true; + command_timeout = 100000000; + + line_break = { + disabled = true; + }; + + package = { + disabled = true; + }; + + aws = { + style = "bold #ffb86c"; + }; + + character = { + error_symbol = "[❯](bold #ff5555)"; + success_symbol = "[❯](bold #50fa7b)"; + }; + + cmd_duration = { + style = "bold #f1fa8c"; + }; + + directory = { + style = "bold #50fa7b"; + }; + + git_branch = { + style = "bold #ff79c6"; + }; + + git_status = { + style = "bold #ff5555"; + }; + + hostname = { + style = "bold #bd93f9"; + }; + + username = { + format = "[$user]($style) on "; + style_user = "bold #8be9fd"; + }; + }; + }; +} diff --git a/home/tmux.nix b/home/tmux.nix new file mode 100644 index 0000000..7d4167e --- /dev/null +++ b/home/tmux.nix @@ -0,0 +1,56 @@ +{ pkgs, ... }: +{ + xdg.enable = true; + + programs.tmux = { + enable = true; + prefix = "C-s"; + mouse = true; + baseIndex = 0; + + plugins = with pkgs.tmuxPlugins; [ + sensible + vim-tmux-navigator + yank + ]; + + extraConfig = '' + set-option -g status-position top + set -g focus-events on + + unbind r + bind r source-file ~/.config/tmux/tmux.conf \; display-message "tmux.conf reloaded." + + bind-key d detach + bind-key p display-popup + bind-key f run-shell "~/.dots/.local/bin/tmux-sessionizer" + + bind-key h select-pane -L + bind-key j select-pane -D + bind-key k select-pane -U + bind-key l select-pane -R + + # Catppuccin Mocha colors + # base=#1e1e2e surface0=#313244 surface1=#45475a + # text=#cdd6f4 subtext0=#a6adc8 + # mauve=#cba6f7 blue=#89b4fa cyan=#89dceb + # green=#a6e3a1 pink=#f38ba8 + + set -g pane-border-style fg=#313244 + set -g pane-active-border-style fg=#cba6f7 + + set -g message-style fg=#cdd6f4,bg=#313244 + + set -g status-style fg=#cdd6f4,bg=#1e1e2e + set -g status-justify left + + set -g window-status-format "#[fg=#1e1e2e,bg=#313244,nobold,noitalics,nounderscore] #[fg=#a6adc8,bg=#313244]#I #[fg=#313244,bg=#45475a,nobold,noitalics,nounderscore] #[fg=#cdd6f4,bg=#45475a]#W #F #[fg=#45475a,bg=#1e1e2e,nobold,noitalics,nounderscore]" + set -g window-status-current-format "#[fg=#1e1e2e,bg=#cba6f7,nobold,noitalics,nounderscore] #[fg=#1e1e2e,bg=#cba6f7]#I #[fg=#cba6f7,bg=#89b4fa,nobold,noitalics,nounderscore] #[fg=#1e1e2e,bg=#89b4fa]#W #F #[fg=#89b4fa,bg=#1e1e2e,nobold,noitalics,nounderscore]" + set -g window-status-separator "" + + set -g status-left "#[fg=#1e1e2e,bg=#cba6f7,bold] #S #[fg=#cba6f7,bg=#1e1e2e,nobold,noitalics,nounderscore]" + set -g status-right "#[fg=#313244,bg=#1e1e2e,nobold,noitalics,nounderscore]#[fg=#a6adc8,bg=#313244] #{pane_current_path} #[fg=#45475a,bg=#313244,nobold,noitalics,nounderscore]#[fg=#cdd6f4,bg=#45475a] #(whoami)@#H #[fg=#cba6f7,bg=#45475a,nobold,noitalics,nounderscore]#[fg=#1e1e2e,bg=#cba6f7,bold] #S " + set -g status-right-length 150 + ''; + }; +} diff --git a/home/zsh.nix b/home/zsh.nix new file mode 100644 index 0000000..84badd5 --- /dev/null +++ b/home/zsh.nix @@ -0,0 +1,211 @@ +{ config, pkgs, ... }: + +{ + programs.zsh = { + enable = true; + dotDir = "${config.xdg.configHome}/zsh"; + + history = { + size = 10000; + save = 10000; + path = "${config.xdg.cacheHome}/zsh/history"; + ignoreDups = true; + ignoreSpace = true; + share = true; + expireDuplicatesFirst = true; + }; + + shellAliases = { + sch = "sudo systemctl set-environment SCX_SCHEDULER_OVERRIDE=scx_lavd && sudo systemctl restart scx"; + + ".." = "cd .."; + + system-manager = ''nix run 'github:numtide/system-manager' --''; + + zrc = "nvim $HOME/.config/zsh/.zshrc"; + + ga = "git add"; + gc = "git commit"; + gp = "git push"; + gu = "git pull"; + gd = "git diff"; + gl = "git log --all --graph --pretty=format:'%C(magenta))%h %C(white) %an %ar%C(auto) %D%n%s%n'"; + gb = "git branch"; + gi = "git init"; + gcl = "git clone"; + + swww = "awww"; + weather = "curl -s 'https://wttr.in/?1n'"; + pacgraph = "pacgraph --show-req-by -b '#232738' -l '#9778d3' -t '#cca9c6' -d '#b8d0eb'"; + grep = "grep --color=auto"; + stow = "stow --ignore='screenshot.png' --ignore='README.org' --ignore='.git' --ignore='.assets' --ignore='deploy.sh'"; + yarn = "yarn --use-yarnrc $XDG_CONFIG_HOME/yarn/config"; + diff = "diff --color=auto"; + df = "duf -hide special"; + neofetch = "fastfetch --kitty ~/.config/fastfetch/logos/arch-logo.png --logo-width 45"; + irssi = "irssi --config=$XDG_CONFIG_HOME/irssi/config --home=$XDG_DATA_HOME/irssi"; + cat = "bat --paging=never"; + less = "bat --paging=always"; + x = "exit"; + logout = "pkill -u $USER"; + dir = "dir --color=auto"; + networkusage = "vnstat -i wlo1"; + b = "brightnessctl set"; + hostname = "uname -n"; + wiki = "nvim $XDG_DATA_HOME/vimwiki/index_$(date '+%a-%d-%m-%y-%H:%M').wiki"; + dosbox = "dosbox -conf $XDG_CONFIG_HOME/dosbox/dosbox.conf"; + adb = "HOME=$XDG_DATA_HOME/android adb"; + time = "hyperfine"; + thumb = "yt-dlp --write-thumbnail --skip-download"; + SS = "sudo systemctl"; + j = "sudo journalctl"; + lsusb = "cyme --headings --tree --hide-buses"; + wget = "wcurl"; + open = "xdg-open"; + loc = "~/.local/share/go/bin/scc"; + rtmp = "podman run -d -p 1935:1935 --name nginx docker.io/tiangolo/nginx-rtmp"; + lf = "yazi"; + dfm = "demonfm"; + + ls = "eza --icons --group-directories-first"; + ll = "eza -lgh --icons --group-directories-first"; + la = "eza -lagh --icons --group-directories-first"; + tree = "eza -aT --icons"; + + mv = "mvg -ig"; + rm = "rip -i --graveyard $HOME/.local/share/Trash"; + ln = "ln -i"; + cp = "cpg -ig"; + + "scheiße" = "bash"; + e = "$EDITOR"; + edit = "msedit"; + c = "clear"; + + xcc = "xclip -selection clipboard"; + xco = "xclip -selection clipboard -o"; + pbcopy = "wl-copy"; + pbpaste = "wl-paste"; + + install = "paru -Slq | fzf --multi --preview 'paru -Si {1}' | xargs -ro paru -S"; + uninstall = "paru -Qq | fzf --multi --preview 'paru -Qi {1}' | xargs -ro paru -Rcns"; + update = "paru -Syu --noconfirm"; + garbage = "paru -Rcns $(paru -Qqdtt)"; + }; + + initContent = '' + unset __HM_SESS_VARS_SOURCED + source ~/.nix-profile/etc/profile.d/hm-session-vars.sh + + # global aliases + alias -g NE='2>/dev/null' + alias -g DN='> /dev/null' + alias -g NUL='>/dev/null 2>&1' + alias -g JQ='| jq' + alias -g C='| wl-copy' + + # plugin manager + ZINIT_HOME="''${XDG_DATA_HOME:-''${HOME}/.local/share}/zinit/zinit.git" + if [ ! -d "$ZINIT_HOME" ]; then + mkdir -p "$(dirname $ZINIT_HOME)" + git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME" + fi + source "''${ZINIT_HOME}/zinit.zsh" + + # plugins + zinit light zsh-users/zsh-syntax-highlighting + zinit light zsh-users/zsh-completions + zinit light zsh-users/zsh-autosuggestions + zinit light Aloxaf/fzf-tab + zinit light jeffreytse/zsh-vi-mode + autoload -U compinit && compinit + + # keybindings + bindkey -v + bindkey '^f' autosuggest-accept + bindkey '^p' history-search-backward + bindkey '^n' history-search-forward + autoload -Uz edit-command-line + zle -N edit-command-line + bindkey '^X^e' edit-command-line + bindkey ' ' magic-space + bindkey -s '^o' 'lfcd\n' + + # completion styling + zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' + zstyle ':completion:*' list-colors "''${(s.:.)LS_COLORS}" + zstyle ':completion:*' menu no + zstyle ':fzf-tab:complete:cd:*' fzf-preview "eza $realpath" + zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-preview "eza $realpath" + + # sourcing + source "''${XDG_CONFIG_HOME:-''${HOME}/.config}/shell/profile" + + # shell integration + eval "$(fzf --zsh)" + eval "$(zoxide init --cmd cd zsh)" + eval "$(starship init zsh)" + eval "$(atuin init zsh)" + + # functions + function help() { + "$@" --help 2>&1 | bat --plain --language=help + } + function chst() { + [ -z $1 ] && echo "no args provided!" || (curl -s cheat.sh/$1 | bat --style=plain) + } + function gdown() { + agent="Mozilla/5.0 (X11; Linux x86_64; rv:129.0) Gecko/20100101 Firefox/129.0" + uuid=$(curl -sL "$1" -A "$agent" | sed -nE 's|.*(uuid=[^"]*)".*|\1|p') + aria2c -x16 -s16 "$1&confirm=t&$uuid" -U "$agent" --summary-interval=0 -d "''${2:-.}" + } + function fshow() { + git log --graph --color=always \ + --format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" | + fzf --ansi --no-sort --reverse --tiebreak=index --bind=ctrl-s:toggle-sort \ + --bind "ctrl-m:execute: + (grep -o '[a-f0-9]\{7\}' | head -1 | + xargs -I % sh -c 'git show --color=always % | less -R') << 'FZF-EOF' + {} + FZF-EOF" + } + function lfcd() { + tmp="$(mktemp)" + yazi -last-dir-path="$tmp" "$@" + if [ -f "$tmp" ]; then + dir="$(cat "$tmp")" + /usr/sbin/rm -f "$tmp" + [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" + fi + } + function tm() { + tmux-sessionizer + } + function cheat() { + lang=$(curl -s cheat.sh/:list | fzf --reverse --height=50%) + curl -s cheat.sh/$lang | bat --paging=always + } + function supercat() { + if [ "$(printf '%s' "$1" | cut -d '.' -f2)" = "jai" ]; then + bat -l odin "$1" + else + bat "$1" + fi + } + function mkcd() { + mkdir -p "$1" + cd "$1" + } + function pdfmaker() { + pandoc --pdf-engine=pdfroff "$1" -o "$2.pdf" + } + + # greeting + if [ "$TERM_PROGRAM" = "tmux" ]; then + figlet "tmux" + else + greet + fi + ''; + }; +} -- cgit v1.1