changes :3
This commit is contained in:
parent
c50bfc3eea
commit
0ad695abcf
27 changed files with 1022 additions and 656 deletions
|
|
@ -1,5 +1,5 @@
|
|||
* {
|
||||
font-family: Iosevka Nerd Font, monospace;
|
||||
font-family: monospace;
|
||||
min-height: 14px;
|
||||
font-size: 14px;
|
||||
border: none;
|
||||
|
|
|
|||
|
|
@ -95,9 +95,18 @@ in {
|
|||
font = {
|
||||
size = 16.0;
|
||||
normal = fonts.mono;
|
||||
bold = "${fonts.mono} Bold";
|
||||
italic = "${fonts.mono} Italic";
|
||||
bold_italic = "${fonts.mono} Bold Italic";
|
||||
bold = {
|
||||
family = fonts.mono;
|
||||
style = "Bold";
|
||||
};
|
||||
italic = {
|
||||
family = fonts.mono;
|
||||
style = "Italic";
|
||||
};
|
||||
bold_italic = {
|
||||
family = fonts.mono;
|
||||
style = "Bold Italic";
|
||||
};
|
||||
|
||||
offset = {
|
||||
x = 0;
|
||||
|
|
|
|||
|
|
@ -23,13 +23,11 @@ in {
|
|||
|
||||
background = colors.crust.hex;
|
||||
|
||||
alpha-blending = "linear-corrected";
|
||||
|
||||
window-padding-x = 20;
|
||||
window-padding-y = 20;
|
||||
window-padding-balance = true;
|
||||
font-style = "SemiBold";
|
||||
font-style-bold = "Bold";
|
||||
font-style-italic = "SemiBold Italic";
|
||||
font-style-bold-italic = "Bold Italic";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -17,24 +17,28 @@ in {
|
|||
programs.kitty = {
|
||||
enable = true;
|
||||
font = {
|
||||
name = fonts.mono;
|
||||
name = "${fonts.mono} SemiLight";
|
||||
size = 16;
|
||||
};
|
||||
|
||||
extraConfig = ''
|
||||
bold_font ${fonts.mono} Bold
|
||||
italic_font ${fonts.mono} Italic
|
||||
bold_italic_font ${fonts.mono} Bold Italic
|
||||
bold_font ${fonts.mono} SemiBold
|
||||
italic_font ${fonts.mono} SemiLight
|
||||
bold_italic_font ${fonts.mono} SemiBold
|
||||
'';
|
||||
|
||||
catppuccin.enable = true;
|
||||
|
||||
settings = {
|
||||
window_padding_width = 20;
|
||||
# background_opacity = "0.9";
|
||||
background_opacity = "0.9";
|
||||
background = colors.crust.hex;
|
||||
foreground = colors.text.hex;
|
||||
|
||||
font_hinting = "slight";
|
||||
|
||||
text_composition_strategy = "1.2 10";
|
||||
|
||||
# Normal colors
|
||||
color0 = colors.surface1.hex; # black
|
||||
color1 = colors.red.hex; # red
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ end
|
|||
|
||||
-- in this case.
|
||||
vim.g.lazyvim_blink_main = true
|
||||
|
||||
vim.g.snacks_animate = false
|
||||
vim.o.termguicolors = true
|
||||
|
||||
vim.g.lazyvim_python_lsp = "basedpyright"
|
||||
vim.g.lazyvim_python_lsp = "pyright"
|
||||
|
|
|
|||
|
|
@ -8,47 +8,50 @@ return {
|
|||
},
|
||||
{
|
||||
"catppuccin",
|
||||
config = function()
|
||||
require("catppuccin").setup({
|
||||
transparent_background = false,
|
||||
integrations = {
|
||||
blink_cmp = true,
|
||||
nvimtree = true,
|
||||
},
|
||||
custom_highlights = function(colors)
|
||||
return {
|
||||
Normal = { bg = colors.crust },
|
||||
NormalFloat = { bg = colors.crust },
|
||||
|
||||
-- Completion menu (nvim-cmp)
|
||||
Pmenu = { bg = colors.crust },
|
||||
PmenuSel = { bg = colors.surface0 },
|
||||
CmpItemAbbr = { bg = colors.crust },
|
||||
CmpItemAbbrMatch = { bg = colors.crust },
|
||||
|
||||
-- Tabs
|
||||
TabLine = { bg = colors.crust },
|
||||
TabLineFill = { bg = colors.crust },
|
||||
TabLineSel = { bg = colors.crust },
|
||||
|
||||
-- Status line
|
||||
StatusLine = { bg = colors.crust },
|
||||
StatusLineNC = { bg = colors.crust },
|
||||
|
||||
-- Line numbers
|
||||
LineNr = { bg = colors.crust },
|
||||
SignColumn = { bg = colors.crust },
|
||||
}
|
||||
end,
|
||||
color_overrides = {
|
||||
mocha = {
|
||||
base = "#11111b",
|
||||
mantle = "#11111b",
|
||||
crust = "#11111b",
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
opts = {
|
||||
transparent_background = true,
|
||||
},
|
||||
-- config = function()
|
||||
-- require("catppuccin").setup({
|
||||
-- transparent_background = true,
|
||||
-- integrations = {
|
||||
-- blink_cmp = true,
|
||||
-- nvimtree = true,
|
||||
-- },
|
||||
-- custom_highlights = function(colors)
|
||||
-- return {
|
||||
-- Normal = { bg = colors.crust },
|
||||
-- NormalFloat = { bg = colors.crust },
|
||||
--
|
||||
-- -- Completion menu (nvim-cmp)
|
||||
-- Pmenu = { bg = colors.crust },
|
||||
-- PmenuSel = { bg = colors.surface0 },
|
||||
-- CmpItemAbbr = { bg = colors.crust },
|
||||
-- CmpItemAbbrMatch = { bg = colors.crust },
|
||||
--
|
||||
-- -- Tabs
|
||||
-- TabLine = { bg = colors.crust },
|
||||
-- TabLineFill = { bg = colors.crust },
|
||||
-- TabLineSel = { bg = colors.crust },
|
||||
--
|
||||
-- -- Status line
|
||||
-- StatusLine = { bg = colors.crust },
|
||||
-- StatusLineNC = { bg = colors.crust },
|
||||
--
|
||||
-- -- Line numbers
|
||||
-- LineNr = { bg = colors.crust },
|
||||
-- SignColumn = { bg = colors.crust },
|
||||
-- }
|
||||
-- end,
|
||||
-- color_overrides = {
|
||||
-- mocha = {
|
||||
-- base = "#11111b",
|
||||
-- mantle = "#11111b",
|
||||
-- crust = "#11111b",
|
||||
-- },
|
||||
-- },
|
||||
-- })
|
||||
-- end,
|
||||
},
|
||||
"f-person/git-blame.nvim",
|
||||
{
|
||||
|
|
@ -83,12 +86,12 @@ return {
|
|||
{ "<c-\\>", "<cmd><C-U>TmuxNavigatePrevious<cr>" },
|
||||
},
|
||||
},
|
||||
{
|
||||
"m4xshen/hardtime.nvim",
|
||||
lazy = false,
|
||||
dependencies = { "MunifTanjim/nui.nvim" },
|
||||
opts = {},
|
||||
},
|
||||
-- {
|
||||
-- "m4xshen/hardtime.nvim",
|
||||
-- lazy = false,
|
||||
-- dependencies = { "MunifTanjim/nui.nvim" },
|
||||
-- opts = {},
|
||||
-- },
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
---@class PluginLspOpts
|
||||
|
|
@ -99,6 +102,9 @@ return {
|
|||
filetypes = { "html", "jinja" },
|
||||
},
|
||||
somesass_ls = {},
|
||||
qmlls = {
|
||||
cmd = { "qmlls", "-E" },
|
||||
},
|
||||
slangd = {
|
||||
settings = {
|
||||
slangd = {
|
||||
|
|
|
|||
|
|
@ -1,193 +0,0 @@
|
|||
-- since this is just an example spec, don't actually load anything here and return an empty spec
|
||||
-- stylua: ignore
|
||||
if true then return {} end
|
||||
|
||||
-- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim
|
||||
--
|
||||
-- In your plugin files, you can:
|
||||
-- * add extra plugins
|
||||
-- * disable/enabled LazyVim plugins
|
||||
-- * override the configuration of LazyVim plugins
|
||||
return {
|
||||
-- add gruvbox
|
||||
{ "ellisonleao/gruvbox.nvim" },
|
||||
|
||||
-- Configure LazyVim to load gruvbox
|
||||
{
|
||||
"LazyVim/LazyVim",
|
||||
opts = {
|
||||
colorscheme = "gruvbox",
|
||||
},
|
||||
},
|
||||
|
||||
-- change trouble config
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
-- opts will be merged with the parent spec
|
||||
opts = { use_diagnostic_signs = true },
|
||||
},
|
||||
|
||||
-- disable trouble
|
||||
{ "folke/trouble.nvim", enabled = false },
|
||||
|
||||
-- override nvim-cmp and add cmp-emoji
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = { "hrsh7th/cmp-emoji" },
|
||||
---@param opts cmp.ConfigSchema
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.sources, { name = "emoji" })
|
||||
end,
|
||||
},
|
||||
|
||||
-- change some telescope options and a keymap to browse plugin files
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
keys = {
|
||||
-- add a keymap to browse plugin files
|
||||
-- stylua: ignore
|
||||
{
|
||||
"<leader>fp",
|
||||
function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end,
|
||||
desc = "Find Plugin File",
|
||||
},
|
||||
},
|
||||
-- change some options
|
||||
opts = {
|
||||
defaults = {
|
||||
layout_strategy = "horizontal",
|
||||
layout_config = { prompt_position = "top" },
|
||||
sorting_strategy = "ascending",
|
||||
winblend = 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- add pyright to lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
---@class PluginLspOpts
|
||||
opts = {
|
||||
---@type lspconfig.options
|
||||
servers = {
|
||||
-- pyright will be automatically installed with mason and loaded with lspconfig
|
||||
pyright = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- add tsserver and setup with typescript.nvim instead of lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"jose-elias-alvarez/typescript.nvim",
|
||||
init = function()
|
||||
require("lazyvim.util").lsp.on_attach(function(_, buffer)
|
||||
-- stylua: ignore
|
||||
vim.keymap.set( "n", "<leader>co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" })
|
||||
vim.keymap.set("n", "<leader>cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer })
|
||||
end)
|
||||
end,
|
||||
},
|
||||
---@class PluginLspOpts
|
||||
opts = {
|
||||
---@type lspconfig.options
|
||||
servers = {
|
||||
-- tsserver will be automatically installed with mason and loaded with lspconfig
|
||||
tsserver = {},
|
||||
},
|
||||
-- you can do any additional lsp server setup here
|
||||
-- return true if you don't want this server to be setup with lspconfig
|
||||
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
|
||||
setup = {
|
||||
-- example to setup with typescript.nvim
|
||||
tsserver = function(_, opts)
|
||||
require("typescript").setup({ server = opts })
|
||||
return true
|
||||
end,
|
||||
-- Specify * to use this function as a fallback for any server
|
||||
-- ["*"] = function(server, opts) end,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- for typescript, LazyVim also includes extra specs to properly setup lspconfig,
|
||||
-- treesitter, mason and typescript.nvim. So instead of the above, you can use:
|
||||
{ import = "lazyvim.plugins.extras.lang.typescript" },
|
||||
|
||||
-- add more treesitter parsers
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"html",
|
||||
"javascript",
|
||||
"json",
|
||||
"lua",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"python",
|
||||
"query",
|
||||
"regex",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"vim",
|
||||
"yaml",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above
|
||||
-- would overwrite `ensure_installed` with the new value.
|
||||
-- If you'd rather extend the default config, use the code below instead:
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function(_, opts)
|
||||
-- add tsx and treesitter
|
||||
vim.list_extend(opts.ensure_installed, {
|
||||
"tsx",
|
||||
"typescript",
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- the opts function can also be used to change the default opts:
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.sections.lualine_x, "😄")
|
||||
end,
|
||||
},
|
||||
|
||||
-- or you can return new options to override all the defaults
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = function()
|
||||
return {
|
||||
--[[add your custom lualine config here]]
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- use mini.starter instead of alpha
|
||||
{ import = "lazyvim.plugins.extras.ui.mini-starter" },
|
||||
|
||||
-- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc
|
||||
{ import = "lazyvim.plugins.extras.lang.json" },
|
||||
|
||||
-- add any tools you want to have installed below
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"stylua",
|
||||
"shellcheck",
|
||||
"shfmt",
|
||||
"flake8",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
return {
|
||||
"sethen/line-number-change-mode.nvim",
|
||||
config = function()
|
||||
require("catppuccin").setup({
|
||||
flavour = "mocha",
|
||||
})
|
||||
local palette = require("catppuccin.palettes").get_palette("mocha")
|
||||
|
||||
if palette == nil then
|
||||
return nil
|
||||
end
|
||||
|
||||
require("line-number-change-mode").setup({
|
||||
mode = {
|
||||
i = {
|
||||
bg = palette.green,
|
||||
fg = palette.mantle,
|
||||
bold = true,
|
||||
},
|
||||
n = {
|
||||
bg = palette.blue,
|
||||
fg = palette.mantle,
|
||||
bold = true,
|
||||
},
|
||||
R = {
|
||||
bg = palette.maroon,
|
||||
fg = palette.mantle,
|
||||
bold = true,
|
||||
},
|
||||
v = {
|
||||
bg = palette.mauve,
|
||||
fg = palette.mantle,
|
||||
bold = true,
|
||||
},
|
||||
V = {
|
||||
bg = palette.mauve,
|
||||
fg = palette.mantle,
|
||||
bold = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
|
@ -188,17 +188,17 @@ return {
|
|||
ins_left({
|
||||
"filename",
|
||||
cond = conditions.buffer_not_empty,
|
||||
color = { fg = ctp.sapphire },
|
||||
color = { fg = ctp.subtext0 },
|
||||
})
|
||||
|
||||
ins_left({
|
||||
-- filesize component
|
||||
"filesize",
|
||||
cond = conditions.buffer_not_empty,
|
||||
color = { fg = ctp.subtext0 },
|
||||
color = { fg = ctp.subtext1 },
|
||||
})
|
||||
|
||||
ins_left({ "location", color = { fg = ctp.subtext0 } })
|
||||
ins_left({ "location", color = { fg = ctp.subtext1 } })
|
||||
|
||||
ins_left({
|
||||
"diagnostics",
|
||||
|
|
|
|||
11
modules/home/apps/tools/neovim/config/snippets/package.json
Normal file
11
modules/home/apps/tools/neovim/config/snippets/package.json
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"name": "personal-snippets",
|
||||
"contributes": {
|
||||
"snippets": [
|
||||
{
|
||||
"language": "nix",
|
||||
"path": "./nixconfig.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
47
modules/home/scripts/default.nix
Normal file
47
modules/home/scripts/default.nix
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with lib.custom; let
|
||||
cfg = config.scripts;
|
||||
in {
|
||||
options.scripts = with types; {
|
||||
enable = mkBoolOpt false "Enable custom scripts";
|
||||
onepassword = {
|
||||
enable = mkBoolOpt false "Enable 1Password search utility";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs;
|
||||
[
|
||||
(writeShellScriptBin "opsearch" (builtins.readFile ./opsearch.sh))
|
||||
]
|
||||
++ (
|
||||
if cfg.onepassword.enable
|
||||
then
|
||||
with pkgs; [
|
||||
jq
|
||||
wl-clipboard
|
||||
]
|
||||
else []
|
||||
);
|
||||
|
||||
# Ensure the scripts directory exists and copy scripts there
|
||||
home.file = {
|
||||
".local/bin/opsearch.sh" = {
|
||||
source = ./opsearch.sh;
|
||||
executable = true;
|
||||
};
|
||||
|
||||
# Add fish function for 1Password search if fish is enabled
|
||||
".config/fish/functions/ops.fish" = mkIf cfg.onepassword.enable {
|
||||
source = ../shell/fish/functions/ops.fish;
|
||||
executable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
323
modules/home/scripts/opsearch.sh
Executable file
323
modules/home/scripts/opsearch.sh
Executable file
|
|
@ -0,0 +1,323 @@
|
|||
#!/usr/bin/env bash
|
||||
# opsearch.sh - A tool to search through 1Password items
|
||||
#
|
||||
# Usage:
|
||||
# opsearch <search_term> [options]
|
||||
#
|
||||
# Options:
|
||||
# -c, --category Filter by category (login, password, document, etc.)
|
||||
# -t, --tag Filter by tag
|
||||
# -v, --vault Specify vault to search in
|
||||
# -f, --field Search only in specific fields
|
||||
# -j, --json Output results in JSON format
|
||||
# -d, --detail Show detailed output for each item
|
||||
# -n, --nushell Use Nushell for output formatting (if available)
|
||||
# -p, --password Retrieve and copy password after selection
|
||||
# -h, --help Show this help message
|
||||
|
||||
set -e
|
||||
|
||||
# Default options
|
||||
FORMAT="json"
|
||||
SHOW_DETAIL=false
|
||||
CATEGORY=""
|
||||
TAG=""
|
||||
VAULT=""
|
||||
FIELD=""
|
||||
SEARCH_TERM=""
|
||||
USE_NUSHELL=false
|
||||
GET_PASSWORD=false
|
||||
|
||||
# Check if 1Password CLI is available
|
||||
if ! command -v op &>/dev/null; then
|
||||
echo "Error: 1Password CLI (op) not found."
|
||||
echo "Please install it from https://1password.com/downloads/command-line/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if 1Password CLI is signed in
|
||||
if ! op account get --format=json &>/dev/null; then
|
||||
echo "You need to sign in to 1Password CLI first."
|
||||
echo "Run: eval \$(op signin)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Function to display help
|
||||
show_help() {
|
||||
cat << EOF
|
||||
opsearch - Search 1Password items with grep-like functionality
|
||||
|
||||
Usage:
|
||||
opsearch <search_term> [options]
|
||||
|
||||
Options:
|
||||
-c, --category <category> Filter by category (login, password, document, etc.)
|
||||
-t, --tag <tag> Filter by tag
|
||||
-v, --vault <vault> Specify vault to search in
|
||||
-f, --field <field> Search only in specific fields
|
||||
-j, --json Output results in JSON format
|
||||
-d, --detail Show detailed output for each item
|
||||
-n, --nushell Use Nushell for output formatting (if available)
|
||||
-p, --password Retrieve and copy password after selection
|
||||
-h, --help Show this help message
|
||||
|
||||
Examples:
|
||||
opsearch github # Search for "github" in all items
|
||||
opsearch amazon -c login # Search for "amazon" in login items
|
||||
opsearch bank -v Personal # Search for "bank" in the Personal vault
|
||||
opsearch -t finance # Show all items with "finance" tag
|
||||
opsearch email -f username # Search for "email" in username fields
|
||||
opsearch ssh -d # Show detailed info for SSH items
|
||||
opsearch github -p # Get GitHub password after selecting item
|
||||
|
||||
EOF
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Parse arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-h|--help)
|
||||
show_help
|
||||
;;
|
||||
-j|--json)
|
||||
FORMAT="json"
|
||||
shift
|
||||
;;
|
||||
-d|--detail)
|
||||
SHOW_DETAIL=true
|
||||
shift
|
||||
;;
|
||||
-n|--nushell)
|
||||
USE_NUSHELL=true
|
||||
shift
|
||||
;;
|
||||
-p|--password)
|
||||
GET_PASSWORD=true
|
||||
shift
|
||||
;;
|
||||
-c|--category)
|
||||
CATEGORY="$2"
|
||||
shift 2
|
||||
;;
|
||||
-t|--tag)
|
||||
TAG="$2"
|
||||
shift 2
|
||||
;;
|
||||
-v|--vault)
|
||||
VAULT="$2"
|
||||
shift 2
|
||||
;;
|
||||
-f|--field)
|
||||
FIELD="$2"
|
||||
shift 2
|
||||
;;
|
||||
-*)
|
||||
echo "Unknown option: $1"
|
||||
show_help
|
||||
;;
|
||||
*)
|
||||
if [[ -z "$SEARCH_TERM" ]]; then
|
||||
SEARCH_TERM="$1"
|
||||
else
|
||||
echo "Error: Multiple search terms provided. Use quotes for terms with spaces."
|
||||
exit 1
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Check for required tools
|
||||
check_dependencies() {
|
||||
if ! command -v jq &> /dev/null; then
|
||||
echo "Error: jq is required for this script to function properly."
|
||||
echo "Please install it using your package manager."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$USE_NUSHELL" == "true" ]] && ! command -v nu &> /dev/null; then
|
||||
echo "Warning: Nushell not found, falling back to jq for formatting."
|
||||
USE_NUSHELL=false
|
||||
fi
|
||||
|
||||
if [[ "$GET_PASSWORD" == "true" ]]; then
|
||||
if ! command -v xclip &> /dev/null && ! command -v pbcopy &> /dev/null && ! command -v wl-copy &> /dev/null; then
|
||||
echo "Warning: No clipboard utility found (xclip, pbcopy, or wl-copy required)."
|
||||
echo "Password will be displayed but not copied."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Build the 1Password CLI command
|
||||
OP_CMD="op item list --format=json"
|
||||
|
||||
# Add filters to the command
|
||||
if [[ -n "$CATEGORY" ]]; then
|
||||
OP_CMD="$OP_CMD --categories=$CATEGORY"
|
||||
fi
|
||||
|
||||
if [[ -n "$TAG" ]]; then
|
||||
OP_CMD="$OP_CMD --tags=$TAG"
|
||||
fi
|
||||
|
||||
if [[ -n "$VAULT" ]]; then
|
||||
OP_CMD="$OP_CMD --vault=$VAULT"
|
||||
fi
|
||||
|
||||
# Function to colorize the output
|
||||
highlight_match() {
|
||||
local text="$1"
|
||||
local pattern="$2"
|
||||
echo "$text" | grep --color=always -i "$pattern" || echo "$text"
|
||||
}
|
||||
|
||||
# Function to copy to clipboard
|
||||
copy_to_clipboard() {
|
||||
local text="$1"
|
||||
|
||||
if command -v wl-copy &> /dev/null; then
|
||||
echo -n "$text" | wl-copy
|
||||
echo "Copied to clipboard with wl-copy"
|
||||
elif command -v xclip &> /dev/null; then
|
||||
echo -n "$text" | xclip -selection clipboard
|
||||
echo "Copied to clipboard with xclip"
|
||||
elif command -v pbcopy &> /dev/null; then
|
||||
echo -n "$text" | pbcopy
|
||||
echo "Copied to clipboard with pbcopy"
|
||||
else
|
||||
echo "No clipboard utility found. Here's the value:"
|
||||
echo "$text"
|
||||
fi
|
||||
}
|
||||
|
||||
# Main function to format and display results
|
||||
display_items() {
|
||||
local items="$1"
|
||||
local count=$(echo "$items" | jq 'length')
|
||||
|
||||
if [[ $count -eq 0 ]]; then
|
||||
echo "No items found matching your search criteria."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Found $count matching items:"
|
||||
|
||||
if [[ "$USE_NUSHELL" == "true" ]]; then
|
||||
# Use Nushell for pretty output
|
||||
echo "$items" | nu -c "open - | select id title category updated vault_id | sort-by title"
|
||||
else
|
||||
# Use jq for formatting
|
||||
echo "$items" | jq -r '
|
||||
["ID", "TITLE", "CATEGORY", "UPDATED"] as $headers |
|
||||
([$headers] +
|
||||
(. | map([.id, .title, .category, .updated[0:10]]))) |
|
||||
.[] | @tsv' | column -t -s $'\t'
|
||||
fi
|
||||
|
||||
if [[ $count -gt 0 ]]; then
|
||||
echo ""
|
||||
select_item "$items"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to select an item and show details or get password
|
||||
select_item() {
|
||||
local items="$1"
|
||||
local count=$(echo "$items" | jq 'length')
|
||||
|
||||
echo "Select an item by number (1-$count) or press Enter to exit:"
|
||||
select opt in $(echo "$items" | jq -r '.[].title'); do
|
||||
if [[ -z "$opt" ]]; then
|
||||
echo "Exiting."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
local idx=$((REPLY-1))
|
||||
if [[ $idx -ge 0 && $idx -lt $count ]]; then
|
||||
local item_id=$(echo "$items" | jq -r ".[$idx].id")
|
||||
local item_title=$(echo "$items" | jq -r ".[$idx].title")
|
||||
|
||||
echo "Selected: $item_title (ID: $item_id)"
|
||||
|
||||
if [[ "$GET_PASSWORD" == "true" ]]; then
|
||||
# Get password and copy to clipboard
|
||||
local password=$(op item get "$item_id" --fields password)
|
||||
if [[ -n "$password" ]]; then
|
||||
copy_to_clipboard "$password"
|
||||
else
|
||||
echo "No password field found for this item."
|
||||
|
||||
# Show available fields
|
||||
echo "Available fields:"
|
||||
op item get "$item_id" --format=json | jq -r '.fields[] | select(.id != "notesPlain") | "\(.id): \(.label)"'
|
||||
|
||||
echo "Get a specific field? Enter field ID or press Enter to skip:"
|
||||
read -r field_id
|
||||
|
||||
if [[ -n "$field_id" ]]; then
|
||||
local field_value=$(op item get "$item_id" --fields "$field_id")
|
||||
if [[ -n "$field_value" ]]; then
|
||||
copy_to_clipboard "$field_value"
|
||||
else
|
||||
echo "Field not found or empty."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
elif [[ "$SHOW_DETAIL" == "true" ]]; then
|
||||
# Show detailed information
|
||||
echo "Detailed information:"
|
||||
echo "------------------------------------------------"
|
||||
if [[ -n "$FIELD" ]]; then
|
||||
# Show only the requested field
|
||||
op item get "$item_id" --fields "$FIELD"
|
||||
else
|
||||
# Show all fields
|
||||
if [[ "$USE_NUSHELL" == "true" ]]; then
|
||||
op item get "$item_id" --format=json | nu -c "open - | get fields | where id != 'notesPlain' | sort-by label"
|
||||
else
|
||||
op item get "$item_id" --format=json | jq -r '.fields[] | select(.id != "notesPlain") | "\(.label): \(.value)"'
|
||||
fi
|
||||
fi
|
||||
echo "------------------------------------------------"
|
||||
else
|
||||
# Show basic information
|
||||
op item get "$item_id" --format=json | jq -r '.fields[] | select(.id == "username" or .id == "password" or .id == "notesPlain") | "\(.label): \(.value // "[Hidden]")"'
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Select another item or press Ctrl+C to exit:"
|
||||
else
|
||||
echo "Invalid selection. Please choose a number between 1 and $count."
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Execute search
|
||||
check_dependencies
|
||||
|
||||
if [[ -z "$SEARCH_TERM" && -z "$TAG" && -z "$CATEGORY" ]]; then
|
||||
echo "Error: No search term provided."
|
||||
show_help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Execute the command and store the results
|
||||
RESULT=$(eval "$OP_CMD")
|
||||
|
||||
# Filter results based on search term
|
||||
if [[ -n "$SEARCH_TERM" ]]; then
|
||||
FILTERED_RESULT=$(echo "$RESULT" | jq --arg term "$SEARCH_TERM" -r '[.[] | select(
|
||||
(.title | ascii_downcase | contains($term | ascii_downcase)) or
|
||||
(.id | ascii_downcase | contains($term | ascii_downcase)) or
|
||||
(.additional_information | ascii_downcase | contains($term | ascii_downcase)) or
|
||||
(.urls != null and (.urls[] | ascii_downcase | contains($term | ascii_downcase))) or
|
||||
(.tags != null and (.tags[] | ascii_downcase | contains($term | ascii_downcase)))
|
||||
)]')
|
||||
else
|
||||
FILTERED_RESULT="$RESULT"
|
||||
fi
|
||||
|
||||
# Display the results
|
||||
display_items "$FILTERED_RESULT"
|
||||
|
||||
55
modules/home/services/quickshell/default.nix
Normal file
55
modules/home/services/quickshell/default.nix
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
system,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with lib.custom; let
|
||||
cfg = config.services.quickshell;
|
||||
|
||||
mkService = recursiveUpdate {
|
||||
Unit.PartOf = ["graphical-session.target"];
|
||||
Unit.After = ["graphical-session.target"];
|
||||
Install.WantedBy = ["graphical-session.target"];
|
||||
};
|
||||
in {
|
||||
options.services.quickshell = with types; {
|
||||
enable = mkBoolOpt false "Enable or Disable QuickShell";
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
systemd.user.services = {
|
||||
quickshell = mkService {
|
||||
Unit.Description = "QuickShell Service";
|
||||
Service = {
|
||||
Environment = [
|
||||
"QSG_RENDER_LOOP=threaded"
|
||||
# "QT_QUICK_BACKEND=software"
|
||||
"QT_QPA_PLATFORM=wayland"
|
||||
"QSG_RENDERER_TIMING=true"
|
||||
"QML_DISABLE_DISTANCEFIELD=1"
|
||||
"QT_WAYLAND_DISABLE_WINDOWDECORATION=1"
|
||||
"QT_QPA_PLATFORMTHEME=qt5ct"
|
||||
"QT_QPA_REFRESH_RATE=240"
|
||||
"__GL_SYNC_TO_VBLANK=0"
|
||||
"LIBGL_ALWAYS_SOFTWARE=0"
|
||||
"__GL_SYNC_DISPLAY_DEVICE=DP-1" # Adjust this to match your display connection
|
||||
"QML_ANIMATION_DRIVER=cadence"
|
||||
"QML_CADENCE_DURATION=4"
|
||||
"QML_CADENCE_MAX_RENDER_TIME=3.5"
|
||||
"QSG_RENDERER_USE_THREADED_GL=1"
|
||||
"QSG_RHI_PREFER_SOFTWARE_RENDERER=0"
|
||||
"QSG_RHI_FORCE_SYNC=0"
|
||||
"QSG_INFO=1"
|
||||
];
|
||||
ExecStart = ''
|
||||
${inputs.quickshell.packages.${system}.default}/bin/qs --log-rules 'quickshell.dbus.properties.warning = false;quickshell.dbus.dbusmenu.warning = false;quickshell.service.notifications.warning = false;quickshell.service.sni.host.warning = false'
|
||||
'';
|
||||
Restart = "always";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
75
modules/home/shell/fish/functions/ops.fish
Normal file
75
modules/home/shell/fish/functions/ops.fish
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
function ops --description "Search 1Password with grep-like functionality"
|
||||
set -l options 'h/help' 'c/category=' 't/tag=' 'v/vault=' 'f/field=' 'j/json' 'd/detail' 'n/nushell' 'p/password'
|
||||
argparse $options -- $argv
|
||||
|
||||
if set -q _flag_help
|
||||
echo "ops - Fish wrapper for opsearch (1Password search utility)"
|
||||
echo
|
||||
echo "Usage:"
|
||||
echo " ops [search_term] [options]"
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " -c/--category [category] Filter by category (login, password, document, etc.)"
|
||||
echo " -t/--tag [tag] Filter by tag"
|
||||
echo " -v/--vault [vault] Specify vault to search in"
|
||||
echo " -f/--field [field] Search only in specific fields"
|
||||
echo " -j/--json Output results in JSON format"
|
||||
echo " -d/--detail Show detailed output for each item"
|
||||
echo " -n/--nushell Use Nushell for output formatting (if available)"
|
||||
echo " -p/--password Retrieve and copy password after selection"
|
||||
echo " -h/--help Show this help message"
|
||||
echo
|
||||
echo "Examples:"
|
||||
echo " ops github # Search for \"github\" in all items"
|
||||
echo " ops amazon -c login # Search for \"amazon\" in login items"
|
||||
echo " ops bank -v Personal # Search for \"bank\" in the Personal vault"
|
||||
echo " ops -t finance # Show all items with \"finance\" tag"
|
||||
echo " ops email -f username # Search for \"email\" in username fields"
|
||||
echo " ops ssh -d # Show detailed info for SSH items"
|
||||
echo " ops github -p # Get GitHub password after selection"
|
||||
return 0
|
||||
end
|
||||
|
||||
set -l cmd_args
|
||||
|
||||
# Convert fish options to bash-style options for the shell script
|
||||
if set -q _flag_category
|
||||
set -a cmd_args "--category" $_flag_category
|
||||
end
|
||||
|
||||
if set -q _flag_tag
|
||||
set -a cmd_args "--tag" $_flag_tag
|
||||
end
|
||||
|
||||
if set -q _flag_vault
|
||||
set -a cmd_args "--vault" $_flag_vault
|
||||
end
|
||||
|
||||
if set -q _flag_field
|
||||
set -a cmd_args "--field" $_flag_field
|
||||
end
|
||||
|
||||
if set -q _flag_json
|
||||
set -a cmd_args "--json"
|
||||
end
|
||||
|
||||
if set -q _flag_detail
|
||||
set -a cmd_args "--detail"
|
||||
end
|
||||
|
||||
if set -q _flag_nushell
|
||||
set -a cmd_args "--nushell"
|
||||
end
|
||||
|
||||
if set -q _flag_password
|
||||
set -a cmd_args "--password"
|
||||
end
|
||||
|
||||
# Add search term if provided
|
||||
if test (count $argv) -gt 0
|
||||
set -a cmd_args $argv
|
||||
end
|
||||
|
||||
# Execute the shell script with all arguments
|
||||
$HOME/.local/bin/opsearch.sh $cmd_args
|
||||
end
|
||||
|
|
@ -24,6 +24,11 @@ in {
|
|||
set -g FZF_PREVIEW_FILE_CMD "head -n 10"
|
||||
set -g FZF_PREVIEW_DIR_CMD "ls"
|
||||
|
||||
set -gx AWS_DEFAULT_PROFILE (cat ~/.aws_profile | string collect)
|
||||
|
||||
set -Ux MANROFFOPT '-c'
|
||||
set -Ux MANPAGER "sh -c 'col -bx | bat -l man -p'"
|
||||
|
||||
if not set -q TMUX
|
||||
tmux
|
||||
end
|
||||
|
|
@ -99,8 +104,6 @@ in {
|
|||
# download from yt and other websites
|
||||
yt-dlp
|
||||
|
||||
zsh-history
|
||||
|
||||
# man pages for tiktok attention span mfs
|
||||
tealdeer
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,6 @@ in {
|
|||
onefetch
|
||||
cpufetch
|
||||
yt-dlp
|
||||
zsh-history
|
||||
tealdeer
|
||||
glow
|
||||
hyperfine
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ in {
|
|||
initContent = let
|
||||
sources = with pkgs; [
|
||||
"${zsh-nix-shell}/share/zsh-nix-shell/nix-shell.plugin.zsh"
|
||||
"${zsh-history}/share/zsh/init.zsh"
|
||||
"${zsh-fzf-tab}/share/fzf-tab/fzf-tab.plugin.zsh"
|
||||
"${zsh-f-sy-h}/share/zsh/site-functions/F-Sy-H.plugin.zsh"
|
||||
"${zsh-you-should-use}/share/zsh/plugins/you-should-use/you-should-use.plugin.zsh"
|
||||
|
|
@ -104,8 +103,6 @@ in {
|
|||
# download from yt and other websites
|
||||
yt-dlp
|
||||
|
||||
zsh-history
|
||||
|
||||
# man pages for tiktok attention span mfs
|
||||
tealdeer
|
||||
|
||||
|
|
|
|||
|
|
@ -129,8 +129,8 @@ in {
|
|||
allow_tearing = true;
|
||||
|
||||
# active border color
|
||||
"col.active_border" = "${colors.lavender.rgb}";
|
||||
"col.inactive_border" = "${colors.base.rgb}";
|
||||
"col.active_border" = colors.lavender.hypr;
|
||||
"col.inactive_border" = colors.base.hypr;
|
||||
};
|
||||
|
||||
input = {
|
||||
|
|
@ -146,7 +146,7 @@ in {
|
|||
|
||||
decoration = {
|
||||
# fancy corners
|
||||
rounding = 0;
|
||||
rounding = 8;
|
||||
# blur
|
||||
blur = {
|
||||
enabled = true;
|
||||
|
|
@ -257,6 +257,7 @@ in {
|
|||
# };
|
||||
# };
|
||||
|
||||
services.quickshell.enable = true;
|
||||
services.wallpaper.enable = true;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -507,6 +507,7 @@ with lib.custom; {
|
|||
};
|
||||
};
|
||||
|
||||
services.quickshell.enable = false;
|
||||
services.wallpaper.enable = true;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue