Compare commits

...

11 Commits

Author SHA1 Message Date
8f1d3cc383
ciao 2025-11-18 16:39:36 +01:00
a008bd33b1
siu 2025-11-10 20:02:52 +01:00
31caf2c391
notifications for media controls 2025-11-07 09:36:15 +01:00
1b31f4dd4d
sway with notification center 2025-11-07 08:57:38 +01:00
06f4d43e7e
ciao 2025-10-23 09:07:27 +02:00
a8c152e766
mpv loop across playlist 2025-10-11 17:12:23 +02:00
39b78f3b43
removed unused stuff 2025-10-11 16:30:14 +02:00
1b7077d75b
nixos 2025-10-03 21:55:25 +02:00
87a251f269
ciao 2025-09-23 20:23:43 +02:00
afd441c0f2
stuff 2025-09-23 19:27:35 +02:00
f80bcc68b6
rework simple cmp and simple native lsp 2025-09-22 23:05:49 +02:00
34 changed files with 1105 additions and 778 deletions

37
.zshrc
View File

@ -14,31 +14,22 @@ plug "zsh-users/zsh-syntax-highlighting"
plug "wintermi/zsh-lsd" plug "wintermi/zsh-lsd"
plug "romkatv/powerlevel10k" plug "romkatv/powerlevel10k"
# plug "zap-zsh/nvm" # plug "zap-zsh/nvm"
#
#
# Load and initialise completion system # # Load and initialise completion system
autoload -Uz compinit # autoload -Uz compinit
fpath+=~/.zfunc # fpath+=~/.zfunc
compinit # compinit
# # nvm initialization # # nvm initialization
# source /usr/share/nvm/init-nvm.sh # source /usr/share/nvm/init-nvm.sh
XDG_CURRENT_DESKTOP="${XDG_CURRENT_DESKTOP:-sway}"
MOZ_ENABLE_WAYLAND=1
alias v="nvim" alias v="nvim"
alias conservation-on="sudo ectool chargecontrol normal 80 80" alias conservation-on="sudo ectool chargecontrol normal 80 80"
alias conservation-off="sudo ectool chargecontrol normal" alias conservation-off="sudo ectool chargecontrol normal"
# alias orphans="sudo pacman -Qtdq | sudo pacman -Rns -" alias orphans="sudo pacman -Qtdq | sudo pacman -Rns -"
# Define variables for monitor names
LAPTOP_MONITOR="eDP-1"
EXTERNAL_MONITOR="DP-2"
# Alias to disable laptop screen (only if external is connected)
alias laptop-screen-off='if xrandr | grep "$EXTERNAL_MONITOR connected"; then swaymsg output $LAPTOP_MONITOR disable; echo "Laptop screen disabled."; else echo "External monitor not connected. Keeping laptop screen on."; fi'
# Alias to enable laptop screen
alias laptop-screen-on='swaymsg output $LAPTOP_MONITOR enable; echo "Laptop screen enabled."'
alias space="du -hsx * | sort -rh | head -10" alias space="du -hsx * | sort -rh | head -10"
@ -47,10 +38,12 @@ export GPG_TTY=$(tty)
export EDITOR="nvim" export EDITOR="nvim"
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
source ~/.cargo/env
export GOROOT="$HOME/.local/bin/go" #THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export GOPATH="$HOME/.go" export SDKMAN_DIR="$HOME/.sdkman"
export PATH="$GOROOT/bin:$GOPATH/bin:$PATH" [[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"
# [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion

View File

@ -17,3 +17,5 @@ npm config set prefix '~/.npm-global'
FONT FONT
https://github.com/ryanoasis/nerd-fonts/releases/download/v3.4.0/Inconsolata.zip https://github.com/ryanoasis/nerd-fonts/releases/download/v3.4.0/Inconsolata.zip
- (guida per installare i nerd fonts)[https://blog.khmersite.net/p/installing-nerd-font-on-fedora/]
- (iosevka)[https://release-assets.githubusercontent.com/github-production-release-asset/27574418/da264fe4-47cc-4350-acd3-4435de81106e?sp=r&sv=2018-11-09&sr=b&spr=https&se=2025-10-23T07%3A54%3A53Z&rscd=attachment%3B+filename%3DIntelOneMono.zip&rsct=application%2Foctet-stream&skoid=96c2d410-5711-43a1-aedd-ab1947aa7ab0&sktid=398a6654-997b-47e9-b12b-9515b896b4de&skt=2025-10-23T06%3A54%3A07Z&ske=2025-10-23T07%3A54%3A53Z&sks=b&skv=2018-11-09&sig=mxyF4BWvhxi8ePVdXlPnWk6t3vY5m5xd4t7W%2BRZhL%2FU%3D&jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmVsZWFzZS1hc3NldHMuZ2l0aHVidXNlcmNvbnRlbnQuY29tIiwia2V5Ijoia2V5MSIsImV4cCI6MTc2MTIwNDkzMywibmJmIjoxNzYxMjAzMTMzLCJwYXRoIjoicmVsZWFzZWFzc2V0cHJvZHVjdGlvbi5ibG9iLmNvcmUud2luZG93cy5uZXQifQ.m4n0dZ3ElI-zBBX281ciSWgdS8tedJihBq-_FfVpY1E&response-content-disposition=attachment%3B%20filename%3DIntelOneMono.zip&response-content-type=application%2Foctet-stream]

View File

@ -1,8 +1,7 @@
#!/bin/bash #!/bin/bash
ln -s ~/Documents/dotfiles/alacritty ~/.config/ # ln -s ~/Documents/dotfiles/alacritty ~/.config/
ln -s ~/Documents/dotfiles/foot ~/.config/ ln -s ~/Documents/dotfiles/foot ~/.config/
ln -s ~/Documents/dotfiles/.gitconfig ~/
ln -s ~/Documents/dotfiles/mako ~/.config/ ln -s ~/Documents/dotfiles/mako ~/.config/
ln -s ~/Documents/dotfiles/mpv ~/.config/ ln -s ~/Documents/dotfiles/mpv ~/.config/
ln -s ~/Documents/dotfiles/nvim ~/.config/ ln -s ~/Documents/dotfiles/nvim ~/.config/
@ -15,3 +14,4 @@ ln -s ~/Documents/dotfiles/wofi ~/.config/
ln -s ~/Documents/dotfiles/yt-dlp ~/.config/ ln -s ~/Documents/dotfiles/yt-dlp ~/.config/
ln -s ~/Documents/dotfiles/zathura ~/.config/ ln -s ~/Documents/dotfiles/zathura ~/.config/
ln -s ~/Documents/dotfiles/.zshrc ~/ ln -s ~/Documents/dotfiles/.zshrc ~/
ln -s ~/Documents/dotfiles/.gitconfig ~/

View File

@ -22,3 +22,6 @@ profile=high-quality
scale=ewa_lanczossharp scale=ewa_lanczossharp
cscale=ewa_lanczossharp cscale=ewa_lanczossharp
loop-playlist=inf
shuffle=yes

View File

@ -0,0 +1,243 @@
Excellent question. The fact that this happens *sometimes* is the key to understanding the problem. It points to a race condition or a conflict between the different services managing your network, specifically `NetworkManager` and `systemd-resolved`, based on the information your router is providing.
Here's a breakdown of the moving parts and why they sometimes fail to cooperate.
### The Actors on Your System
1. **The Router (The Source of Truth):**
* When you connect to Wi-Fi, your router provides network configuration information.
* For IPv4, it uses **DHCP** to give you an IP address, a gateway, and DNS servers.
* For IPv6, it uses **Router Advertisements (RAs)** and/or **DHCPv6**. RAs can include information about which DNS servers to use.
* **The Core Issue:** Some routers, especially consumer-grade ones, are poorly configured. They advertise their own **link-local** (`fe80::...`) address as the DNS server in their IPv6 RAs. This is technically valid but problematic for many client systems.
2. **NetworkManager (The Connection Manager):**
* Its job is to manage network interfaces (like `wlp1s0`). It brings the Wi-Fi up, handles authentication, and listens for the configuration data from your router (both DHCP and RAs).
* When it receives the DNS server information, it needs to pass it on to the system's resolver.
3. **systemd-resolved (The DNS Resolver):**
* This is the service that actually performs the DNS lookups for your applications (like your web browser). It's designed to be a central clearinghouse for DNS. It maintains a list of all DNS servers learned from all network interfaces, caches results, and can handle advanced protocols like DNS-over-TLS.
### The Conflict: Who Controls `/etc/resolv.conf`?
The problem arises from how `NetworkManager` and `systemd-resolved` are configured to interact, and which one gets the final say over the `/etc/resolv.conf` file. There are two common modes:
1. **Mode A: `NetworkManager` is in control (Your likely situation).**
* In this setup, `NetworkManager` takes the DNS server information it receives from the router and writes it *directly* into `/etc/resolv.conf`.
* The file comment `# Generated by NetworkManager` is the evidence for this.
* When your router sends that bad `fe80::1%wlp1s0` address, `NetworkManager` dutifully writes it into the file, and your system's DNS breaks.
2. **Mode B: `systemd-resolved` is in control (The modern, recommended setup).**
* `NetworkManager` is configured to pass all the DNS information it learns to `systemd-resolved` via an internal system bus (D-Bus).
* `systemd-resolved` then manages the DNS servers internally.
* `/etc/resolv.conf` is then symlinked to a file managed by `systemd-resolved` (like `/run/systemd/resolve/stub-resolv.conf`), which contains only `nameserver 127.0.0.53`. This points all system queries to the local `systemd-resolved` daemon, which then intelligently forwards them to the correct upstream servers.
### Why "Sometimes"? The Race Condition
The fact that it's intermittent strongly suggests a race condition between your IPv4 and IPv6 configuration on startup or reconnect.
* **Scenario 1 (Everything Works):** Your system connects, the IPv4 DHCP negotiation finishes first. `NetworkManager` gets a valid IPv4 DNS server (e.g., `8.8.8.8` or your ISP's) and writes it to `/etc/resolv.conf`. A moment later, the problematic IPv6 RA arrives, but `NetworkManager` might prioritize or already be using the working IPv4 server.
* **Scenario 2 (DNS Breaks):** Your system connects, but the IPv6 Router Advertisement is processed first. `NetworkManager` receives the `fe80::1%wlp1s0` address and writes it to `/etc/resolv.conf`. DNS is broken from the start. A few moments later, the IPv4 address might arrive, but `NetworkManager` might not update the config file, leaving the broken one in place. This can also happen after waking from suspend. Such intermittent failures are a known class of bugs [github.com](https://github.com/systemd/systemd/issues/21123).
As one user on a forum described a similar situation, "After doing a -Syu and reboot, I no longer have access to the internet system-wide. I can ping 8.8.8.8 but not ping google.com" this is the classic symptom you are experiencing [forum.endeavouros.com](https://forum.endeavouros.com/t/no-internet-dns-issues-after-update-networkmanager-systemd-resolved-on-kde/69865).
---
### How to Verify and Fix This Permanently
The best solution is to switch to the modern setup where `systemd-resolved` is in full control.
#### Step 1: Check Your Current `resolv.conf` Setup
Run this command to see what `/etc/resolv.conf` really is:
```bash
ls -l /etc/resolv.conf
```
* **If it shows a file (`-rw-r--r-- ...`)**, you are in the problematic Mode A.
* **If it shows a symlink (`lrwxrwxrwx ... -> ../run/systemd/resolve/stub-resolv.conf`)**, you are in Mode B, but `NetworkManager` might still be misconfigured.
#### Step 2: Configure NetworkManager to Use `systemd-resolved`
1. Edit the main NetworkManager configuration file:
```bash
sudo nano /etc/NetworkManager/NetworkManager.conf
```
2. In the `[main]` section, add or uncomment the `dns` line and set it to `systemd-resolved`:
```ini
[main]
plugins=ifupdown,keyfile
dns=systemd-resolved
[ifupdown]
managed=false
```
3. Save the file and exit.
#### Step 3: Enable `systemd-resolved` and Create the Correct Symlink
1. First, ensure the service is running:
```bash
sudo systemctl enable systemd-resolved.service
sudo systemctl start systemd-resolved.service
```
2. Next, remove the static file and create the correct symlink. This forces the system to use the local `systemd-resolved` stub resolver.
```bash
# IMPORTANT: Back up the old file first
sudo mv /etc/resolv.conf /etc/resolv.conf.bak
# Create the symlink
sudo ln -s /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
```
#### Step 4: Restart and Verify
Restart `NetworkManager` to apply all the changes.
```bash
sudo systemctl restart NetworkManager
```
Now, your DNS should work reliably. Check your `resolv.conf` to confirm it points to `127.0.0.53`. To see the *actual* DNS servers your system is now using (which it gets from `NetworkManager`), use the `resolvectl` command:
```bash
resolvectl status
```
This will give you a detailed report, showing the DNS servers for each interface (like `wlp1s0`). Even if the problematic `fe80::` address is listed there, `systemd-resolved` is smart enough to ignore or fall back from it if it doesn't work, preventing a total DNS outage.
Excellent! You've correctly identified that you're in "Mode A," where `NetworkManager` writes directly to `/etc/resolv.conf`. Switching to the modern approach where `systemd-resolved` handles everything is the most robust and permanent solution.
Let's walk through the process step-by-step. This is a standard and safe procedure on most modern Linux distributions.
---
### Step-by-Step Guide to Switch to `systemd-resolved`
We are going to reconfigure your system so that:
1. `NetworkManager` passes DNS information to `systemd-resolved`.
2. `systemd-resolved` manages all DNS lookups.
3. `/etc/resolv.conf` points to the local `systemd-resolved` service.
#### Step 1: Configure NetworkManager
First, we need to tell `NetworkManager` to stop managing `/etc/resolv.conf` by itself and start sending its DNS information to `systemd-resolved`.
1. Open the `NetworkManager.conf` file with a text editor and `sudo` privileges:
```bash
sudo nano /etc/NetworkManager/NetworkManager.conf
```
2. Find the `[main]` section. Add a `dns` line and set it to `systemd-resolved`. If the line already exists but is set to something else (like `default`), change it.
**Your file should look like this:**
```ini
[main]
plugins=ifupdown,keyfile
dns=systemd-resolved
[ifupdown]
managed=false
```
*(Note: You might have other settings in the `[main]` section. Just make sure the `dns=systemd-resolved` line is present and correct.)*
3. Save the file and exit the editor (in `nano`, press `Ctrl+O`, then `Enter` to save, and `Ctrl+X` to exit).
#### Step 2: Enable and Start `systemd-resolved`
Now, let's make sure the `systemd-resolved` service is active and will start automatically on boot.
```bash
# Enable the service to start on every boot
sudo systemctl enable systemd-resolved.service
# Start the service right now
sudo systemctl start systemd-resolved.service
```
#### Step 3: Recreate `/etc/resolv.conf` as a Symlink
This is the most important step. We will replace the static file that `NetworkManager` used to write with a symbolic link to the `resolv.conf` file that `systemd-resolved` provides.
1. **Important:** Back up your current `resolv.conf` file. This lets you easily revert if something goes wrong.
```bash
sudo mv /etc/resolv.conf /etc/resolv.conf.bak
```
This command safely renames the file.
2. Create the new symbolic link:
```bash
sudo ln -s /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
```
This links `/etc/resolv.conf` to the "stub" resolver file, which correctly points all DNS queries to the local `systemd-resolved` daemon.
#### Step 4: Restart NetworkManager and Verify
Finally, restart `NetworkManager` to apply all the changes and verify that everything is working.
1. Restart the service:
```bash
sudo systemctl restart NetworkManager
```
2. **Verify the symlink:** Check that `/etc/resolv.conf` is now a link.
```bash
ls -l /etc/resolv.conf
```
The output should look like this (colors and dates will vary):
```
lrwxrwxrwx 1 root root 39 Nov 18 10:30 /etc/resolv.conf -> /run/systemd/resolve/stub-resolv.conf
```
3. **Verify the content:** Check what's inside the new `resolv.conf`.
```bash
cat /etc/resolv.conf
```
The output should show `127.0.0.53` as the nameserver. This is the local `systemd-resolved` stub resolver.
```
# This file is managed by man:systemd-resolved(8). Do not edit.
...
nameserver 127.0.0.53
options edns0 trust-ad
```
4. **Check the REAL DNS servers:** Use `resolvectl` to see which DNS servers `systemd-resolved` is actually using (which it learned from `NetworkManager`).
```bash
resolvectl status
```
This will give you a detailed report. Look for the section corresponding to your Wi-Fi interface (`wlp1s0`). You will see the actual IP addresses of the DNS servers it is using. Even if the problematic `fe80::` address is listed, `systemd-resolved` is much more resilient and will fall back to other working servers.
5. **Final Test:**
```bash
ping archlinux.org
```
If you get a reply, congratulations! Your DNS is now being managed robustly by `systemd-resolved`.
---
### How to Revert (If Needed)
If anything goes wrong, you can easily go back to the old setup:
1. **Restore the old `resolv.conf`:**
```bash
sudo mv /etc/resolv.conf.bak /etc/resolv.conf
```
2. **Edit `NetworkManager.conf` again:**
```bash
sudo nano /etc/NetworkManager/NetworkManager.conf
```
Remove the `dns=systemd-resolved` line, or change it back to `dns=default`.
3. **Restart NetworkManager:**
```bash
sudo systemctl restart NetworkManager
```

View File

@ -1,8 +1,8 @@
root = true root = true
# Unix-style newlines with a newline ending every file # Unix-style newlines with a newline ending every file
[*] [*.lua]
end_of_line = lf end_of_line = lf
insert_final_newline = true insert_final_newline = true
indent_style = space indent_style = space
indent_size = 4 indent_size = 2

View File

@ -1,3 +1,4 @@
require("kanopo.options") require("kanopo.options")
require("kanopo.lazy") require("kanopo.keymaps")
require("kanopo.autocmds") require("kanopo.autocmds")
require("kanopo.lazy")

View File

@ -1,23 +1,3 @@
-- autoformat on save file
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args)
local client = vim.lsp.get_client_by_id(args.data.client_id)
if not client then return end
if client.supports_method("textDocument/formatting") then
vim.api.nvim_create_autocmd("BufWritePre", {
buffer = args.buf,
callback = function()
vim.lsp.buf.format({
bufnr = args.buf,
id = client.id
})
end
})
end
end
})
-- Highlight yanked text -- Highlight yanked text
local highlight_group = vim.api.nvim_create_augroup("YankHighlight", { clear = true }) local highlight_group = vim.api.nvim_create_augroup("YankHighlight", { clear = true })
vim.api.nvim_create_autocmd("TextYankPost", { vim.api.nvim_create_autocmd("TextYankPost", {
@ -28,7 +8,6 @@ vim.api.nvim_create_autocmd("TextYankPost", {
pattern = "*", pattern = "*",
}) })
-- Go to last cursor position when opening a file -- Go to last cursor position when opening a file
vim.api.nvim_create_autocmd("BufReadPost", { vim.api.nvim_create_autocmd("BufReadPost", {
callback = function() callback = function()
@ -41,3 +20,21 @@ vim.api.nvim_create_autocmd("BufReadPost", {
end end
end, end,
}) })
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('my.lsp', {}),
callback = function(args)
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
-- Usually not needed if server supports "textDocument/willSaveWaitUntil".
if not client:supports_method('textDocument/willSaveWaitUntil')
and client:supports_method('textDocument/formatting') then
vim.api.nvim_create_autocmd('BufWritePre', {
group = vim.api.nvim_create_augroup('my.lsp', { clear = false }),
buffer = args.buf,
callback = function()
vim.lsp.buf.format({ bufnr = args.buf, id = client.id, timeout_ms = 1000 })
end,
})
end
end,
})

View File

@ -0,0 +1,35 @@
-- Clear highlights on search when pressing <Esc> in normal mode
-- See `:help hlsearch`
vim.keymap.set("n", "<Esc>", "<cmd>nohlsearch<CR>")
-- Diagnostic keymaps
vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, { desc = "Open diagnostic [Q]uickfix list" })
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
-- is not what someone will guess without a bit more experience.
--
-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
-- or just use <C-\><C-n> to exit terminal mode
vim.keymap.set("t", "<Esc><Esc>", "<C-\\><C-n>", { desc = "Exit terminal mode" })
-- TIP: Disable arrow keys in normal mode
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
-- Keybinds to make split navigation easier.
-- Use CTRL+<hjkl> to switch between windows
--
-- See `:help wincmd` for a list of all window commands
vim.keymap.set("n", "<C-h>", "<C-w><C-h>", { desc = "Move focus to the left window" })
vim.keymap.set("n", "<C-l>", "<C-w><C-l>", { desc = "Move focus to the right window" })
vim.keymap.set("n", "<C-j>", "<C-w><C-j>", { desc = "Move focus to the lower window" })
vim.keymap.set("n", "<C-k>", "<C-w><C-k>", { desc = "Move focus to the upper window" })
-- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes
-- vim.keymap.set("n", "<C-S-h>", "<C-w>H", { desc = "Move window to the left" })
-- vim.keymap.set("n", "<C-S-l>", "<C-w>L", { desc = "Move window to the right" })
-- vim.keymap.set("n", "<C-S-j>", "<C-w>J", { desc = "Move window to the lower" })
-- vim.keymap.set("n", "<C-S-k>", "<C-w>K", { desc = "Move window to the upper" })

View File

@ -1,104 +1,94 @@
-- options.lua -- Leader keys (set early)
vim.opt.cmdheight = 0
-- Leader key for all the keymaps
vim.g.mapleader = " " vim.g.mapleader = " "
vim.g.maplocalleader = " " vim.g.maplocalleader = " "
-------------------------------------------------------------------------------- -- UI and appearance
-- -- GENERAL EDITOR BEHAVIOR vim.o.termguicolors = true -- 24-bit colors in TUI
-------------------------------------------------------------------------------- vim.o.cursorline = true -- highlight current line
vim.opt.clipboard = "unnamedplus" -- Use system clipboard vim.o.number = true -- absolute line numbers
vim.opt.writebackup = false -- Disable backup files vim.o.relativenumber = true -- relative line numbers
vim.opt.undofile = true -- Enable persistent undo vim.o.signcolumn = "yes" -- always show signcolumn
vim.opt.wrap = false -- Do not wrap lines vim.o.colorcolumn = "100" -- visual column guide
vim.opt.conceallevel = 2 -- Hide markdown syntax, etc. vim.o.winborder = "rounded" -- default floating window border
vim.opt.signcolumn = "yes" -- Always show the sign column to avoid resizing vim.o.cmdheight = 0 -- minimal command-line height (NVIM 0.10+)
vim.opt.timeoutlen = 300 -- Time to wait for a mapped sequence to complete vim.o.conceallevel = 2 -- conceal in Markdown/jsonc when appropriate
vim.opt.updatetime = 250 -- Faster completion and CursorHold updates vim.o.foldlevel = 0 -- start with folds closed (Treesitter can open)
vim.o.winborder = "rounded"
-- Disable unused built-in providers for faster startup -- Splits
vim.o.splitright = true -- open vertical splits to the right
vim.o.splitbelow = true -- open horizontal splits below
-- Editing behavior
vim.o.wrap = false -- do not wrap lines by default
vim.o.breakindent = true -- keep indentation on wrapped lines (if wrap is enabled later)
-- Sync clipboard between OS and Neovim.
-- Schedule the setting after `UiEnter` because it can increase startup-time.
-- Remove this option if you want your OS clipboard to remain independent.
-- See `:help 'clipboard'`
vim.schedule(function()
vim.o.clipboard = "unnamedplus"
end)
vim.o.swapfile = false -- no swapfiles
vim.o.undofile = true -- persistent undo
vim.o.writebackup = false -- do not keep backup around
-- Tabs and indentation (2-space default; override per-filetype with autocmds)
vim.o.expandtab = true
vim.o.tabstop = 2
vim.o.softtabstop = 2
vim.o.shiftwidth = 2
-- Search
vim.o.ignorecase = true -- case-insensitive
vim.o.smartcase = true -- unless uppercase is used
-- Completion UX (good defaults for omni and popup behavior)
vim.o.completeopt = "menu,menuone,noinsert,noselect"
vim.o.shortmess = (vim.o.shortmess or "") .. "c" -- reduce completion messages
-- Performance and input timing
vim.o.timeoutlen = 300 -- mapped sequence timeout
vim.o.updatetime = 250 -- faster CursorHold/diagnostic updates
vim.o.scrolloff = 10 -- context lines around cursor
-- Fonts/icons (used by statuslines/UIs)
vim.g.have_nerd_font = true
-- Providers (disable unused for faster startup)
vim.g.loaded_perl_provider = 0 vim.g.loaded_perl_provider = 0
vim.g.loaded_ruby_provider = 0 vim.g.loaded_ruby_provider = 0
vim.g.loaded_netrw = 0 -- Disable netrw, as you likely use a plugin like nvim-tree -- If you don't use Python providers via :CheckHealth, consider disabling too:
-- vim.g.loaded_python_provider = 0
-- vim.g.loaded_python3_provider = 0
-------------------------------------------------------------------------------- -- Netrw (disable if using an explorer plugin like oil.nvim; enable if you rely on netrw)
-- -- UI AND APPEARANCE vim.g.loaded_netrw = 0
-------------------------------------------------------------------------------- vim.g.loaded_netrwPlugin = 0
vim.opt.number = true -- Show line numbers -- If you need netrw again, set both back to nil or 0 and restart:
vim.opt.relativenumber = true -- Show relative line numbers -- vim.g.loaded_netrw = nil; vim.g.loaded_netrwPlugin = nil
vim.opt.cursorline = true -- Highlight the current line
vim.opt.scrolloff = 10 -- Keep 10 lines of context around the cursor
vim.opt.termguicolors = true -- Enable 24-bit RGB color in the TUI
vim.o.foldlevel = 0 -- Start with all folds closed
-------------------------------------------------------------------------------- -- Filetype-specific indentation overrides (examples)
-- -- SEARCHING
--------------------------------------------------------------------------------
vim.opt.ignorecase = true -- Case-insensitive searching
vim.opt.smartcase = true -- ...unless the query contains a capital letter
--------------------------------------------------------------------------------
-- -- SPELL CHECKING (currently disabled)
--------------------------------------------------------------------------------
-- vim.opt.spell = true
-- vim.opt.spelllang = "en,it"
-- local spell_dir = vim.fn.stdpath("data") .. "/spell"
-- vim.opt.spellfile = {
-- spell_dir .. "/en.utf-8.add",
-- spell_dir .. "/it.utf-8.add",
-- "~/.config/nvim/spell/en.proj.spl",
-- "~/.config/nvim/spell/it.proj.spl",
-- }
--------------------------------------------------------------------------------
-- -- FILETYPE-SPECIFIC SETTINGS (AUTOCOMMANDS)
--------------------------------------------------------------------------------
-- Create an autocommand group to prevent duplicate autocommands on reload
local ft_augroup = vim.api.nvim_create_augroup("FileTypeSettings", { clear = true }) local ft_augroup = vim.api.nvim_create_augroup("FileTypeSettings", { clear = true })
-- C, C++, etc: 4-space indentation -- C-like and web files: 2 spaces (adjust as needed)
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", {
group = ft_augroup, group = ft_augroup,
pattern = { "c", "cpp", "objc", "objcpp", "js", "ts", "tsx", "jsx" }, pattern = { "c", "cpp", "objc", "objcpp", "javascript", "typescript", "tsx", "jsx" },
callback = function() callback = function()
-- Use vim.bo for buffer-local options
vim.bo.tabstop = 2 vim.bo.tabstop = 2
vim.bo.shiftwidth = 2 vim.bo.shiftwidth = 2
vim.bo.expandtab = true -- Use spaces instead of tabs vim.bo.expandtab = true
end, end,
}) })
-- -- Web dev, scripting, etc: 2-space indentation vim.o.mouse = "a"
-- vim.api.nvim_create_autocmd("FileType", {
-- group = ft_augroup, vim.o.showmode = false
-- pattern = {
-- "lua", vim.o.list = true
-- "python", vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "" }
-- "javascript",
-- "typescript", -- Preview substitutions live, as you type!
-- "html", vim.o.inccommand = "split"
-- "css",
-- "json", vim.o.confirm = true
-- "yaml",
-- "toml",
-- "markdown",
-- },
-- callback = function()
-- vim.bo.tabstop = 2
-- vim.bo.shiftwidth = 2
-- vim.bo.expandtab = true
-- end,
-- })
--
-- -- LaTeX: 2-space indentation (example)
-- vim.api.nvim_create_autocmd("FileType", {
-- group = ft_augroup,
-- pattern = { "tex" },
-- callback = function()
-- vim.bo.tabstop = 2
-- vim.bo.shiftwidth = 2
-- vim.bo.expandtab = true
-- end,
-- })

