new monitor and better auth
This commit is contained in:
parent
4c6e8a472f
commit
038a2f537d
@ -17,13 +17,22 @@ local tools = {
|
||||
"prettierd",
|
||||
}
|
||||
|
||||
-- DAP adapters that will be auto-installed based on your LSP servers
|
||||
local dap_adapters = {
|
||||
-- "js-debug-adapter", -- for ts_ls
|
||||
-- "codelldb", -- for clangd, rust_analyzer
|
||||
-- "debugpy", -- if you add python later
|
||||
"delve"
|
||||
}
|
||||
|
||||
local on_attach = function(_, bufnr)
|
||||
local map = function(key, func, desc)
|
||||
vim.keymap.set("n", key, func, { noremap = true, silent = true, desc = desc })
|
||||
vim.keymap.set("n", key, func, { noremap = true, silent = true, desc = desc, buffer = bufnr })
|
||||
end
|
||||
|
||||
local telescope = require("telescope.builtin")
|
||||
|
||||
-- LSP mappings
|
||||
map("<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", "[R]ename Symbol")
|
||||
map("<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", "[C]ode [A]ction")
|
||||
map("K", "<cmd>lua vim.lsp.buf.hover()<CR>", "[K] Hover")
|
||||
@ -33,6 +42,103 @@ local on_attach = function(_, bufnr)
|
||||
map("gI", telescope.lsp_implementations, "[G]o [I]mplementations")
|
||||
end
|
||||
|
||||
-- Auto-detect project type and setup DAP configurations
|
||||
local function setup_dap_configs()
|
||||
local dap = require("dap")
|
||||
|
||||
-- Project detection patterns
|
||||
local project_patterns = {
|
||||
typescript = { "package.json", "tsconfig.json", "*.ts", "*.tsx" },
|
||||
javascript = { "package.json", "*.js", "*.jsx" },
|
||||
rust = { "Cargo.toml", "*.rs" },
|
||||
cpp = { "CMakeLists.txt", "Makefile", "*.cpp", "*.c", "*.h" },
|
||||
c = { "Makefile", "*.c", "*.h" },
|
||||
}
|
||||
|
||||
local detected_languages = {}
|
||||
|
||||
-- Detect project types
|
||||
for lang, patterns in pairs(project_patterns) do
|
||||
for _, pattern in ipairs(patterns) do
|
||||
if vim.fn.glob(pattern) ~= "" then
|
||||
detected_languages[lang] = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Setup configurations for detected languages
|
||||
if detected_languages.typescript or detected_languages.javascript then
|
||||
dap.configurations.typescript = {
|
||||
{
|
||||
type = "pwa-node",
|
||||
request = "launch",
|
||||
name = "Launch file",
|
||||
program = "${file}",
|
||||
cwd = "${workspaceFolder}",
|
||||
},
|
||||
{
|
||||
type = "pwa-node",
|
||||
request = "attach",
|
||||
name = "Attach",
|
||||
processId = require("dap.utils").pick_process,
|
||||
cwd = "${workspaceFolder}",
|
||||
},
|
||||
}
|
||||
dap.configurations.javascript = dap.configurations.typescript
|
||||
end
|
||||
|
||||
if detected_languages.rust then
|
||||
dap.configurations.rust = {
|
||||
{
|
||||
type = "codelldb",
|
||||
request = "launch",
|
||||
name = "Launch file",
|
||||
program = function()
|
||||
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/target/debug/", "file")
|
||||
end,
|
||||
cwd = "${workspaceFolder}",
|
||||
stopOnEntry = false,
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
if detected_languages.cpp or detected_languages.c then
|
||||
dap.configurations.cpp = {
|
||||
{
|
||||
type = "codelldb",
|
||||
request = "launch",
|
||||
name = "Launch file",
|
||||
program = function()
|
||||
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
||||
end,
|
||||
cwd = "${workspaceFolder}",
|
||||
stopOnEntry = false,
|
||||
},
|
||||
}
|
||||
dap.configurations.c = dap.configurations.cpp
|
||||
end
|
||||
end
|
||||
|
||||
-- Setup DAP keymaps
|
||||
local function setup_dap_keymaps()
|
||||
local dap = require("dap")
|
||||
local map = function(key, func, desc)
|
||||
vim.keymap.set("n", key, func, { noremap = true, silent = true, desc = desc })
|
||||
end
|
||||
|
||||
map("<F5>", dap.continue, "DAP Continue")
|
||||
map("<F10>", dap.step_over, "DAP Step Over")
|
||||
map("<F11>", dap.step_into, "DAP Step Into")
|
||||
map("<F12>", dap.step_out, "DAP Step Out")
|
||||
map("<leader>b", dap.toggle_breakpoint, "Toggle Breakpoint")
|
||||
map("<leader>B", function()
|
||||
dap.set_breakpoint(vim.fn.input("Breakpoint condition: "))
|
||||
end, "Conditional Breakpoint")
|
||||
map("<leader>dr", dap.repl.open, "Open DAP REPL")
|
||||
map("<leader>dl", dap.run_last, "Run Last DAP")
|
||||
end
|
||||
|
||||
return {
|
||||
"williamboman/mason.nvim",
|
||||
dependencies = {
|
||||
@ -41,9 +147,15 @@ return {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"nvim-telescope/telescope.nvim",
|
||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||
|
||||
-- DAP dependencies
|
||||
"mfussenegger/nvim-dap",
|
||||
"jay-babu/mason-nvim-dap.nvim",
|
||||
-- Aggiunto none-ls per gestire formattatori e linter esterni
|
||||
"rcarriga/nvim-dap-ui",
|
||||
"theHamsta/nvim-dap-virtual-text",
|
||||
"nvim-neotest/nvim-nio",
|
||||
|
||||
-- Formatting/Linting
|
||||
"nvimtools/none-ls.nvim",
|
||||
{
|
||||
"folke/lazydev.nvim",
|
||||
@ -56,29 +168,32 @@ return {
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
-- Mason setup
|
||||
require("mason").setup()
|
||||
|
||||
-- Install tools and DAP adapters
|
||||
require("mason-tool-installer").setup({
|
||||
ensure_installed = tools,
|
||||
ensure_installed = vim.list_extend(tools, dap_adapters),
|
||||
automatic_installation = true,
|
||||
})
|
||||
|
||||
-- LSP setup
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = lsp_servers,
|
||||
automatic_installation = true,
|
||||
automatic_enable = true,
|
||||
})
|
||||
|
||||
-- None-ls setup
|
||||
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,
|
||||
},
|
||||
})
|
||||
|
||||
-- LSP server configurations
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
for _, lsp_server in pairs(lsp_servers) do
|
||||
@ -97,5 +212,79 @@ return {
|
||||
|
||||
require("lspconfig")[lsp_server].setup(server_config)
|
||||
end
|
||||
|
||||
require("mason-nvim-dap").setup({
|
||||
ensure_installed = dap_adapters,
|
||||
automatic_installation = true,
|
||||
-- handlers = {
|
||||
-- return function(config)
|
||||
-- require("mason-nvim-dap").default_setup(config)
|
||||
-- end,
|
||||
--
|
||||
-- -- -- Custom adapter configurations
|
||||
-- -- ["js-debug-adapter"] = function(config)
|
||||
-- -- config.adapters = {
|
||||
-- -- type = "server",
|
||||
-- -- host = "localhost",
|
||||
-- -- port = "${port}",
|
||||
-- -- executable = {
|
||||
-- -- command = "js-debug-adapter",
|
||||
-- -- args = { "${port}" },
|
||||
-- -- },
|
||||
-- -- }
|
||||
-- -- require("mason-nvim-dap").default_setup(config)
|
||||
-- -- end,
|
||||
-- },
|
||||
})
|
||||
|
||||
-- DAP UI setup
|
||||
local dap, dapui = require("dap"), require("dapui")
|
||||
dapui.setup({
|
||||
layouts = {
|
||||
{
|
||||
elements = {
|
||||
{ id = "scopes", size = 0.25 },
|
||||
{ id = "breakpoints", size = 0.25 },
|
||||
{ id = "stacks", size = 0.25 },
|
||||
{ id = "watches", size = 0.25 },
|
||||
},
|
||||
size = 40,
|
||||
position = "left",
|
||||
},
|
||||
{
|
||||
elements = { "repl", "console" },
|
||||
size = 10,
|
||||
position = "bottom",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- Auto-open/close DAP UI
|
||||
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||
dapui.close()
|
||||
end
|
||||
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||
dapui.close()
|
||||
end
|
||||
|
||||
-- DAP Virtual Text
|
||||
require("nvim-dap-virtual-text").setup({
|
||||
enabled = true,
|
||||
enabled_commands = true,
|
||||
highlight_changed_variables = true,
|
||||
highlight_new_as_changed = false,
|
||||
show_stop_reason = true,
|
||||
commented = false,
|
||||
})
|
||||
|
||||
-- Setup DAP configurations and keymaps
|
||||
setup_dap_configs()
|
||||
setup_dap_keymaps()
|
||||
|
||||
-- Additional DAP UI keymap
|
||||
vim.keymap.set("n", "<leader>du", dapui.toggle, { desc = "Toggle DAP UI" })
|
||||
end,
|
||||
}
|
||||
|
||||
14
pam/sudo
Normal file
14
pam/sudo
Normal file
@ -0,0 +1,14 @@
|
||||
#%PAM-1.0
|
||||
|
||||
# Try password first
|
||||
auth sufficient pam_unix.so try_first_pass
|
||||
|
||||
# If password fails/empty, try fingerprint
|
||||
auth sufficient pam_fprintd.so
|
||||
|
||||
# Final fallback to system-auth
|
||||
auth include system-auth
|
||||
|
||||
account include system-auth
|
||||
session include system-auth
|
||||
|
||||
31
pam/system-local-login
Normal file
31
pam/system-local-login
Normal file
@ -0,0 +1,31 @@
|
||||
# /etc/pam.d/system-local-login
|
||||
|
||||
#%PAM-1.0
|
||||
|
||||
# Skip the next module for specific services (sudo, su, su-l) or unknown TTYs.
|
||||
# For standard local login, this typically defaults to 'ignore' and proceeds.
|
||||
auth [success=1 default=ignore] pam_succeed_if.so service in sudo:su:su-l tty in :unknown
|
||||
|
||||
# 1. PASSWORD FIRST: Try password authentication as the primary method.
|
||||
# - sufficient: If correct password is provided, authentication succeeds immediately
|
||||
# and fingerprint is skipped entirely.
|
||||
# - If password is incorrect OR user just presses Enter (empty input),
|
||||
# this module fails and PAM continues to fingerprint.
|
||||
# - try_first_pass: Uses any pre-existing password input.
|
||||
# - nullok: Allows accounts with empty passwords (if configured).
|
||||
auth sufficient pam_unix.so try_first_pass nullok
|
||||
|
||||
# 2. FINGERPRINT FALLBACK: If password failed/was empty, try fingerprint.
|
||||
# - sufficient: If fingerprint succeeds, authentication passes.
|
||||
# - If fingerprint fails or times out, this module fails and PAM continues.
|
||||
auth sufficient pam_fprintd.so
|
||||
|
||||
# 3. FINAL FALLBACK: If both password and fingerprint failed, include system-login
|
||||
# as a required step. This ensures proper faillock handling and forces
|
||||
# password authentication if no other method succeeded.
|
||||
auth include system-login
|
||||
|
||||
# Standard includes for account management, password changes, and session setup
|
||||
account include system-login
|
||||
password include system-login
|
||||
session include system-login
|
||||
@ -10,7 +10,10 @@ set $menu wofi -S drun -p Search -I -b -i
|
||||
|
||||
# Wallpaper e output
|
||||
set $wallpaper ~/Nextcloud/wallpapers/laptop/hiroishi_nagasai.png
|
||||
set $benq_wallpaper ~/Nextcloud/wallpapers/laptop/hiroishi_nagasai.png
|
||||
|
||||
set $laptop eDP-1
|
||||
set $benq DP-9
|
||||
|
||||
# Color Scheme (Gruvbox)
|
||||
set $gruvbox_bg_dark #282828
|
||||
@ -31,6 +34,11 @@ output * bg $wallpaper fill
|
||||
output $laptop color_profile icc ~/Documents/dotfiles/BOE_CQ_______NE135FBM_N41_03.icm
|
||||
output $laptop resolution 2256x1504 position 0,0
|
||||
output $laptop scale 1.3
|
||||
# Configure BenQ display
|
||||
output $benq bg $benq_wallpaper fill
|
||||
output $benq resolution 2560x1440@99.990Hz position 0,0
|
||||
# Optional: Add ICC profile if available
|
||||
# output $benq color_profile icc ~/path/to/benq_pd2706qn.icm
|
||||
|
||||
# Gestione degli eventi del coperchio
|
||||
bindswitch --reload --locked lid:on output $laptop disable
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user