From 09f424bf97ab6452ed243e149afb54f5059dbfa4 Mon Sep 17 00:00:00 2001 From: sandptel Date: Tue, 14 Jan 2025 18:42:16 +0530 Subject: [PATCH] lights|tmux|nvim --- config/hypr/UserConfigs/Monitors.conf | 7 +- config/hypr/UserScripts/Lights.sh | 17 ++ config/hypr/UserScripts/WallpaperRandom.sh | 6 +- config/hypr/UserScripts/WallpaperSelect.sh | 4 +- config/hypr/scripts/Refresh.sh | 3 +- config/hypr/scripts/WaybarCava.sh | 7 +- flake.lock | 37 +++ flake.nix | 5 + hosts/default/code.nix | 2 +- hosts/default/home.nix | 2 + hosts/default/nixvim.nix | 338 +-------------------- hosts/default/tmux.nix | 54 ++++ nixos-dots.nix | 2 +- 13 files changed, 142 insertions(+), 342 deletions(-) create mode 100755 config/hypr/UserScripts/Lights.sh create mode 100644 hosts/default/tmux.nix diff --git a/config/hypr/UserConfigs/Monitors.conf b/config/hypr/UserConfigs/Monitors.conf index a911108..febf12b 100644 --- a/config/hypr/UserConfigs/Monitors.conf +++ b/config/hypr/UserConfigs/Monitors.conf @@ -7,19 +7,20 @@ # Monitors monitor= eDP-1,1920x1080@60,0x0,1 -#monitor=HDMI-A-1, 2560x1080@100, 0x-1080, 1 +# monitor=HDMI-A-1, 2560x1080@60, 0x-1080, 1 # NOTE: for laptop, kindly check notes in Laptops.conf regarding display # Created this inorder for the monitor display to not wake up if not intended. # See here: https://github.com/hyprwm/Hyprland/issues/4090 # Some examples #monitor = eDP-1, preferred, auto, 1 -#monitor = eDP-1, 2560x1440@165, 0x0, 1 #own screen +# monitor = eDP-1, 2560x1440@165, 0x0, 1 #own screen #monitor = DP-3, 1920x1080@240, auto, 1 #monitor = DP-1, preferred, auto, 1 #you need this one -# monitor = HDMI-A-1, preferred,0x-1080,1 +monitor = HDMI-A-1, preferred,0x-1080,1 + # QEMU-KVM, virtual box or vmware #monitor = Virtual-1, 1920x1080@60,auto,1 diff --git a/config/hypr/UserScripts/Lights.sh b/config/hypr/UserScripts/Lights.sh new file mode 100755 index 0000000..51a4980 --- /dev/null +++ b/config/hypr/UserScripts/Lights.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# wal_template=$HOME/.config/wal/templates/obsidian.css +wal_cached=$HOME/.cache/wal/colors.json + + +link_template () { + ln -sr $wal_cached $1 +} + +autolit_folder=$HOME/Documents/autolitt + +rm $autolitt_folder/colors.json + +cp $wal_cached $autolit_folder/colors.json +# cp $wal_cached $obsidian_vault/.obsidian/obsidian1.css + diff --git a/config/hypr/UserScripts/WallpaperRandom.sh b/config/hypr/UserScripts/WallpaperRandom.sh index 16ac960..9135176 100755 --- a/config/hypr/UserScripts/WallpaperRandom.sh +++ b/config/hypr/UserScripts/WallpaperRandom.sh @@ -42,8 +42,8 @@ basename "$(basename "$RANDOMPICS")" > "$allwallDIR/current_wallpaper.txt" # Transition config FPS=60 TYPE="any" -DURATION=1.7 -BEZIER=".43,1.19,1,.4" +DURATION=2.4 +BEZIER="0,.95,1,.05" SWWW_PARAMS="--transition-fps $FPS --transition-type $TYPE --transition-duration $DURATION --transition-bezier $BEZIER" # Set the wallpaper @@ -51,6 +51,8 @@ swww query || swww-daemon --format xrgb && swww img "${RANDOMPICS}" $SWWW_PARAMS # Run additional scripts "${scriptsDir}/WallustSwww.sh" +${UserScripts}/Lights.sh +sleep 1.2 "${scriptsDir}/Refresh.sh" exit 0 \ No newline at end of file diff --git a/config/hypr/UserScripts/WallpaperSelect.sh b/config/hypr/UserScripts/WallpaperSelect.sh index 1cb269d..c3e7ab2 100755 --- a/config/hypr/UserScripts/WallpaperSelect.sh +++ b/config/hypr/UserScripts/WallpaperSelect.sh @@ -70,7 +70,7 @@ main() { # Random choice case if [[ "$choice" == "$RANDOM_PIC_NAME" ]]; then - swww img -o "$focused_monitor" "$RANDOM_PIC" $SWWW_PARAMS; + swww img "$RANDOM_PIC" $SWWW_PARAMS; sleep 0.5 "$SCRIPTSDIR/WallustSwww.sh" sleep $RELOAD_DURATION @@ -89,7 +89,7 @@ main() { done if [[ $pic_index -ne -1 ]]; then - swww img -o "$focused_monitor" "${PICS[$pic_index]}" $SWWW_PARAMS + swww img "${PICS[$pic_index]}" $SWWW_PARAMS else echo "Image not found." exit 1 diff --git a/config/hypr/scripts/Refresh.sh b/config/hypr/scripts/Refresh.sh index 799e81f..0e245c9 100755 --- a/config/hypr/scripts/Refresh.sh +++ b/config/hypr/scripts/Refresh.sh @@ -13,7 +13,7 @@ file_exists() { return 1 # File does not exist fi } - +${UserScripts}/Lights.sh # Kill already running processes _ps=(waybar rofi swaync ags) for _prs in "${_ps[@]}"; do @@ -43,7 +43,6 @@ ${SCRIPTSDIR}/WallustSwww.sh pywalfox update # sleep 0.5 - ${UserScripts}/Obsidian.sh # ${UserScripts}/spicetify.sh # Relaunching rainbow borders if the script exists diff --git a/config/hypr/scripts/WaybarCava.sh b/config/hypr/scripts/WaybarCava.sh index 2f8e330..565dfa5 100755 --- a/config/hypr/scripts/WaybarCava.sh +++ b/config/hypr/scripts/WaybarCava.sh @@ -32,7 +32,12 @@ ascii_max_range = 7 EOF # Kill cava if it's already running -pkill -f "cava -p $config_file" +# pkill -f "cava -p $config_file" +# if ( pgrep -cf "cava -p" > hyprctl monitors -j | jq '. | length' ); then +# cava -p "$config_file" | sed -u "$dict" +# printf "Started cava session with config: %s\n" "$CONFIG_FILE" +# fi +pkill -f "cava -p $config_file" # Read stdout from cava and perform substitution in a single sed command cava -p "$config_file" | sed -u "$dict" diff --git a/flake.lock b/flake.lock index 2ca4528..9973ac9 100644 --- a/flake.lock +++ b/flake.lock @@ -687,6 +687,27 @@ "type": "github" } }, + "hyprfocus": { + "inputs": { + "hyprland": [ + "hyprland" + ], + "nix-filter": "nix-filter_2" + }, + "locked": { + "lastModified": 1719058201, + "narHash": "sha256-CQXeRkyS16cC9FXzfTeTmI14NZpySB9mJRksE5PAEAw=", + "owner": "VortexCoyote", + "repo": "hyprfocus", + "rev": "2eef8cfca879ccc8cc83f3dd7ac1dd012b5454ae", + "type": "github" + }, + "original": { + "owner": "VortexCoyote", + "repo": "hyprfocus", + "type": "github" + } + }, "hyprgraphics": { "inputs": { "hyprutils": [ @@ -1050,6 +1071,21 @@ "type": "github" } }, + "nix-filter_2": { + "locked": { + "lastModified": 1694857738, + "narHash": "sha256-bxxNyLHjhu0N8T3REINXQ2ZkJco0ABFPn6PIe2QUfqo=", + "owner": "numtide", + "repo": "nix-filter", + "rev": "41fd48e00c22b4ced525af521ead8792402de0ea", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nix-filter", + "type": "github" + } + }, "nix-gaming": { "inputs": { "flake-parts": "flake-parts", @@ -1482,6 +1518,7 @@ "home-manager": "home-manager_2", "hypr-dynamic-cursors": "hypr-dynamic-cursors", "hyprchroma": "hyprchroma", + "hyprfocus": "hyprfocus", "hyprland": "hyprland", "hyprland-plugins": "hyprland-plugins", "hyprpanel": "hyprpanel", diff --git a/flake.nix b/flake.nix index 10f6fdd..989e71f 100644 --- a/flake.nix +++ b/flake.nix @@ -8,6 +8,7 @@ }; nix-gaming.url = "github:fufexan/nix-gaming"; # hellwal.url = "github:sandptel/hellwal"; + nixvim = { url = "github:nix-community/nixvim/"; inputs.nixpkgs.follows = "nixpkgs"; @@ -28,6 +29,10 @@ url = "github:alexhulbert/Hyprchroma"; inputs.hyprland.follows = "hyprland"; }; + hyprfocus = { + url = "github:VortexCoyote/hyprfocus"; + inputs.hyprland.follows = "hyprland"; + }; hyprpanel = { url = "github:Jas-SinghFSU/HyprPanel"; # inputs.nixpkgs.follows = "nixpkgs"; diff --git a/hosts/default/code.nix b/hosts/default/code.nix index 92fb296..0d1c429 100644 --- a/hosts/default/code.nix +++ b/hosts/default/code.nix @@ -24,7 +24,7 @@ environment.systemPackages = cargo # vim git - tmux + # tmux pkg-config # github-desktop #vscode diff --git a/hosts/default/home.nix b/hosts/default/home.nix index 5bed5d8..4b61983 100644 --- a/hosts/default/home.nix +++ b/hosts/default/home.nix @@ -8,6 +8,8 @@ inputs.hyprland.homeManagerModules.default ./matugen.nix ./spicetify.nix + ./tmux.nix + # ./nixvim.nix # inputs.hellwal.homeManagerModules.default # inputs.matugen.homeManagerModules.default ]; diff --git a/hosts/default/nixvim.nix b/hosts/default/nixvim.nix index 3d7e8e2..0d3d246 100644 --- a/hosts/default/nixvim.nix +++ b/hosts/default/nixvim.nix @@ -1,331 +1,9 @@ {pkgs, ...}: { - config = { - extraPackages = with pkgs; [ - black - alejandra - codespell - ormolu - ghc - gcc - fd - ]; - opts = { - updatetime = 100; - number = true; - relativenumber = true; - smartcase = true; - list = true; - foldmethod = "expr"; - foldexpr = "nvim_treesitter#foldexpr()"; - foldenable = true; - foldlevel = 99; - scrolloff = 15; - signcolumn = "yes"; - fo = "cqj"; - - textwidth = 80; - # This means it'll show the colorcolumn at the textwidth - colorcolumn = "+0"; - - # show spaces and stuff - listchars = "tab:▸ ,trail:·,nbsp:␣"; - }; - globals = { - mapleader = " "; - }; - extraConfigLua = - # lua - '' - -- Make lsp popups pretty - local _border = "rounded" - - vim.lsp.handlers["textDocument/hover"] = vim.lsp.with( - vim.lsp.handlers.hover, { - border = _border - } - ) - - vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with( - vim.lsp.handlers.signature_help, { - border = _border - } - ) - - vim.diagnostic.config{ - float={border=_border} - }; - - require('lspconfig.ui.windows').default_options = { - border = _border - } - - -- This fixes luasnip. - package.preload["jsregexp"] = package.loadlib("${pkgs.lua51Packages.jsregexp}/lib/lua/5.1/jsregexp/core.so", "luaopen_jsregexp_core"); - ''; - package = pkgs.neovim-unwrapped; - enableMan = true; - clipboard.register = "unnamedplus"; - # colorscheme = "catppuccin"; - # colorschemes.catppuccin = { - # enable = true; - # settings = { - # flavour = "mocha"; - # transparent_background = true; - # }; - # }; - plugins = { - treesitter = { - enable = true; - # settings = { - # ensure_installed = [ - # "all" - # ]; - # }; - nixvimInjections = true; - }; - web-devicons.enable = true; - lsp = { - enable = true; - servers = { - #nix - nixd.enable = true; - - #python - pyright.enable = true; - ruff.enable = true; - - #bash - bashls.enable = true; - - #lua - lua_ls.enable = true; - - #filesystem - fsautocomplete.enable = true; - }; - keymaps.lspBuf = { - "gd" = "definition"; - "gD" = "references"; - "gi" = "implementation"; - "K" = "hover"; - }; - }; - nix.enable = true; - comment.enable = true; - telescope.enable = true; - intellitab.enable = true; - indent-o-matic.enable = true; - - # Make it pretty - dressing.enable = true; - indent-blankline.enable = true; - nvim-colorizer.enable = true; - lualine.enable = true; - lspkind = { - enable = true; - symbolMap = {Codeium = "󰚩";}; - }; - - neocord.enable = true; - - cursorline.enable = true; - - # Make it usable - gitsigns = { - enable = true; - settings = { - current_line_blame = true; - }; - }; - - hop = { - enable = true; - settings = { - keys = "srtnyeiafg"; - }; - }; - - conform-nvim = { - enable = true; - settings = { - lsp_fallback = true; - formatters_by_ft = { - # Conform will run multiple formatters sequentially - python = ["black"]; - - nix = ["alejandra"]; - - # Use the "*" filetype to run formatters on all filetypes. - #"*" = ["codespell"]; - # Use the "_" filetype to run formatters on filetypes that don't - # have other formatters configured. - "_" = ["trim_whitespace"]; - }; - }; - }; - - luasnip = { - enable = true; - settings = { - enable_autosnippets = true; - }; - fromVscode = [ - { - lazyLoad = true; - paths = "${pkgs.vimPlugins.friendly-snippets}"; - } - ]; - }; - - which-key = { - enable = true; - }; - - vim-surround.enable = true; - nvim-autopairs.enable = true; - rainbow-delimiters.enable = true; - - oil = { - enable = true; - settings.defaultFileExplorer = true; - }; - - cmp = { - enable = true; - autoEnableSources = true; - settings = { - experimental = {ghost_text = true;}; - snippet = {expand = "luasnip";}; - sources = [ - {name = "nvim_lsp";} - {name = "luasnip";} - {name = "path";} - ]; - mapping = { - "" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})"; - "" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})"; - "" = "cmp.mapping.select_next_item()"; - "" = "cmp.mapping.select_prev_item()"; - "" = "cmp.mapping.abort()"; - "" = "cmp.mapping.scroll_docs(-4)"; - "" = "cmp.mapping.scroll_docs(4)"; - "" = "cmp.mapping.complete()"; - "" = "cmp.mapping.confirm({ select = false })"; - "" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })"; - }; - }; - }; - - # cmp-ai.settings = { - # enable = true; - # provider = "Ollama"; - # provider_options = { - # model = "codellama:7b"; - # }; - # max_lines = 50; - # notify = true; - # run_on_every_keystroke = true; - # }; - }; - - keymaps = [ - # Oil - { - action = "Oil ."; - key = "f"; - options.desc = "Open file explorer"; - } - # Telescope - { - action = "Telescope find_files"; - key = "tf"; - options.desc = "Find files"; - } - { - action = "Telescope buffers"; - key = "to"; - options.desc = "Pick open buffers"; - } - { - action = "Telescope live_grep"; - key = "tt"; - options.desc = "Find text in project"; - } - # LSP - { - action = "lua vim.lsp.buf.code_action()"; - key = "lc"; - options.desc = "Code actions"; - } - { - action = "lua vim.lsp.buf.rename()"; - key = "lr"; - options.desc = "Rename"; - } - { - action = "lua vim.diagnostic.open_float()"; - key = "lf"; - options.desc = "Open diagnostic"; - } - # Other - { - mode = "n"; - action = "nohlsearch"; - key = ""; - } - { - mode = "n"; - action = "HopWord"; - key = ""; - } - { - mode = "n"; - action = "HopPattern"; - key = "/"; - } - { - mode = "n"; - action = "HopYankChar1"; - key = "y"; - } - { - mode = "n"; - action = "b#"; - key = "b"; - } - # LuaSnip - { - mode = ["n" "i" "s"]; - action = "lua require('luasnip').jump(-1)"; - key = ""; - } - { - mode = ["n" "i" "s"]; - action = "lua require('luasnip').jump(1)"; - key = ""; - } - ]; - - # autoCmd = [ - # { - # event = ["BufWritePre"]; - # command = "lua require(\"conform\").format()"; - # } - # { - # event = ["BufRead" "BufNewFile"]; - # pattern = ["*/diary/*.txt"]; - # command = "source notes.vim"; - # } - # { - # event = ["BufWritePre"]; - # pattern = ["*/diary/*.txt"]; - # command = "helptags ./"; - # } - # { - # event = ["BufReadPost"]; - # pattern = ["*/diary/*.txt"]; - # command = "normal!'\""; - # } - # ]; - }; -} \ No newline at end of file +programs.neovim = { + enable = true; + plugins = [{ +plugin = pkgs.vimPlugins.pywal-nvim; +type = "lua"; + }]; +} +}; diff --git a/hosts/default/tmux.nix b/hosts/default/tmux.nix new file mode 100644 index 0000000..ccda750 --- /dev/null +++ b/hosts/default/tmux.nix @@ -0,0 +1,54 @@ +{ pkgs, config, ... }: +{ + programs.tmux = { + enable = true; + shortcut = "a"; + # aggressiveResize = true; -- Disabled to be iTerm-friendly + baseIndex = 1; + newSession = true; + # Stop tmux+escape craziness. + escapeTime = 0; + # Force tmux to use /tmp for sockets (WSL2 compat) + secureSocket = false; + + plugins = with pkgs; [ + tmuxPlugins.better-mouse-mode + ]; + + extraConfig = '' + # https://old.reddit.com/r/tmux/comments/mesrci/tmux_2_doesnt_seem_to_use_256_colors/ + set -g default-terminal "xterm-256color" + set -ga terminal-overrides ",*256col*:Tc" + set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q' + set-environment -g COLORTERM "truecolor" + + # Mouse works as expected + set-option -g mouse on + # easy-to-remember split pane commands + bind | split-window -h -c "#{pane_current_path}" + bind - split-window -v -c "#{pane_current_path}" + bind c new-window -c "#{pane_current_path}" + ''; + }; + + programs.tmate = { + enable = true; + # FIXME: This causes tmate to hang. + # extraConfig = config.xdg.configFile."tmux/tmux.conf".text; + }; + + home.packages = [ + # Open tmux for current project. + (pkgs.writeShellApplication { + name = "pux"; + runtimeInputs = [ pkgs.tmux ]; + text = '' + PRJ="''$(zoxide query -i)" + echo "Launching tmux for ''$PRJ" + set -x + cd "''$PRJ" && \ + exec tmux -S "''$PRJ".tmux attach + ''; + }) + ]; +} \ No newline at end of file diff --git a/nixos-dots.nix b/nixos-dots.nix index 00c5f27..be9bef8 100644 --- a/nixos-dots.nix +++ b/nixos-dots.nix @@ -208,4 +208,4 @@ home.file.".config/spicetify/config-xpui.ini".source = config.lib.file.mkOutOfSt # # executable = true; # }; }; -} +} \ No newline at end of file