From c86e6c6d5e138b86a83eab60f1f4c9e804246d77 Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Sat, 19 Aug 2023 22:13:34 +0300 Subject: [PATCH] Configured anyrun --- dotfiles/neovim/lazy-lock.json | 1 + dotfiles/neovim/lua/my/plugins/lspconfig.lua | 11 ++- dotfiles/neovim/lua/my/plugins/treesitter.lua | 9 +- flake.lock | 88 ++++++++++++++--- flake.nix | 9 +- home/features/desktop/zathura.nix | 94 +++++++++++++++---- home/features/wayland/anyrun/default.nix | 32 ++++++- home/features/wayland/hyprland/hyprland.conf | 6 +- home/features/wayland/wofi/wofi.css | 12 +-- 9 files changed, 209 insertions(+), 53 deletions(-) diff --git a/dotfiles/neovim/lazy-lock.json b/dotfiles/neovim/lazy-lock.json index e58483a..52627b3 100644 --- a/dotfiles/neovim/lazy-lock.json +++ b/dotfiles/neovim/lazy-lock.json @@ -48,6 +48,7 @@ "nvim-lspconfig": { "branch": "master", "commit": "a981d4447b92c54a4d464eb1a76b799bc3f9a771" }, "nvim-tree.lua": { "branch": "master", "commit": "18c7a3119839adc4599d838726deae662859c8b2" }, "nvim-treesitter": { "branch": "master", "commit": "93ee00cd9daf8d2e3fbaa2a18b8b9adcb4471b16" }, + "nvim-treesitter-context": { "branch": "master", "commit": "a17c31268b56d53624fdc9cb03a225d4a17cabdb" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "9e519b6146512c8e2e702faf8ac48420f4f5deec" }, "nvim-web-devicons": { "branch": "master", "commit": "ab899311f8ae00a47eae8e0879506cead8eb1561" }, "nvim_context_vt": { "branch": "master", "commit": "f44f46ecad6e6983fd04dac84c5a5c03815d3427" }, diff --git a/dotfiles/neovim/lua/my/plugins/lspconfig.lua b/dotfiles/neovim/lua/my/plugins/lspconfig.lua index 61a4c78..5ed97b8 100644 --- a/dotfiles/neovim/lua/my/plugins/lspconfig.lua +++ b/dotfiles/neovim/lua/my/plugins/lspconfig.lua @@ -44,11 +44,11 @@ function M.on_attach(client, bufnr) if client.supports_method("textDocument/formatting") then nmap("F", format, "[F]ormat") - -- vim.api.nvim_create_autocmd("BufWritePre", { - -- group = vim.api.nvim_create_augroup("LspFormatting", { clear = false }), - -- buffer = bufnr, - -- callback = format, - -- }) + vim.api.nvim_create_autocmd("BufWritePre", { + group = vim.api.nvim_create_augroup("LspFormatting", { clear = false }), + buffer = bufnr, + callback = format, + }) end -- }}} -- {{{ Go to declaration / references / implementation @@ -178,6 +178,7 @@ local servers = { jsonls = {}, dhall_lsp_server = {}, typst_lsp = {}, + elmls = {}, -- {{{ Inactive -- pylsp = {}, -- pyright = {}, diff --git a/dotfiles/neovim/lua/my/plugins/treesitter.lua b/dotfiles/neovim/lua/my/plugins/treesitter.lua index 509cf9f..f02d480 100644 --- a/dotfiles/neovim/lua/my/plugins/treesitter.lua +++ b/dotfiles/neovim/lua/my/plugins/treesitter.lua @@ -33,7 +33,7 @@ local M = { "vim", "yaml", "nix", - "lua" + "lua", }, sync_install = false, --}}} @@ -91,6 +91,13 @@ local M = { event = "BufReadPost", cond = env.vscode.not_active(), }, + { + -- show context at top of file + "nvim-treesitter/nvim-treesitter-context", + event = "BufReadPost", + cond = env.vscode.not_active(), + opts = { enable = true }, + }, } return M diff --git a/flake.lock b/flake.lock index 22903ab..066f1e0 100644 --- a/flake.lock +++ b/flake.lock @@ -43,6 +43,27 @@ "type": "github" } }, + "anyrun-nixos-options": { + "inputs": { + "flake-parts": "flake-parts_2", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1691142041, + "narHash": "sha256-ik4CHY1xck8je6IKPB3w8rGq1uO9TYDFczTyMXdbB4k=", + "owner": "n3oney", + "repo": "anyrun-nixos-options", + "rev": "a4ba8f84f6b5c5771bc0f30dc0f4241d39b43208", + "type": "github" + }, + "original": { + "owner": "n3oney", + "repo": "anyrun-nixos-options", + "type": "github" + } + }, "base16": { "inputs": { "fromYaml": "fromYaml" @@ -249,6 +270,24 @@ } }, "flake-parts_2": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1690933134, + "narHash": "sha256-ab989mN63fQZBFrkk4Q8bYxQCktuHmBIBqUG1jl6/FQ=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "59cf3f1447cfc75087e7273b04b31e689a8599fb", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_3": { "inputs": { "nixpkgs-lib": [ "neovim-nightly-overlay", @@ -269,9 +308,9 @@ "type": "github" } }, - "flake-parts_3": { + "flake-parts_4": { "inputs": { - "nixpkgs-lib": "nixpkgs-lib" + "nixpkgs-lib": "nixpkgs-lib_2" }, "locked": { "lastModified": 1685662779, @@ -286,7 +325,7 @@ "type": "indirect" } }, - "flake-parts_4": { + "flake-parts_5": { "inputs": { "nixpkgs-lib": [ "neovim-nightly-overlay", @@ -309,9 +348,9 @@ "type": "github" } }, - "flake-parts_5": { + "flake-parts_6": { "inputs": { - "nixpkgs-lib": "nixpkgs-lib_2" + "nixpkgs-lib": "nixpkgs-lib_3" }, "locked": { "lastModified": 1685662779, @@ -327,7 +366,7 @@ "type": "github" } }, - "flake-parts_6": { + "flake-parts_7": { "inputs": { "nixpkgs-lib": [ "nixpkgs-wayland", @@ -472,7 +511,7 @@ }, "hercules-ci-agent": { "inputs": { - "flake-parts": "flake-parts_4", + "flake-parts": "flake-parts_5", "haskell-flake": "haskell-flake", "nixpkgs": "nixpkgs" }, @@ -491,7 +530,7 @@ }, "hercules-ci-effects": { "inputs": { - "flake-parts": "flake-parts_3", + "flake-parts": "flake-parts_4", "hercules-ci-agent": "hercules-ci-agent", "nixpkgs": [ "neovim-nightly-overlay", @@ -661,7 +700,7 @@ "lib-aggregate": { "inputs": { "flake-utils": "flake-utils_3", - "nixpkgs-lib": "nixpkgs-lib_3" + "nixpkgs-lib": "nixpkgs-lib_4" }, "locked": { "lastModified": 1686485342, @@ -704,7 +743,7 @@ "neovim-nightly-overlay": { "inputs": { "flake-compat": "flake-compat_2", - "flake-parts": "flake-parts_2", + "flake-parts": "flake-parts_3", "hercules-ci-effects": "hercules-ci-effects", "neovim-flake": "neovim-flake", "nixpkgs": [ @@ -727,7 +766,7 @@ }, "nix-eval-jobs": { "inputs": { - "flake-parts": "flake-parts_6", + "flake-parts": "flake-parts_7", "nixpkgs": "nixpkgs_4" }, "locked": { @@ -746,7 +785,7 @@ }, "nixd": { "inputs": { - "flake-parts": "flake-parts_5", + "flake-parts": "flake-parts_6", "nixpkgs": "nixpkgs_2" }, "locked": { @@ -818,11 +857,11 @@ "nixpkgs-lib": { "locked": { "dir": "lib", - "lastModified": 1685564631, - "narHash": "sha256-8ywr3AkblY4++3lIVxmrWZFzac7+f32ZEhH/A8pNscI=", + "lastModified": 1690881714, + "narHash": "sha256-h/nXluEqdiQHs1oSgkOOWF+j8gcJMWhwnZ9PFabN6q0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "4f53efe34b3a8877ac923b9350c874e3dcd5dc0a", + "rev": "9e1960bc196baf6881340d53dccb203a951745a2", "type": "github" }, "original": { @@ -852,6 +891,24 @@ } }, "nixpkgs-lib_3": { + "locked": { + "dir": "lib", + "lastModified": 1685564631, + "narHash": "sha256-8ywr3AkblY4++3lIVxmrWZFzac7+f32ZEhH/A8pNscI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4f53efe34b3a8877ac923b9350c874e3dcd5dc0a", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib_4": { "locked": { "lastModified": 1686445117, "narHash": "sha256-QfbAtKFmh92rv0j1e9d7EDgPLDERn1EY6FGXwKG09SM=", @@ -972,6 +1029,7 @@ "inputs": { "agenix": "agenix", "anyrun": "anyrun", + "anyrun-nixos-options": "anyrun-nixos-options", "catppuccin-base16": "catppuccin-base16", "deploy-rs": "deploy-rs", "disko": "disko", diff --git a/flake.nix b/flake.nix index 9f5563c..68e6a2a 100644 --- a/flake.nix +++ b/flake.nix @@ -93,6 +93,10 @@ anyrun.url = "github:Kirottu/anyrun"; anyrun.inputs.nixpkgs.follows = "nixpkgs"; + # Anyrun nixos options + anyrun-nixos-options.url = "github:n3oney/anyrun-nixos-options"; + anyrun-nixos-options.inputs.nixpkgs.follows = "nixpkgs"; + # Nixos hardware nixos-hardware.url = "github:NixOS/nixos-hardware/master"; }; @@ -151,7 +155,7 @@ # Available through 'nixos-rebuild --flake .#... nixosConfigurations = let nixos = { system, hostname, user }: nixpkgs.lib.nixosSystem { - system = system; + inherit system; specialArgs = specialArgs system; modules = [ @@ -160,8 +164,10 @@ home-manager.users.${user} = import ./home/${hostname}.nix; home-manager.extraSpecialArgs = specialArgs system; home-manager.useUserPackages = true; + stylix.homeManagerIntegration.followSystem = false; stylix.homeManagerIntegration.autoImport = false; + _module.args.nixinate = { host = hostname; sshUser = "adrielus"; @@ -204,6 +210,7 @@ let mkHomeConfig = { system, hostname }: home-manager.lib.homeManagerConfiguration { + inherit system; pkgs = nixpkgs.legacyPackages.${system}; extraSpecialArgs = specialArgs system; modules = [ diff --git a/home/features/desktop/zathura.nix b/home/features/desktop/zathura.nix index d8586fd..489b39b 100644 --- a/home/features/desktop/zathura.nix +++ b/home/features/desktop/zathura.nix @@ -1,29 +1,87 @@ -{ config, pkgs, ... }: -let base16-zathura = config.lib.stylix.colors { - templateRepo = pkgs.fetchFromGitHub { - owner = "doenerkebap"; - repo = "base16-zathura"; - sha256 = "1zcrzll13d4lmyzibwdqkkdssyhr3c9s4yxhqigg3azsizk8adb4"; - rev = "2caef8fff6a5412e05950c6105c5020a6f16ead2"; - }; - - # REASON: fails otherwise :/ - # See [the troubleshooting section](https://github.com/SenchoPens/base16.nix/tree/main#%EF%B8%8F-troubleshooting). - check-parsed-config-yaml = false; -}; -in +{ config, ... }: { programs.zathura = { enable = true; - extraConfig = '' - # Generated theme - include ${base16-zathura} - + extraConfig = with config.lib.stylix.scheme.withHashtag; '' + # {{{ Some arbitrary settings # Open document in fit-width mode by default set adjust-open "best-fit" # Inject font set font "${config.stylix.fonts.sansSerif.name}" + # }}} + # {{{ Default foreground/background color + set default-bg rgba(${config.satellite.theming.colors.rgba "base00"}) + set default-fg ${base05} + # }}} + # {{{ Recolor + set recolor 'true' # Allow recolor + set recolor-keephue 'false' # Don't allow original hue when recoloring + set recolor-reverse-video 'true' # Keep original image colors while recoloring + + # Represent light/dark colors in recoloring mode + set recolor-lightcolor rgba(0,0,0,0) + set recolor-darkcolor '${base05}' + # }}} + # {{{ Completion + # Command line completion entries + set completion-fg '${base05}' + set completion-bg '${base00}' + + # Command line completion group elements + set completion-group-fg '${base02}' + set completion-group-bg '${base00}' + + # Current command line completion element + set completion-highlight-fg '${base00}' + set completion-highlight-bg '${base05}' + # }}} + # {{{ Input bar + set inputbar-fg '${base05}' + set inputbar-bg '${base00}' + # }}} + # {{{ Notifications + set notification-fg '${base05}' + set notification-bg '${base00}' + + # Error notification + set notification-error-fg '${base08}' + set notification-error-bg '${base01}' + + # Warning notification + set notification-warning-fg '${base0A}' + set notification-warning-bg '${base01}' + # }}} + # {{{ TODO: tabs + # Tab + # set tabbar-fg + # set tabbar-bg + + # Focused tab + # set tabbar-focus-fg + # set tabbar-focus-bg + # }}} + # {{{ Status bar + set statusbar-fg '${base05}' + set statusbar-bg '${base00}' + # }}} + # {{{ Highlighting parts of the document (e.g. show search results) + # TODO: make sure these look fine on other schemes + set highlight-color '${base03}' + set highlight-active-color '${base06}' + # }}} + # {{{ 'Loading...' text + set render-loading-fg '${base05}' + set render-loading-bg '${base00}' + # }}} + # {{{ Index mode + set index-fg '${base05}' + set index-bg 'rgba(0,0,0.0)' + + # Selected element in index mode + set index-active-fg '${base07}' + set index-active-bg '${base03}' + # }}} ''; }; } diff --git a/home/features/wayland/anyrun/default.nix b/home/features/wayland/anyrun/default.nix index 09ae7a2..ab944ca 100644 --- a/home/features/wayland/anyrun/default.nix +++ b/home/features/wayland/anyrun/default.nix @@ -2,17 +2,41 @@ programs.anyrun = { enable = true; config = { + # {{{ Plugins plugins = with inputs.anyrun.packages.${pkgs.system}; [ applications dictionary rink stdin - symbols - websearch + # symbols # Looks ugly atm + # websearch + # inputs.anyrun-nixos-options.packages.${pkgs.system}.default # Idk how to set this up :( ]; - + # }}} + # {{{ Geometry + x.fraction = 0.5; + y.fraction = 0.25; width.fraction = 0.5; - height.fraction = 0.6; + # }}} + + hidePluginInfo = true; + closeOnClick = true; + showResultsImmediately = true; + maxEntries = 7; }; + + extraCss = null; }; + + # # See [the readme](https://github.com/n3oney/anyrun-nixos-options) for anyrun-nixos-options. + # programs.anyrun.extraConfigFiles."nixos-options.ron".text = '' + # Config( + # options_path: "${config.system.build.manual.optionsJSON}/share/doc/nixos/options.json" + # ) + # ''; + + # home.packages = + # let anyrunScript = name: plugin: pkgs.writeShellScriptBin "anyrun-${plugin}"; + # in + # [ (anyrunScript "launch" "applications") ]; } diff --git a/home/features/wayland/hyprland/hyprland.conf b/home/features/wayland/hyprland/hyprland.conf index 1165d7c..93159ad 100644 --- a/home/features/wayland/hyprland/hyprland.conf +++ b/home/features/wayland/hyprland/hyprland.conf @@ -27,8 +27,8 @@ decoration { # Blur extra surfaces layerrule = blur,gtk-layer-shell -layerrule = blur,wofi -layerrule = ignorezero,wofi +layerrule = blur,anyrun +layerrule = ignorezero,anyrun input { kb_layout = us @@ -84,7 +84,7 @@ bind = $mod, T, exec, wl-ocr # Use ocr script bind = $mod SHIFT, T, exec, hyprpicker | wl-copy && libnotify "Copied color $(wp-paste)" # Color picker bind = $mod, Q, exec, wlogout # Show logout menu bind = $mod, L, exec, loginctl lock-session # Lock screen -bind = $mod, P, exec, wofi --show drun # Launch app +bind = $mod, P, exec, anyrun bind = $mod, B, exec, wlsunset-toggle # Toggle blue light filter thingy bind = $mod, V, exec, wezterm start vimclip # Vim anywhere! diff --git a/home/features/wayland/wofi/wofi.css b/home/features/wayland/wofi/wofi.css index 2d6803d..c79ba72 100644 --- a/home/features/wayland/wofi/wofi.css +++ b/home/features/wayland/wofi/wofi.css @@ -1,6 +1,6 @@ /* Styling guide: https://cloudninja.pw/docs/wofi.html */ window { - background:none; + background: none; } #outer-box { @@ -15,7 +15,7 @@ window { padding: 1rem; font-size: 2em; border-radius: 8px; - box-shadow: .5px .5px 1.5px 1.5px rgba(0, 0, 0, .5); + box-shadow: 0.5px 0.5px 1.5px 1.5px rgba(0, 0, 0, 0.5); /* background: none; */ background-color: rgba(256, 256, 256, 0.6); } @@ -23,7 +23,7 @@ window { #scroll { margin: 1rem; border-radius: 8px; - box-shadow: .5px .5px 1.5px 1.5px rgba(0, 0, 0, .5); + box-shadow: 0.5px 0.5px 1.5px 1.5px rgba(0, 0, 0, 0.5); /* background: none; */ background-color: rgba(256, 256, 256, 0.6); } @@ -36,19 +36,19 @@ window { } #text { - margin: .5rem; + margin: 0.5rem; font-size: 1.5em; } #img { - margin-left: .5rem; + margin-left: 0.5rem; } #entry:selected { outline: none; color: #4c4f69; background: rgba(188, 192, 204, 0.2); - box-shadow: .5px .5px 1.5px 1.5px rgba(0, 0, 0, .5); + box-shadow: 0.5px 0.5px 1.5px 1.5px rgba(0, 0, 0, 0.5); } #text:selected {