View File

@ -1,107 +1,84 @@
return { return { -- Autocompletion
"hrsh7th/nvim-cmp", "saghen/blink.cmp",
event = { "InsertEnter" }, event = "VimEnter",
version = "1.*",
dependencies = { dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"saadparwaiz1/cmp_luasnip",
{ {
"L3MON4D3/LuaSnip", "L3MON4D3/LuaSnip",
version = "2.*",
build = (function()
if vim.fn.has("win32") == 1 or vim.fn.executable("make") == 0 then
return
end
return "make install_jsregexp"
end)(),
dependencies = { dependencies = {
-- `friendly-snippets` contains a variety of premade snippets.
-- See the README about individual language/framework/plugin snippets:
-- https://github.com/rafamadriz/friendly-snippets
{
"rafamadriz/friendly-snippets", "rafamadriz/friendly-snippets",
},
},
"onsails/lspkind-nvim",
"js-everts/cmp-tailwind-colors"
},
config = function() config = function()
local cmp = require("cmp") require("luasnip.loaders.from_vscode").lazy_load()
local luasnip = require("luasnip")
require("luasnip/loaders/from_vscode").lazy_load()
local lspkind = require("lspkind")
local check_backspace = function()
local col = vim.fn.col(".") - 1
return col == 0 or vim.fn.getline("."):sub(col, col):match("%s")
end
-- La tua configurazione esistente per la INSERT MODE rimane invariata
cmp.setup({
performance = {
debounce = 10,
throttle = 10,
max_view_entries = 10,
async_budget = 500,
fetching_timeout = 1000,
confirm_resolve_timeout = 2000,
filtering_context_budget = 200,
},
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end, end,
}, },
mapping = cmp.mapping.preset.insert({
["<C-p>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }),
["<C-n>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }),
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
["<C-c>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
["<C-e>"] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expandable() then
luasnip.expand()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif check_backspace() then
fallback()
else
fallback()
end
end, {
"i",
"s",
}),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, {
"i",
"s",
}),
}),
formatting = {
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,
-- }),
}, },
opts = {},
},
"folke/lazydev.nvim",
},
--- @module 'blink.cmp'
--- @type blink.cmp.Config
opts = {
keymap = {
-- set to 'none' to disable the 'default' preset
preset = "none",
["<C-k>"] = { "select_prev", "fallback" },
["<C-j>"] = { "select_next", "fallback" },
["<C-b>"] = { "scroll_documentation_up", "fallback" },
["<C-f>"] = { "scroll_documentation_down", "fallback" },
["<Tab>"] = { "snippet_forward", "fallback" },
["<S-Tab>"] = { "snippet_backward", "fallback" },
-- ["<S-Tab>"] = { "select_prev", "fallback" },
-- ["<Tab>"] = { "select_next", "fallback" },
["<C-space>"] = { "show", "show_documentation", "hide_documentation" },
["<CR>"] = { "select_and_accept", "fallback" },
["<C-e>"] = { "hide", "fallback" },
["<C-s>"] = { "show_signature", "hide_signature", "fallback" },
},
appearance = {
nerd_font_variant = "mono",
},
completion = {
-- By default, you may press `<c-space>` to show the documentation.
-- Optionally, set `auto_show = true` to show the documentation after a delay.
documentation = { auto_show = false, auto_show_delay_ms = 500 },
},
sources = { sources = {
{ name = "nvim_lsp" }, default = { "lsp", "path", "snippets", "lazydev" },
{ name = "luasnip" }, providers = {
{ name = "buffer" }, lazydev = { module = "lazydev.integrations.blink", score_offset = 100 },
{ name = "path" },
}, },
confirm_opts = {
behavior = cmp.ConfirmBehavior.Replace,
select = false,
}, },
})
end, snippets = { preset = "luasnip" },
-- Blink.cmp includes an optional, recommended rust fuzzy matcher,
-- which automatically downloads a prebuilt binary when enabled.
--
-- By default, we use the Lua implementation instead, but you may enable
-- the rust implementation via `'prefer_rust_with_warning'`
--
-- See :h blink-cmp-config-fuzzy for more information
fuzzy = { implementation = "lua" },
-- Shows a signature help window while you type arguments for a function
signature = { enabled = true },
},
} }

