diff --git a/flake.lock b/flake.lock index 9a83c85..ab8a9dd 100644 --- a/flake.lock +++ b/flake.lock @@ -90,11 +90,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1738861981, - "narHash": "sha256-QfphE389j/AkIBLrPti7iaWdzRlByxZ9PZdQ0Z9ES5g=", + "lastModified": 1738919824, + "narHash": "sha256-FvaTbPs4O4NmE71xjb/lNSsNAkyXUnm7NU/bY86oUws=", "owner": "nix-community", "repo": "emacs-overlay", - "rev": "1d19c1885c8807e044eb861162ee0120b6749dea", + "rev": "d1a312c524fe9f1a6836fc3fd63c6fd09f795abb", "type": "github" }, "original": { @@ -401,11 +401,11 @@ ] }, "locked": { - "lastModified": 1738841109, - "narHash": "sha256-sEgE3nifaRU5gfAx33ds0tx/j+qM0/5/bHopv/w6c0c=", + "lastModified": 1738878603, + "narHash": "sha256-fmhq8B3MvQLawLbMO+LWLcdC2ftLMmwSk+P29icJ3tE=", "owner": "nix-community", "repo": "home-manager", - "rev": "f99c704fe3a4cf8d72b2d568ec80bc38be1a9407", + "rev": "433799271274c9f2ab520a49527ebfe2992dcfbd", "type": "github" }, "original": { @@ -690,11 +690,11 @@ "uv2nix": "uv2nix" }, "locked": { - "lastModified": 1738789634, - "narHash": "sha256-phbQUuuRxGk9P9fxzza00pmxpc1hdWctn3/n9QwhMMM=", + "lastModified": 1738874392, + "narHash": "sha256-/oKOtwENrb/4Goqx1kz9i5C6kYGnuhC71NKgkGQ8kgw=", "owner": "isd-project", "repo": "isd", - "rev": "1ffa08db3e54a435e796093e53e91e8280f61661", + "rev": "d210d28160feaed4b696d1016f9162d3dd84a70a", "type": "github" }, "original": { @@ -790,11 +790,11 @@ "xwayland-satellite-unstable": "xwayland-satellite-unstable" }, "locked": { - "lastModified": 1738835520, - "narHash": "sha256-qvaWZ3PDJ0MC7t0wD8MdoGdVnMu0ps/ZWCXGepCFo5s=", + "lastModified": 1738918638, + "narHash": "sha256-lQ02wFQ4GYXMXcq8V4pfZUbXMzA9nJjtXlwUgA+RiQA=", "owner": "sodiboo", "repo": "niri-flake", - "rev": "4e72debdb5675b41278ddd492168b6c9c9ed09a0", + "rev": "1df0adf742570d4f09233a63e58998261cef8ee5", "type": "github" }, "original": { @@ -823,11 +823,11 @@ "niri-unstable": { "flake": false, "locked": { - "lastModified": 1738827003, - "narHash": "sha256-s3bBfzPRRWybVSzRYStIwQxSOH5/9kR0Kfqi4IsvG7E=", + "lastModified": 1738911818, + "narHash": "sha256-7bhr9ldHrNP71qOmKI1Hu80uclx+Tco0RNmO+GKtC1Y=", "owner": "YaLTeR", "repo": "niri", - "rev": "b31c0359ebce114ae2f9b4e5df3dc37a93f5115e", + "rev": "397e704d644d1bfe7736f2fdacbfe5742c7b2f9f", "type": "github" }, "original": { @@ -988,11 +988,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1738702386, - "narHash": "sha256-nJj8f78AYAxl/zqLiFGXn5Im1qjFKU8yBPKoWEeZN5M=", + "lastModified": 1738843498, + "narHash": "sha256-7x+Q4xgFj9UxZZO9aUDCR8h4vyYut4zPUvfj3i+jBHE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "030ba1976b7c0e1a67d9716b17308ccdab5b381e", + "rev": "f5a32fa27df91dfc4b762671a0e0a859a8a0058f", "type": "github" }, "original": { @@ -1004,11 +1004,11 @@ }, "nixpkgs-stable_2": { "locked": { - "lastModified": 1738702386, - "narHash": "sha256-nJj8f78AYAxl/zqLiFGXn5Im1qjFKU8yBPKoWEeZN5M=", + "lastModified": 1738843498, + "narHash": "sha256-7x+Q4xgFj9UxZZO9aUDCR8h4vyYut4zPUvfj3i+jBHE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "030ba1976b7c0e1a67d9716b17308ccdab5b381e", + "rev": "f5a32fa27df91dfc4b762671a0e0a859a8a0058f", "type": "github" }, "original": { @@ -1540,11 +1540,11 @@ }, "locked": { "dir": "nix", - "lastModified": 1738379806, - "narHash": "sha256-3dkZt53Lr90wQOCPlDHAZn5t0G6n56t+JXW66+vviTE=", + "lastModified": 1738902298, + "narHash": "sha256-q9uy1uxEtykA/mfgZnzNR156M/jKMj1QL1Zy9mfk1Do=", "owner": "wez", "repo": "wezterm", - "rev": "b28bbbc4c8345197e433590c9ce50a7bf3ea5bc7", + "rev": "5c5d2c8a628d655d6ec0c58e210d478a5a6b8ade", "type": "github" }, "original": { @@ -1596,11 +1596,11 @@ "rust-overlay": "rust-overlay_2" }, "locked": { - "lastModified": 1738867873, - "narHash": "sha256-/xJnHYYIQ3SeRqKaQEZ1VpAJA24iWUYPLIv78OygAP4=", + "lastModified": 1738917769, + "narHash": "sha256-f8+C+L8eOugnyx4Zm2y3qAXH33BsI5F1JWecigPKuMg=", "owner": "sxyazi", "repo": "yazi", - "rev": "a8477059fd2c7366c31af46a44081898f938ca34", + "rev": "17ff1e8812304d52aab56eb5dd6a220578a0dd74", "type": "github" }, "original": { diff --git a/homes/emenel/dotfiles/dot_config/wezterm/wezterm.lua b/homes/emenel/dotfiles/dot_config/wezterm/wezterm.lua new file mode 100644 index 0000000..3aee66f --- /dev/null +++ b/homes/emenel/dotfiles/dot_config/wezterm/wezterm.lua @@ -0,0 +1,264 @@ +local wezterm = require 'wezterm' +local config = wezterm.config_builder() +local act = wezterm.action +local io = require 'io' +local os = require 'os' + +-- config.default_prog = { 'fish', '-l' } + +wezterm.on('trigger-emacs-with-scrollback', function(window, pane) + -- Retrieve the text from the pane + local text = pane:get_lines_as_text(pane:get_dimensions().scrollback_rows) + + -- Create a temporary file to pass to vim + local name = os.tmpname() + local f = io.open(name, 'w+') + f:write(text) + f:flush() + f:close() + + -- Open a new window running vim and tell it to open the file + window:perform_action( + act.SpawnCommandInNewWindow { + args = { 'em', name }, + }, + pane + ) + + -- Wait "enough" time for vim to read the file before we remove it. + -- The window creation and process spawn are asynchronous wrt. running + -- this script and are not awaitable, so we just pick a number. + -- + -- Note: We don't strictly need to remove this file, but it is nice + -- to avoid cluttering up the temporary directory. + wezterm.sleep_ms(1000) + os.remove(name) +end) + +-- plugins +local domains = wezterm.plugin.require("https://github.com/DavidRR-F/quick_domains.wezterm") +local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez") +local workspace_switcher = wezterm.plugin.require("https://github.com/MLFlexer/smart_workspace_switcher.wezterm") + +config.enable_wayland = false; +-- config.front_end = "WebGpu"; + +config.font_size = 14 +config.font = wezterm.font { + family = 'JetBrains Mono', + -- weight = 'Normal' +} + +-- config.enable_scroll_bar = true + +config.color_scheme = 'Adventure' +-- config.color_scheme = 'Molokai' +config.colors = { + background = "#111111", + -- tab_bar = { + -- background = "#111111", + -- inactive_tab = { + -- fg_color = "#444444", + -- bg_color = "#111111" + -- } + -- } +} + +config.background = { + { + source = { + Color = '#111111' + }, + width = "100%", + height = "100%", + opacity = 1 + } +} + +config.window_decorations = "RESIZE" + +config.window_padding = { + left = 6, + right = 6, + top = 6, + bottom = 6, +} + +config.cursor_thickness = 2 +config.default_cursor_style = 'SteadyBar' + +config.use_fancy_tab_bar = false +config.tab_bar_at_bottom = true + +config.enable_kitty_keyboard = true + +config.unzoom_on_switch_pane = true + +config.keys = { + { + key = 'Enter', + mods = 'CTRL', + action = act.SplitVertical { domain = 'CurrentPaneDomain' }, + }, + { + key = 'Enter', + mods = 'CTRL|SHIFT', + action = act.SplitHorizontal { domain = 'CurrentPaneDomain' }, + }, + { + key = 'w', + mods = 'CTRL', + action = wezterm.action.CloseCurrentTab { confirm = true }, + }, + { + key = 'w', + mods = 'CTRL|SHIFT', + action = act.DetachDomain 'CurrentPaneDomain', + }, + { + key = 'k', + mods = 'CTRL|SHIFT', + action = act.Multiple { + act.ClearScrollback 'ScrollbackAndViewport', + act.SendKey { key = 'L', mods = 'CTRL' }, + }, + }, + { + key = 'z', + mods = 'CTRL|META', + action = wezterm.action.TogglePaneZoomState, + }, + { + key = 'E', + mods = 'CTRL', + action = act.EmitEvent 'trigger-emacs-with-scrollback', + }, + { + key = 'o', + mods = 'CTRL', + action = wezterm.action.ShowLauncher + }, + + { key="Backspace", mods="CTRL", action=act.SendKey { key="Backspace", mods="META" } }, + + { key='t', mods='CTRL', action=act { SpawnCommandInNewTab = { cwd = wezterm.home_dir } } }, + + { key="LeftArrow", mods="CTRL|META", action=act.ActivateTabRelative(-1) }, + { key="RightArrow", mods="CTRL|META", action=act.ActivateTabRelative(1) }, + + { key="UpArrow", mods="CTRL|META", action=act.ActivatePaneDirection("Prev") }, + { key="DownArrow", mods="CTRL|META", action=act.ActivatePaneDirection("Next") }, + + { key='h', mods='CTRL|META', action=wezterm.action{ActivatePaneDirection="Left"} }, + { key='l', mods='CTRL|META', action=wezterm.action{ActivatePaneDirection="Right"} }, + { key='j', mods='CTRL|META', action=wezterm.action{ActivatePaneDirection="Up"} }, + { key='k', mods='CTRL|META', action=wezterm.action{ActivatePaneDirection="Down"} }, +} + +tabline.setup({ + options = { + theme_overrides = { + background = "#111111", + tab = { + active = { fg = '#eeeeee', bg = '#111111' }, + inactive = { fg = '#999999', bg = '#222222' }, + inactive_hover = { fg = '#cccccc', bg = '#222222' }, + }, + normal_mode = { + a = { bg = "#222222", fg = "#eeeeee" }, + b = { bg = "#222222", fg = "#eeeeee" }, + c = { bg = "#222222", fg = "#eeeeee" }, + x = { bg = "#222222", fg = "#eeeeee" }, + y = { bg = "#222222", fg = "#eeeeee" }, + z = { bg = "#222222", fg = "#eeeeee" }, + }, + copy_mode = { + b = { bg = "#222222", fg = "#eeeeee" } + } + }, + section_separators = { + left = " ", + right = " ", + }, + component_separators = { + left = " ", + right = " ", + }, + tab_separators = { + left = " ", + right = " ", + }, + icons_enabled = true, + tabs_enabled = true, + }, + sections = { + tabline_a = { 'workspace' }, + tabline_b = { '' }, + tabline_c = { '' }, + tab_active = { + 'index', + { 'process', icons_only = true, process_to_icon = { ['fish'] = wezterm.nerdfonts.cod_terminal } }, + { 'parent', padding = 0 }, + '/', + { 'cwd', padding = { left = 0, right = 1 } }, + { 'zoomed', padding = 0 }, + }, + tab_inactive = { + 'index', + { 'process', process_to_icon = { ['fish'] = wezterm.nerdfonts.cod_terminal } }, + { 'parent', padding = 0 }, + '/', + { 'cwd', padding = { left = 0, right = 1 } }, + { 'zoomed', padding = 0 }, + }, + tabline_x = { '' }, + tabline_y = { '' }, + tabline_z = { 'domain' }, + }, + extensions = { + smart_workspace_switcher, + quick_domains + }, +}) + +tabline.apply_to_config(config) + +domains.apply_to_config( + config, + { + keys = { + -- open domain in new tab + attach = { + -- mod keys for fuzzy domain finder + mods = 'CTRL|SHIFT', + -- base key for fuzzy domain finder + key = 'a', + -- key table to insert key map to if any + tbl = '', + }, + -- open domain in split pane + -- excludes remote domains + -- add remote domains as exec domain for split binds + vsplit = { + key = 'v', + mods = 'CTRL', + tbl = 'tmux' + }, + hsplit = { + key = 'h', + mods = 'CTRL', + tbl = 'tmux' + } + }, + auto = { + ssh_ignore = false, + exec_ignore = { + ssh = false + } + } + } +) + +workspace_switcher.apply_to_config(config) + +return config diff --git a/modules/home/niri.nix b/modules/home/niri.nix index 7a07ad7..b936307 100644 --- a/modules/home/niri.nix +++ b/modules/home/niri.nix @@ -170,6 +170,9 @@ open-floating = true; } ]; + + # TODO write scripts to manage lid/sleep states using the output from loginctl session + switch-events = with config.lib.niri.actions; { lid-close.action = spawn "niri msg output eDP-1 off && shikanectl switch desk-clam"; lid-open.action = spawn "niri msg output eDP-1 on"; diff --git a/overlays/theme.nix b/overlays/theme.nix new file mode 100644 index 0000000..6d62451 --- /dev/null +++ b/overlays/theme.nix @@ -0,0 +1,48 @@ +self: super: +with super.lib.nix-rice; +let theme = kitty-themes.getThemeByName "DimmedMonokai"; +in { + rice = { + colorPalette = rec { + normal = palette.defaultPalette // { + black = theme.color0; + red = theme.color1; + green = theme.color2; + yellow = theme.color3; + blue = theme.color4; + magenta = theme.color5; + cyan = theme.color6; + white = theme.color7; + }; + bright = palette.brighten 10 normal // { + black = theme.color8; + red = theme.color9; + green = theme.color10; + yellow = theme.color11; + blue = theme.color12; + magenta = theme.color13; + cyan = theme.color14; + white = theme.color15; + }; + dark = palette.darken 10 normal; + primary = { + inherit (theme) background foreground; + bright_foreground = color.brighten 10 theme.foreground; + dim_foreground = color.darken 10 theme.foreground; + }; + } // theme; + font = { + normal = { + name = "Cantarell"; + package = self.cantarell-fonts; + size = 10; + }; + monospace = { + name = "FiraCode Nerd Font Mono"; + package = self.nerdfonts.override { fonts = [ "FiraCode" ]; }; + size = 10; + }; + }; + opacity = 0.95; + }; +}