From 7e8882551ef7366f9d215bc9316672b6bcd8d3d4 Mon Sep 17 00:00:00 2001 From: Surendra Jammishetti Date: Sun, 7 Dec 2025 18:29:46 -0800 Subject: [PATCH] a lot of movement? --- flake.nix | 32 +- modules/home/bars/sketchybar/default.nix | 11 + .../home/bars/sketchybar/sketchybar/colors.sh | 8 + .../bars/sketchybar/sketchybar/graphs/cpu.sh | 33 ++ .../bars/sketchybar/sketchybar/graphs/disk.sh | 21 ++ .../sketchybar/sketchybar/graphs/memory.sh | 20 + .../sketchybar/sketchybar/graphs/network.sh | 16 + .../sketchybar/plugins/aerospace.sh | 20 + .../sketchybar/sketchybar/plugins/battery.sh | 28 ++ .../sketchybar/sketchybar/plugins/clock.sh | 7 + .../bars/sketchybar/sketchybar/plugins/cpu.sh | 18 + .../sketchybar/sketchybar/plugins/disk.sh | 32 ++ .../sketchybar/plugins/front_app.sh | 10 + .../sketchybar/sketchybar/plugins/memory.sh | 26 ++ .../sketchybar/sketchybar/plugins/network.sh | 28 ++ .../sketchybar/sketchybar/plugins/space.sh | 7 + .../sketchybar/sketchybar/plugins/volume.sh | 20 + .../bars/sketchybar/sketchybar/sketchybarrc | 133 +++++++ modules/home/prompts/oh-my-posh/default.nix | 5 + .../home/prompts/oh-my-posh/mypure.omp.toml | 79 ++++ modules/home/prompts/starship/default.nix | 11 + modules/home/prompts/starship/starship.toml | 347 +++++++++++++++++ modules/home/shells/fish/default.nix | 136 +++++++ modules/home/shells/fish/nix-fix.fish | 139 +++++++ modules/home/shells/zsh/default.nix | 0 modules/home/term/ghostty/default.nix | 0 modules/home/term/ghostty/ghostty/config | 125 +++++++ modules/home/term/ghostty/ghostty/shaders | 1 + modules/home/tools/btop.nix | 8 + modules/home/tools/default.nix | 29 ++ modules/home/tools/git.nix | 12 + modules/home/tools/helix/default.nix | 213 +++++++++++ modules/home/tools/helix/theme-trans.toml | 5 + modules/home/tools/zellij/config.kdl | 264 +++++++++++++ modules/home/tools/zellij/default.nix | 44 +++ modules/home/wm/aerospace/aerospace.toml | 354 ++++++++++++++++++ modules/home/wm/aerospace/default.nix | 6 + modules/home/wm/default.nix | 0 modules/home/wm/hyprland/default.nix | 0 {system => modules/system}/boot.nix | 0 {system => modules/system}/sound.nix | 0 users/suri/home.nix | 13 +- 42 files changed, 2251 insertions(+), 10 deletions(-) create mode 100644 modules/home/bars/sketchybar/default.nix create mode 100755 modules/home/bars/sketchybar/sketchybar/colors.sh create mode 100755 modules/home/bars/sketchybar/sketchybar/graphs/cpu.sh create mode 100755 modules/home/bars/sketchybar/sketchybar/graphs/disk.sh create mode 100755 modules/home/bars/sketchybar/sketchybar/graphs/memory.sh create mode 100755 modules/home/bars/sketchybar/sketchybar/graphs/network.sh create mode 100755 modules/home/bars/sketchybar/sketchybar/plugins/aerospace.sh create mode 100755 modules/home/bars/sketchybar/sketchybar/plugins/battery.sh create mode 100755 modules/home/bars/sketchybar/sketchybar/plugins/clock.sh create mode 100755 modules/home/bars/sketchybar/sketchybar/plugins/cpu.sh create mode 100755 modules/home/bars/sketchybar/sketchybar/plugins/disk.sh create mode 100755 modules/home/bars/sketchybar/sketchybar/plugins/front_app.sh create mode 100755 modules/home/bars/sketchybar/sketchybar/plugins/memory.sh create mode 100755 modules/home/bars/sketchybar/sketchybar/plugins/network.sh create mode 100755 modules/home/bars/sketchybar/sketchybar/plugins/space.sh create mode 100755 modules/home/bars/sketchybar/sketchybar/plugins/volume.sh create mode 100755 modules/home/bars/sketchybar/sketchybar/sketchybarrc create mode 100644 modules/home/prompts/oh-my-posh/default.nix create mode 100644 modules/home/prompts/oh-my-posh/mypure.omp.toml create mode 100644 modules/home/prompts/starship/default.nix create mode 100644 modules/home/prompts/starship/starship.toml create mode 100644 modules/home/shells/fish/default.nix create mode 100644 modules/home/shells/fish/nix-fix.fish create mode 100644 modules/home/shells/zsh/default.nix create mode 100644 modules/home/term/ghostty/default.nix create mode 100644 modules/home/term/ghostty/ghostty/config create mode 160000 modules/home/term/ghostty/ghostty/shaders create mode 100644 modules/home/tools/btop.nix create mode 100644 modules/home/tools/default.nix create mode 100644 modules/home/tools/git.nix create mode 100644 modules/home/tools/helix/default.nix create mode 100644 modules/home/tools/helix/theme-trans.toml create mode 100644 modules/home/tools/zellij/config.kdl create mode 100644 modules/home/tools/zellij/default.nix create mode 100644 modules/home/wm/aerospace/aerospace.toml create mode 100644 modules/home/wm/aerospace/default.nix create mode 100644 modules/home/wm/default.nix create mode 100644 modules/home/wm/hyprland/default.nix rename {system => modules/system}/boot.nix (100%) rename {system => modules/system}/sound.nix (100%) diff --git a/flake.nix b/flake.nix index 0126ab7..2666c1d 100644 --- a/flake.nix +++ b/flake.nix @@ -16,11 +16,22 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; # Flake outputs - outputs = { self, darwin, nixpkgs, home-manager, ... }@inputs: - let inherit (self) outputs; + outputs = { self, darwin, nixpkgs, home-manager, rust-overlay, ... }@inputs: + let + overlays = [ rust-overlay.overlays.default ]; + mkPkgs = system: + import nixpkgs { + inherit system overlays; + config.allowUnfree = true; + }; in { @@ -28,10 +39,8 @@ # Available through 'nixos-rebuild --flake .#your-hostname' nixosConfigurations = { Khaos = nixpkgs.lib.nixosSystem { - specialArgs = { inherit inputs outputs; }; - modules = [ ./hosts/Khaos ]; + modules = [ ./hosts/Khaos { nixpkgs.overlays = overlays; } ]; }; - }; darwinConfigurations = { @@ -39,6 +48,7 @@ system = "aarch64-darwin"; # or x86_64-darwin modules = [ ./hosts/Daedalus + { nixpkgs.overlays = overlays; } home-manager.darwinModules.home-manager { home-manager = { @@ -53,5 +63,17 @@ }; }; + homeConfigurations = { + "suri@Daedalus" = home-manager.lib.homeManagerConfiguration { + pkgs = mkPkgs "aarch64-darwin"; + modules = [ ./users/suri/Daedalus.nix ]; + }; + + "suri@Khaos" = home-manager.lib.homeManagerConfiguration { + pkgs = mkPkgs "x86_64-linux"; + modules = [ ./users/suri/Khaos.nix ]; + }; + }; + }; } diff --git a/modules/home/bars/sketchybar/default.nix b/modules/home/bars/sketchybar/default.nix new file mode 100644 index 0000000..0820c59 --- /dev/null +++ b/modules/home/bars/sketchybar/default.nix @@ -0,0 +1,11 @@ +{ ... }: { + home.file.".config/sketchybar/".source = ./sketchybar; + # home.file.".config/sketchybar/".source = builtins.fetchGit { + # url = "https://github.com/zphrs/sketchybar-config"; + # rev = "2545e7bab0c41577a8bcabc783c17e0593100182"; + # }; + + # home.file.".config/sketchybar/".source = ./sketchybar-config; + # home.file.".config/sketchybar/" + +} diff --git a/modules/home/bars/sketchybar/sketchybar/colors.sh b/modules/home/bars/sketchybar/sketchybar/colors.sh new file mode 100755 index 0000000..847898e --- /dev/null +++ b/modules/home/bars/sketchybar/sketchybar/colors.sh @@ -0,0 +1,8 @@ +BLACK=0xFF2E312D +RED=0xFFFF8C54 +GREEN=0xFF86B59E +YELLOW=0xFFDCA11D +BLUE=0xFFA5A1FF +MAGENTA=0xFFE79788 +CYAN=0xFFBCEED5 +WHITE=0xFF777771 diff --git a/modules/home/bars/sketchybar/sketchybar/graphs/cpu.sh b/modules/home/bars/sketchybar/sketchybar/graphs/cpu.sh new file mode 100755 index 0000000..f268678 --- /dev/null +++ b/modules/home/bars/sketchybar/sketchybar/graphs/cpu.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env sh +source "$HOME/.config/sketchybar/colors.sh" +sketchybar \ + --add item cpu.percent q \ + --set cpu.percent label.font="FiraCode Nerd Font:Bold:12" \ + label=CPU \ + y_offset=-4 \ + width=0 \ + icon.drawing=off \ + update_freq=2 \ + \ + --add graph cpu.sys q 80 \ + --set cpu.sys width=0 \ + graph.color=$RED \ + graph.fill_color=$RED \ + label.drawing=off \ + icon.drawing=off \ + background.padding_right=5 \ + \ + --add item cpu.top q \ + --set cpu.top label.font="FiraCode Nerd Font:Medium:7" \ + label=CPU \ + icon.drawing=off \ + y_offset=6 \ + background.padding_right=5 \ + width=0 \ + --add graph cpu.user q 80 \ + --set cpu.user graph.color=$BLUE \ + update_freq=2 \ + label.drawing=off \ + icon.drawing=off \ + background.padding_left=4 \ + script="$PLUGIN_DIR/cpu.sh" \ diff --git a/modules/home/bars/sketchybar/sketchybar/graphs/disk.sh b/modules/home/bars/sketchybar/sketchybar/graphs/disk.sh new file mode 100755 index 0000000..9598337 --- /dev/null +++ b/modules/home/bars/sketchybar/sketchybar/graphs/disk.sh @@ -0,0 +1,21 @@ + +#!/usr/bin/env sh +source "$HOME/.config/sketchybar/colors.sh" +sketchybar \ + --add item disk.used_txt q \ + --set disk.used_txt label.font="FiraCode Nerd Font:Bold:10" \ + label=DISK \ + y_offset=-4 \ + width=0 \ + icon.drawing=off \ + update_freq=1 \ + padding_left=15 \ + \ + --add graph disk.used e 80 \ + --set disk.used graph.color=$RED \ + update_freq=1 \ + label.drawing=off \ + icon.drawing=off \ + background.padding_left=4 \ + padding_left=15 \ + script="$PLUGIN_DIR/disk.sh" \ diff --git a/modules/home/bars/sketchybar/sketchybar/graphs/memory.sh b/modules/home/bars/sketchybar/sketchybar/graphs/memory.sh new file mode 100755 index 0000000..45985fa --- /dev/null +++ b/modules/home/bars/sketchybar/sketchybar/graphs/memory.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env sh +source "$HOME/.config/sketchybar/colors.sh" +sketchybar \ + --add item mem.used_txt e \ + --set mem.used_txt label.font="FiraCode Nerd Font:Bold:10" \ + label=MEM \ + y_offset=-4 \ + width=0 \ + icon.drawing=off \ + update_freq=2 \ + padding_left=15 \ + \ + --add graph mem.used e 80 \ + --set mem.used graph.color=$RED \ + update_freq=2 \ + label.drawing=off \ + icon.drawing=off \ + background.padding_left=4 \ + padding_left=15 \ + script="$PLUGIN_DIR/memory.sh" \ diff --git a/modules/home/bars/sketchybar/sketchybar/graphs/network.sh b/modules/home/bars/sketchybar/sketchybar/graphs/network.sh new file mode 100755 index 0000000..462b571 --- /dev/null +++ b/modules/home/bars/sketchybar/sketchybar/graphs/network.sh @@ -0,0 +1,16 @@ +sketchybar --add graph net.in e 100 \ + --set net.in icon.drawing=off label.drawing=off graph.color=$BLUE width=0 script="$PLUGIN_DIR/network.sh" \ + padding_left=15 \ + --add item net.in_txt e \ + --set net.in_txt icon.drawing=off icon.font.size=10 width=0 label="-.--KB/s" label.font.size=10 label.font.style=Bold \ + padding_left=15 \ + --add item net.out_txt e \ + --set net.out_txt icon.drawing=off icon.font.size=10 width=0 label="-.--KB/s" label.font.size=10 label.font.style=Bold \ + y_offset=12 \ + padding_left=15 \ + --add graph net.out e 100 \ + --set net.out icon.drawing=off label.drawing=off graph.color=$YELLOW padding_left=0 \ + padding_left=15 \ + --add bracket networks net.out net.in net.in_txt net.out_txt \ + --set networks background.color=0xff000000 padding_left=5 padding_right=5 background.corner_radius=0 background.height=40 \ + padding_left=15 \ diff --git a/modules/home/bars/sketchybar/sketchybar/plugins/aerospace.sh b/modules/home/bars/sketchybar/sketchybar/plugins/aerospace.sh new file mode 100755 index 0000000..cdb15aa --- /dev/null +++ b/modules/home/bars/sketchybar/sketchybar/plugins/aerospace.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +# make sure it's executable with: +# chmod +x ~/.config/sketchybar/plugins/aerospace.sh + +if [ "$1" = "$FOCUSED_WORKSPACE" ]; then + # sketchybar --set $NAME background.drawing=on + + sketchybar --animate quadratic 7 \ + --set $NAME icon.font.size=25 + + # --set $NAME y_offset=10 \ + +else + # sketchybar --set $NAME background.drawing=off + sketchybar --animate quadratic 7 \ + --set $NAME icon.font.size=15 + + # --set $NAME y_offset=0 \ +fi diff --git a/modules/home/bars/sketchybar/sketchybar/plugins/battery.sh b/modules/home/bars/sketchybar/sketchybar/plugins/battery.sh new file mode 100755 index 0000000..9dd9627 --- /dev/null +++ b/modules/home/bars/sketchybar/sketchybar/plugins/battery.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +PERCENTAGE="$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1)" +CHARGING="$(pmset -g batt | grep 'AC Power')" + +if [ "$PERCENTAGE" = "" ]; then + exit 0 +fi + +case "${PERCENTAGE}" in + 9[0-9]|100) ICON="" + ;; + [6-8][0-9]) ICON="" + ;; + [3-5][0-9]) ICON="" + ;; + [1-2][0-9]) ICON="" + ;; + *) ICON="" +esac + +if [[ "$CHARGING" != "" ]]; then + ICON="" +fi + +# The item invoking this script (name $NAME) will get its icon and label +# updated with the current battery status +sketchybar --set "$NAME" icon="$ICON" label="${PERCENTAGE}%" diff --git a/modules/home/bars/sketchybar/sketchybar/plugins/clock.sh b/modules/home/bars/sketchybar/sketchybar/plugins/clock.sh new file mode 100755 index 0000000..cf1b8c6 --- /dev/null +++ b/modules/home/bars/sketchybar/sketchybar/plugins/clock.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# The $NAME variable is passed from sketchybar and holds the name of +# the item invoking this script: +# https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting + +sketchybar --set "$NAME" label="$(date '+%m/%d %l:%M %p')" diff --git a/modules/home/bars/sketchybar/sketchybar/plugins/cpu.sh b/modules/home/bars/sketchybar/sketchybar/plugins/cpu.sh new file mode 100755 index 0000000..2418784 --- /dev/null +++ b/modules/home/bars/sketchybar/sketchybar/plugins/cpu.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env sh + +source "$HOME/.config/sketchybar/colors.sh" + +CORE_COUNT=$(sysctl -n machdep.cpu.thread_count) +CPU_INFO=$(ps -eo pcpu,user) +CPU_SYS=$(echo "$CPU_INFO" | grep -v $(whoami) | sed "s/[^ 0-9\.]//g" | awk "{sum+=\$1} END {print sum/(100.0 * $CORE_COUNT)}") +CPU_USER=$(echo "$CPU_INFO" | grep $(whoami) | sed "s/[^ 0-9\.]//g" | awk "{sum+=\$1} END {print sum/(100.0 * $CORE_COUNT)}") + +TOPPROC=$(LANG=C && ps axo "%cpu,ucomm" | sort -nr | tail +1 | head -n1 | awk '{printf "%.0f%% %s\n", $1, $2}' | sed -e 's/com.apple.//g') +CPUP=$(echo $TOPPROC | sed -nr 's/([^\%]+).*/\1/p') + +CPU_PERCENT="$(echo "$CPU_SYS $CPU_USER" | awk '{printf "%.0f\n", ($1 + $2)*100}')" + +sketchybar --set cpu.percent label=$CPU_PERCENT% \ + --set cpu.top label="$TOPPROC" \ + --push cpu.sys $CPU_SYS \ + --push cpu.user $CPU_USER diff --git a/modules/home/bars/sketchybar/sketchybar/plugins/disk.sh b/modules/home/bars/sketchybar/sketchybar/plugins/disk.sh new file mode 100755 index 0000000..954c351 --- /dev/null +++ b/modules/home/bars/sketchybar/sketchybar/plugins/disk.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# Script to sum up the "Used" column from df -k output +# Usage: ./df-k-usage-sum.sh + +# No conversion function needed since df -k outputs in kilobytes + +# Function to convert kilobytes to human-readable format +kb_to_human() { + local kb="$1" + + if (( kb >= 1073741824 )); then # 1 TiB in KB + echo "$kb" | awk '{printf "%.1fT", $1/1073741824}' + elif (( kb >= 1048576 )); then # 1 GiB in KB + echo "$kb" | awk '{printf "%.1fG", $1/1048576}' + elif (( kb >= 1024 )); then # 1 MiB in KB + echo "$kb" | awk '{printf "%.1fM", $1/1024}' + else + echo "${kb}K" + fi +} + +# Get df -k output and process it +total_kb=$(df -k | awk ' + BEGIN { total = 0 } + NR > 1 && $3 ~ /^[0-9]+$/ { total += $3 } + END { print total } +') + +total_kb_human=$(kb_to_human $total_kb) + +sketchybar --set "$NAME" icon="" label="$total_kb_human" diff --git a/modules/home/bars/sketchybar/sketchybar/plugins/front_app.sh b/modules/home/bars/sketchybar/sketchybar/plugins/front_app.sh new file mode 100755 index 0000000..fb6d0b3 --- /dev/null +++ b/modules/home/bars/sketchybar/sketchybar/plugins/front_app.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# Some events send additional information specific to the event in the $INFO +# variable. E.g. the front_app_switched event sends the name of the newly +# focused application in the $INFO variable: +# https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting + +if [ "$SENDER" = "front_app_switched" ]; then + sketchybar --set "$NAME" label="$INFO" +fi diff --git a/modules/home/bars/sketchybar/sketchybar/plugins/memory.sh b/modules/home/bars/sketchybar/sketchybar/plugins/memory.sh new file mode 100755 index 0000000..ba620ce --- /dev/null +++ b/modules/home/bars/sketchybar/sketchybar/plugins/memory.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# Get total physical memory in bytes +total_ram=$(sysctl -n hw.memsize) + +# Get used memory using vm_stat (convert page counts to bytes) +pages_free=$(vm_stat | awk '/Pages free/ {print $3}' | tr -d '.') +pages_speculative=$(vm_stat | awk '/Pages speculative/ {print $3}' | tr -d '.') +pages_purgeable=$(vm_stat | awk '/Pages purgeable/ {print $3}' | tr -d '.') +page_size=$(vm_stat | head -1 | awk '{print $8}') +page_size=${page_size%\.} # remove any trailing period + +# Calculate used RAM in bytes +free_ram=$(( (pages_free + pages_speculative + pages_purgeable) * page_size )) +used_ram=$(( total_ram - free_ram )) + +# Calculate percentage used (rounded) +ram_usage_frac=$(awk "BEGIN {printf \"%.6f\", $used_ram / $total_ram}") + +# Optional: format output for human readability +total_ram_human=$(bc <<< "$total_ram / (1024^3)") +used_ram_human=$(bc <<< "scale=2; $used_ram / (1024^3)") + +sketchybar \ + --set mem.used_txt label="$used_ram_human/$total_ram_human GB" \ + --push mem.used $ram_usage_frac diff --git a/modules/home/bars/sketchybar/sketchybar/plugins/network.sh b/modules/home/bars/sketchybar/sketchybar/plugins/network.sh new file mode 100755 index 0000000..76250ee --- /dev/null +++ b/modules/home/bars/sketchybar/sketchybar/plugins/network.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env sh +source "$HOME/.config/sketchybar/colors.sh" + +ifstat -i en0 | while read -r IN_KB OUT_KB; do + if [[ $IN_KB == "KB/s" ]] || [[ $IN_KB == "en0" ]]; then + sketchybar --push net.in 0 \ + --push net.out 0 + continue; + fi + + if [[ $IN_KB == "0.00" ]]; then + sketchybar --push net.in 0 \ + --set net.in_txt label="0.00KB/s " label.color=$BLUE icon.color=$BLUE + else + IN=$(echo "l(5 + $IN_KB)/21" | bc -l) + sketchybar --push net.in $IN \ + --set net.in_txt label="${IN_KB}KB/s " label.color=$BLUE icon.color=$BLUE + fi + if [[ $OUT_KB == "0.00" ]]; then + sketchybar --push net.out 0 \ + --set net.out_txt label="0.00KB/s " label.color=$YELLOW icon.color=$YELLOW + else + OUT=$(echo "l(5 + $OUT_KB)/21" | bc -l) + sketchybar --push net.out $OUT \ + --set net.out_txt label="${OUT_KB}KB/s " label.color=$YELLOW icon.color=$YELLOW + + fi +done diff --git a/modules/home/bars/sketchybar/sketchybar/plugins/space.sh b/modules/home/bars/sketchybar/sketchybar/plugins/space.sh new file mode 100755 index 0000000..b8602b5 --- /dev/null +++ b/modules/home/bars/sketchybar/sketchybar/plugins/space.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# The $SELECTED variable is available for space components and indicates if +# the space invoking this script (with name: $NAME) is currently selected: +# https://felixkratz.github.io/SketchyBar/config/components#space----associate-mission-control-spaces-with-an-item + +sketchybar --set "$NAME" background.drawing="$SELECTED" diff --git a/modules/home/bars/sketchybar/sketchybar/plugins/volume.sh b/modules/home/bars/sketchybar/sketchybar/plugins/volume.sh new file mode 100755 index 0000000..6e69a5d --- /dev/null +++ b/modules/home/bars/sketchybar/sketchybar/plugins/volume.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +# The volume_change event supplies a $INFO variable in which the current volume +# percentage is passed to the script. + +if [ "$SENDER" = "volume_change" ]; then + VOLUME="$INFO" + + case "$VOLUME" in + [6-9][0-9]|100) ICON="󰕾" + ;; + [3-5][0-9]) ICON="󰖀" + ;; + [1-9]|[1-2][0-9]) ICON="󰕿" + ;; + *) ICON="󰖁" + esac + + sketchybar --set "$NAME" icon="$ICON" label="$VOLUME%" +fi diff --git a/modules/home/bars/sketchybar/sketchybar/sketchybarrc b/modules/home/bars/sketchybar/sketchybar/sketchybarrc new file mode 100755 index 0000000..489f1d7 --- /dev/null +++ b/modules/home/bars/sketchybar/sketchybar/sketchybarrc @@ -0,0 +1,133 @@ +# This is a demo config to showcase some of the most important commands. +# It is meant to be changed and configured, as it is intentionally kept sparse. +# For a (much) more advanced configuration example see my dotfiles: +# https://github.com/FelixKratz/dotfiles + +PLUGIN_DIR="$CONFIG_DIR/plugins" + +##### Bar Appearance ##### +# Configuring the general appearance of the bar. +# These are only some of the options available. For all options see: +# https://felixkratz.github.io/SketchyBar/config/bar +# If you are looking for other colors, see the color picker: +# https://felixkratz.github.io/SketchyBar/config/tricks#color-picker + +sketchybar --bar position=top height=40 blur_radius=30 color=0x40000000 + +##### Changing Defaults ##### +# We now change some default values, which are applied to all further items. +# For a full list of all available item properties see: +# https://felixkratz.github.io/SketchyBar/config/items + +default=( + padding_left=5 + padding_right=5 + icon.font="Hack Nerd Font:Bold:17.0" + label.font="Hack Nerd Font:Bold:14.0" + icon.color=0xffffffff + label.color=0xffffffff + icon.padding_left=4 + icon.padding_right=4 + label.padding_left=4 + label.padding_right=4 +) +sketchybar --default "${default[@]}" + +##### Adding Mission Control Space Indicators ##### +# Let's add some mission control spaces: +# https://felixkratz.github.io/SketchyBar/config/components#space----associate-mission-control-spaces-with-an-item +# to indicate active and available mission control spaces. + +# SPACE_ICONS=("1" "2" "3" "4" "5" "6" "7" "8" "9" "10") +# for i in "${!SPACE_ICONS[@]}" +# do +# sid="$(($i+1))" +# space=( +# space="$sid" +# icon="${SPACE_ICONS[i]}" +# icon.padding_left=7 +# icon.padding_right=7 +# background.color=0x40ffffff +# background.corner_radius=5 +# background.height=25 +# label.drawing=off +# script="$PLUGIN_DIR/space.sh" +# click_script="yabai -m space --focus $sid" +# ) +# sketchybar --add space space."$sid" left --set space."$sid" "${space[@]}" +# done + +##### Adding Left Items ##### +# We add some regular items to the left side of the bar, where +# only the properties deviating from the current defaults need to be set + +sketchybar --add item chevron left \ + --set chevron icon= label.drawing=off \ + --add item front_app left \ + --set front_app icon.drawing=off script="$PLUGIN_DIR/front_app.sh" \ + --subscribe front_app front_app_switched + +##### Adding Right Items ##### +# In the same way as the left items we can add items to the right side. +# Additional position (e.g. center) are available, see: +# https://felixkratz.github.io/SketchyBar/config/items#adding-items-to-sketchybar + +# Some items refresh on a fixed cycle, e.g. the clock runs its script once +# every 10s. Other items respond to events they subscribe to, e.g. the +# volume.sh script is only executed once an actual change in system audio +# volume is registered. More info about the event system can be found here: +# https://felixkratz.github.io/SketchyBar/config/events + +sketchybar --add item clock right \ + --set clock update_freq=10 icon= script="$PLUGIN_DIR/clock.sh" \ + --add item volume right \ + --set volume script="$PLUGIN_DIR/volume.sh" \ + --subscribe volume volume_change \ + --add item battery right \ + --set battery update_freq=120 script="$PLUGIN_DIR/battery.sh" \ + --subscribe battery system_woke power_source_change \ + --add item disk right \ + --set disk update_freq=20 script="$PLUGIN_DIR/disk.sh" \ + + + +##### Aerospace Configuration ##### +sketchybar --add event aerospace_workspace_change + +# Get all aerospace workspaces and reverse them +WORKSPACES=($(aerospace list-workspaces --all)) +REVERSED_WORKSPACES=() + +# Reverse the array +for ((i=${#WORKSPACES[@]}-1; i>=0; i--)); do + REVERSED_WORKSPACES+=("${WORKSPACES[i]}") +done + +source "${CONFIG_DIR}/graphs/cpu.sh" + +sketchybar --add item spacer q \ + --set spacer \ + padding_right=25 + +# Add workspace items to sketchybar in reversed order +for sid in "${REVERSED_WORKSPACES[@]}"; do + sketchybar --add item space.$sid q \ + --subscribe space.$sid aerospace_workspace_change \ + --set space.$sid \ + background.color=0x44ffffff \ + background.corner_radius=5 \ + background.height=20 \ + background.drawing=off \ + icon="◉" \ + label.padding_left=0 \ + label.padding_right=0 \ + click_script="aerospace workspace $sid" \ + script="$CONFIG_DIR/plugins/aerospace.sh $sid" +done + + +source "${CONFIG_DIR}/graphs/memory.sh" +source "${CONFIG_DIR}/graphs/network.sh" + +##### Force all scripts to run the first time (never do this in a script) ##### +sketchybar --update diff --git a/modules/home/prompts/oh-my-posh/default.nix b/modules/home/prompts/oh-my-posh/default.nix new file mode 100644 index 0000000..f2ad334 --- /dev/null +++ b/modules/home/prompts/oh-my-posh/default.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: { + + home.file.".config/oh-my-posh/theme.toml".source = ./mypure.omp.toml; + +} diff --git a/modules/home/prompts/oh-my-posh/mypure.omp.toml b/modules/home/prompts/oh-my-posh/mypure.omp.toml new file mode 100644 index 0000000..d249a1e --- /dev/null +++ b/modules/home/prompts/oh-my-posh/mypure.omp.toml @@ -0,0 +1,79 @@ +console_title_template = '{{if .Root}}(Admin){{end}} {{.PWD}}' +version = 3 + +[transient_prompt] + template = '❯ ' + foreground = '#B48EAD' + foreground_templates = ['{{ if gt .Code 0 }}#BF616A{{ end }}'] + +[upgrade] + source = 'cdn' + interval = '168h' + auto = false + notice = false + +[[blocks]] + type = 'prompt' + alignment = 'left' + + [[blocks.segments]] + template = '{{ .UserName }} ' + foreground = '#FD971E' + type = 'session' + style = 'plain' + + [[blocks.segments]] + template = '{{ .Path }} ' + foreground = '#98E025' + type = 'path' + style = 'plain' + + [blocks.segments.properties] + style = 'full' + +[[blocks]] + type = 'prompt' + alignment = 'left' + + [[blocks.segments]] + template = '{{ .UpstreamIcon }}{{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }}<#FFAFD7>*{{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }}  {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }}  {{ .StashCount }}{{ end }} ' + foreground = '#6C6C6C' + type = 'git' + style = 'plain' + + [blocks.segments.properties] + branch_ahead_icon = '<#88C0D0>⇡ ' + branch_behind_icon = '<#88C0D0>⇣ ' + branch_icon = '' + fetch_stash_count = true + fetch_status = true + fetch_upstream_icon = true + github_icon = '' + +[[blocks]] + type = 'prompt' + alignment = 'left' + + [[blocks.segments]] + template = ' {{ .FormattedMs }} ' + foreground = '#A3BE8C' + type = 'executiontime' + style = 'plain' + + [blocks.segments.properties] + style = 'austin' + +[[blocks]] + type = 'prompt' + alignment = 'left' + newline = true + + [[blocks.segments]] + template = '❯ ' + foreground = '#B48EAD' + type = 'status' + style = 'plain' + foreground_templates = ['{{ if gt .Code 0 }}#BF616A{{ end }}'] + + [blocks.segments.properties] + always_enabled = true diff --git a/modules/home/prompts/starship/default.nix b/modules/home/prompts/starship/default.nix new file mode 100644 index 0000000..d0d2c2e --- /dev/null +++ b/modules/home/prompts/starship/default.nix @@ -0,0 +1,11 @@ +{ lib, home, ... }: { + + programs.starship = { + enable = true; + + settings = + lib.mkForce (builtins.fromTOML (builtins.readFile ./starship.toml)); + }; + # home.file.".config/starship.toml".source = lib.mkForce ./starship.toml; + +} diff --git a/modules/home/prompts/starship/starship.toml b/modules/home/prompts/starship/starship.toml new file mode 100644 index 0000000..72601b4 --- /dev/null +++ b/modules/home/prompts/starship/starship.toml @@ -0,0 +1,347 @@ +# Get editor completions based on the config schema +"$schema" = 'https://starship.rs/config-schema.json' + +# ### --------- +# ### "Power10" +# ### --------- +# - Variant 2: two line prompt, no background in top line, separators on left side, filling solid line in top row +# - This preset is inspired by a [powerlevel10k](https://github.com/romkatv/powerlevel10k) configuration variant. +# +# - Recommended / tested with Font 'MesloLGS NF Regular' from: Meslo Nerd Font patched for Powerlevel10k +# Link: https://github.com/romkatv/powerlevel10k?tab=readme-ov-file#manual-font-installation +# --> "Manual font installation", with currently 4 Font Types + +# - If you do not want the filling solid line in top row: +# set the fill symbol to ' ' +# - Shell [shell]: +# If you want to see the content of the shell module, search for [shell] and change 'disabled = true' to false +# - '$line_break': everything from the next line on refers to the second line of the prompt +# - Some modules listed further down will not show up (all the time), as their default value is 'disabled = true' or +# they are only displayed under certain conditions +# - added but disabled modules: [battery], [time] +# - if you want to see them: search for the module and set 'disabled' to 'false' +# - Symbols: +# Don't be confused if you don't see any "real" symbols here. If Nerd-fonts are installed on your system, it should work. + +# Customizing the prompt (and placing desired modules at desired position and sequence): +# ╭╴ # \u256D\u2574 +# ╰╴ # \u2570\u2574 +format = """ +[\u256D\u2574](fg:greydimmed)\ +$os\ +$shell\ +$username\ +$hostname\ +$sudo\ +$directory\ +$direnv\ +$php\ +$python\ +$git_branch$git_commit$git_state$git_metrics$git_status\ +[ ](fg:greydarker)\ +$fill\ +$fill\ +$status\ +$jobs\ +$memory_usage\ +$cmd_duration\ +$battery\ +$time\ +$line_break\ +\ +[\u2570\u2574](fg:greydimmed)\ +[$character]($style)""" + +# move the rest of the prompt to the right +right_format = """ +[$localip]($style)""" + +# Inserts a blank line between shell prompts: +add_newline = true + +# Color Palette +palette = "Power10Gruv" + +[palettes.Power10] +# only lowercase names +greydimmed = '#424242' +greydarker = '#242424' +ossymbol = '#AAAAAA' # dimmed white +user = 'green' +userroot = 'red' +sshsymbol = 'green' +hostname = 'green' +sudo = 'red' +directory = 'cyan' +php = '#7a86b8' # light blue +python = 'yellow' +# git start --- +orangegit = '#E04D27' +conflicted = 'red' +ahead = 'yellow' +behind = 'yellow' +diverged = 'yellow' +uptodate = 'green' +untracked = 'red' +stashed = '#A52A2A' # redbrown +modified = '#C8AC00' # darker yellow +staged = 'green' +renamed = 'yellow' +deleted = 'orange' +# git end --- +jobs = 'blue' +memory = 'purple' +duration = 'yellow' +fill = '#424242' # greydimmed +status = 'red' +localip = 'green' +shell = '#424242' # greydimmed + +[palettes.Power10Gruv] +greydimmed = '#424242' +greydarker = '#242424' +# only lowercase names +# greydimmed = '#32302f' # Gruvbox dark gray +# greydarker = '#1d2021' # Gruvbox darkest gray +ossymbol = '#a89984' # Gruvbox light gray +user = '#b8bb26' # Gruvbox green +userroot = '#fb4934' # Gruvbox red +sshsymbol = '#b8bb26' # Gruvbox green +hostname = '#b8bb26' # Gruvbox green +sudo = '#fb4934' # Gruvbox red +directory = '#83a598' # Gruvbox blue +php = '#d3869b' # Gruvbox purple +python = '#fabd2f' # Gruvbox yellow +# git start --- +orangegit = '#fe8019' # Gruvbox orange +conflicted = '#fb4934' # Gruvbox red +ahead = '#fabd2f' # Gruvbox yellow +behind = '#fabd2f' # Gruvbox yellow +diverged = '#fabd2f' # Gruvbox yellow +uptodate = '#b8bb26' # Gruvbox green +untracked = '#fb4934' # Gruvbox red +stashed = '#d65d0e' # Gruvbox dark orange +modified = '#d79921' # Gruvbox dark yellow +staged = '#b8bb26' # Gruvbox green +renamed = '#fabd2f' # Gruvbox yellow +deleted = '#fe8019' # Gruvbox orange +# git end --- +jobs = '#458588' # Gruvbox blue +memory = '#d3869b' # Gruvbox purple +duration = '#fabd2f' # Gruvbox yellow +fill = '#32302f' # Gruvbox dark gray +status = '#fb4934' # Gruvbox red +localip = '#b8bb26' # Gruvbox green +shell = '#32302f' # Gruvbox dark gray +# Customization and activation of some modules: +# Listed in the order of their position in the module rows above +[os] +format = "[$symbol]($style)()" +style = "ossymbol" +disabled = false + +[os.symbols] +AIX = "AIX " +Alpaquita = "\uf26a " # \uf26a  # \ue3a5\ue390  +AlmaLinux = "\uf31d " #  +Alpine = "\uf300 " # "" +Amazon = "\uf270 " # "" +Android = "\ue70e " # "" +Arch = "\uf303 " # "" +Artix = "\uf31f " #  +CentOS = "\uf304 " # "" +Debian = "\uf306 " # "" +DragonFly = "\ueef8 " #   🐉 +Emscripten = "\u26A1 " # ⚡ +EndeavourOS = "\uf322 " # "" #  +Fedora = "\uf30a " # "" +FreeBSD = "\uf30c " # "" +Garuda = "\uf337 " # "" +Gentoo = "\uf30d " # "" +HardenedBSD = "\uf132 " #  +Illumos = "\uf326 " # "🐦" +Kali = "\uf327 " #  +Linux = "\uf17c " # "" +Mabox = "\uf1b2 " #  📦 +Macos = "\uf302 " # "" +Manjaro = "\uf312 " # "" +Mariner = "\ue7ae " # \ue7ae  +MidnightBSD = "\ue3e0 " # 🌘 +Mint = "\uf30e " # "" +NetBSD = "\u2691 " # ⚑ +NixOS = "\uf313 " # "" +OpenBSD = "\uf328 " # "" +OpenCloudOS = "\uf0c2 " #  +openEuler = "\u2208 " # \u2208 ∈ +openSUSE = "\uf314 " # "" +OracleLinux = "\u213A " # \u213A ℺ # ⊂⊃ \u2282\u2283 +Pop = "\uf32a " # "" +Raspbian = "\uf315 " # "" +Redhat = "\uf316 " # "" # 󱄛 +RedHatEnterprise = "\uf316 " # "" # 󱄛 +RockyLinux = "\uf32b " #  +Redox = "\uf331 " #  󰺕 +Solus = "\uf32d " # "" # " " +SUSE = "\uef6d " # "" +Ubuntu = "\uf31b " # "" +Ultramarine = "󱙳 " # 🔷 +Unknown = "\uf108 " # "" +Void = "\uf32e " #   +Windows = "\uf17a " # "" + +[shell] +format = '[$indicator]($style)()' +style = 'fg:shell' +# empty indicator (''): e.g. if you do not want to see indicator for your standard shell +zsh_indicator = '%_ ' # '%_ ' '󰰶 ' +bash_indicator = '\$_ ' # "\uebca " ' ' '\$_ ' +fish_indicator = '>> ' # "\uee41 " '󰈺 ' '>>_ ' +powershell_indicator = '>_ ' # "\uebc7 " ' ' '>_' +unknown_indicator = '?_ ' # '?_ ' ' ' +disabled = true # set to false if you want to see the shell indicator + +[username] +format = "[\ueab6 ](fg:user bold)[$user]($style)[ ]()" # \u276F ❯ \ueab6  +style_user = 'fg:user bold' +style_root = 'fg:userroot bold' +show_always = false +disabled = false + +[hostname] +format = '[$ssh_symbol ](fg:sshsymbol bold)[$hostname](fg:hostname bold)[ ]()' +ssh_only = true +ssh_symbol = "\ue36e" # \ue36e '' # '⇒' # ' ' # 'fi⇒' +# trim_at = '.companyname.com' +disabled = false + +[sudo] +format = "[\ueab6 ](fg:sudo bold)[as $symbol]($style)" # \u276F ❯ \ueab6  +style = 'fg:red bold' +symbol = "\uf007! " # \uf007  # \uf21b \uedcc ' ' # ' ' +disabled = false + +[directory] +format = "[\ueab6 ](fg:directory bold)[$read_only]($read_only_style)[$repo_root]($repo_root_style)[$path ]($style)" # \u276F ❯ \ueab6  +style = 'fg:directory bold' +home_symbol = "\uf015 ~" # \uf015 ' ~' +read_only = "\uf023 " # \uf023 ' ' +read_only_style = 'fg:directory' +truncation_length = 3 +truncation_symbol = '…/' +truncate_to_repo = true +repo_root_format = "[\ueab6 ](fg:directory bold)[$read_only]($read_only_style)[$before_root_path]($before_repo_root_style)[$repo_root]($repo_root_style)[$path ]($style)" # \u276F ❯ \ueab6  +repo_root_style = 'fg:directory bold' +use_os_path_sep = true +disabled = false + +[direnv] +symbol = 'direnv' +style = 'fg:greydimmed' +format = "[\u3009$symbol $loaded/$allowed ]($style)" +allowed_msg = 'a' # 'ok' # '✓' +not_allowed_msg = '!a' # 'nok' # '!' +denied_msg = 'x' # '✘' +loaded_msg = '+' # "\ueabc" # \ueabc  # '->' # 'yo' # '󰗡' # \udb81\udde1 # '󱥸✓' # '󱥸✓' #  +unloaded_msg = '-' # "\ueabc!" # \ueabc ! # '->!' # 'no' # '󰅚' # '󱥸!' \udb86\udd78 +disabled = false + +[php] +format = " [\u3009[$symbol](php italic)($version )]($style)" +style = 'fg:php' +symbol = "php " # \ue73d  # 󰌟 + +[python] +format = "[\u3009${symbol}${pyenv_prefix}(${version} )(($virtualenv) )]($style)" +style = 'fg:python' +symbol = "\ue73c " #  +pyenv_version_name = true + +[git_branch] +format = "[\u3009$symbol $branch(:$remote_branch)]($style)[ ]()" # \u3009 \uf460 ❯ +style = 'fg:orangegit' +symbol = "\ue702" # \ue702  +# ignore_branches = ['master', 'main'] + +[git_commit] +format = '[\($hash$tag\)]($style)[ ]()' +style = 'fg:orangegit' +commit_hash_length = 8 +tag_symbol = " \uf412 " # \uf412 '  ' # '  '' +tag_disabled = false +disabled = false + +[git_metrics] +format = '[\[+$added/]($added_style)[-$deleted\]]($deleted_style)[ ]()' +added_style = 'fg:orangegit' +deleted_style = 'fg:orangegit' +disabled = false + +[git_status] +format = '([$all_status$ahead_behind]($style))' +style = 'fg:orangegit' +conflicted = "[\ueaaf${count} ](fg:conflicted)" #  +ahead = "[\u21E1${count} ](fg:ahead)" # ⇡ \ueaa0 +behind = "[\u21E3${unt} ](fg:behind)" # ⇣ \uea9d +diverged = "[\u2195\u21E1${ahead_count} \u21E3${behind_count} ](fg:diverged)" # \u2195\u21E1 ⇕ ↕ ⇳ 󰹹 󰹺 󰧈 +up_to_date = "[\u2714 ](fg:uptodate)" # \u2714 ✔ \u2713 \ueab2 ✓ +untracked = "[󰟉.${count} ](fg:untracked)" # 󰟉 \uf441 \ueb32 ﳇ ' ' # '? ' +stashed = "[\ueb29${count} ](fg:stashed)" # \ueb29  '📦 '# ' ' # ' ' # ' ' # ' ' +modified = "[\uf040${count} ](fg:modified)" # \uf040 󰷉 '📝' # '! ' #  #  #  \uf044 \uea73 +staged = "[\u26DF .${count} ](fg:staged)" # \u26DF  '+ ' +renamed = "[\u0373${count} ](fg:renamed)" # \u0373 \ueb69  ' ' # '﫦' # ᴂ #  #  #  # ﳳ +deleted = "[\uea81${count} ](fg:deleted)" # \uea81 \uf507 ﯊ '🗑 ' '- ' +disabled = false + +[fill] +style = 'fg:fill' +symbol = "\u2500" # "\u2500" "─" # no line: ' ' + +[status] +format = "[$symbol $status $hex_status( \uf0a2 $signal_number-$signal_name)]($style)" # \uf0a2  , \ueaa2 +style = 'fg:status' +symbol = " \u2717" # \u2717 \uf467 \uebde  ✘ +disabled = false + +[jobs] +format = "[ \ueab5 ](fg:jobs bold)[$symbol $number]($style)" # \u3009 +style = 'fg:jobs' +symbol = "\ueb7b" # \ueb7b  \uef0c 省 # '廒' # '󰜎' # '' +symbol_threshold = 1 +number_threshold = 2 +disabled = false + +[memory_usage] +format = "[ \ueab5 ](fg:memory bold)[$symbol ${ram} ${swap}]($style)" # \u3009 +style = "fg:memory" +symbol = "\ueb50 \uebcb" # "\ueb50 \uebcb" \uf1ec '﬙ 北' '﬙ 痢' # '﬙ 󰾵' # '󰍛 󰾵' # '﬙ 󰾴' # '﬙ 󰾶' '﬙ 󰣂' +threshold = 75 +disabled = false + +[cmd_duration] +format = "[ \ueab5 \uf017 $duration]($style)" # \ueab5 \uf017   +style = 'fg:duration' +min_time = 500 +disabled = false + +[battery] +format = "[ \ueab5 $symbol$percentage]($style)" +full_symbol = '󰁹 ' +charging_symbol = '󰂄 ' +discharging_symbol = '󰂃 ' +unknown_symbol = '󰁽? ' +empty_symbol = '󰂎 ' +disabled = true # set to 'false', if you want to see the battery status + +[[battery.display]] +threshold = 100 # show always +style = 'fg:greydimmed' + +[time] +format = "[ \ueab5 $time]($style)" +style = 'fg:greydimmed' +disabled = false # set to 'false', if you want to see the time + +[localip] +format = '[$localipv4](fg:localip bold)' +ssh_only = true +disabled = false diff --git a/modules/home/shells/fish/default.nix b/modules/home/shells/fish/default.nix new file mode 100644 index 0000000..d42e07b --- /dev/null +++ b/modules/home/shells/fish/default.nix @@ -0,0 +1,136 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ fish ]; + + # whereis fish + # sudo hx /etc/shells + # chsh -s {locaiton of fish} + + home.file."~/.config/fish/conf.d/nix-env.fish".source = ./nix-fix.fish; + + programs.fish = { + + enable = true; + + interactiveShellInit = '' + set fish_greeting + eval (ssh-agent -c) &> /dev/null + ssh-add ~/.ssh/github &> /dev/null + ssh-add ~/.ssh/ucsc_gitlab &> /dev/null + + eval "$(zoxide init fish)" + eval "$(starship init fish)" + + enable_transience + ''; + + shellAliases = { + ".." = "cd .."; + "..." = "cd ../.."; + "...." = "cd ../../../"; + "....." = "cd ../../../../"; + + "dots" = "cd ~/dev/dots"; + + "cp" = "cp -v"; + "ddf" = "df -h"; + "etc" = "erd -H"; + "mkdir" = "mkdir -p"; + "mv" = "mv -v"; + "rm" = "rm -v"; + "rr" = "rm -rf"; + + "ld" = "eza -ld */ --no-quotes --time-style long-iso"; + "lla" = "eza -lah --no-quotes --time-style long-iso"; + "ll" = "eza -lh --no-quotes --time-style long-iso"; + "llr" = "eza -lhr --no-quotes --time-style long-iso"; + "lls" = "eza -lh -s size --no-quotes --time-style long-iso"; + "llt" = "eza -lh -s time --no-quotes --time-style long-iso"; + "lltr" = "eza -lhr -s time --no-quotes --time-style long-iso"; + + "ree" = + "sudo nixos-rebuild switch --flake ~/dots/nixdots#zephryus && git push"; + + "fcd" = '' + cd "$(find ~/coding/ ~/storage/ -type d -not \( -path "*/.git/*" -o -path "*/target/*" -o -path "*/.venv/*" -o -path "*/node_modules/*" -o -path "*/venv/*" -o -path "*/build/*" -o -path "*/.*/*" \) -print 2>/dev/null | fzf)" ''; + + "l" = "exa"; + + "lg" = "lazygit"; + }; + + shellAbbrs = { + # cargo abbreviations + cb = "cargo build"; + cc = "cargo check"; + cdo = "cargo doc --open"; + cr = "cargo run"; + + # git abbreviations + gaa = "git add -A"; + ga = "git add"; + gbd = "git branch --delete"; + gb = "git branch"; + gc = "git commit"; + gcm = "git commit -m"; + gcob = "git checkout -b"; + gco = "git checkout"; + gd = "git diff"; + gl = "git log"; + gp = "git push"; + gpom = "git push origin main"; + gs = "git status"; + gst = "git stash"; + gstp = "git stash pop"; + + }; + + functions = { + + # TODO: figure out how this is supposed to work, rn need to call it twice for it to + # use argument + mkcd = '' + function mkcd --argument name + mkdir -p $name + cd $name + end + ''; + # re = '' + # set VERSION (math (readlink /nix/var/nix/profiles/system | grep -o "[0-9]*") + 1) + # z ~/dots/nixdots + # git add -A + # git commit -m "Generation: $VERSION" + # sudo nixos-rebuild switch --flake /home/suri/dots/nixdots#zephryus + # git push + # ''; + + y = '' + set tmp (mktemp -t "yazi-cwd.XXXXXX") + yazi $argv --cwd-file="$tmp" + if test -s "$tmp" + set cwd (cat -- "$tmp") + if test -n "$cwd" -a "$cwd" != "$PWD" + cd -- "$cwd" + end + end + rm -f -- "$tmp" &> /dev/null + + ''; + + tz = '' + if test (count $argv) -eq 0 + echo "Usage: tz " + return 1 + end + + set input_file $argv[1] + set output_file (string replace ".typ" ".pdf" -- $input_file) + + typst watch "$input_file" "$output_file" & # Watch and compile Typst file + sleep 1 # Give Typst some time to generate the PDF + zathura "$output_file" # Open the generated PDF + ''; + }; + }; +} diff --git a/modules/home/shells/fish/nix-fix.fish b/modules/home/shells/fish/nix-fix.fish new file mode 100644 index 0000000..4f2c276 --- /dev/null +++ b/modules/home/shells/fish/nix-fix.fish @@ -0,0 +1,139 @@ + +# Setup Nix + +# We need to distinguish between single-user and multi-user installs. +# This is difficult because there's no official way to do this. +# We could look for the presence of /nix/var/nix/daemon-socket/socket but this will fail if the +# daemon hasn't started yet. /nix/var/nix/daemon-socket will exist if the daemon has ever run, but +# I don't think there's any protection against accidentally running `nix-daemon` as a user. +# We also can't just look for /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh because +# older single-user installs used the default profile instead of a per-user profile. +# We can still check for it first, because all multi-user installs should have it, and so if it's +# not present that's a pretty big indicator that this is a single-user install. If it does exist, +# we still need to verify the install type. To that end we'll look for a root owner and sticky bit +# on /nix/store. Multi-user installs set both, single-user installs don't. It's certainly possible +# someone could do a single-user install as root and then manually set the sticky bit but that +# would be extremely unusual. + +set -l nix_profile_path /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh +set -l single_user_profile_path ~/.nix-profile/etc/profile.d/nix.sh +if test -e $nix_profile_path + # The path exists. Double-check that this is a multi-user install. + # We can't just check for ~/.nix-profile/… because this may be a single-user install running as + # the wrong user. + + # stat is not portable. Splitting the output of ls -nd is reliable on most platforms. + set -l owner (string split -n ' ' (command ls -nd /nix/store 2>/dev/null))[3] + if not test -k /nix/store -a $owner -eq 0 + # /nix/store is either not owned by root or not sticky. Assume single-user. + set nix_profile_path $single_user_profile_path + end +else + # The path doesn't exist. Assume single-user + set nix_profile_path $single_user_profile_path +end + +if test -e $nix_profile_path + # Source the nix setup script + # We're going to run the regular Nix profile under bash and then print out a few variables + for line in (command env -u BASH_ENV bash -c '. "$0"; for name in PATH "${!NIX_@}"; do printf "%s=%s\0" "$name" "${!name}"; done' $nix_profile_path | string split0) + set -xg (string split -m 1 = $line) + end + + # Insert Nix's fish share directories into fish's special variables. + # nixpkgs-installed fish tries to set these up already if NIX_PROFILES is defined, which won't + # be the case when sourcing $__fish_data_dir/share/config.fish normally, but might be for a + # recursive invocation. To guard against that, we'll only insert paths that don't already exit. + # Furthermore, for the vendor_conf.d sourcing, we'll use the pre-existing presence of a path in + # $fish_function_path to determine whether we want to source the relevant vendor_conf.d folder. + + # To start, let's locally define NIX_PROFILES if it doesn't already exist. + set -al NIX_PROFILES + if test (count $NIX_PROFILES) -eq 0 + set -a NIX_PROFILES $HOME/.nix-profile + end + # Replicate the logic from nixpkgs version of $__fish_data_dir/__fish_build_paths.fish. + set -l __nix_profile_paths (string split ' ' -- $NIX_PROFILES)[-1..1] + set -l __extra_completionsdir \ + $__nix_profile_paths/etc/fish/completions \ + $__nix_profile_paths/share/fish/vendor_completions.d + set -l __extra_functionsdir \ + $__nix_profile_paths/etc/fish/functions \ + $__nix_profile_paths/share/fish/vendor_functions.d + set -l __extra_confdir \ + $__nix_profile_paths/etc/fish/conf.d \ + $__nix_profile_paths/share/fish/vendor_conf.d \ + + ### Configure fish_function_path ### + # Remove any of our extra paths that may already exist. + # Record the equivalent __extra_confdir path for any function path that exists. + set -l existing_conf_paths + for path in $__extra_functionsdir + if set -l idx (contains --index -- $path $fish_function_path) + set -e fish_function_path[$idx] + set -a existing_conf_paths $__extra_confdir[(contains --index -- $path $__extra_functionsdir)] + end + end + # Insert the paths before $__fish_data_dir. + if set -l idx (contains --index -- $__fish_data_dir/functions $fish_function_path) + # Fish has no way to simply insert into the middle of an array. + set -l new_path $fish_function_path[1..$idx] + set -e new_path[$idx] + set -a new_path $__extra_functionsdir + set fish_function_path $new_path $fish_function_path[$idx..-1] + else + set -a fish_function_path $__extra_functionsdir + end + + ### Configure fish_complete_path ### + # Remove any of our extra paths that may already exist. + for path in $__extra_completionsdir + if set -l idx (contains --index -- $path $fish_complete_path) + set -e fish_complete_path[$idx] + end + end + # Insert the paths before $__fish_data_dir. + if set -l idx (contains --index -- $__fish_data_dir/completions $fish_complete_path) + set -l new_path $fish_complete_path[1..$idx] + set -e new_path[$idx] + set -a new_path $__extra_completionsdir + set fish_complete_path $new_path $fish_complete_path[$idx..-1] + else + set -a fish_complete_path $__extra_completionsdir + end + + ### Source conf directories ### + # The built-in directories were already sourced during shell initialization. + # Any __extra_confdir that came from $__fish_data_dir/__fish_build_paths.fish was also sourced. + # As explained above, we're using the presence of pre-existing paths in $fish_function_path as a + # signal that the corresponding conf dir has also already been sourced. + # In order to simulate this, we'll run through the same algorithm as found in + # $__fish_data_dir/config.fish except we'll avoid sourcing the file if it comes from an + # already-sourced location. + # Caveats: + # * Files will be sourced in a different order than we'd ideally do (because we're coming in + # after the fact to source them). + # * If there are existing extra conf paths, files in them may have been sourced that should have + # been suppressed by paths we're inserting in front. + # * Similarly any files in $__fish_data_dir/vendor_conf.d that should have been suppressed won't + # have been. + set -l sourcelist + for file in $__fish_config_dir/conf.d/*.fish $__fish_sysconf_dir/conf.d/*.fish + # We know these paths were sourced already. Just record them. + set -l basename (string replace -r '^.*/' '' -- $file) + contains -- $basename $sourcelist + or set -a sourcelist $basename + end + for root in $__extra_confdir + for file in $root/*.fish + set -l basename (string replace -r '^.*/' '' -- $file) + contains -- $basename $sourcelist + and continue + set -a sourcelist $basename + contains -- $root $existing_conf_paths + and continue # this is a pre-existing path, it will have been sourced already + [ -f $file -a -r $file ] + and source $file + end + end +end diff --git a/modules/home/shells/zsh/default.nix b/modules/home/shells/zsh/default.nix new file mode 100644 index 0000000..e69de29 diff --git a/modules/home/term/ghostty/default.nix b/modules/home/term/ghostty/default.nix new file mode 100644 index 0000000..e69de29 diff --git a/modules/home/term/ghostty/ghostty/config b/modules/home/term/ghostty/ghostty/config new file mode 100644 index 0000000..8ad8c6d --- /dev/null +++ b/modules/home/term/ghostty/ghostty/config @@ -0,0 +1,125 @@ +initial-command = "/etc/profiles/per-user/suri/bin/suri_zellij_session_helper" + +custom-shader = ./shaders/cursor_blaze.glsl + +# custom-shader = ./shaders/starfield-colors.glsl + +# funny +# custom-shader = ./shaders/bettercrt.glsl + +# Im hacker +# custom-shader = ./shaders/inside-the-matrix.glsl + + +# really cool +# custom-shader = ./shaders/glow-rgbsplit-twitchy.glsl +# custom-shader = ./shaders/glow.glsl +# custom-shader = ./shaders/tunnel.glsl + + + + + + + +# custom-shader-animation = always + +font-family = "" + +font-family = "Monaspace Krypton SemiBold" + +font-family-bold = "Monaspace Neon SemiBold" + +font-family-italic = "Monaspace Argon SemiBold" + +font-family-bold-italic = "Monaspace Neon SemiBold" + +cursor-style = "bar" + +font-feature = "calt" +font-feature = "clig" +font-feature = "liga" +font-feature = "dlig" +font-feature = "ss01" +font-feature = "ss02" +font-feature = "ss03" +font-feature = "ss04" +font-feature = "ss05" +font-feature = "ss06" +font-feature = "ss07" +font-feature = "ss08" + +font-size = "14" + +mouse-hide-while-typing = true + +# background-opacity = 0.8 + +# background-blur = true + +window-padding-x = 5,5 + +window-padding-y = 5,5 + +# window-decoration = false + +# Disable conflicting Ghostty defaults to allow Zellij keybinds + + +# keybind = clear + +# keybind = super+shift+,=reload + +# Ghostty uses super+k for clear_screen, Zellij uses it for MoveFocus up +keybind = super+k=unbind +keybind = super+d=unbind +keybind = super+t=unbind +# Ghostty uses super+n for new_window, Zellij uses it for NewPane +keybind = super+n=unbind +# Ghostty uses super+left_bracket for goto_split:previous, Zellij uses Super+[ for PreviousSwapLayout +keybind = super+left_bracket=unbind +# Ghostty uses super+right_bracket for goto_split:next, Zellij uses Super+] for NextSwapLayout +keybind = super+right_bracket=unbind +# Ghostty uses super+up for jump_to_prompt:-1, Zellij uses it for MoveFocus up +keybind = super+up=unbind +# Ghostty uses super+down for jump_to_prompt:1, Zellij uses it for MoveFocus down +keybind = super+down=unbind +# Ghostty uses super+right for text:\x05, Zellij uses it for MoveFocusOrTab right +keybind = super+right=unbind +# Ghostty uses super+left for text:\x01, Zellij uses it for MoveFocusOrTab left +keybind = super+left=unbind +# Ghostty tab navigation conflicts with Zellij GoToTab +# keybind = super+one=unbind +# keybind = super+two=unbind +# keybind = super+three=unbind +# keybind = super+four=unbind +# keybind = super+five=unbind +# keybind = super+six=unbind +# keybind = super+seven=unbind +# keybind = super+eight=unbind +# keybind = super+nine=unbind + +keybind = super+digit_1=unbind +keybind = super+digit_2=unbind +keybind = super+digit_3=unbind +keybind = super+digit_4=unbind +keybind = super+digit_5=unbind +keybind = super+digit_6=unbind +keybind = super+digit_7=unbind +keybind = super+digit_8=unbind +keybind = super+digit_9=unbind + +keybind = super+1=unbind +keybind = super+2=unbind +keybind = super+3=unbind +keybind = super+4=unbind +keybind = super+5=unbind +keybind = super+6=unbind +keybind = super+7=unbind +keybind = super+8=unbind +keybind = super+9=unbind +# theme = "gruvbox-material" +# theme = GruvboxDarkHard +# theme = Monokai Remastered +# theme = Kanagawa Dragon +theme = ayu diff --git a/modules/home/term/ghostty/ghostty/shaders b/modules/home/term/ghostty/ghostty/shaders new file mode 160000 index 0000000..0173821 --- /dev/null +++ b/modules/home/term/ghostty/ghostty/shaders @@ -0,0 +1 @@ +Subproject commit 01738211b26a60eac33119d6da0c7bb12763e683 diff --git a/modules/home/tools/btop.nix b/modules/home/tools/btop.nix new file mode 100644 index 0000000..8847a23 --- /dev/null +++ b/modules/home/tools/btop.nix @@ -0,0 +1,8 @@ +{ + programs.btop = { + enable = true; + settings = { + # color_theme = "TTY"; + }; + }; +} diff --git a/modules/home/tools/default.nix b/modules/home/tools/default.nix new file mode 100644 index 0000000..306494e --- /dev/null +++ b/modules/home/tools/default.nix @@ -0,0 +1,29 @@ +{ pkgs, lib, ... }: { + + imports = [ ./helix ./zellij ]; + + home.sessionVariables.LIBRARY_PATH = + "${lib.makeLibraryPath [ pkgs.libiconv ]}\${LIBRARY_PATH:+:$LIBRARY_PATH}"; + + home.packages = with pkgs; [ + + fastfetch + zoxide + zstd + coreutils-prefixed + lazygit + docker + yazi + fzf + github-cli + dust + glow + just + typst + tokei + ripgrep + bat + + ]; + +} diff --git a/modules/home/tools/git.nix b/modules/home/tools/git.nix new file mode 100644 index 0000000..eeeab5f --- /dev/null +++ b/modules/home/tools/git.nix @@ -0,0 +1,12 @@ +{ + programs.git = { + enable = true; + settings.user = { + name = "suri312006"; + email = "suri312006@gmail.com"; + + }; + + lfs = { enable = true; }; + }; +} diff --git a/modules/home/tools/helix/default.nix b/modules/home/tools/helix/default.nix new file mode 100644 index 0000000..8d1174a --- /dev/null +++ b/modules/home/tools/helix/default.nix @@ -0,0 +1,213 @@ +{ pkgs, ... }: { + + home.file.".config/helix/ignore".text = '' + !.notes/ + !.gitignore + !.gitmodules + !.github/ + !.devcontainer/ + !.env* + !.sqlx/ + !.cargo/ + !.config/ + !puzzles/* + !examples/* + !inputs/* + target/ + ''; + + home.file.".config/helix/themes/theme-trans.toml".source = ./theme-trans.toml; + + programs.helix = { + enable = true; + defaultEditor = true; + extraPackages = with pkgs; [ + # markdown-oxide + gopls + nil + texlab + taplo + lua-language-server + haskell-language-server + python312Packages.python-lsp-server + typescript-language-server + svelte-language-server + tailwindcss-language-server + emmet-language-server + vale-ls + tinymist + ltex-ls + nixd + nil + codebook + markdown-oxide + ruff + ]; + + settings = { + # theme = "gruvbox_dark_hard"; + theme = "theme-trans"; + # theme = lib.mkForce "stylix"; + # theme = lib.mkForce "monokai_soda"; + # theme = lib.mkForce "helix-ayu"; + editor.cursor-shape = { + normal = "block"; + insert = "bar"; + select = "underline"; + + }; + + editor = { + + line-number = "relative"; + inline-diagnostics.cursor-line = "hint"; + end-of-line-diagnostics = "hint"; + color-modes = true; + completion-trigger-len = 1; + completion-timeout = 5; + + auto-save = { focus-lost = true; }; + + lsp = { display-inlay-hints = true; }; + + statusline = { + left = [ + "mode" + "spinner" + "file-name" + "file-type" + "total-line-numbers" + "file-encoding" + ]; + right = [ + "version-control" + "position" + "selections" + "primary-selection-length" + "position-percentage" + "spacer" + "workspace-diagnostics" + ]; + separator = "│"; + mode.normal = "NORMAL"; + mode.insert = "INSERT"; + mode.select = "SELECT"; + }; + }; + keys.normal = { X = "extend_line_above"; }; + keys.normal = { ret = "goto_word"; }; + + }; + + languages = { + language-server.ltex = { + command = "ltex-ls-plus"; + config.ltex.dictionary."en-US" = [ "ewwe" "flaberrasted" ]; + config.ltex.disabledRules."en-US" = [ "WHITESPACE_RULE" ]; + + }; + + language-server.rust-analyzer.config.check.command = "clippy"; + + language-server.texlab = { + command = "texlab"; + config.texlab = { + build = { + onSave = true; + forwardSearchAfter = true; + executable = "latexmk"; + args = [ + "-pdf" + "-interaction=nonstopmode" + "-synctex=1" + "-shell-escape" + "%f" + ]; + }; + forwardSearch = { + executable = "zathura"; + args = [ "--synctex-forward" "%l:%c:%f" "%p" ]; + }; + chktex = { + onOpenAndSave = true; + onEdit = true; + }; + }; + }; + + language-server.codebook = { + command = "codebook"; + args = [ "serve" ]; + + }; + + language-server.gdscript = { + command = "nc"; + args = [ "127.0.0.1" "6005" ]; + }; + + language = [ + { + name = "typst"; + auto-format = true; + formatter.command = "typstyle"; + # idk how to fucking set this shit up + # language-servers = [ "tinymist" "vale-ls" ]; + # language-servers = [ "tinymist" "ltex-ls" ]; + + language-servers = [ "tinymist" ]; + } + { + name = "latex"; + # language-servers = [ "texlab" "ltex-ls-plus" "vale-ls" ]; + language-servers = [ "texlab" "ltex-ls-plus" ]; + } + { + name = "nix"; + auto-format = true; + formatter.command = "${pkgs.nixfmt-classic}/bin/nixfmt"; + } + { + name = "svelte"; + auto-format = true; + formatter = { + command = "dprint"; + args = [ "fmt" "--stdin" "svelte" ]; + }; + language-servers = + [ "svelteserver" "tailwindcss-language-server" "codebook" ]; + } + { + name = "html"; + language-servers = [ "vscode-html-language-server" "tailwindcss-ls" ]; + } + { + name = "css"; + language-servers = [ "vscode-css-language-server" "tailwindcss-ls" ]; + } + + { + name = "gdscript"; + language-servers = [ "gdscript" ]; + language-id = "gdscript"; + } + + { + name = "rust"; + language-servers = [ "rust-analyzer" "codebook" ]; + } + { + name = "markdown"; + # auto-format = true; + # formatter = { + # command = "fmt"; + # args = [ "70" ]; + # }; + language-servers = [ "codebook" "markdown-oxide" ]; + } + + ]; + }; + + }; +} diff --git a/modules/home/tools/helix/theme-trans.toml b/modules/home/tools/helix/theme-trans.toml new file mode 100644 index 0000000..f84d05b --- /dev/null +++ b/modules/home/tools/helix/theme-trans.toml @@ -0,0 +1,5 @@ +inherits = "gruvbox_dark_hard" + + +"ui.background" = { bg = "#0B0E14" } +"ui.statusline" = { bg = "#0B0E14" } diff --git a/modules/home/tools/zellij/config.kdl b/modules/home/tools/zellij/config.kdl new file mode 100644 index 0000000..c29d368 --- /dev/null +++ b/modules/home/tools/zellij/config.kdl @@ -0,0 +1,264 @@ +keybinds clear-defaults=true { + normal { + // Switch to different modes with Super key + bind "Super p" { SwitchToMode "pane"; } + bind "Super t" { SwitchToMode "tab"; } + bind "Super r" { SwitchToMode "resize"; } + bind "Super m" { SwitchToMode "move"; } + bind "Super v" { SwitchToMode "scroll"; } + bind "Super o" { SwitchToMode "session"; } + } + + locked { + bind "Super g" { SwitchToMode "normal"; } + } + + pane { + bind "left" { MoveFocus "left"; } + bind "down" { MoveFocus "down"; } + bind "up" { MoveFocus "up"; } + bind "right" { MoveFocus "right"; } + bind "c" { SwitchToMode "renamepane"; PaneNameInput 0; } + bind "d" { NewPane "down"; SwitchToMode "normal"; } + bind "e" { TogglePaneEmbedOrFloating; SwitchToMode "normal"; } + bind "f" { ToggleFocusFullscreen; SwitchToMode "normal"; } + bind "h" { MoveFocus "left"; } + bind "j" { MoveFocus "down"; } + bind "k" { MoveFocus "up"; } + bind "l" { MoveFocus "right"; } + bind "n" { NewPane; SwitchToMode "normal"; } + bind "p" { SwitchToMode "normal"; } + bind "r" { NewPane "right"; SwitchToMode "normal"; } + bind "w" { ToggleFloatingPanes; SwitchToMode "normal"; } + bind "x" { CloseFocus; SwitchToMode "normal"; } + bind "z" { TogglePaneFrames; SwitchToMode "normal"; } + bind "tab" { SwitchFocus; } + } + + tab { + bind "left" { GoToPreviousTab; } + bind "down" { GoToNextTab; } + bind "up" { GoToPreviousTab; } + bind "right" { GoToNextTab; } + bind "1" { GoToTab 1; SwitchToMode "normal"; } + bind "2" { GoToTab 2; SwitchToMode "normal"; } + bind "3" { GoToTab 3; SwitchToMode "normal"; } + bind "4" { GoToTab 4; SwitchToMode "normal"; } + bind "5" { GoToTab 5; SwitchToMode "normal"; } + bind "6" { GoToTab 6; SwitchToMode "normal"; } + bind "7" { GoToTab 7; SwitchToMode "normal"; } + bind "8" { GoToTab 8; SwitchToMode "normal"; } + bind "9" { GoToTab 9; SwitchToMode "normal"; } + bind "[" { BreakPaneLeft; SwitchToMode "normal"; } + bind "]" { BreakPaneRight; SwitchToMode "normal"; } + bind "b" { BreakPane; SwitchToMode "normal"; } + bind "h" { GoToPreviousTab; } + bind "j" { GoToNextTab; } + bind "k" { GoToPreviousTab; } + bind "l" { GoToNextTab; } + bind "n" { NewTab; SwitchToMode "normal"; } + bind "r" { SwitchToMode "renametab"; TabNameInput 0; } + bind "s" { ToggleActiveSyncTab; SwitchToMode "normal"; } + bind "t" { SwitchToMode "normal"; } + bind "x" { CloseTab; SwitchToMode "normal"; } + bind "tab" { ToggleTab; } + } + + resize { + bind "left" { Resize "Increase left"; } + bind "down" { Resize "Increase down"; } + bind "up" { Resize "Increase up"; } + bind "right" { Resize "Increase right"; } + bind "+" { Resize "Increase"; } + bind "-" { Resize "Decrease"; } + bind "=" { Resize "Increase"; } + bind "H" { Resize "Decrease left"; } + bind "J" { Resize "Decrease down"; } + bind "K" { Resize "Decrease up"; } + bind "L" { Resize "Decrease right"; } + bind "h" { Resize "Increase left"; } + bind "j" { Resize "Increase down"; } + bind "k" { Resize "Increase up"; } + bind "l" { Resize "Increase right"; } + bind "r" { SwitchToMode "normal"; } + } + + move { + bind "left" { MovePane "left"; } + bind "down" { MovePane "down"; } + bind "up" { MovePane "up"; } + bind "right" { MovePane "right"; } + bind "h" { MovePane "left"; } + bind "j" { MovePane "down"; } + bind "k" { MovePane "up"; } + bind "l" { MovePane "right"; } + bind "m" { SwitchToMode "normal"; } + bind "n" { MovePane; } + bind "p" { MovePaneBackwards; } + bind "tab" { MovePane; } + } + + scroll { + bind "Alt left" { MoveFocusOrTab "left"; SwitchToMode "normal"; } + bind "Alt down" { MoveFocus "down"; SwitchToMode "normal"; } + bind "Alt up" { MoveFocus "up"; SwitchToMode "normal"; } + bind "Alt right" { MoveFocusOrTab "right"; SwitchToMode "normal"; } + bind "e" { EditScrollback; SwitchToMode "normal"; } + bind "f" { SwitchToMode "entersearch"; SearchInput 0; } + bind "Alt h" { MoveFocusOrTab "left"; SwitchToMode "normal"; } + bind "Alt j" { MoveFocus "down"; SwitchToMode "normal"; } + bind "Alt k" { MoveFocus "up"; SwitchToMode "normal"; } + bind "Alt l" { MoveFocusOrTab "right"; SwitchToMode "normal"; } + bind "s" { SwitchToMode "normal"; } + } + + search { + bind "c" { SearchToggleOption "CaseSensitivity"; } + bind "n" { Search "down"; } + bind "o" { SearchToggleOption "WholeWord"; } + bind "p" { Search "up"; } + bind "w" { SearchToggleOption "Wrap"; } + } + + session { + bind "c" { + LaunchOrFocusPlugin "configuration" { + floating true + move_to_focused_tab true + } + SwitchToMode "normal" + } + bind "d" { Detach; } + bind "o" { SwitchToMode "normal"; } + bind "p" { + LaunchOrFocusPlugin "plugin-manager" { + floating true + move_to_focused_tab true + } + SwitchToMode "normal" + } + bind "w" { + LaunchOrFocusPlugin "session-manager" { + floating true + move_to_focused_tab true + } + SwitchToMode "normal" + } + } + + shared_among "normal" "locked" { + bind "Super [" { PreviousSwapLayout; } + bind "Super ]" { NextSwapLayout; } + bind "Super f" { ToggleFloatingPanes; } + + bind "Super left" { MoveFocusOrTab "left"; } + bind "Super down" { MoveFocus "down"; } + bind "Super up" { MoveFocus "up"; } + bind "Super right" { MoveFocusOrTab "right"; } + + bind "Super h" { MoveFocusOrTab "left"; } + bind "Super j" { MoveFocus "down"; } + bind "Super k" { MoveFocus "up"; } + bind "Super l" { MoveFocusOrTab "right"; } + + bind "Super n" { NewPane; } + bind "Super x" { CloseFocus; } + bind "Super s" { + LaunchOrFocusPlugin "session-manager" { + floating true + move_to_focused_tab true + } + } + + bind "Super o" { MoveTab "right"; } + bind "Super i" { MoveTab "left"; } + + bind "Super 1" { GoToTab 1; } + bind "Super 2" { GoToTab 2; } + bind "Super 3" { GoToTab 3; } + bind "Super 4" { GoToTab 4; } + bind "Super 5" { GoToTab 5; } + bind "Super 6" { GoToTab 6; } + bind "Super 7" { GoToTab 7; } + bind "Super 8" { GoToTab 8; } + bind "Super 9" { GoToTab 9; } + } + + shared_except "locked" "renametab" "renamepane" { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl q" { Quit; } + } + + shared_except "normal" "locked" "entersearch" { + bind "enter" { SwitchToMode "normal"; } + } + + shared_except "normal" "locked" "entersearch" "renametab" "renamepane" { + bind "esc" { SwitchToMode "normal"; } + } + + shared_among "scroll" "search" { + bind "PageDown" { PageScrollDown; } + bind "PageUp" { PageScrollUp; } + bind "left" { PageScrollUp; } + bind "down" { ScrollDown; } + bind "up" { ScrollUp; } + bind "right" { PageScrollDown; } + bind "Ctrl b" { PageScrollUp; } + bind "Ctrl c" { ScrollToBottom; SwitchToMode "normal"; } + bind "d" { HalfPageScrollDown; } + bind "Ctrl f" { PageScrollDown; } + bind "h" { PageScrollUp; } + bind "j" { ScrollDown; } + bind "k" { ScrollUp; } + bind "l" { PageScrollDown; } + bind "u" { HalfPageScrollUp; } + } + + entersearch { + bind "Ctrl c" { SwitchToMode "scroll"; } + bind "esc" { SwitchToMode "scroll"; } + bind "enter" { SwitchToMode "search"; } + } + + renametab { + bind "esc" { UndoRenameTab; SwitchToMode "tab"; } + } + + shared_among "renametab" "renamepane" { + bind "Ctrl c" { SwitchToMode "normal"; } + } + + renamepane { + bind "esc" { UndoRenamePane; SwitchToMode "pane"; } + } +} + +plugins { + compact-bar location="zellij:compact-bar" + configuration location="zellij:configuration" + filepicker location="zellij:strider" { + cwd "/" + } + plugin-manager location="zellij:plugin-manager" + session-manager location="zellij:session-manager" + status-bar location="zellij:status-bar" + strider location="zellij:strider" + tab-bar location="zellij:tab-bar" + welcome-screen location="zellij:session-manager" { + welcome_screen true + } +} + +load_plugins { +} + +// theme "onedark" +theme "ayu_dark" + +// Changed from "locked" to "normal" +default_mode "normal" + +pane_frames false + +scrollback_lines_to_serialize 10000 diff --git a/modules/home/tools/zellij/default.nix b/modules/home/tools/zellij/default.nix new file mode 100644 index 0000000..6041a0d --- /dev/null +++ b/modules/home/tools/zellij/default.nix @@ -0,0 +1,44 @@ +{ pkgs, ... }: +# let +# suri_zellij_session_helper = +# pkgs.writeShellScriptBin "suri_zellij_session_helper" '' + +# ZELLIJ_SESSIONS=$(zellij ls | sed 's/\x1b\[[0-9;]*m//g' | cut -d ' ' -f 1) +# NUM_SESSIONS=$(echo "''${ZELLIJ_SESSIONS}" | wc -l ) + +# if [ "''${NUM_SESSIONS}" -ge 1 ]; then +# SESSION="$(echo "''${ZELLIJ_SESSIONS}" | fzf)" + +# zellij a ''${SESSION} + +# else +# zellij attach -c +# fi + +# ''; +# in { + +# home = { +# packages = [ pkgs.zellij suri_zellij_session_helper ]; +# file.".config/zellij/config.kdl".source = ./config.kdl; +# }; +# } + +let + suri_zellij_session_helper = + pkgs.writeShellScriptBin "suri_zellij_session_helper" '' + ZELLIJ_SESSIONS=$(${pkgs.zellij}/bin/zellij ls | sed 's/\x1b\[[0-9;]*m//g' | cut -d ' ' -f 1) + NUM_SESSIONS=$(echo "''${ZELLIJ_SESSIONS}" | wc -l ) + if [ "''${NUM_SESSIONS}" -ge 1 ]; then + SESSION="$(echo "''${ZELLIJ_SESSIONS}" | ${pkgs.fzf}/bin/fzf)" + ${pkgs.zellij}/bin/zellij a ''${SESSION} + else + ${pkgs.zellij}/bin/zellij attach -c + fi + ''; +in { + home = { + packages = [ pkgs.zellij pkgs.fzf suri_zellij_session_helper ]; + file.".config/zellij/config.kdl".source = ./config.kdl; + }; +} diff --git a/modules/home/wm/aerospace/aerospace.toml b/modules/home/wm/aerospace/aerospace.toml new file mode 100644 index 0000000..8badef9 --- /dev/null +++ b/modules/home/wm/aerospace/aerospace.toml @@ -0,0 +1,354 @@ + +# Place a copy of this config to ~/.aerospace.toml +# After that, you can edit ~/.aerospace.toml to your liking + +# You can use it to add commands that run after login to macOS user session. +# 'start-at-login' needs to be 'true' for 'after-login-command' to work +# Available commands: https://nikitabobko.github.io/AeroSpace/commands +after-login-command = [] + +# You can use it to add commands that run after AeroSpace startup. +# 'after-startup-command' is run after 'after-login-command' +# Available commands : https://nikitabobko.github.io/AeroSpace/commands +# +# Run Sketchybar together with AeroSpace +# sketchbar has a built-in detection of already running process, +# so it won't be run twice on AeroSpace restart +# after-startup-command = ['exec-and-forget sketchybar'] + +# # Notify Sketchybar about workspace change +# exec-on-workspace-change = ['/bin/bash', '-c', +# 'sketchybar --trigger aerospace_workspace_change FOCUSED_WORKSPACE=$AEROSPACE_FOCUSED_WORKSPACE' +# ] +# +exec-on-workspace-change = [ + '/bin/bash', + '-c', + 'sketchybar --trigger aerospace_workspace_change FOCUSED_WORKSPACE=$AEROSPACE_FOCUSED_WORKSPACE FOCUSED_DISPLAY=$(aerospace list-monitors --focused | awk "{print $1}")', +] + +# Notify Sketchybar about focuse change +# See https://nikitabobko.github.io/AeroSpace/guide#on-focus-changed-callbacks +on-focus-changed = [ + 'exec-and-forget sketchybar --trigger aerospace_focus_change FOCUSED_WORKSPACE=$AEROSPACE_FOCUSED_WORKSPACE', +] +# startup apps +after-startup-command = [ +# 'exec-and-forget borders active_color=0xffe1e3e4 inactive_color=0xff494d64 width=3.0', + +'''exec-and-forget osascript -e ' + +-- Launch applications in sequence +tell application "Zen" + activate + delay 0.8 +end tell + +tell application "Ghostty" + activate + delay 0.8 +end tell + +tell application "Discord" + activate + delay 0.8 +end tell + + +tell application "Zulip" + activate + delay 0.8 +end tell + +tell application "Mail" + activate + delay 0.8 +end tell + +tell application "Spotify" + activate + delay 0.8 +end tell +' + +''' +] + +# Start AeroSpace at login +start-at-login = true + +# Normalizations. See: https://nikitabobko.github.io/AeroSpace/guide#normalization +enable-normalization-flatten-containers = true +enable-normalization-opposite-orientation-for-nested-containers = true + +# See: https://nikitabobko.github.io/AeroSpace/guide#layouts +# The 'accordion-padding' specifies the size of accordion padding +# You can set 0 to disable the padding feature +accordion-padding = 30 + +# Possible values: tiles|accordion +default-root-container-layout = 'tiles' + +# Possible values: horizontal|vertical|auto +# 'auto' means: wide monitor (anything wider than high) gets horizontal orientation, +# tall monitor (anything higher than wide) gets vertical orientation +default-root-container-orientation = 'auto' + +# Mouse follows focus when focused monitor changes +# Drop it from your config, if you don't like this behavior +# See https://nikitabobko.github.io/AeroSpace/guide#on-focus-changed-callbacks +# See https://nikitabobko.github.io/AeroSpace/commands#move-mouse +# Fallback value (if you omit the key): on-focused-monitor-changed = [] +on-focused-monitor-changed = ['move-mouse monitor-lazy-center'] + +# You can effectively turn off macOS "Hide application" (cmd-h) feature by toggling this flag +# Useful if you don't use this macOS feature, but accidentally hit cmd-h or cmd-alt-h key +# Also see: https://nikitabobko.github.io/AeroSpace/goodies#disable-hide-app +automatically-unhide-macos-hidden-apps = false + +# Possible values: (qwerty|dvorak|colemak) +# See https://nikitabobko.github.io/AeroSpace/guide#key-mapping +[key-mapping] + preset = 'qwerty' + +# Gaps between windows (inner-*) and between monitor edges (outer-*). +# Possible values: +# - Constant: gaps.outer.top = 8 +# - Per monitor: gaps.outer.top = [{ monitor.main = 16 }, { monitor."some-pattern" = 32 }, 24] +# In this example, 24 is a default value when there is no match. +# Monitor pattern is the same as for 'workspace-to-monitor-force-assignment'. +# See: +# https://nikitabobko.github.io/AeroSpace/guide#assign-workspaces-to-monitors +[gaps] + inner.horizontal = 5 + inner.vertical = 5 + outer.left = 10 + outer.bottom = 10 + outer.right = 10 + # need to do this so sketchybar looks good + # outer.top = [{monitor."SB270" = 40}, {monitor."CB272" = 40}, 10] + # outer.top = 10 + + +# 'main' binding mode declaration +# See: https://nikitabobko.github.io/AeroSpace/guide#binding-modes +# 'main' binding mode must be always presented +# Fallback value (if you omit the key): mode.main.binding = {} +[mode.main.binding] + alt-v= 'layout v_tiles' + alt-shift-v='layout h_tiles' + # All possible keys: + # - Letters. a, b, c, ..., z + # - Numbers. 0, 1, 2, ..., 9 + # - Keypad numbers. keypad0, keypad1, keypad2, ..., keypad9 + # - F-keys. f1, f2, ..., f20 + # - Special keys. minus, equal, period, comma, slash, backslash, quote, semicolon, + # backtick, leftSquareBracket, rightSquareBracket, space, enter, esc, + # backspace, tab, pageUp, pageDown, home, end, forwardDelete, + # sectionSign (ISO keyboards only, european keyboards only) + # - Keypad special. keypadClear, keypadDecimalMark, keypadDivide, keypadEnter, keypadEqual, + # keypadMinus, keypadMultiply, keypadPlus + # - Arrows. left, down, up, right + + # All possible modifiers: cmd, alt, ctrl, shift + + # All possible commands: https://nikitabobko.github.io/AeroSpace/commands + + # See: https://nikitabobko.github.io/AeroSpace/commands#exec-and-forget + # You can uncomment the following lines to open up terminal with alt + enter shortcut + # (like in i3) + # alt-enter = '''exec-and-forget osascript -e ' + # tell application "Terminal" + # do script + # activate + # end tell' + # ''' + # + alt-enter = '''exec-and-forget osascript -e ' + tell application "Ghostty" + do script + activate + end tell' + ''' + + alt-f = 'fullscreen' + + # See: https://nikitabobko.github.io/AeroSpace/commands#layout + alt-slash = 'layout tiles horizontal vertical' + alt-comma = 'layout accordion horizontal vertical' + + # See: https://nikitabobko.github.io/AeroSpace/commands#focus + alt-h = 'focus left' + alt-j = 'focus down' + alt-k = 'focus up' + alt-l = 'focus right' + + # See: https://nikitabobko.github.io/AeroSpace/commands#move + alt-shift-h = 'move left' + alt-shift-j = 'move down' + alt-shift-k = 'move up' + alt-shift-l = 'move right' + + # See: https://nikitabobko.github.io/AeroSpace/commands#resize + alt-minus = 'resize smart -50' + alt-equal = 'resize smart +50' + + # See: https://nikitabobko.github.io/AeroSpace/commands#workspace + alt-1 = 'workspace 1' + alt-2 = 'workspace 2' + alt-3 = 'workspace 3' + alt-4 = 'workspace 4' + alt-5 = 'workspace 5' + alt-6 = 'workspace 6' + alt-7 = 'workspace 7' + alt-8 = 'workspace 8' + alt-9 = 'workspace 9' + alt-0 = 'workspace 10' + # alt-a = 'workspace A' # In your config, you can drop workspace bindings that you don't need + # alt-b = 'workspace B' + # alt-c = 'workspace C' + # alt-d = 'workspace D' + # alt-e = 'workspace E' + # alt-f = 'workspace F' + # alt-g = 'workspace G' + # alt-i = 'workspace I' + # alt-m = 'workspace M' + # alt-n = 'workspace N' + # alt-o = 'workspace O' + # alt-p = 'workspace P' + # alt-q = 'workspace Q' + # alt-r = 'workspace R' + # alt-s = 'workspace S' + # alt-t = 'workspace T' + # alt-u = 'workspace U' + # alt-v = 'workspace V' + # alt-w = 'workspace W' + # alt-x = 'workspace X' + # alt-y = 'workspace Y' + # alt-z = 'workspace Z' + + # See: https://nikitabobko.github.io/AeroSpace/commands#move-node-to-workspace + alt-shift-1 = ['move-node-to-workspace 1', 'workspace 1'] + alt-shift-2 = ['move-node-to-workspace 2', 'workspace 2'] + alt-shift-3 = ['move-node-to-workspace 3', 'workspace 3'] + alt-shift-4 = ['move-node-to-workspace 4', 'workspace 4'] + alt-shift-5 = ['move-node-to-workspace 5', 'workspace 5'] + alt-shift-6 = ['move-node-to-workspace 6', 'workspace 6'] + alt-shift-7 = ['move-node-to-workspace 7', 'workspace 7'] + alt-shift-8 = ['move-node-to-workspace 8', 'workspace 8'] + alt-shift-9 = ['move-node-to-workspace 9', 'workspace 9'] + alt-shift-0 = ['move-node-to-workspace 10', 'workspace 10'] + # alt-shift-a = 'move-node-to-workspace A' + # alt-shift-b = 'move-node-to-workspace B' + # alt-shift-c = 'move-node-to-workspace C' + # alt-shift-d = 'move-node-to-workspace D' + # alt-shift-e = 'move-node-to-workspace E' + # alt-shift-f = 'move-node-to-workspace F' + # alt-shift-g = 'move-node-to-workspace G' + # alt-shift-i = 'move-node-to-workspace I' + # alt-shift-m = 'move-node-to-workspace M' + # alt-shift-n = 'move-node-to-workspace N' + # alt-shift-o = 'move-node-to-workspace O' + # alt-shift-p = 'move-node-to-workspace P' + # alt-shift-q = 'move-node-to-workspace Q' + # alt-shift-r = 'move-node-to-workspace R' + # alt-shift-s = 'move-node-to-workspace S' + # alt-shift-t = 'move-node-to-workspace T' + # alt-shift-u = 'move-node-to-workspace U' + # alt-shift-v = 'move-node-to-workspace V' + # alt-shift-w = 'move-node-to-workspace W' + # alt-shift-x = 'move-node-to-workspace X' + # alt-shift-y = 'move-node-to-workspace Y' + # alt-shift-z = 'move-node-to-workspace Z' + + # See: https://nikitabobko.github.io/AeroSpace/commands#workspace-back-and-forth + alt-tab = 'workspace-back-and-forth' + # See: https://nikitabobko.github.io/AeroSpace/commands#move-workspace-to-monitor + alt-shift-tab = 'move-workspace-to-monitor --wrap-around next' + + # See: https://nikitabobko.github.io/AeroSpace/commands#mode + alt-shift-semicolon = 'mode service' + +# 'service' binding mode declaration. +# See: https://nikitabobko.github.io/AeroSpace/guide#binding-modes +[mode.service.binding] + esc = ['reload-config', 'mode main'] + r = ['flatten-workspace-tree', 'mode main'] # reset layout + f = ['layout floating tiling', 'mode main'] # Toggle between floating and tiling layout + backspace = ['close-all-windows-but-current', 'mode main'] + + # sticky is not yet supported https://github.com/nikitabobko/AeroSpace/issues/2 + #s = ['layout sticky tiling', 'mode main'] + + alt-shift-h = ['join-with left', 'mode main'] + alt-shift-j = ['join-with down', 'mode main'] + alt-shift-k = ['join-with up', 'mode main'] + + alt-shift-l = ['join-with right', 'mode main'] + + down = 'volume down' + up = 'volume up' + shift-down = ['volume set 0', 'mode main'] + +[workspace-to-monitor-force-assignment] +1 = 2 +2 = 2 +3 = 2 +4 = 2 +5 = 2 +6 = 3 +7 = 3 +8 = 3 +9 = 3 +# 9 = 1 +10 = 1 + + +[[on-window-detected]] + if.app-id = 'app.zen-browser.zen' + run = ['move-node-to-workspace 3'] + +[[on-window-detected]] + if.app-id = 'com.hnc.Discord' + run = ['move-node-to-workspace 7'] + +[[on-window-detected]] + if.app-id = 'com.spotify.client' + run = ['move-node-to-workspace 7'] + +[[on-window-detected]] + if.app-id = 'org.zulip.zulip-electron' + run = ['move-node-to-workspace 8'] + +[[on-window-detected]] + if.app-id = 'com.tinyspeck.slackmacgap' + run = ['move-node-to-workspace 8'] + +[[on-window-detected]] + if.app-id = 'com.apple.mail' + run = ['move-node-to-workspace 6'] + +[[on-window-detected]] + if.app-id = 'com.mitchellh.ghostty' + run = ['move-node-to-workspace 2'] + +[[on-window-detected]] + if.window-title-regex-substring = '(?i)emergence' + run = ['move-node-to-workspace 10'] + + +[[on-window-detected]] + if.app-id = 'com.mitchellh.ghostty' + run = ['move-node-to-workspace 2'] + + +[[on-window-detected]] +if.app-id = 'org.mozilla.firefox' +if.window-title-regex-substring = 'Picture-in-Picture' +run = 'layout floating' + + +[[on-window-detected]] +if.app-id = 'app.zen-browser.zen' +if.window-title-regex-substring = 'Picture-in-Picture' +run = ['layout floating'] diff --git a/modules/home/wm/aerospace/default.nix b/modules/home/wm/aerospace/default.nix new file mode 100644 index 0000000..278ac67 --- /dev/null +++ b/modules/home/wm/aerospace/default.nix @@ -0,0 +1,6 @@ +{ pkgs, stdenv, ... }: + +{ + home.file.".aerospace.toml" = + pkgs.lib.mkIf pkgs.stdenv.isDarwin { source = ./aerospace.toml; }; +} diff --git a/modules/home/wm/default.nix b/modules/home/wm/default.nix new file mode 100644 index 0000000..e69de29 diff --git a/modules/home/wm/hyprland/default.nix b/modules/home/wm/hyprland/default.nix new file mode 100644 index 0000000..e69de29 diff --git a/system/boot.nix b/modules/system/boot.nix similarity index 100% rename from system/boot.nix rename to modules/system/boot.nix diff --git a/system/sound.nix b/modules/system/sound.nix similarity index 100% rename from system/sound.nix rename to modules/system/sound.nix diff --git a/users/suri/home.nix b/users/suri/home.nix index a33db47..76c76c1 100644 --- a/users/suri/home.nix +++ b/users/suri/home.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, ... }: let OOS = path: config.lib.file.mkOutOfStoreSymlink path; @@ -6,15 +6,18 @@ let in { # imports = [ ./apps ]; + # + imports = [ - home.packages = [ - - pkgs.fastfetch + ../../modules/home/wm/aerospace + ../../modules/home/prompts/oh-my-posh + ../../modules/home/shells/zsh + ../../modules/home/term/ghostty + ../../modules/home/tools ]; home.file = { - # REMEMBER to lift the config file out, and refacts this after kenric puts his config # on the public internet, study and refactor my dotfiles! "Library/Application Support/com.mitchellh.ghostty".source = -- 2.51.2