View File

@ -1,4 +0,0 @@
return {
"j-hui/fidget.nvim",
opts = {},
}

View File

@ -0,0 +1,41 @@
return { -- Autoformat
"stevearc/conform.nvim",
event = { "BufWritePre" },
cmd = { "ConformInfo" },
keys = {
{
"<leader>f",
function()
require("conform").format({ async = true, lsp_format = "fallback" })
end,
mode = "",
desc = "[F]ormat buffer",
},
},
opts = {
notify_on_error = false,
format_on_save = function(bufnr)
-- Disable "format_on_save lsp_fallback" for languages that don't
-- have a well standardized coding style. You can add additional
-- languages here or re-enable it for the disabled ones.
local disable_filetypes = { c = true, cpp = true }
if disable_filetypes[vim.bo[bufnr].filetype] then
return nil
else
return {
timeout_ms = 500,
lsp_format = "fallback",
}
end
end,
formatters_by_ft = {
lua = { "stylua" },
-- Conform can also run multiple formatters sequentially
-- python = { "isort", "black" },
--
-- You can use 'stop_after_first' to run the first available formatter from the list
-- javascript = { "prettierd", "prettier", stop_after_first = true },
},
},
}

View File

@ -1,14 +0,0 @@
return {
"ThePrimeagen/harpoon",
branch = "harpoon2",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim"
},
config = function()
local harpoon = require('harpoon')
harpoon:setup({})
vim.keymap.set("n", "<leader>a", function() harpoon:list():add() end)
vim.keymap.set("n", "<C-e>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
end
}

