From 3a0b8f5fc6c030d88bd7d6315fd31668b8abb887 Mon Sep 17 00:00:00 2001 From: Belal Elsabbagh Date: Fri, 15 May 2026 21:10:42 +0300 Subject: [PATCH] stuff --- .config/btop/btop.conf | 2 +- .config/hypr/hyprland.lua | 185 ++++++++++++++++++++ .config/hypr/keymaps.lua | 105 +++++++++++ .config/nvim/lsp/svelte-language-server.lua | 16 ++ .config/nvim/lua/plugins/formatter.lua | 38 ---- .config/zed/settings.json | 2 +- .luarc.json | 8 + 7 files changed, 316 insertions(+), 40 deletions(-) create mode 100644 .config/hypr/hyprland.lua create mode 100644 .config/hypr/keymaps.lua create mode 100644 .luarc.json diff --git a/.config/btop/btop.conf b/.config/btop/btop.conf index 387d7fd..8b6ca92 100644 --- a/.config/btop/btop.conf +++ b/.config/btop/btop.conf @@ -66,7 +66,7 @@ proc_sorting = "memory" proc_reversed = false #* Show processes as a tree. -proc_tree = false +proc_tree = true #* Use the cpu graph colors in the process list. proc_colors = true diff --git a/.config/hypr/hyprland.lua b/.config/hypr/hyprland.lua new file mode 100644 index 0000000..7221943 --- /dev/null +++ b/.config/hypr/hyprland.lua @@ -0,0 +1,185 @@ +-- Hyprland Lua Config +-- Migrated from hyprland.conf + keymaps.conf + +-- Environment Variables +hl.env("XDG_CURRENT_DESKTOP", "Hyprland") +hl.env("XDG_SESSION_TYPE", "wayland") +hl.env("XDG_SESSION_DESKTOP", "Hyprland") +hl.env("XDG_SCREENSHOTS_DIR", os.getenv("HOME") .. "/Pictures/Screenshots") + +hl.env("AQ_DRM_DEVICES", "/dev/dri/card2:/dev/dri/card1") +hl.env("GDK_BACKEND", "wayland,x11,*") +hl.env("CLUTTER_BACKEND", "wayland") +hl.env("QT_AUTO_SCREEN_SCALE_FACTOR", "1") +hl.env("QT_QPA_PLATFORM", "wayland;xcb") +hl.env("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1") +hl.env("QT_QPA_PLATFORMTHEME", "qt5ct") +hl.env("XCURSOR_SIZE", "24") +hl.env("HYPRCURSOR_SIZE", "24") + +-- Monitor +hl.monitor({ + output = "", + mode = "preferred", + position = "auto", + scale = "auto", +}) + +require("keymaps") + +-- Autostart +hl.on("hyprland.start", function() + hl.exec_cmd("~/.config/hypr/start.sh") + hl.exec_cmd("wl-paste --type text --watch cliphist store") + hl.exec_cmd("wl-paste --type image --watch cliphist store") +end) + +-- Look and Feel +hl.config({ + general = { + gaps_in = 3, + gaps_out = 5, + border_size = 2, + col = { + active_border = "0xffd3869b", + inactive_border = "0xff45475a", + }, + resize_on_border = false, + allow_tearing = false, + layout = "dwindle", + }, + cursor = { + no_hardware_cursors = true, + }, + decoration = { + rounding = 10, + active_opacity = 0.9, + inactive_opacity = 0.9, + shadow = { + enabled = true, + range = 4, + render_power = 3, + color = 0x33000000, + color_inactive = 0x22000000, + }, + blur = { + enabled = true, + size = 2, + passes = 4, + vibrancy = 0.1696, + }, + }, + animations = { + enabled = true, + }, +}) + +-- Bezier curves +hl.curve( + "myBezier", + { type = "bezier", points = { { 0.05, 0.9 }, { 0.1, 1.05 } } } +) +hl.curve( + "default", + { type = "bezier", points = { { 0.25, 0.1 }, { 0.25, 1 } } } +) + +-- Animations +hl.animation({ + leaf = "windows", + enabled = true, + speed = 7, + bezier = "myBezier", +}) +hl.animation({ + leaf = "windowsOut", + enabled = true, + speed = 7, + bezier = "default", + style = "popin 80%", +}) +hl.animation({ + leaf = "border", + enabled = true, + speed = 10, + bezier = "default", +}) +hl.animation({ + leaf = "borderangle", + enabled = true, + speed = 8, + bezier = "default", +}) +hl.animation({ + leaf = "fade", + enabled = true, + speed = 7, + bezier = "default", +}) +hl.animation({ + leaf = "workspaces", + enabled = true, + speed = 6, + bezier = "default", +}) + +-- Dwindle layout +hl.config({ + dwindle = { + preserve_split = true, + force_split = 2, + }, +}) + +-- Master layout +hl.config({ + master = { + new_status = "master", + }, +}) + +-- Misc +hl.config({ + misc = { + animate_manual_resizes = true, + animate_mouse_windowdragging = true, + enable_swallow = true, + disable_hyprland_logo = true, + }, +}) + +-- Input +hl.config({ + input = { + kb_layout = "us,eg", + kb_variant = "", + kb_model = "", + kb_options = "grp:alt_shift_toggle", + kb_rules = "", + follow_mouse = 1, + sensitivity = 0, + touchpad = { + natural_scroll = true, + }, + }, +}) + +-- Per-device config +hl.device({ + name = "epic-mouse-v1", + sensitivity = -0.5, +}) + +-- Window rules +hl.window_rule({ + name = "suppress-maximize", + match = { class = ".*" }, + suppress_event = "maximize", +}) + +-- Gestures +hl.gesture({ + fingers = 3, + direction = "horizontal", + action = "workspace", +}) diff --git a/.config/hypr/keymaps.lua b/.config/hypr/keymaps.lua new file mode 100644 index 0000000..205154c --- /dev/null +++ b/.config/hypr/keymaps.lua @@ -0,0 +1,105 @@ +-- Keybindings +local terminal = "alacritty" +local fileManager = "dolphin" +local menu = "wofi --show drun" +local browser = "zen-browser" +local mainMod = "SUPER" + +-- Launch/close +hl.bind(mainMod .. " + Return", hl.dsp.exec_cmd(terminal)) +hl.bind(mainMod .. " + Q", hl.dsp.window.close()) +hl.bind(mainMod .. " + ALT + Q", hl.dsp.exit()) +hl.bind(mainMod .. " + E", hl.dsp.exec_cmd(fileManager)) +hl.bind(mainMod .. " + W", hl.dsp.exec_cmd(browser)) +hl.bind(mainMod .. " + T", hl.dsp.window.float({ action = "toggle" })) +hl.bind(mainMod .. " + F", hl.dsp.window.fullscreen()) +hl.bind( + mainMod .. " + V", + hl.dsp.exec_cmd("cliphist list | wofi --dmenu | cliphist decode | wl-copy") +) +hl.bind(mainMod .. " + R", hl.dsp.exec_cmd(menu)) +hl.bind(mainMod .. " + P", hl.dsp.window.pseudo()) +hl.bind(mainMod .. " + J", hl.dsp.layout("togglesplit")) + +-- Move focus with mainMod + arrow keys +hl.bind(mainMod .. " + left", hl.dsp.focus({ direction = "l" })) +hl.bind(mainMod .. " + right", hl.dsp.focus({ direction = "r" })) +hl.bind(mainMod .. " + up", hl.dsp.focus({ direction = "u" })) +hl.bind(mainMod .. " + down", hl.dsp.focus({ direction = "d" })) + +-- Swap windows with mainMod + SHIFT + arrow keys +hl.bind(mainMod .. " + SHIFT + left", hl.dsp.window.swap({ direction = "l" })) +hl.bind(mainMod .. " + SHIFT + right", hl.dsp.window.swap({ direction = "r" })) +hl.bind(mainMod .. " + SHIFT + up", hl.dsp.window.swap({ direction = "u" })) +hl.bind(mainMod .. " + SHIFT + down", hl.dsp.window.swap({ direction = "d" })) + +-- Resize windows with mainMod + CTRL + arrow keys +hl.bind(mainMod .. " + CTRL + left", hl.dsp.window.resize({ x = -60, y = 0 })) +hl.bind(mainMod .. " + CTRL + right", hl.dsp.window.resize({ x = 60, y = 0 })) +hl.bind(mainMod .. " + CTRL + up", hl.dsp.window.resize({ x = 0, y = -60 })) +hl.bind(mainMod .. " + CTRL + down", hl.dsp.window.resize({ x = 0, y = 60 })) + +-- Switch / move workspaces with mainMod + [0-9] +for i = 1, 10 do + local key = i % 10 + hl.bind(mainMod .. " + " .. key, hl.dsp.focus({ workspace = i })) + hl.bind( + mainMod .. " + SHIFT + " .. key, + hl.dsp.window.move({ workspace = i, silent = true }) + ) +end + +-- Scroll through existing workspaces with mainMod + scroll +hl.bind(mainMod .. " + mouse_down", hl.dsp.focus({ workspace = "e+1" })) +hl.bind(mainMod .. " + mouse_up", hl.dsp.focus({ workspace = "e-1" })) + +-- Move/resize windows with mainMod + LMB/RMB +hl.bind(mainMod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true }) +hl.bind(mainMod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true }) + +-- Brightness +hl.bind( + "XF86MonBrightnessDown", + hl.dsp.exec_cmd("brightnessctl set 5%-"), + { locked = true, repeating = true } +) +hl.bind( + "XF86MonBrightnessUp", + hl.dsp.exec_cmd("brightnessctl set 5%+"), + { locked = true, repeating = true } +) + +-- Audio +hl.bind( + "XF86AudioRaiseVolume", + hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"), + { locked = true, repeating = true } +) +hl.bind( + "XF86AudioLowerVolume", + hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"), + { locked = true, repeating = true } +) +hl.bind( + "XF86AudioMute", + hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"), + { locked = true } +) +hl.bind( + "XF86AudioPlay", + hl.dsp.exec_cmd("playerctl play-pause"), + { locked = true } +) +hl.bind( + "XF86AudioPrev", + hl.dsp.exec_cmd("playerctl previous"), + { locked = true } +) +hl.bind("XF86AudioNext", hl.dsp.exec_cmd("playerctl next"), { locked = true }) + +-- Misc binds +hl.bind( + mainMod .. " + SHIFT + C", + hl.dsp.exec_cmd(terminal .. " -e sh -c 'nvim ~/.config/'") +) +hl.bind(mainMod .. " + SHIFT + S", hl.dsp.exec_cmd("grimblast copysave area")) diff --git a/.config/nvim/lsp/svelte-language-server.lua b/.config/nvim/lsp/svelte-language-server.lua index 2e2d5f2..66d7916 100644 --- a/.config/nvim/lsp/svelte-language-server.lua +++ b/.config/nvim/lsp/svelte-language-server.lua @@ -13,6 +13,21 @@ return { cmd = { 'svelteserver', '--stdio' }, filetypes = { 'svelte' }, + settings = { + typescript = { + inlayHints = { + parameterNames = { + enabled = 'literals', + suppressWhenArgumentMatchesName = true, + }, + parameterTypes = { enabled = true }, + variableTypes = { enabled = true }, + propertyDeclarationTypes = { enabled = true }, + functionLikeReturnTypes = { enabled = true }, + enumMemberValues = { enabled = true }, + }, + }, + }, root_dir = function(bufnr, on_dir) local fname = vim.api.nvim_buf_get_name(bufnr) -- Svelte LSP only supports file:// schema. https://github.com/sveltejs/language-tools/issues/2777 @@ -32,6 +47,7 @@ return { group = vim.api.nvim_create_augroup('lspconfig.svelte', {}), callback = function(ctx) -- internal API to sync changes that have not yet been saved to the file system + ---@diagnostic disable-next-line: param-type-mismatch client:notify('$/onDidChangeTsOrJsFile', { uri = ctx.match }) end, }) diff --git a/.config/nvim/lua/plugins/formatter.lua b/.config/nvim/lua/plugins/formatter.lua index 0834e04..4b06b51 100644 --- a/.config/nvim/lua/plugins/formatter.lua +++ b/.config/nvim/lua/plugins/formatter.lua @@ -40,43 +40,5 @@ return { php = { 'pint', stop_after_first = true }, typst = { 'typstyle', stop_after_first = true }, }, - formatters = { - biome = { - meta = { - url = 'https://github.com/biomejs/biome', - description = 'A toolchain for web projects, aimed to provide functionalities to maintain them.', - }, - command = 'biome', - stdin = true, - args = { 'format', '--stdin-file-path', '$FILENAME' }, - }, - ---@type conform.FileFormatterConfig - ruff = { - meta = { - url = 'https://docs.astral.sh/ruff/', - description = 'An extremely fast Python linter, written in Rust. Formatter subcommand.', - }, - command = 'ruff', - args = { - 'format', - '--force-exclude', - '--stdin-filename', - '$FILENAME', - '-', - }, - range_args = function(self, ctx) - return { - 'format', - '--force-exclude', - '--range', - string.format('%d:%d-%d:%d', ctx.range.start[1], ctx.range.start[2] + 1, ctx.range['end'][1], ctx.range['end'][2] + 1), - '--stdin-filename', - '$FILENAME', - '-', - } - end, - stdin = true, - }, - }, }, } diff --git a/.config/zed/settings.json b/.config/zed/settings.json index 0abdd23..855d0da 100644 --- a/.config/zed/settings.json +++ b/.config/zed/settings.json @@ -13,6 +13,6 @@ "theme": { "mode": "system", "light": "Dracula Solid", - "dark": "One Dark" + "dark": "Gruvbox Dark Hard" } } diff --git a/.luarc.json b/.luarc.json new file mode 100644 index 0000000..babfd90 --- /dev/null +++ b/.luarc.json @@ -0,0 +1,8 @@ +{ + "workspace": { + "library": ["/usr/share/hypr/stubs"] + }, + "diagnostics": { + "globals": ["hl"] + } +}