Compare commits

..

No commits in common. "3caac1a07e664ef66778413f34cda7e2a9f9b564" and "d5279a25d265e23081ddbbb881f16ea3e225b434" have entirely different histories.

22 changed files with 116 additions and 424 deletions

View file

@ -135,7 +135,6 @@ bind = , I, exec, hyprctl dispatch submap reset; ctl idle
bind = , K, exec, hyprctl dispatch submap reset; ctl keyboard next
bind = , M, exec, hyprctl dispatch submap reset; ctl media
bind = , P, exec, hyprctl dispatch submap reset; ctl power
bind = , D, exec, hyprctl dispatch submap reset; ctl dictate
bind = , T, exec, hyprctl dispatch submap reset; theme
bind = , catchall, submap, reset

View file

@ -1,14 +1,18 @@
-- Rerun tests only if their modification time changed.
cache = true
ignore = {
"122",
"212",
"631",
"122", -- Setting a read-only field of a global variable.
"212", -- Unused argument, In the case of callback function, _arg_name is easier to understand than _, so this option is set to off.
"631", -- max_line_length, vscode pkg URL is too long
}
-- Global objects defined by the C code
read_globals = {
"vim",
}
include_files = { "lua", "tests" }
exclude_files = { ".luacheckrc", "tests/**/*_spec.lua" }
-- vim: ft=lua tw=80

View file

@ -1,4 +1,10 @@
{
"guard-collection": { "branch": "main", "commit": "edf6c86c06badc972964dadb7fd469022690cbf0" },
"guard.nvim": { "branch": "main", "commit": "addb8d2f40662b8b62d60dd7d18f503beb2332e7" }
"lazy.nvim": {
"branch": "main",
"commit": "85c7ff3711b730b4030d03144f6db6375044ae82"
},
"midnight.nvim": {
"branch": "main",
"commit": "fe062a6f2e5bd77cd8a260f61e6e12789eaf4f13"
}
}

View file

@ -2,67 +2,65 @@ local M = {}
local Methods = vim.lsp.protocol.Methods
local function fzf_or(fzf_cmd, fallback)
return function()
pcall(require('lz.n').trigger_load, 'ibhagwan/fzf-lua')
if pcall(require, 'fzf-lua') then
vim.cmd('FzfLua ' .. fzf_cmd)
else
fallback()
end
end
end
function M.on_attach(client, bufnr)
if client:supports_method(Methods.textDocument_hover) then
vim.keymap.set('n', 'K', vim.lsp.buf.hover, { buffer = bufnr })
end
local ok, _ = pcall(require, 'fzf-lua')
local mappings = {
{
Methods.textDocument_codeAction,
'gra',
fzf_or('lsp_code_actions', vim.lsp.buf.code_action),
ok and '<cmd>FzfLua lsp_code_actions<CR>'
or vim.lsp.buf.code_action,
},
{
Methods.textDocument_declaration,
'gD',
fzf_or('lsp_declarations', vim.lsp.buf.declaration),
ok and '<cmd>FzfLua lsp_declarations<CR>'
or vim.lsp.buf.declaration,
},
{
Methods.textDocument_definition,
'gd',
fzf_or('lsp_definitions', vim.lsp.buf.definition),
ok and '<cmd>FzfLua lsp_definitions<CR>' or vim.lsp.buf.definition,
},
{
Methods.textDocument_implementation,
'gri',
fzf_or('lsp_implementations', vim.lsp.buf.implementation),
ok and '<cmd>FzfLua lsp_implementations<CR>'
or vim.lsp.buf.implementation,
},
{
Methods.textDocument_references,
'grr',
fzf_or('lsp_references', vim.lsp.buf.references),
ok and '<cmd>FzfLua lsp_references<CR>' or vim.lsp.buf.references,
},
{
Methods.textDocument_typeDefinition,
'grt',
fzf_or('lsp_typedefs', vim.lsp.buf.type_definition),
ok and '<cmd>FzfLua lsp_typedefs<CR>'
or vim.lsp.buf.type_definition,
},
{
Methods.textDocument_documentSymbol,
'gs',
fzf_or('lsp_document_symbols', vim.lsp.buf.document_symbol),
ok and '<cmd>FzfLua lsp_document_symbols<CR>'
or vim.lsp.buf.document_symbol,
},
{
Methods.workspace_diagnostic,
'gw',
fzf_or('lsp_workspace_diagnostics', vim.diagnostic.setqflist),
ok and '<cmd>FzfLua lsp_workspace_diagnostics<CR>'
or vim.diagnostic.setqflist,
},
{
Methods.workspace_symbol,
'gS',
fzf_or('lsp_workspace_symbols', vim.lsp.buf.workspace_symbol),
ok and '<cmd>FzfLua lsp_workspace_symbols<CR>'
or vim.lsp.buf.workspace_symbol,
},
}