View File

@ -0,0 +1,13 @@
return {
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
-- used for completion, annotations and signatures of Neovim apis
"folke/lazydev.nvim",
ft = "lua",
opts = {
library = {
-- Load luvit types when the `vim.uv` word is found
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
},
},
}

View File

@ -1,16 +0,0 @@
return {
"kawre/leetcode.nvim",
build = ":TSUpdate html", -- if you have `nvim-treesitter` installed
dependencies = {
'nvim-telescope/telescope.nvim',
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
},
opts = {
logging = false,
lang = "typescript",
picker = {
provider = "telescope"
}
},
}

View File

@ -1,287 +1,170 @@
local lsp_servers = {
"lua_ls",
"ts_ls",
"texlab",
"marksman",
"docker_compose_language_service",
"dockerls",
"tailwindcss",
"cssls",
"clangd",
"rust_analyzer",
"gopls",
}
local tools = {
"luacheck",
"latexindent",
"prettierd",
}
-- DAP adapters that will be auto-installed based on your LSP servers
local dap_adapters = {
}
local on_attach = function(_, bufnr)
local map = function(key, func, 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")
map("<leader>d", "<cmd>lua vim.diagnostic.open_float()<CR>", "[E]xplain Diagnostic")
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")
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 { return {
"williamboman/mason.nvim",
dependencies = {
"williamboman/mason-lspconfig.nvim",
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
"hrsh7th/cmp-nvim-lsp", dependencies = {
"nvim-telescope/telescope.nvim", { "mason-org/mason.nvim", opts = {} },
"mason-org/mason-lspconfig.nvim",
"WhoIsSethDaniel/mason-tool-installer.nvim", "WhoIsSethDaniel/mason-tool-installer.nvim",
-- DAP dependencies { "j-hui/fidget.nvim", opts = {} },
"mfussenegger/nvim-dap",
"jay-babu/mason-nvim-dap.nvim",
"rcarriga/nvim-dap-ui",
"theHamsta/nvim-dap-virtual-text",
"nvim-neotest/nvim-nio",
-- Formatting/Linting "saghen/blink.cmp",
"nvimtools/none-ls.nvim",
{
"folke/lazydev.nvim",
ft = "lua",
opts = {
library = {
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
},
},
},
}, },
config = function() config = function()
-- Mason setup vim.api.nvim_create_autocmd("LspAttach", {
require("mason").setup() group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }),
callback = function(event)
-- Install tools and DAP adapters local map = function(keys, func, desc, mode)
require("mason-tool-installer").setup({ mode = mode or "n"
ensure_installed = vim.list_extend(tools, dap_adapters), vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = "LSP: " .. desc })
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 = {
null_ls.builtins.formatting.prettierd,
null_ls.builtins.formatting.latexindent,
},
})
-- LSP server configurations
local capabilities = require("cmp_nvim_lsp").default_capabilities()
for _, lsp_server in pairs(lsp_servers) do
local server_config = {
on_attach = on_attach,
capabilities = capabilities,
}
if lsp_server == "texlab" then
server_config.settings = {
texlab = {
latexFormatter = "latexindent",
},
}
end end
require("lspconfig")[lsp_server].setup(server_config) -- Rename the variable under your cursor.
end -- Most Language Servers support renaming across files, etc.
map("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame")
require("mason-nvim-dap").setup({ -- Execute a code action, usually your cursor needs to be on top of an error
ensure_installed = dap_adapters, -- or a suggestion from your LSP for this to activate.
automatic_installation = true, map("<leader>ca", vim.lsp.buf.code_action, "[G]oto Code [A]ction", { "n", "x" })
-- handlers = {
-- return function(config) -- Find references for the word under your cursor.
-- require("mason-nvim-dap").default_setup(config) map("<leader>gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
-- end,
-- Jump to the implementation of the word under your cursor.
-- Useful when your language has ways of declaring types without an actual implementation.
map("<leader>gi", require("telescope.builtin").lsp_implementations, "[G]oto [I]mplementation")
-- Jump to the definition of the word under your cursor.
-- This is where a variable was first declared, or where a function is defined, etc.
-- To jump back, press <C-t>.
map("<leader>gd", require("telescope.builtin").lsp_definitions, "[G]oto [D]efinition")
-- WARN: This is not Goto Definition, this is Goto Declaration.
-- For example, in C this would take you to the header.
map("<leader>gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
-- -- Fuzzy find all the symbols in your current document.
-- -- Symbols are things like variables, functions, types, etc.
-- map("gO", require("telescope.builtin").lsp_document_symbols, "Open Document Symbols")
-- --
-- -- -- Custom adapter configurations -- -- Fuzzy find all the symbols in your current workspace.
-- -- ["js-debug-adapter"] = function(config) -- -- Similar to document symbols, except searches over your entire project.
-- -- config.adapters = { -- map("gW", require("telescope.builtin").lsp_dynamic_workspace_symbols, "Open Workspace Symbols")
-- -- type = "server", --
-- -- host = "localhost", -- -- Jump to the type of the word under your cursor.
-- -- port = "${port}", -- -- Useful when you're not sure what type a variable is and you want to see
-- -- executable = { -- -- the definition of its *type*, not where it was *defined*.
-- -- command = "js-debug-adapter", -- map("grt", require("telescope.builtin").lsp_type_definitions, "[G]oto [T]ype Definition")
-- -- args = { "${port}" },
-- -- }, map("<leader>e", vim.diagnostic.open_float, "Line Diagnostics")
-- -- }
-- -- require("mason-nvim-dap").default_setup(config) -- The following code creates a keymap to toggle inlay hints in your
-- -- end, -- code, if the language server you are using supports them
-- }, --
-- This may be unwanted, since they displace some of your code
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
map("<leader>th", function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = event.buf }))
end, "[T]oggle Inlay [H]ints")
end
end,
}) })
-- DAP UI setup -- Diagnostic Config
local dap, dapui = require("dap"), require("dapui") -- See :help vim.diagnostic.Opts
dapui.setup({ vim.diagnostic.config({
layouts = { severity_sort = true,
{ float = { border = "rounded", source = "if_many" },
elements = { underline = { severity = vim.diagnostic.severity.ERROR },
{ id = "scopes", size = 0.25 }, signs = vim.g.have_nerd_font and {
{ id = "breakpoints", size = 0.25 }, text = {
{ id = "stacks", size = 0.25 }, [vim.diagnostic.severity.ERROR] = "󰅚 ",
{ id = "watches", size = 0.25 }, [vim.diagnostic.severity.WARN] = "󰀪 ",
}, [vim.diagnostic.severity.INFO] = "󰋽 ",
size = 40, [vim.diagnostic.severity.HINT] = "󰌶 ",
position = "left",
},
{
elements = { "repl", "console" },
size = 10,
position = "bottom",
}, },
} or {},
virtual_text = {
source = "if_many",
spacing = 2,
format = function(diagnostic)
local diagnostic_message = {
[vim.diagnostic.severity.ERROR] = diagnostic.message,
[vim.diagnostic.severity.WARN] = diagnostic.message,
[vim.diagnostic.severity.INFO] = diagnostic.message,
[vim.diagnostic.severity.HINT] = diagnostic.message,
}
return diagnostic_message[diagnostic.severity]
end,
}, },
}) })
-- Auto-open/close DAP UI -- LSP servers and clients are able to communicate to each other what features they support.
dap.listeners.after.event_initialized["dapui_config"] = function() -- By default, Neovim doesn't support everything that is in the LSP specification.
dapui.open() -- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
end -- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
dap.listeners.before.event_terminated["dapui_config"] = function() local capabilities = require("blink.cmp").get_lsp_capabilities()
dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
end
-- DAP Virtual Text -- Enable the following language servers
require("nvim-dap-virtual-text").setup({ -- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
enabled = true, --
enabled_commands = true, -- Add any additional override configuration in the following tables. Available keys are:
highlight_changed_variables = true, -- - cmd (table): Override the default command used to start the server
highlight_new_as_changed = false, -- - filetypes (table): Override the default list of associated filetypes for the server
show_stop_reason = true, -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.
commented = false, -- - settings (table): Override the default settings passed when initializing the server.
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
local servers = {
texlab = {},
-- clangd = {},
gopls = {},
jdtls = {},
-- nil_ls = {},
ts_ls = {},
lua_ls = {
settings = {
Lua = {
completion = {
callSnippet = "Replace",
},
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
-- diagnostics = { disable = { 'missing-fields' } },
},
},
},
}
-- Ensure the servers and tools above are installed
--
-- To check the current status of installed tools and/or manually install
-- other tools, you can run
-- :Mason
--
-- You can press `g?` for help in this menu.
--
-- `mason` had to be setup earlier: to configure its options see the
-- `dependencies` table for `nvim-lspconfig` above.
--
-- You can add other tools here that you want Mason to install
-- for you, so that they are available from within Neovim.
local ensure_installed = vim.tbl_keys(servers or {})
vim.list_extend(ensure_installed, {
"stylua", -- Used to format Lua code
}) })
require("mason-tool-installer").setup({ ensure_installed = ensure_installed })
-- Setup DAP configurations and keymaps require("mason-lspconfig").setup({
setup_dap_configs() ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
setup_dap_keymaps() automatic_installation = true,
handlers = {
-- Additional DAP UI keymap function(server_name)
vim.keymap.set("n", "<leader>du", dapui.toggle, { desc = "Toggle DAP UI" }) local server = servers[server_name] or {}
-- This handles overriding only values explicitly passed
-- by the server configuration above. Useful when disabling
-- certain features of an LSP (for example, turning off formatting for ts_ls)
server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {})
require("lspconfig")[server_name].setup(server)
end,
},
})
end, end,
} }

