From 186a6f0a91c3ff28d31c39b3910c091de3a5b366 Mon Sep 17 00:00:00 2001 From: Dmitri Date: Thu, 19 Jun 2025 09:50:51 +0200 Subject: [PATCH] a --- hypr/hyprland.conf | 9 +++- hypr/scripts/lid_close.sh | 17 +++++++ mpv/mpv.conf | 25 ++++++++++ nvim/lua/kanopo/options.lua | 3 +- nvim/lua/kanopo/plugins/cmp.lua | 18 ++++---- nvim/lua/kanopo/plugins/lsp.lua | 59 +++++++++--------------- nvim/lua/kanopo/plugins/precognition.lua | 30 ++++++++++++ nvim/lua/kanopo/plugins/trouble.lua | 37 +++++++++++++++ tmux/tmux.conf | 3 +- yt-dlp/config | 39 +++++++++++++++- 10 files changed, 192 insertions(+), 48 deletions(-) create mode 100755 hypr/scripts/lid_close.sh create mode 100644 mpv/mpv.conf create mode 100644 nvim/lua/kanopo/plugins/precognition.lua create mode 100644 nvim/lua/kanopo/plugins/trouble.lua diff --git a/hypr/hyprland.conf b/hypr/hyprland.conf index 8ceff73..12d120f 100644 --- a/hypr/hyprland.conf +++ b/hypr/hyprland.conf @@ -29,7 +29,14 @@ exec-once = wl-paste --type text --watch cliphist store exec-once = wl-paste --type image --watch cliphist store exec-once = /usr/lib/polkit-kde-authentication-agent-1 exec-once = gnome-keyring-daemon --start --components=pkcs11,secrets,ssh -exec-once = swayidle -w +# exec-once = swayidle -w +exec-once = swayidle -w \ + timeout 300 'swaylock -f' \ + timeout 600 'hyprctl dispatch dpms off' \ + resume 'hyprctl dispatch dpms on' \ + before-sleep 'swaylock -f' \ + lock 'swaylock -f' \ + event lid:on 'bash ~/.config/hypr/scripts/lid_suspend.sh' ############################# ### ENVIRONMENT VARIABLES ### diff --git a/hypr/scripts/lid_close.sh b/hypr/scripts/lid_close.sh new file mode 100755 index 0000000..113a6f7 --- /dev/null +++ b/hypr/scripts/lid_close.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# ~/.config/hypr/scripts/lid_suspend.sh +# Script per sospendere il sistema alla chiusura del coperchio, +# mettendo prima in pausa la riproduzione multimediale. + +# Controlla se è collegato un solo monitor (quello del laptop). +if [[ $(hyprctl monitors | grep -c 'Monitor') -eq 1 ]]; then + # Controlla se playerctl è installato e se c'è qualcosa in riproduzione. + # Se sì, mette in pausa tutti i lettori multimediali compatibili + # (es. Spotify, browser, VLC, etc.). + if command -v playerctl &> /dev/null && playerctl status &> /dev/null; then + playerctl --all pause + fi + + # Sospende il sistema. + systemctl suspend +fi diff --git a/mpv/mpv.conf b/mpv/mpv.conf new file mode 100644 index 0000000..e43d715 --- /dev/null +++ b/mpv/mpv.conf @@ -0,0 +1,25 @@ +# ----------------- +# GENERAL PLAYBACK +# ----------------- +# Save playback position on quit +save-position-on-quit=yes + +# Don't close the window when playback finishes +keep-open=yes + +# Set default volume to 70% +volume=70 + + +# ----------------- +# VIDEO & PERFORMANCE +# ----------------- +# Enable hardware video decoding. 'auto-safe' is a good default. +# It tries to find a working hardware decoder but avoids problematic ones. +hwdec=auto-safe + +# High-quality upscaling for when video resolution is lower than your screen. +profile=high-quality +scale=ewa_lanczossharp +cscale=ewa_lanczossharp + diff --git a/nvim/lua/kanopo/options.lua b/nvim/lua/kanopo/options.lua index 0ccbd87..0a61e67 100644 --- a/nvim/lua/kanopo/options.lua +++ b/nvim/lua/kanopo/options.lua @@ -1,4 +1,5 @@ -- options.lua +vim.opt.cmdheight = 0 -- Leader key for all the keymaps vim.g.mapleader = " " @@ -59,7 +60,7 @@ local ft_augroup = vim.api.nvim_create_augroup("FileTypeSettings", { clear = tru -- C, C++, etc: 4-space indentation vim.api.nvim_create_autocmd("FileType", { group = ft_augroup, - pattern = { "c", "cpp", "objc", "objcpp" }, + pattern = { "c", "cpp", "objc", "objcpp", "js", "ts", "tsx", "jsx" }, callback = function() -- Use vim.bo for buffer-local options vim.bo.tabstop = 2 diff --git a/nvim/lua/kanopo/plugins/cmp.lua b/nvim/lua/kanopo/plugins/cmp.lua index 058a2e3..939c9b3 100644 --- a/nvim/lua/kanopo/plugins/cmp.lua +++ b/nvim/lua/kanopo/plugins/cmp.lua @@ -13,6 +13,7 @@ return { }, }, "onsails/lspkind-nvim", + "js-everts/cmp-tailwind-colors" }, config = function() local cmp = require("cmp") @@ -81,14 +82,15 @@ return { }), }), formatting = { - expandable_indicator = true, - fields = { "kind", "abbr", "menu" }, - format = lspkind.cmp_format({ - mode = "symbol", - maxwidth = 50, - ellipsis = "...", - show_labelDetails = true, - }), + format = require("cmp-tailwind-colors").format + -- expandable_indicator = true, + -- fields = { "kind", "abbr", "menu" }, + -- format = lspkind.cmp_format({ + -- mode = "symbol", + -- maxwidth = 50, + -- ellipsis = "...", + -- show_labelDetails = true, + -- }), }, sources = { { name = "nvim_lsp" }, diff --git a/nvim/lua/kanopo/plugins/lsp.lua b/nvim/lua/kanopo/plugins/lsp.lua index c29268b..824a184 100644 --- a/nvim/lua/kanopo/plugins/lsp.lua +++ b/nvim/lua/kanopo/plugins/lsp.lua @@ -8,13 +8,13 @@ local lsp_servers = { "tailwindcss", "cssls", "clangd", - "rust_analyzer" + "rust_analyzer", } local tools = { "luacheck", "latexindent", - "prettierd" + "prettierd", } local on_attach = function(_, bufnr) @@ -24,7 +24,6 @@ local on_attach = function(_, bufnr) local telescope = require("telescope.builtin") - -- LSP actions map("rn", "lua vim.lsp.buf.rename()", "[R]ename Symbol") map("ca", "lua vim.lsp.buf.code_action()", "[C]ode [A]ction") map("K", "lua vim.lsp.buf.hover()", "[K] Hover") @@ -32,7 +31,6 @@ local on_attach = function(_, bufnr) map("gd", telescope.lsp_definitions, "[G]o [D]efinition") map("gr", telescope.lsp_references, "[G]o [R]eferences") map("gI", telescope.lsp_implementations, "[G]o [I]mplementations") - -- map("gD", telescope.diagnostics, "Diagnostics") end return { @@ -41,10 +39,12 @@ return { "williamboman/mason-lspconfig.nvim", "neovim/nvim-lspconfig", "hrsh7th/cmp-nvim-lsp", - 'nvim-telescope/telescope.nvim', + "nvim-telescope/telescope.nvim", "WhoIsSethDaniel/mason-tool-installer.nvim", "mfussenegger/nvim-dap", "jay-babu/mason-nvim-dap.nvim", + -- Aggiunto none-ls per gestire formattatori e linter esterni + "nvimtools/none-ls.nvim", { "folke/lazydev.nvim", ft = "lua", @@ -59,16 +59,29 @@ return { require("mason").setup() require("mason-tool-installer").setup({ ensure_installed = tools, - automatic_installation = true + automatic_installation = true, }) require("mason-lspconfig").setup({ ensure_installed = lsp_servers, - automatic_installation = true + automatic_installation = true, + automatic_enable = true, }) - local capabilities = require('cmp_nvim_lsp').default_capabilities() + -- [[ NUOVA SEZIONE: Configurazione Formatter e Linter con none-ls ]] + local null_ls = require("null-ls") + null_ls.setup({ + sources = { + -- Formatter + null_ls.builtins.formatting.prettierd, + null_ls.builtins.formatting.latexindent, + + -- -- Linter (diagnostics) + -- null_ls.builtins.diagnostics.luacheck, + }, + }) + + local capabilities = require("cmp_nvim_lsp").default_capabilities() - -- Loop through all servers to set them up for _, lsp_server in pairs(lsp_servers) do local server_config = { on_attach = on_attach, @@ -78,38 +91,12 @@ return { if lsp_server == "texlab" then server_config.settings = { texlab = { - bibtexFormatter = "texlab", - build = { - args = { "-pdf", "-interaction=nonstopmode", "-synctex=1", "%f" }, - executable = "latexmk", - forwardSearchAfter = false, - onSave = false, - }, - chktex = { - onEdit = false, - onOpenAndSave = false, - }, - diagnosticsDelay = 300, - formatterLineLength = 80, - forwardSearch = { - args = {}, - }, latexFormatter = "latexindent", - latexindent = { - modifyLineBreaks = false, - }, }, } - -- Puoi aggiungere altri server con configurazioni specifiche qui - -- elseif lsp_server == "another_lsp_server" then - -- server_config.settings = { - -- another_lsp_server = { - -- -- le tue impostazioni per questo server - -- } - -- } end require("lspconfig")[lsp_server].setup(server_config) end - end + end, } diff --git a/nvim/lua/kanopo/plugins/precognition.lua b/nvim/lua/kanopo/plugins/precognition.lua new file mode 100644 index 0000000..355c34e --- /dev/null +++ b/nvim/lua/kanopo/plugins/precognition.lua @@ -0,0 +1,30 @@ +return { + "tris203/precognition.nvim", + event = "VeryLazy", + opts = { + -- startVisible = true, + -- showBlankVirtLine = true, + -- highlightColor = { link = "Comment" }, + -- hints = { + -- Caret = { text = "^", prio = 2 }, + -- Dollar = { text = "$", prio = 1 }, + -- MatchingPair = { text = "%", prio = 5 }, + -- Zero = { text = "0", prio = 1 }, + -- w = { text = "w", prio = 10 }, + -- b = { text = "b", prio = 9 }, + -- e = { text = "e", prio = 8 }, + -- W = { text = "W", prio = 7 }, + -- B = { text = "B", prio = 6 }, + -- E = { text = "E", prio = 5 }, + -- }, + -- gutterHints = { + -- G = { text = "G", prio = 10 }, + -- gg = { text = "gg", prio = 9 }, + -- PrevParagraph = { text = "{", prio = 8 }, + -- NextParagraph = { text = "}", prio = 8 }, + -- }, + -- disabled_fts = { + -- "startify", + -- }, + }, +} diff --git a/nvim/lua/kanopo/plugins/trouble.lua b/nvim/lua/kanopo/plugins/trouble.lua new file mode 100644 index 0000000..e3ae746 --- /dev/null +++ b/nvim/lua/kanopo/plugins/trouble.lua @@ -0,0 +1,37 @@ +return { + "folke/trouble.nvim", + opts = {}, -- for default options, refer to the configuration section for custom setup. + cmd = "Trouble", + keys = { + { + "xx", + "Trouble diagnostics toggle", + desc = "Diagnostics (Trouble)", + }, + { + "xX", + "Trouble diagnostics toggle filter.buf=0", + desc = "Buffer Diagnostics (Trouble)", + }, + { + "cs", + "Trouble symbols toggle focus=false", + desc = "Symbols (Trouble)", + }, + { + "cl", + "Trouble lsp toggle focus=false win.position=right", + desc = "LSP Definitions / references / ... (Trouble)", + }, + { + "xL", + "Trouble loclist toggle", + desc = "Location List (Trouble)", + }, + { + "xQ", + "Trouble qflist toggle", + desc = "Quickfix List (Trouble)", + }, + }, +} diff --git a/tmux/tmux.conf b/tmux/tmux.conf index 7cbd2ed..3d85e7c 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -2,7 +2,8 @@ # set-option -g status-style bg=colour235,fg=colour136,default # bg=base02, fg=yellow set-option -g focus-events on -set-option -g default-terminal "screen-256color" +# set-option -g default-terminal "screen-256color" +set-option -a terminal-features 'alacritty:RGB' # easy reload config bind-key r source-file ~/.config/tmux/tmux.conf \; display-message "reloaded." diff --git a/yt-dlp/config b/yt-dlp/config index 20ed844..39b7d5b 100644 --- a/yt-dlp/config +++ b/yt-dlp/config @@ -1 +1,38 @@ -# -f ytdl-format=bestvideo[height>=?1440][vcodec^=vp9]+bestaudio/bestvideo[height<=?1440][vcodec^=av0]+bestaudio/bestvideo+bestaudio/best +# +# +# # Prioritize 60fps at 1080p. +# -f "bestvideo[height=1080][fps>30]+bestaudio/bestvideo[height<=1080]+bestaudio/best" +# +# +# # Prefer AV1 codec, best video, best audio. Fallback to best overall. +# -f "bestvideo[vcodec^=av01]+bestaudio/bestvideo+bestaudio/best" + + +# This is a comment. Lines starting with # are ignored. + +# ----------------- +# QUALITY SELECTION +# ----------------- +# Use the -f or --format option to select quality. +# The format is: +/ +# This example tries to get the best video up to 1080p with the best audio. +# If a combined stream is not available, it merges the best separate streams. +# 'best' is a fallback if nothing else matches. +-f "bestvideo[height<=1080]+bestaudio/best" + + +# ----------------- +# OTHER USEFUL OPTIONS +# ----------------- + +# Download subtitles if available (e.g., for saving files) +# --write-subs +# --sub-lang "en.*,en" + +# Prefer free formats when available +# --prefer-free-formats + +# Use a sponsorblock remover to skip ad segments in the video data +# This is useful for both streaming and downloading. +--sponsorblock-mark all +--sponsorblock-remove sponsor,selfpromo