View file

@ -2,7 +2,7 @@ return {
filetypes = { 'typst' },
settings = {
formatterMode = 'typstyle',
-- exportPdf = 'onSave',
exportPdf = 'onSave',
semanticTokens = 'disable',
lint = {
enabled = true,

View file

@ -60,30 +60,6 @@ local git_status = new_git_status()
local synctex_pdf = {}
return {
{
'barrettruth/diffs.nvim',
enabled = true,
before = function()
vim.g.diffs = {
debug = false,
integrations = { fugitive = true },
extra_filetypes = { 'diff' },
hide_prefix = true,
highlights = {
gutter = true,
vim = {
enabled = true,
-- max_lines = 500,
},
-- treesitter = { max_lines = 10 },
intra = {
enabled = true,
max_lines = 500,
},
},
}
end,
},
{
'barrettruth/midnight.nvim',
enabled = true,
@ -105,14 +81,14 @@ return {
'barrettruth/canola.nvim',
enabled = true,
after = function()
require('oil').setup({
require('canola').setup({
skip_confirm_for_simple_edits = true,
cleanup_buffers_on_delete = true,
prompt_save_on_select_new_entry = false,
float = { border = 'single' },
view_options = {
is_hidden_file = function(name, bufnr)
local dir = require('oil').get_current_dir(bufnr)
local dir = require('canola').get_current_dir(bufnr)
local is_dotfile = vim.startswith(name, '.')
and name ~= '..'
if not dir then
@ -145,7 +121,7 @@ return {
end,
},
})
local refresh = require('oil.actions').refresh
local refresh = require('canola.actions').refresh
local orig_refresh = refresh.callback
refresh.callback = function(...)
git_status = new_git_status()
@ -161,37 +137,23 @@ return {
end
end
end,
group = vim.api.nvim_create_augroup('AOil', { clear = true }),
group = vim.api.nvim_create_augroup(
'ACanola',
{ clear = true }
),
})
end,
event = 'DeferredUIEnter',
keys = {
{ '-', '<cmd>e .<cr>' },
{ '_', '<cmd>Oil<cr>' },
{ '_', '<cmd>Canola<cr>' },
},
},
{
'barrettruth/pending.nvim',
before = function()
vim.g.pending = {
view = {
queue = {
sort = {
'lol',
'dne',
'status',
'due',
'priority',
'order',
'id',
},
},
category = { hide_done_categories = true },
},
debug = false,
sync = {
s3 = { bucket = 'pending.nvim', region = 'us-east-1' },
},
data_path = (
os.getenv('XDG_STATE_HOME')
or (os.getenv('HOME') .. '/.local/state')
@ -346,7 +308,7 @@ return {
vim.filetype.add({
extension = { puml = 'plantuml', pu = 'plantuml' },
})
vim.fn.serverstart('/tmp/nvim-preview.sock')
vim.api.nvim_create_autocmd('User', {
pattern = 'PreviewCompileSuccess',
callback = function(args)
@ -378,31 +340,12 @@ return {
})
vim.g.preview = {
debug = false,
github = {
output = function(ctx)
return '/tmp/'
.. vim.fn.fnamemodify(ctx.file, ':t:r')
.. '.html'
end,
},
github = true,
typst = { open = { 'sioyek', '--new-instance' } },
plantuml = true,
mermaid = true,
latex = {
open = { 'sioyek', '--instance-name', 'preview' },
args = function(ctx)
local dir = vim.fn.fnamemodify(ctx.file, ':h')
.. '/build'
vim.fn.mkdir(dir, 'p')
return {
'-pdf',
'-interaction=nonstopmode',
'-synctex=1',
'-output-directory=' .. dir,
'-pdflatex=pdflatex -file-line-error %O %S',
ctx.file,
}
end,
output = function(ctx)
return vim.fn.fnamemodify(ctx.file, ':h')
.. '/build/'

View file

@ -1,5 +1,5 @@
return {
'ibhagwan/fzf-lua',
'barrettruth/fzf-lua',
after = function()
local fzf = require('fzf-lua')
local has_nonicons = pcall(require, 'nonicons')
@ -94,7 +94,6 @@ return {
fzf_reload.reload()
end
end,
cmd = 'FzfLua',
keys = {
{
'<c-t>',

View file

@ -218,3 +218,30 @@ end)
vim.keymap.set('n', '<leader>gp', function()
forge_picker('pr', 'all')
end)
return {
{
'barrettruth/diffs.nvim',
enabled = true,
before = function()
vim.g.diffs = {
debug = false,
integrations = { fugitive = true },
extra_filetypes = { 'diff' },
hide_prefix = false,
highlights = {
-- blend_alpha = 0.9,
gutter = true,
vim = {
enabled = true,
max_lnes = 500,
},
intra = {
enabled = true,
max_lines = 500,
},
},
}
end,
},
}

View file

@ -25,7 +25,7 @@ return {
args = { '--profile', 'black', '-' },
stdin = true,
})
:fmt('black')
:append('black')
:lint('mypy')
ft('lua'):fmt('stylua'):lint('selene')
@ -43,8 +43,6 @@ return {
ft('sh,bash'):lint('shellcheck')
ft('zsh'):lint('zsh')
ft('html'):fmt('prettierd')
ft('proto'):fmt('buf'):lint('buf')
ft('dockerfile'):lint('hadolint')
ft('tex'):fmt('latexindent')
@ -52,7 +50,7 @@ return {
ft('cmake'):fmt('cmake-format')
ft('make'):lint('checkmake')
ft('cpp'):lint('cpplint')
ft('markdown'):fmt('cbfmt'):fmt('prettierd')
ft('markdown'):fmt('cbfmt'):append('prettierd')
local lint = require('guard.lint')
ft('nix')

View file

@ -46,9 +46,8 @@ vim.o.number = true
vim.o.relativenumber = true
vim.o.signcolumn = 'no'
vim.o.statuscolumn = "%{%v:virtnum?'':'%s%C %=%{v:relnum?v:relnum:v:lnum} '%}"
vim.o.statusline =
" %{len(expand('%'))?expand('%:~').' ':''}%h%m%r%=%c:%l/%L %{&ft!=''?&ft:&bt} "
vim.o.statuscolumn = '%s%C %=%{v:relnum?v:relnum:v:lnum} '
vim.o.statusline = " %{len(expand('%'))?expand('%:~').' ':''}%h%m%r%=%c:%l/%L %{&ft!=''?&ft:&bt} "
vim.opt.path:append('**')

69
flake.lock generated
View file

@ -5,11 +5,11 @@
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1773106201,
"narHash": "sha256-p5JuCe5wywjp2oanroCOzH+kzKCFt7rpJDg+lVykSjw=",
"lastModified": 1772841847,
"narHash": "sha256-Qre73BGBcw1YlhBTTT+T/rVoqVtlCgHYYExUreIJoYs=",
"owner": "ryoppippi",
"repo": "claude-code-overlay",
"rev": "a6293ea4b12f65545c21357c1df4dcb885f0de6e",
"rev": "871c9fa0d37c0d6b3bdbf30341a8d08a75b1793b",
"type": "github"
},
"original": {
@ -18,26 +18,6 @@
"type": "github"
}
},
"disko": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1773025010,
"narHash": "sha256-khlHllTsovXgT2GZ0WxT4+RvuMjNeR5OW0UYeEHPYQo=",
"owner": "nix-community",
"repo": "disko",
"rev": "7b9f7f88ab3b339f8142dc246445abb3c370d3d3",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "disko",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
@ -66,11 +46,11 @@
]
},
"locked": {
"lastModified": 1773179137,
"narHash": "sha256-EdW2bwzlfme0vbMOcStnNmKlOAA05Bp6su2O8VLGT0k=",
"lastModified": 1772845525,
"narHash": "sha256-Dp5Ir2u4jJDGCgeMRviHvEQDe+U37hMxp6RSNOoMMPc=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "3f98e2bbc661ec0aaf558d8a283d6955f05f1d09",
"rev": "27b93804fbef1544cb07718d3f0a451f4c4cd6c0",
"type": "github"
},
"original": {
@ -107,11 +87,11 @@
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1773187529,
"narHash": "sha256-g+SvIUF9he6xFI5d3752wNAsOcbKBg6a0HpX16ggKY4=",
"lastModified": 1772928300,
"narHash": "sha256-7WXA2vUlHNvCjjTDLsM0CGzTE52d8M8tXj+c4QOQnsk=",
"owner": "nix-community",
"repo": "neovim-nightly-overlay",
"rev": "2c00dfe845f47f9cdab706372e82613d233e5c85",
"rev": "8df2141922896b7923ab78d624951f29531b5e8a",
"type": "github"
},
"original": {
@ -123,11 +103,11 @@
"neovim-src": {
"flake": false,
"locked": {
"lastModified": 1773186516,
"narHash": "sha256-IPthgh8IUiFme222fCPbFzxZHDmvDY9ibNZ4MS3v+PA=",
"lastModified": 1772909350,
"narHash": "sha256-SOywFX51TumgEMzjRN8JBo2E59Dr9+13sye7qv20nR8=",
"owner": "neovim",
"repo": "neovim",
"rev": "3a7ade847f10e22af6cecf92046eee238d6b21f6",
"rev": "e8e694d837427bd158d51dd62a25f165d49725c6",
"type": "github"
},
"original": {
@ -138,11 +118,11 @@
},
"nixos-hardware": {
"locked": {
"lastModified": 1772972630,
"narHash": "sha256-mUJxsNOrBMNOUJzN0pfdVJ1r2pxeqm9gI/yIKXzVVbk=",
"lastModified": 1771969195,
"narHash": "sha256-qwcDBtrRvJbrrnv1lf/pREQi8t2hWZxVAyeMo7/E9sw=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "3966ce987e1a9a164205ac8259a5fe8a64528f72",
"rev": "41c6b421bdc301b2624486e11905c9af7b8ec68e",
"type": "github"
},
"original": {
@ -169,11 +149,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1772956932,
"narHash": "sha256-M0yS4AafhKxPPmOHGqIV0iKxgNO8bHDWdl1kOwGBwRY=",
"lastModified": 1772736753,
"narHash": "sha256-au/m3+EuBLoSzWUCb64a/MZq6QUtOV8oC0D9tY2scPQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "608d0cadfed240589a7eea422407a547ad626a14",
"rev": "917fec990948658ef1ccd07cef2a1ef060786846",
"type": "github"
},
"original": {
@ -185,11 +165,11 @@
},
"nixpkgs_3": {
"locked": {
"lastModified": 1773110118,
"narHash": "sha256-mPAG8phMbCReKSiKAijjjd3v7uVcJOQ75gSjGJjt/Rk=",
"lastModified": 1772736753,
"narHash": "sha256-au/m3+EuBLoSzWUCb64a/MZq6QUtOV8oC0D9tY2scPQ=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "e607cb5360ff1234862ac9f8839522becb853bb9",
"rev": "917fec990948658ef1ccd07cef2a1ef060786846",
"type": "github"
},
"original": {
@ -218,7 +198,6 @@
"root": {
"inputs": {
"claude-code": "claude-code",
"disko": "disko",
"home-manager": "home-manager",
"neovim-nightly": "neovim-nightly",
"nixos-hardware": "nixos-hardware",
@ -232,11 +211,11 @@
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1773225617,
"narHash": "sha256-IT0n3jJgf4M7U0EuZJ2XJwXBmSJVVK3auqWDGeHGMzY=",
"lastModified": 1772945022,
"narHash": "sha256-Fv14NttjL/7xfi6eVwrSEBAyBvDjI00RLiRNqA5apcw=",
"owner": "0xc000022070",
"repo": "zen-browser-flake",
"rev": "413a22ab7acf848ed4e20c3f47ea96ccd4788518",
"rev": "3a6a5ca7fb48cc8fd8183386506a06579d1d79dc",
"type": "github"
},
"original": {

View file

@ -11,10 +11,6 @@
zen-browser.url = "github:0xc000022070/zen-browser-flake";
claude-code.url = "github:ryoppippi/claude-code-overlay";
neovim-nightly.url = "github:nix-community/neovim-nightly-overlay";
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
@ -25,7 +21,6 @@
zen-browser,
claude-code,
neovim-nightly,
disko,
...
}:
let
@ -134,10 +129,6 @@
"tailscale"
"libfprint-2-tod1-goodix"
"brgenml1lpr"
"cuda_cccl"
"cuda_cudart"
"libcublas"
"cuda_nvcc"
]
);
}
@ -158,12 +149,10 @@
};
};
nixosConfigurations.netcup = nixpkgs.lib.nixosSystem {
modules = [
disko.nixosModules.disko
./hosts/netcup/configuration.nix
{ nixpkgs.hostPlatform = "x86_64-linux"; }
];
homeConfigurations = {
"barrett@mac" = mkHome macConfig;
"barrett@mac-work" = mkHome macWorkConfig;
"barrett@linux-work" = mkHome linuxWorkConfig;
};
};
}

View file

@ -19,7 +19,6 @@
++ lib.optionals hostConfig.isLinux [
./modules/hyprland.nix
./modules/ui.nix
./modules/dictation.nix
];
config = {

View file

@ -1,24 +0,0 @@
{
lib,
pkgs,
config,
hostConfig,
...
}:
let
whisper = pkgs.whisper-cpp.override { cudaSupport = hostConfig.gpu == "nvidia"; };
modelDir = "${config.home.homeDirectory}/.local/share/whisper-models";
model = "ggml-large-v3-turbo.bin";
modelUrl = "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/${model}";
in
{
home.packages = [ whisper ];
home.activation.downloadWhisperModel = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
if [ ! -f "${modelDir}/${model}" ]; then
run mkdir -p "${modelDir}"
run ${pkgs.curl}/bin/curl -L -o "${modelDir}/${model}" "${modelUrl}"
fi
'';
}

View file

@ -161,7 +161,7 @@ in
font_size 18
status_bar_font_size 18
inverse_search_command ${repoDir}/scripts/nvim-inverse-search %1 %2
inverse_search_command nvim --server /tmp/nvim-preview.sock --remote-expr "execute('b +%2 %1 | normal! zz')"
'';
};

View file

@ -130,16 +130,16 @@ in
home.activation.awsConfig = lib.mkIf aws (
lib.hm.dag.entryAfter [ "writeBoundary" ] ''
dir="${config.xdg.configHome}/aws"
mkdir -p "$dir"
if [ ! -f "$dir/config" ]; then
cat > "$dir/config" << 'AWSEOF'
[default]
[profile barrett]
region = us-east-2
output = json
AWSEOF
fi
dir="${config.xdg.configHome}/aws"
mkdir -p "$dir"
if [ ! -f "$dir/config" ]; then
cat > "$dir/config" << 'AWSEOF'
[default]
[profile barrett]
region = us-east-2
output = json
AWSEOF
fi
''
);
@ -336,7 +336,6 @@ in
xdg.configFile."claude/settings.json" = lib.mkIf claude {
text = builtins.toJSON {
permissions.defaultMode = "acceptEdits";
notifications.hints = "disabled";
network_access = true;
allowed_domains = [
"github.com"

View file

@ -159,12 +159,6 @@ in
];
};
home.packages = [ pkgs.tea ];
programs.ssh.matchBlocks."codeberg.org" = {
identityFile = "~/.ssh/id_ed25519";
};
programs.gh = {
enable = true;
settings = {

View file

@ -1,126 +0,0 @@
{ pkgs, ... }:
{
imports = [ ./disk-config.nix ];
boot.loader.grub = {
enable = true;
efiSupport = true;
efiInstallAsRemovable = true;
device = "nodev";
};
networking = {
hostName = "netcup";
useDHCP = false;
interfaces.eth0 = {
ipv4.addresses = [
{
address = "152.53.168.144";
prefixLength = 22;
}
];
ipv6.addresses = [
{
address = "2a0a:4cc0:2000:af7d:c8e4:dff:fe7f:c233";
prefixLength = 64;
}
];
};
defaultGateway = {
address = "152.53.168.1";
interface = "eth0";
};
defaultGateway6 = {
address = "fe80::1";
interface = "eth0";
};
nameservers = [
"1.1.1.1"
"8.8.8.8"
];
firewall.allowedTCPPorts = [
22
80
443
];
};
services.openssh = {
enable = true;
settings = {
PermitRootLogin = "prohibit-password";
PasswordAuthentication = false;
};
};
users.users.root.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILA1pOJawzHtJqIn56AZT4IhPUh9vUEhLPLwndk5s3iM br.barrettruth@gmail.com"
];
security.acme = {
acceptTerms = true;
defaults.email = "br.barrettruth@gmail.com";
};
services.nginx = {
enable = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
virtualHosts."vault.barrettruth.com" = {
enableACME = true;
forceSSL = true;
locations."/".proxyPass = "http://127.0.0.1:8222";
};
virtualHosts."git.barrettruth.com" = {
enableACME = true;
forceSSL = true;
locations."/".proxyPass = "http://127.0.0.1:3000";
};
};
services.vaultwarden = {
enable = true;
backupDir = "/var/backup/vaultwarden";
environmentFile = "/var/lib/vaultwarden/vaultwarden.env";
config = {
DOMAIN = "https://vault.barrettruth.com";
SIGNUPS_ALLOWED = false;
ROCKET_ADDRESS = "127.0.0.1";
ROCKET_PORT = 8222;
};
};
services.forgejo = {
enable = true;
settings = {
server = {
DOMAIN = "git.barrettruth.com";
ROOT_URL = "https://git.barrettruth.com/";
HTTP_PORT = 3000;
};
service.DISABLE_REGISTRATION = true;
};
};
environment.systemPackages = with pkgs; [
vim
git
];
nix.settings = {
auto-optimise-store = true;
experimental-features = [
"nix-command"
"flakes"
];
};
nix.gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
system.stateVersion = "24.11";
}

View file

@ -1,32 +0,0 @@
{
disko.devices.disk.main = {
type = "disk";
device = "/dev/vda";
content = {
type = "gpt";
partitions = {
boot = {
size = "1M";
type = "EF02";
};
esp = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
root = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
};
};
};
}

1
new
View file

@ -1 +0,0 @@

View file

@ -126,7 +126,6 @@ audio)
--mesg="$header" --mesg-mode=expand \
--font="monospace:size=12" --width="$fw")
rc=$?
[ "$rc" = 10 ] && continue
[ "$rc" = 11 ] && {
wpctl set-volume "$node" 5%+ --limit 1.0
continue
@ -533,50 +532,6 @@ power)
"$shutdown") systemctl poweroff ;;
esac
;;
dictate)
require pw-record whisper-cli wl-copy notify-send
dtmp="${XDG_RUNTIME_DIR:-/tmp}/dictation"
mkdir -p "$dtmp"
dpid="$dtmp/rec_pid"
daudio="$dtmp/recording.wav"
dmodel="${DICTATE_MODEL:-large-v3-turbo}"
dmodel_dir="${XDG_DATA_HOME:-$HOME/.local/share}/whisper-models"
dmodel_file="$dmodel_dir/ggml-$dmodel.bin"
if [ -f "$dpid" ] && kill -0 "$(cat "$dpid")" 2>/dev/null; then
kill "$(cat "$dpid")" 2>/dev/null
rm -f "$dpid"
sleep 0.2
if [ ! -s "$daudio" ]; then
notify-send -a ctl -t 1250 "no audio"
exit 1
fi
notify-send -a ctl -t 1250 "transcribing..."
text=$(whisper-cli \
--model "$dmodel_file" \
--language "${DICTATE_LANG:-en}" \
--no-prints --no-timestamps \
"$daudio" 2>/dev/null | tr '\n' ' ' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | tr -s ' ')
rm -f "$daudio"
if [ -z "$text" ]; then
notify-send -a ctl -t 1250 "no speech detected"
exit 1
fi
printf '%s' "$text" | wl-copy
notify-send -a ctl -t 1250 "$text"
exit 0
fi
if [ ! -f "$dmodel_file" ]; then
notify-send -a ctl -t 1250 "downloading whisper $dmodel model..."
mkdir -p "$dmodel_dir"
curl -L -o "$dmodel_file" \
"https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-$dmodel.bin"
fi
notify-send -a ctl -t 1250 "recording..."
pw-record "$daudio" &
printf '%s' "$!" > "$dpid"
;;
idle)
require notify-send
if systemctl --user is-active --quiet hypridle.service; then
@ -590,7 +545,7 @@ idle)
fi
;;
*)
echo "Usage: ctl {screenshot|keyboard|audio|wifi|brightness|volume|media|wallpaper|power|idle|clip|dictate}" >&2
echo "Usage: ctl {screenshot|keyboard|audio|wifi|brightness|volume|media|wallpaper|power|idle|clip}" >&2
exit 1
;;
esac

View file

@ -1,13 +0,0 @@
#!/bin/sh
file="$1"
line="$2"
for sock in /run/user/"$(id -u)"/nvim.*.0; do
[ -S "$sock" ] || continue
result=$(nvim --headless --server "$sock" --remote-expr "bufnr('$file')" 2>/dev/null)
if [ "$result" != "-1" ] && [ -n "$result" ]; then
nvim --headless --server "$sock" --remote-expr "execute('b +$line $file | normal! zz')" >/dev/null 2>&1
exit 0
fi
done