View File

@ -4,6 +4,6 @@ return {
dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if prefer nvim-web-devicons dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if prefer nvim-web-devicons
config = function() config = function()
require("oil").setup() require("oil").setup()
vim.keymap.set('n', '<leader>ee', "<cmd>:Oil<cr>") vim.keymap.set('n', '<leader>fe', "<cmd>:Oil<cr>")
end end
} }

View File

@ -1,30 +0,0 @@
return {
"tris203/precognition.nvim",
event = "VeryLazy",
opts = {
startVisible = false,
-- 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",
-- },
},
}

View File

@ -1,38 +1,112 @@
return { return { -- Fuzzy Finder (files, lsp, etc)
'nvim-telescope/telescope.nvim', "nvim-telescope/telescope.nvim",
tag = '0.1.8', event = "VimEnter",
dependencies = { dependencies = {
'nvim-lua/plenary.nvim', "nvim-lua/plenary.nvim",
-- { 'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release' } { -- If encountering errors, see telescope-fzf-native README for installation instructions
{ 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' } "nvim-telescope/telescope-fzf-native.nvim",
-- `build` is used to run some command when the plugin is installed/updated.
-- This is only run then, not every time Neovim starts up.
build = "make",
-- `cond` is a condition used to determine whether this plugin should be
-- installed and loaded.
cond = function()
return vim.fn.executable("make") == 1
end,
},
{ "nvim-telescope/telescope-ui-select.nvim" },
-- Useful for getting pretty icons, but requires a Nerd Font.
{ "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font },
}, },
config = function() config = function()
require('telescope').setup { -- Telescope is a fuzzy finder that comes with a lot of different things that
-- it can fuzzy find! It's more than just a "file finder", it can search
-- many different aspects of Neovim, your workspace, LSP, and more!
--
-- The easiest way to use Telescope, is to start by doing something like:
-- :Telescope help_tags
--
-- After running this command, a window will open up and you're able to
-- type in the prompt window. You'll see a list of `help_tags` options and
-- a corresponding preview of the help.
--
-- Two important keymaps to use while in Telescope are:
-- - Insert mode: <c-/>
-- - Normal mode: ?
--
-- This opens a window that shows you all of the keymaps for the current
-- Telescope picker. This is really useful to discover what Telescope can
-- do as well as how to actually do it!
-- [[ Configure Telescope ]]
-- See `:help telescope` and `:help telescope.setup()`
require("telescope").setup({
pickers = { pickers = {
find_files = { find_files = {
theme = "ivy",
hidden = true, hidden = true,
prompt_prefix = "🔍 ", prompt_prefix = "🔍 ",
}, },
live_grep = { live_grep = {
theme = "ivy",
hidden = true, hidden = true,
prompt_prefix = "🔍 ", prompt_prefix = "🔍 ",
}, },
}, },
extensions = { extensions = {
["ui-select"] = {
require("telescope.themes").get_dropdown(),
},
fzf = { fzf = {
fuzzy = true, fuzzy = true,
override_generic_sorter = true, override_generic_sorter = true,
override_file_sorter = true, override_file_sorter = true,
case_mode = "ignore_case", case_mode = "ignore_case",
} },
} },
} })
require('telescope').load_extension('fzf')
-- Enable Telescope extensions if they are installed
pcall(require("telescope").load_extension, "fzf")
pcall(require("telescope").load_extension, "ui-select")
-- See `:help telescope.builtin`
local builtin = require("telescope.builtin")
vim.keymap.set("n", "<leader>sh", builtin.help_tags, { desc = "[S]earch [H]elp" })
vim.keymap.set("n", "<leader>sk", builtin.keymaps, { desc = "[S]earch [K]eymaps" })
vim.keymap.set("n", "<leader>sf", builtin.find_files, { desc = "[S]earch [F]iles" })
vim.keymap.set("n", "<leader>ss", builtin.builtin, { desc = "[S]earch [S]elect Telescope" })
vim.keymap.set("n", "<leader>sw", builtin.grep_string, { desc = "[S]earch current [W]ord" })
vim.keymap.set("n", "<leader>sg", builtin.live_grep, { desc = "[S]earch by [G]rep" })
vim.keymap.set("n", "<leader>sd", builtin.diagnostics, { desc = "[S]earch [D]iagnostics" })
vim.keymap.set("n", "<leader>sr", builtin.resume, { desc = "[S]earch [R]esume" })
vim.keymap.set("n", "<leader>s.", builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
vim.keymap.set("n", "<leader><leader>", builtin.buffers, { desc = "[ ] Find existing buffers" })
-- Slightly advanced example of overriding default behavior and theme
vim.keymap.set("n", "<leader>/", function()
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({
winblend = 10,
previewer = false,
}))
end, { desc = "[/] Fuzzily search in current buffer" })
-- It's also possible to pass additional configuration options.
-- See `:help telescope.builtin.live_grep()` for information about particular keys
vim.keymap.set("n", "<leader>s/", function()
builtin.live_grep({
grep_open_files = true,
prompt_title = "Live Grep in Open Files",
})
end, { desc = "[S]earch [/] in Open Files" })
-- Shortcut for searching your Neovim configuration files
vim.keymap.set("n", "<leader>sn", function()
builtin.find_files({ cwd = vim.fn.stdpath("config") })
end, { desc = "[S]earch [N]eovim files" })
end, end,
keys = {
{ "<leader>ff", "<cmd>Telescope find_files<cr>", desc = "[F]ind [F]iles" },
{ "<leader>fh", "<cmd>Telescope help_tags<cr>", desc = "[F]ind [H]elp" },
{ "<leader>fd", "<cmd>Telescope diagnostics<cr>", desc = "[F]ind [D]iadgnostics" },
{ "<leader>fg", "<cmd>Telescope live_grep<cr>", desc = "[F]ind [G]rep" },
}
} }

View File

@ -1,37 +0,0 @@
return {
"folke/trouble.nvim",
opts = {}, -- for default options, refer to the configuration section for custom setup.
cmd = "Trouble",
keys = {
{
"<leader>xx",
"<cmd>Trouble diagnostics toggle<cr>",
desc = "Diagnostics (Trouble)",
},
{
"<leader>xX",
"<cmd>Trouble diagnostics toggle filter.buf=0<cr>",
desc = "Buffer Diagnostics (Trouble)",
},
{
"<leader>cs",
"<cmd>Trouble symbols toggle focus=false<cr>",
desc = "Symbols (Trouble)",
},
{
"<leader>cl",
"<cmd>Trouble lsp toggle focus=false win.position=right<cr>",
desc = "LSP Definitions / references / ... (Trouble)",
},
{
"<leader>xL",
"<cmd>Trouble loclist toggle<cr>",
desc = "Location List (Trouble)",
},
{
"<leader>xQ",
"<cmd>Trouble qflist toggle<cr>",
desc = "Quickfix List (Trouble)",
},
},
}

View File

@ -1,14 +1,52 @@
return { return { -- Useful plugin to show you pending keybinds.
"folke/which-key.nvim", "folke/which-key.nvim",
event = "VeryLazy", event = "VimEnter", -- Sets the loading event to 'VimEnter'
opts = true, opts = {
keys = { -- delay between pressing a key and opening which-key (milliseconds)
{ -- this setting is independent of vim.o.timeoutlen
"<leader>?", delay = 0,
function() icons = {
require("which-key").show({ global = false }) -- set icon mappings to true if you have a Nerd Font
end, mappings = vim.g.have_nerd_font,
desc = "Buffer Local Keymaps (which-key)", -- If you are using a Nerd Font: set icons.keys to an empty table which will use the
-- default which-key.nvim defined Nerd Font icons, otherwise define a string table
keys = vim.g.have_nerd_font and {} or {
Up = "<Up> ",
Down = "<Down> ",
Left = "<Left> ",
Right = "<Right> ",
C = "<C-…> ",
M = "<M-…> ",
D = "<D-…> ",
S = "<S-…> ",
CR = "<CR> ",
Esc = "<Esc> ",
ScrollWheelDown = "<ScrollWheelDown> ",
ScrollWheelUp = "<ScrollWheelUp> ",
NL = "<NL> ",
BS = "<BS> ",
Space = "<Space> ",
Tab = "<Tab> ",
F1 = "<F1>",
F2 = "<F2>",
F3 = "<F3>",
F4 = "<F4>",
F5 = "<F5>",
F6 = "<F6>",
F7 = "<F7>",
F8 = "<F8>",
F9 = "<F9>",
F10 = "<F10>",
F11 = "<F11>",
F12 = "<F12>",
}, },
}, },
}
-- Document existing key chains
spec = {
{ "<leader>s", group = "[S]earch" },
{ "<leader>t", group = "[T]oggle" },
{ "<leader>h", group = "Git [H]unk", mode = { "n", "v" } },
},
},
}

2
sdkman/config Normal file
View File

@ -0,0 +1,2 @@
# enable automatic env
sdkman_auto_env=true

2
services/hibernate.conf Normal file
View File

@ -0,0 +1,2 @@
[Sleep]
HibernateDelaySec=30min

28
services/readme.md Normal file
View File

@ -0,0 +1,28 @@
```bash
sudo tee /etc/systemd/system/suspend-radios.service << 'EOF'
[Unit]
Description=Disable radios before suspend
Before=sleep.target
[Service]
Type=oneshot
ExecStart=/usr/sbin/rfkill block wifi bluetooth
ExecStop=/usr/sbin/rfkill unblock wifi bluetooth
[Install]
WantedBy=sleep.target
EOF
sudo systemctl enable suspend-radios.service
```
```bash
sudo mkdir -p /etc/systemd/sleep.conf.d
sudo tee /etc/systemd/sleep.conf.d/hibernate.conf << 'EOF'
[Sleep]
HibernateDelaySec=30min
EOF
sudo systemctl daemon-reload
```

View File

@ -0,0 +1,11 @@
[Unit]
Description=Disable radios before suspend
Before=sleep.target
[Service]
Type=oneshot
ExecStart=/usr/sbin/rfkill block wifi bluetooth
ExecStop=/usr/sbin/rfkill unblock wifi bluetooth
[Install]
WantedBy=sleep.target

View File

@ -4,7 +4,7 @@ set $left h
set $down j set $down j
set $up k set $up k
set $right l set $right l
set $term ghostty set $term foot
# Launcher: wofi (sostituisce wmenu-run) # Launcher: wofi (sostituisce wmenu-run)
set $menu wofi -S drun -p Search -I -b -i set $menu wofi -S drun -p Search -I -b -i
@ -85,7 +85,7 @@ floating_modifier $mod normal
bindsym $mod+Shift+c reload bindsym $mod+Shift+c reload
# Esci da Sway (con conferma tramite swaynag) # Esci da Sway (con conferma tramite swaynag)
bindsym $mod+Shift+e exec swaynag -t warning -m 'Hai premuto la scorciatoia per uscire. Vuoi davvero uscire da Sway?' -B 'Sì, esci' 'swaymsg exit' # bindsym $mod+Shift+e exec swaynag -t warning -m 'Hai premuto la scorciatoia per uscire. Vuoi davvero uscire da Sway?' -B 'Sì, esci' 'swaymsg exit'
### Navigazione e spostamento tra finestre ### Navigazione e spostamento tra finestre
# Sposta il focus # Sposta il focus
@ -177,36 +177,15 @@ bindsym $mod+r mode "resize"
### Notifiche e Controlli Audio/Luminosità ### Notifiche e Controlli Audio/Luminosità
set $notification_time 1000 set $notification_time 1000
# Comandi per le notifiche (volume, mute, mic, luminosità) # Audio controls
set $audio_notification_cmd command -v notify-send >/dev/null && \ bindsym XF86AudioMute exec ~/.config/sway/scripts/notification-control.sh mute-toggle
VALUE=$(pactl get-sink-volume @DEFAULT_SINK@ | head -n 1 | awk '{print substr($5, 1, length($5)-1)}') && \ bindsym XF86AudioLowerVolume exec ~/.config/sway/scripts/notification-control.sh volume-down
notify-send -e -h string:x-canonical-private-synchronous:audio \ bindsym XF86AudioRaiseVolume exec ~/.config/sway/scripts/notification-control.sh volume-up
-h "int:value:$VALUE" -t $notification_time "Volume: ${VALUE}%" bindsym XF86AudioMicMute exec ~/.config/sway/scripts/notification-control.sh mic-mute-toggle
set $mute_notification_cmd command -v notify-send >/dev/null && \ # Brightness controls
VALUE=$(pactl get-sink-mute @DEFAULT_SINK@ | head -n 1 | awk '{print $2}') && \ bindsym XF86MonBrightnessDown exec ~/.config/sway/scripts/notification-control.sh brightness-down
notify-send -e -h string:x-canonical-private-synchronous:audio \ bindsym XF86MonBrightnessUp exec ~/.config/sway/scripts/notification-control.sh brightness-up
-h "string:x-canonical-private-synchronous:audio" -t $notification_time "Mute: ${VALUE}"
set $mute_mic_notification_cmd command -v notify-send >/dev/null && \
VALUE=$(pactl get-source-mute @DEFAULT_SOURCE@ | head -n 1 | awk '{print $2}') && \
notify-send -e -h string:x-canonical-private-synchronous:audio \
-h "string:x-canonical-private-synchronous:audio" -t $notification_time "Mic Mute: ${VALUE}"
set $brightness_notification_cmd command -v notify-send >/dev/null && \
VALUE=$(brightnessctl get) && \
MAX=255 && \
PERCENT=$((VALUE * 100 / MAX)) && \
notify-send -e -h string:x-canonical-private-synchronous:brightness \
-h "int:value:$PERCENT" -t $notification_time "Brightness: ${PERCENT}%"
# Key bindings per audio e luminosità
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle; exec $mute_notification_cmd
bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% && $audio_notification_cmd
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% && $audio_notification_cmd
bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle && $mute_mic_notification_cmd
bindsym XF86MonBrightnessDown exec brightnessctl s 10%- && $brightness_notification_cmd
bindsym XF86MonBrightnessUp exec brightnessctl s 10%+ && $brightness_notification_cmd
# Controlli multimediali # Controlli multimediali
bindsym XF86AudioPlay exec playerctl play-pause bindsym XF86AudioPlay exec playerctl play-pause
@ -214,18 +193,24 @@ bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous bindsym XF86AudioPrev exec playerctl previous
### Screenshot e Registrazione Schermo ### Screenshot e Registrazione Schermo
bindsym Print exec grimshot --notify copy output bindsym Print exec grimshot --notify copy output && \
bindsym $mod+Print exec grimshot --notify copy area notify-send -u normal "📸 Screenshot" "Full screen copied to clipboard"
bindsym $mod+P exec grimshot --notify copy output
bindsym $mod+Shift+P exec grimshot --notify copy area
bindsym $mod+XF86AudioMedia exec --no-startup-id \ # Screenshot selected area
(pgrep -x wf-recorder > /dev/null && killall -s SIGINT wf-recorder && notify-send "Recording Stopped") || \ bindsym $mod+Print exec grimshot --notify copy area && \
(notify-send "Recording Started + Audio." && wf-recorder --audio --file ~/Videos/$(date +'%Y-%m-%d-%H-%M-%S').mp4) notify-send -u normal "📸 Screenshot" "Selected area copied to clipboard"
bindsym XF86AudioMedia exec --no-startup-id \ # Alternative bindings
(pgrep -x wf-recorder > /dev/null && killall -s SIGINT wf-recorder && notify-send "Recording Stopped") || \ bindsym $mod+P exec grimshot --notify copy output && \
(notify-send "Recording Started" && wf-recorder --file ~/Videos/$(date +'%Y-%m-%d-%H-%M-%S').mp4) notify-send -u normal "📸 Screenshot" "Full screen copied to clipboard"
bindsym $mod+Shift+P exec grimshot --notify copy area && \
notify-send -u normal "📸 Screenshot" "Selected area copied to clipboard"
# this one includes audio track in the recording
bindsym $mod+XF86AudioMedia exec ~/.config/sway/scripts/screen-recording.sh audio
# this one not
bindsym XF86AudioMedia exec ~/.config/sway/scripts/screen-recording.sh
### Modalità per azioni di sistema (lock, logout, reboot, suspend, shutdown) ### Modalità per azioni di sistema (lock, logout, reboot, suspend, shutdown)
set $mode_system "What to do? (l) lock, (e) logout, (r) reboot, (Shift+s) shutdown" set $mode_system "What to do? (l) lock, (e) logout, (r) reboot, (Shift+s) shutdown"
@ -248,8 +233,8 @@ bar {
### Borders e Gaps ### Borders e Gaps
default_border pixel default_border pixel
smart_gaps on smart_gaps on
gaps outer 3 gaps outer 2
gaps inner 5 gaps inner 3
# Impostazioni dei colori per il focus delle finestre # Impostazioni dei colori per il focus delle finestre
client.focused $gruvbox_orange $gruvbox_orange $gruvbox_bg_dark $gruvbox_orange client.focused $gruvbox_orange $gruvbox_orange $gruvbox_bg_dark $gruvbox_orange
@ -264,15 +249,15 @@ exec_always {
} }
### Applicazioni in autostart ### Applicazioni in autostart
# exec keepassxc exec keepassxc
exec flatpak run org.keepassxc.KeePassXC # exec flatpak run org.keepassxc.KeePassXC
# exec nextcloud exec nextcloud
exec flatpak run com.nextcloud.desktopclient.nextcloud # exec flatpak run com.nextcloud.desktopclient.nextcloud
exec wlsunset -S 08:00 -s 18:00 exec wlsunset -S 08:00 -s 18:00
exec blueman-applet exec blueman-applet
exec xss-lock -- swaylock -f -i $wallpaper exec xss-lock -- swaylock -f -i $wallpaper
# exec --no-startup-id easyeffects --gapplication-service exec --no-startup-id easyeffects --gapplication-service
exec flatpak run com.github.wwmm.easyeffects --gapplication-service # exec flatpak run com.github.wwmm.easyeffects --gapplication-service
exec --no-startup-id wluma exec --no-startup-id wluma
# Avvio del polkit agent GNOME # Avvio del polkit agent GNOME
@ -286,7 +271,8 @@ exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CU
exec dbus-update-activation-environment WAYLAND_DISPLAY DISPLAY XDG_CURRENT_DESKTOP SWAYSOCK I3SOCK XCURSOR_SIZE XCURSOR_THEME exec dbus-update-activation-environment WAYLAND_DISPLAY DISPLAY XDG_CURRENT_DESKTOP SWAYSOCK I3SOCK XCURSOR_SIZE XCURSOR_THEME
### Notifiche Desktop e Clip History ### Notifiche Desktop e Clip History
exec mako exec swaync
# exec mako
exec wl-paste --type text --watch cliphist store exec wl-paste --type text --watch cliphist store
exec wl-paste --type image --watch cliphist store exec wl-paste --type image --watch cliphist store
@ -316,15 +302,3 @@ for_window [title="Picture in picture"] floating enable, sticky enable
for_window [title="Save File"] floating enable for_window [title="Save File"] floating enable
for_window [app_id="firefox" title="Firefox — Sharing Indicator"] kill for_window [app_id="firefox" title="Firefox — Sharing Indicator"] kill
# assign [app_id="configs"] workspace configs
assign [class="Spotify"] workspace 10
for_window [app_id="keymapp"] floating enable
for_window [app_id="keymapp"] resize set width 800 px height 600 px
for_window [app_id="keymapp"] move position 100%-800px 100%-600px
for_window [app_id="keymapp"] mark pin-keymapp
no_focus [app_id="keymapp"]
exec_always ~/.config/sway/scripts/pin-keymapp.sh
# Includi eventuali configurazioni aggiuntive
# include /etc/sway/config.d/*

View File

@ -0,0 +1,69 @@
#!/usr/bin/env bash
ACTION="$1"
NOTIFICATION_TIME=1000
case "$ACTION" in
volume-up)
pactl set-sink-volume @DEFAULT_SINK@ +5%
VALUE=$(pactl get-sink-volume @DEFAULT_SINK@ | head -n 1 | awk '{print substr($5, 1, length($5)-1)}')
notify-send -e -h string:x-canonical-private-synchronous:audio \
-h "int:value:$VALUE" -t $NOTIFICATION_TIME "🔊 Volume" "${VALUE}%"
;;
volume-down)
pactl set-sink-volume @DEFAULT_SINK@ -5%
VALUE=$(pactl get-sink-volume @DEFAULT_SINK@ | head -n 1 | awk '{print substr($5, 1, length($5)-1)}')
notify-send -e -h string:x-canonical-private-synchronous:audio \
-h "int:value:$VALUE" -t $NOTIFICATION_TIME "🔉 Volume" "${VALUE}%"
;;
mute-toggle)
pactl set-sink-mute @DEFAULT_SINK@ toggle
MUTED=$(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}')
if [ "$MUTED" = "yes" ]; then
notify-send -e -h string:x-canonical-private-synchronous:audio \
-t $NOTIFICATION_TIME "🔇 Audio Muted" "Output muted"
else
notify-send -e -h string:x-canonical-private-synchronous:audio \
-t $NOTIFICATION_TIME "🔊 Audio Unmuted" "Output active"
fi
;;
mic-mute-toggle)
pactl set-source-mute @DEFAULT_SOURCE@ toggle
MUTED=$(pactl get-source-mute @DEFAULT_SOURCE@ | awk '{print $2}')
if [ "$MUTED" = "yes" ]; then
notify-send -e -h string:x-canonical-private-synchronous:audio \
-t $NOTIFICATION_TIME "🎤 Microphone Muted" "Mic muted"
else
notify-send -e -h string:x-canonical-private-synchronous:audio \
-t $NOTIFICATION_TIME "🎤 Microphone Active" "Mic unmuted"
fi
;;
brightness-up)
brightnessctl s 10%+
# Get current and max brightness values
CURRENT=$(brightnessctl get)
MAX=$(brightnessctl max)
PERCENT=$((CURRENT * 100 / MAX))
notify-send -e -h string:x-canonical-private-synchronous:brightness \
-h "int:value:$PERCENT" -t $NOTIFICATION_TIME "☀️ Brightness" "${PERCENT}%"
;;
brightness-down)
brightnessctl s 10%-
# Get current and max brightness values
CURRENT=$(brightnessctl get)
MAX=$(brightnessctl max)
PERCENT=$((CURRENT * 100 / MAX))
notify-send -e -h string:x-canonical-private-synchronous:brightness \
-h "int:value:$PERCENT" -t $NOTIFICATION_TIME "🔅 Brightness" "${PERCENT}%"
;;
*)
echo "Usage: $0 {volume-up|volume-down|mute-toggle|mic-mute-toggle|brightness-up|brightness-down}"
exit 1
;;
esac

View File

@ -1,18 +0,0 @@
#!/usr/bin/env bash
# Follow current workspace and place bottom-right at 800x600.
# Requires the window to be marked "pin-keymapp" and floating.
# Subscribe to workspace changes
swaymsg -t subscribe '["workspace"]' | while read -r _; do
# Ensure the window exists before issuing moves
if swaymsg -t get_tree | jq -e '.. | objects | select(.marks? and (index("pin-keymapp"))) ' >/dev/null; then
# Move to current workspace
swaymsg '[con_mark="pin-keymapp"] move container to workspace current'
# Ensure size, then place. Order matters: floating -> resize -> move.
swaymsg '[con_mark="pin-keymapp"] floating enable'
swaymsg '[con_mark="pin-keymapp"] resize set width 800 px height 600 px'
swaymsg '[con_mark="pin-keymapp"] move position 100%-800px 100%-600px'
# If needed (multi-output absolute coords), use:
# swaymsg '[con_mark="pin-keymapp"] move absolute position 100%-800px 100%-600px'
fi
done

View File

@ -0,0 +1,30 @@
#!/usr/bin/env bash
RECORD_DIR="$HOME/Videos"
TIMESTAMP=$(date +'%Y-%m-%d-%H-%M-%S')
AUDIO_FLAG="$1"
# Create directory if it doesn't exist
if [ ! -d "$RECORD_DIR" ]; then
mkdir -p "$RECORD_DIR"
notify-send -u low "📁 Directory Created" "$RECORD_DIR"
fi
if pgrep -x wf-recorder > /dev/null; then
killall -s SIGINT wf-recorder
notify-send -u normal "🛑 Recording Stopped" "Saved to $RECORD_DIR/"
else
if [ "$AUDIO_FLAG" = "audio" ]; then
notify-send -u normal "🔴 Recording Started" "With audio enabled"
wf-recorder --audio --file "$RECORD_DIR/${TIMESTAMP}.mp4"
else
notify-send -u normal "🔴 Recording Started" "Video only"
wf-recorder --file "$RECORD_DIR/${TIMESTAMP}.mp4"
fi
if [ $? -eq 0 ]; then
notify-send -u normal "✅ Recording Complete" "Saved as ${TIMESTAMP}.mp4"
else
notify-send -u critical "❌ Recording Failed" "Check your configuration"
fi
fi

View File

@ -1,7 +1,11 @@
// -*- mode: jsonc -*- // -*- mode: jsonc -*-
{ {
"height": 34, // Waybar height (to be removed for auto height) "height": 34, // Waybar height (to be removed for auto height)
"modules-left": ["sway/workspaces", "sway/mode", "sway/scratchpad"], "modules-left": [
// "hyprland/workspaces",
// // "hyprland/window",
"sway/workspaces", "sway/mode", "sway/scratchpad"
],
"modules-center": ["clock"], "modules-center": ["clock"],
"modules-right": [ "modules-right": [
"idle_inhibitor", "idle_inhibitor",
@ -13,6 +17,7 @@
"backlight", "backlight",
"battery", "battery",
"tray", "tray",
"custom/notification"
], ],
"sway/mode": { "sway/mode": {
"format": "<span style=\"italic\">{}</span>", "format": "<span style=\"italic\">{}</span>",
@ -112,4 +117,24 @@
}, },
"on-click": "pavucontrol", "on-click": "pavucontrol",
}, },
"custom/notification" : {
"tooltip" : false,
"format" : "{} {icon}",
"format-icons" : {
"notification" : "󱅫",
"none" : "",
"dnd-notification" : " ",
"dnd-none" : "󰂛",
"inhibited-notification" : " ",
"inhibited-none" : "",
"dnd-inhibited-notification" : " ",
"dnd-inhibited-none" : " ",
},
"return-type" : "json",
"exec-if" : "which swaync-client",
"exec" : "swaync-client -swb",
"on-click" : "sleep 0.1 && swaync-client -t -sw",
"on-click-right" : "sleep 0.1 && swaync-client -d -sw",
"escape" : true,
}
} }

View File

@ -1,6 +1,8 @@
* { * {
font-family: "Iosevka Nerd Font", "Font Awesome 6 Free", "monospace"; font-family: "Iosevka Nerd Font", "Font Awesome 6 Free", "monospace";
font-size: 16px; font-size: 16px;
margin: 0;
padding: 0;
} }
@define-color background #282828; @define-color background #282828;
@ -25,6 +27,18 @@ window#waybar {
background-color: @background; background-color: @background;
padding: 0; padding: 0;
margin: 0; margin: 0;
margin-right: 10px;
}
.module-left * {
padding: 10px;
}
#custom-notification {
/* padding: 0 20px; */
padding-left: 10px;
padding-right: 20px;
font-size: 18px;
} }
#custom-scratch { #custom-scratch {
@ -34,6 +48,7 @@ window#waybar {
} }
#workspaces button { #workspaces button {
padding: 0 10px;
border-radius: 0px; border-radius: 0px;
color: @foreground; color: @foreground;
} }