feat(devkit): zellij wrapper
This commit is contained in:
@@ -4,5 +4,9 @@
|
||||
lazygit = pkgs.callPackage ./lazygit {};
|
||||
starship = pkgs.callPackage ./starship {};
|
||||
yazi = pkgs.callPackage ./yazi {};
|
||||
zellij = pkgs.callPackage ./zellij {
|
||||
shell = zsh;
|
||||
addPath = [ghostty git lazygit starship yazi zsh];
|
||||
};
|
||||
zsh = pkgs.callPackage ./zsh {inherit starship;};
|
||||
}
|
||||
|
||||
387
packages/devkit/zellij/config.kdl
Normal file
387
packages/devkit/zellij/config.kdl
Normal file
@@ -0,0 +1,387 @@
|
||||
// If you'd like to override the default keybindings completely, be sure to change "keybinds" to "keybinds clear-defaults=true"
|
||||
default_mode "locked"
|
||||
keybinds clear-defaults=true {
|
||||
normal {
|
||||
bind "1" { GoToTab 1; SwitchToMode "Locked"; }
|
||||
bind "2" { GoToTab 2; SwitchToMode "Locked"; }
|
||||
bind "3" { GoToTab 3; SwitchToMode "Locked"; }
|
||||
bind "4" { GoToTab 4; SwitchToMode "Locked"; }
|
||||
bind "5" { GoToTab 5; SwitchToMode "Locked"; }
|
||||
bind "6" { GoToTab 6; SwitchToMode "Locked"; }
|
||||
bind "7" { GoToTab 7; SwitchToMode "Locked"; }
|
||||
bind "8" { GoToTab 8; SwitchToMode "Locked"; }
|
||||
bind "9" { GoToTab 9; SwitchToMode "Locked"; }
|
||||
bind "g" {
|
||||
LaunchOrFocusPlugin "zellij-sessionizer" {
|
||||
floating true
|
||||
move_to_focused_tab true
|
||||
cwd "/"
|
||||
root_dirs "/home/guz/.projects;/home/guz/.job;/home/guz/.work"
|
||||
session ":default"
|
||||
}
|
||||
SwitchToMode "Locked"
|
||||
}
|
||||
}
|
||||
locked {
|
||||
bind "Ctrl g" { SwitchToMode "Normal"; }
|
||||
}
|
||||
resize {
|
||||
bind "r" { SwitchToMode "Normal"; }
|
||||
bind "h" "Left" { Resize "Increase Left"; }
|
||||
bind "j" "Down" { Resize "Increase Down"; }
|
||||
bind "k" "Up" { Resize "Increase Up"; }
|
||||
bind "l" "Right" { Resize "Increase Right"; }
|
||||
bind "H" { Resize "Decrease Left"; }
|
||||
bind "J" { Resize "Decrease Down"; }
|
||||
bind "K" { Resize "Decrease Up"; }
|
||||
bind "L" { Resize "Decrease Right"; }
|
||||
bind "=" "+" { Resize "Increase"; }
|
||||
bind "-" { Resize "Decrease"; }
|
||||
}
|
||||
pane {
|
||||
bind "p" { SwitchToMode "Normal"; }
|
||||
bind "h" "Left" { MoveFocus "Left"; }
|
||||
bind "l" "Right" { MoveFocus "Right"; }
|
||||
bind "j" "Down" { MoveFocus "Down"; }
|
||||
bind "k" "Up" { MoveFocus "Up"; }
|
||||
bind "Tab" { SwitchFocus; }
|
||||
bind "n" { NewPane; SwitchToMode "Locked"; }
|
||||
bind "d" { NewPane "Down"; SwitchToMode "Locked"; }
|
||||
bind "r" { NewPane "Right"; SwitchToMode "Locked"; }
|
||||
bind "x" { CloseFocus; SwitchToMode "Locked"; }
|
||||
bind "f" { ToggleFocusFullscreen; SwitchToMode "Locked"; }
|
||||
bind "z" { TogglePaneFrames; SwitchToMode "Locked"; }
|
||||
bind "w" { ToggleFloatingPanes; SwitchToMode "Locked"; }
|
||||
bind "e" { TogglePaneEmbedOrFloating; SwitchToMode "Locked"; }
|
||||
bind "c" { SwitchToMode "RenamePane"; PaneNameInput 0; }
|
||||
// bind "i" { TogglePanePinned; SwitchToMode "Locked"; }
|
||||
}
|
||||
move {
|
||||
bind "m" { SwitchToMode "Normal"; }
|
||||
bind "n" "Tab" { MovePane; }
|
||||
bind "p" { MovePaneBackwards; }
|
||||
bind "h" "Left" { MovePane "Left"; }
|
||||
bind "j" "Down" { MovePane "Down"; }
|
||||
bind "k" "Up" { MovePane "Up"; }
|
||||
bind "l" "Right" { MovePane "Right"; }
|
||||
}
|
||||
tab {
|
||||
bind "t" { SwitchToMode "Normal"; }
|
||||
bind "r" { SwitchToMode "RenameTab"; TabNameInput 0; }
|
||||
bind "h" "Left" "Up" "k" { GoToPreviousTab; }
|
||||
bind "l" "Right" "Down" "j" { GoToNextTab; }
|
||||
bind "n" { NewTab; SwitchToMode "Locked"; }
|
||||
bind "x" { CloseTab; SwitchToMode "Locked"; }
|
||||
bind "s" { ToggleActiveSyncTab; SwitchToMode "Locked"; }
|
||||
bind "b" { BreakPane; SwitchToMode "Locked"; }
|
||||
bind "]" { BreakPaneRight; SwitchToMode "Locked"; }
|
||||
bind "[" { BreakPaneLeft; SwitchToMode "Locked"; }
|
||||
bind "1" { GoToTab 1; SwitchToMode "Locked"; }
|
||||
bind "2" { GoToTab 2; SwitchToMode "Locked"; }
|
||||
bind "3" { GoToTab 3; SwitchToMode "Locked"; }
|
||||
bind "4" { GoToTab 4; SwitchToMode "Locked"; }
|
||||
bind "5" { GoToTab 5; SwitchToMode "Locked"; }
|
||||
bind "6" { GoToTab 6; SwitchToMode "Locked"; }
|
||||
bind "7" { GoToTab 7; SwitchToMode "Locked"; }
|
||||
bind "8" { GoToTab 8; SwitchToMode "Locked"; }
|
||||
bind "9" { GoToTab 9; SwitchToMode "Locked"; }
|
||||
bind "Tab" { ToggleTab; }
|
||||
}
|
||||
scroll {
|
||||
bind "s" { SwitchToMode "Normal"; }
|
||||
bind "e" { EditScrollback; SwitchToMode "Locked"; }
|
||||
bind "s" { SwitchToMode "EnterSearch"; SearchInput 0; }
|
||||
bind "Ctrl c" { ScrollToBottom; SwitchToMode "Locked"; }
|
||||
bind "j" "Down" { ScrollDown; }
|
||||
bind "k" "Up" { ScrollUp; }
|
||||
bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; }
|
||||
bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; }
|
||||
bind "d" { HalfPageScrollDown; }
|
||||
bind "u" { HalfPageScrollUp; }
|
||||
bind "Alt left" "Alt h" { MoveFocusOrTab "left"; SwitchToMode "Locked"; }
|
||||
bind "Alt down" "Alt j" { MoveFocusOrTab "down"; SwitchToMode "Locked"; }
|
||||
bind "Alt up" "Alt k" { MoveFocusOrTab "up"; SwitchToMode "Locked"; }
|
||||
bind "Alt right" "Alt l" { MoveFocusOrTab "right"; SwitchToMode "Locked"; }
|
||||
// uncomment this and adjust key if using copy_on_select=false
|
||||
// bind "Alt c" { Copy; }
|
||||
}
|
||||
search {
|
||||
bind "Ctrl s" { SwitchToMode "Locked"; }
|
||||
bind "Ctrl c" { ScrollToBottom; SwitchToMode "Locked"; }
|
||||
bind "j" "Down" { ScrollDown; }
|
||||
bind "k" "Up" { ScrollUp; }
|
||||
bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; }
|
||||
bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; }
|
||||
bind "d" { HalfPageScrollDown; }
|
||||
bind "u" { HalfPageScrollUp; }
|
||||
bind "n" { Search "down"; }
|
||||
bind "p" { Search "up"; }
|
||||
bind "c" { SearchToggleOption "CaseSensitivity"; }
|
||||
bind "w" { SearchToggleOption "Wrap"; }
|
||||
bind "o" { SearchToggleOption "WholeWord"; }
|
||||
}
|
||||
entersearch {
|
||||
bind "Ctrl c" "Esc" { SwitchToMode "Scroll"; }
|
||||
bind "Enter" { SwitchToMode "Search"; }
|
||||
}
|
||||
renametab {
|
||||
bind "Ctrl c" { SwitchToMode "Locked"; }
|
||||
bind "Esc" { UndoRenameTab; SwitchToMode "Tab"; }
|
||||
}
|
||||
renamepane {
|
||||
bind "Ctrl c" { SwitchToMode "Locked"; }
|
||||
bind "Esc" { UndoRenamePane; SwitchToMode "Pane"; }
|
||||
}
|
||||
session {
|
||||
bind "o" { SwitchToMode "Locked"; }
|
||||
bind "d" { Detach; }
|
||||
bind "w" {
|
||||
LaunchOrFocusPlugin "session-manager" {
|
||||
floating true
|
||||
move_to_focused_tab true
|
||||
};
|
||||
SwitchToMode "Locked"
|
||||
}
|
||||
bind "c" {
|
||||
LaunchOrFocusPlugin "configuration" {
|
||||
floating true
|
||||
move_to_focused_tab true
|
||||
}
|
||||
SwitchToMode "Locked"
|
||||
}
|
||||
bind "g" {
|
||||
LaunchOrFocusPlugin "zellij-sessionizer" {
|
||||
floating true
|
||||
move_to_focused_tab true
|
||||
cwd "/"
|
||||
root_dirs "/home/guz/.projects;/home/guz/.job;/home/guz/.work"
|
||||
session ":default"
|
||||
}
|
||||
SwitchToMode "Locked"
|
||||
}
|
||||
}
|
||||
/* tmux {
|
||||
bind "[" { SwitchToMode "Scroll"; }
|
||||
bind "Ctrl b" { Write 2; SwitchToMode "Normal"; }
|
||||
bind "\"" { NewPane "Down"; SwitchToMode "Normal"; }
|
||||
bind "%" { NewPane "Right"; SwitchToMode "Normal"; }
|
||||
bind "z" { ToggleFocusFullscreen; SwitchToMode "Normal"; }
|
||||
bind "c" { NewTab; SwitchToMode "Normal"; }
|
||||
bind "," { SwitchToMode "RenameTab"; }
|
||||
bind "p" { GoToPreviousTab; SwitchToMode "Normal"; }
|
||||
bind "n" { GoToNextTab; SwitchToMode "Normal"; }
|
||||
bind "Left" { MoveFocus "Left"; SwitchToMode "Normal"; }
|
||||
bind "Right" { MoveFocus "Right"; SwitchToMode "Normal"; }
|
||||
bind "Down" { MoveFocus "Down"; SwitchToMode "Normal"; }
|
||||
bind "Up" { MoveFocus "Up"; SwitchToMode "Normal"; }
|
||||
bind "h" { MoveFocus "Left"; SwitchToMode "Normal"; }
|
||||
bind "l" { MoveFocus "Right"; SwitchToMode "Normal"; }
|
||||
bind "j" { MoveFocus "Down"; SwitchToMode "Normal"; }
|
||||
bind "k" { MoveFocus "Up"; SwitchToMode "Normal"; }
|
||||
bind "o" { FocusNextPane; }
|
||||
bind "d" { Detach; }
|
||||
bind "Space" { NextSwapLayout; }
|
||||
bind "x" { CloseFocus; SwitchToMode "Normal"; }
|
||||
} */
|
||||
shared_except "locked" "renametab" "renamepane" {
|
||||
bind "Ctrl g" { SwitchToMode "Locked"; }
|
||||
bind "Ctrl Q" { Quit; }
|
||||
}
|
||||
shared_except "renamepane" "renametab" "entersearch" "locked" {
|
||||
bind "esc" { SwitchToMode "locked"; }
|
||||
}
|
||||
shared_among "normal" "locked" {
|
||||
bind "Alt n" { NewPane; }
|
||||
bind "Alt f" { ToggleFloatingPanes; }
|
||||
bind "Alt i" { MoveTab "Left"; }
|
||||
bind "Alt o" { MoveTab "Right"; }
|
||||
bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; }
|
||||
bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; }
|
||||
bind "Alt j" "Alt Down" { MoveFocusOrTab "Down"; }
|
||||
bind "Alt k" "Alt Up" { MoveFocusOrTab "Up"; }
|
||||
bind "Alt =" "Alt +" { Resize "Increase"; }
|
||||
bind "Alt -" { Resize "Decrease"; }
|
||||
bind "Alt [" { PreviousSwapLayout; }
|
||||
bind "Alt ]" { NextSwapLayout; }
|
||||
}
|
||||
shared_except "locked" "renametab" "renamepane" {
|
||||
bind "Enter" { SwitchToMode "Locked"; }
|
||||
}
|
||||
shared_except "pane" "locked" "renametab" "renamepane" "renamepane" "entersearch" {
|
||||
bind "p" { SwitchToMode "Pane"; }
|
||||
}
|
||||
shared_except "resize" "locked" "renametab" "renamepane" "renamepane" "entersearch" {
|
||||
bind "r" { SwitchToMode "Resize"; }
|
||||
}
|
||||
shared_except "scroll" "locked" "renametab" "renamepane" "renamepane" "entersearch" {
|
||||
bind "s" { SwitchToMode "Scroll"; }
|
||||
}
|
||||
shared_except "session" "locked" "renametab" "renamepane" "renamepane" "entersearch" {
|
||||
bind "o" { SwitchToMode "Session"; }
|
||||
}
|
||||
shared_except "tab" "locked" "renametab" "renamepane" "renamepane" "entersearch" {
|
||||
bind "t" { SwitchToMode "Tab"; }
|
||||
}
|
||||
shared_except "move" "locked" "renametab" "renamepane" "renamepane" "entersearch" {
|
||||
bind "m" { SwitchToMode "Move"; }
|
||||
}
|
||||
}
|
||||
|
||||
// SET BY WRAPPER
|
||||
// themes {
|
||||
// frappuccino {
|
||||
// bg "#181818" // Surface2
|
||||
// fg "#cdd6f4" // Text
|
||||
// red "#f38ba8"
|
||||
// green "#a6e3a1"
|
||||
// blue "#89b4fa"
|
||||
// yellow "#f9e2af"
|
||||
// magenta "#f5c2e7" // Pink
|
||||
// orange "#fab387" // Peach
|
||||
// cyan "#89dceb" // Sky
|
||||
// black "#101010" // Mantle
|
||||
// white "#cdd6f4" // Text
|
||||
// }
|
||||
// }
|
||||
// theme "default"
|
||||
|
||||
// Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP
|
||||
// eg. when terminal window with an active zellij session is closed
|
||||
// Options:
|
||||
// - detach (Default)
|
||||
// - quit
|
||||
//
|
||||
// on_force_close "quit"
|
||||
|
||||
// Send a request for a simplified ui (without arrow fonts) to plugins
|
||||
// Options:
|
||||
// - true
|
||||
// - false (Default)
|
||||
//
|
||||
simplified_ui true
|
||||
|
||||
// Choose the path to the default shell that zellij will use for opening new panes
|
||||
// Default: $SHELL
|
||||
//
|
||||
// default_shell "fish" // SET BY WRAPPER
|
||||
|
||||
// Choose the path to override cwd that zellij will use for opening new panes
|
||||
//
|
||||
// default_cwd ""
|
||||
|
||||
// Toggle between having pane frames around the panes
|
||||
// Options:
|
||||
// - true (default)
|
||||
// - false
|
||||
//
|
||||
pane_frames false
|
||||
|
||||
// Toggle between having Zellij lay out panes according to a predefined set of layouts whenever possible
|
||||
// Options:
|
||||
// - true (default)
|
||||
// - false
|
||||
//
|
||||
// auto_layout true
|
||||
|
||||
// Whether sessions should be serialized to the cache folder (including their tabs/panes, cwds and running commands) so that they can later be resurrected
|
||||
// Options:
|
||||
// - true (default)
|
||||
// - false
|
||||
//
|
||||
session_serialization true
|
||||
|
||||
// Whether pane viewports are serialized along with the session, default is false
|
||||
// Options:
|
||||
// - true
|
||||
// - false (default)
|
||||
serialize_pane_viewport true
|
||||
|
||||
// Scrollback lines to serialize along with the pane viewport when serializing sessions, 0
|
||||
// defaults to the scrollback size. If this number is higher than the scrollback size, it will
|
||||
// also default to the scrollback size. This does nothing if `serialize_pane_viewport` is not true.
|
||||
//
|
||||
scrollback_lines_to_serialize 0
|
||||
|
||||
// The name of the default layout to load on startup
|
||||
// Default: "default"
|
||||
//
|
||||
// default_layout "compact"
|
||||
|
||||
// Choose the mode that zellij uses when starting up.
|
||||
// Default: normal
|
||||
//
|
||||
// default_mode "locked"
|
||||
|
||||
// Toggle enabling the mouse mode.
|
||||
// On certain configurations, or terminals this could
|
||||
// potentially interfere with copying text.
|
||||
// Options:
|
||||
// - true (default)
|
||||
// - false
|
||||
//
|
||||
// mouse_mode false
|
||||
|
||||
// Configure the scroll back buffer size
|
||||
// This is the number of lines zellij stores for each pane in the scroll back
|
||||
// buffer. Excess number of lines are discarded in a FIFO fashion.
|
||||
// Valid values: positive integers
|
||||
// Default value: 10000
|
||||
//
|
||||
// scroll_buffer_size 10000
|
||||
|
||||
// Provide a command to execute when copying text. The text will be piped to
|
||||
// the stdin of the program to perform the copy. This can be used with
|
||||
// terminal emulators which do not support the OSC 52 ANSI control sequence
|
||||
// that will be used by default if this option is not set.
|
||||
// Examples:
|
||||
//
|
||||
// copy_command "xclip -selection clipboard" // x11
|
||||
// copy_command "wl-copy" // wayland
|
||||
// copy_command "pbcopy" // osx
|
||||
|
||||
// Choose the destination for copied text
|
||||
// Allows using the primary selection buffer (on x11/wayland) instead of the system clipboard.
|
||||
// Does not apply when using copy_command.
|
||||
// Options:
|
||||
// - system (default)
|
||||
// - primary
|
||||
//
|
||||
copy_clipboard "system"
|
||||
|
||||
// Enable or disable automatic copy (and clear) of selection when releasing mouse
|
||||
// Default: true
|
||||
//
|
||||
// copy_on_select false
|
||||
|
||||
// Path to the default editor to use to edit pane scrollbuffer
|
||||
// Default: $EDITOR or $VISUAL
|
||||
//
|
||||
// scrollback_editor "/usr/bin/vim"
|
||||
|
||||
// When attaching to an existing session with other users,
|
||||
// should the session be mirrored (true)
|
||||
// or should each user have their own cursor (false)
|
||||
// Default: false
|
||||
//
|
||||
// mirror_session true
|
||||
|
||||
// The folder in which Zellij will look for layouts
|
||||
//
|
||||
// layout_dir "/path/to/my/layout_dir"
|
||||
|
||||
// The folder in which Zellij will look for themes
|
||||
//
|
||||
// theme_dir "/path/to/my/theme_dir"
|
||||
|
||||
// Enable or disable the rendering of styled and colored underlines (undercurl).
|
||||
// May need to be disabled for certain unsupported terminals
|
||||
// Default: true
|
||||
//
|
||||
// styled_underlines false
|
||||
|
||||
// Enable or disable writing of session metadata to disk (if disabled, other sessions might not know
|
||||
// metadata info on this session)
|
||||
// Default: false
|
||||
//
|
||||
// disable_session_metadata true
|
||||
|
||||
84
packages/devkit/zellij/default.nix
Normal file
84
packages/devkit/zellij/default.nix
Normal file
@@ -0,0 +1,84 @@
|
||||
{
|
||||
symlinkJoin,
|
||||
makeWrapper,
|
||||
pkgs,
|
||||
lib,
|
||||
zellij ? pkgs.zellij,
|
||||
shell ? pkgs.zsh,
|
||||
addPath ? [],
|
||||
}: let
|
||||
colors = import ../colors.nix;
|
||||
|
||||
config = let
|
||||
plugins = {
|
||||
sessionizer = builtins.fetchurl {
|
||||
url = "https://github.com/laperlej/zellij-sessionizer/releases/download/v0.4.3/zellij-sessionizer.wasm";
|
||||
sha256 = "0d43jhlhm7p8pvd8kcylfbfy3dahr8q4yngpnjyqivapwip9csq0";
|
||||
};
|
||||
};
|
||||
in
|
||||
pkgs.writeText "config.kdl" ''
|
||||
plugins {
|
||||
zellij-sessionizer location="file:${plugins.sessionizer}"
|
||||
|
||||
tab-bar location="zellij:tab-bar"
|
||||
status-bar location="zellij:status-bar"
|
||||
compact-bar location="zellij:compact-bar"
|
||||
session-manager location="zellij:session-manager"
|
||||
}
|
||||
|
||||
default_shell "${lib.getExe shell}"
|
||||
|
||||
themes {
|
||||
defautl {
|
||||
bg "${colors.base03}";
|
||||
fg "${colors.base05}";
|
||||
red "${colors.base01}";
|
||||
green "${colors.base0B}";
|
||||
blue "${colors.base0D}";
|
||||
yellow "${colors.base0A}";
|
||||
magenta "${colors.base0E}";
|
||||
orange "${colors.base09}";
|
||||
cyan "${colors.base0C}";
|
||||
black "${colors.base00}";
|
||||
white "${colors.base07}";
|
||||
}
|
||||
}
|
||||
theme "default"
|
||||
|
||||
${builtins.readFile ./config.kdl}
|
||||
'';
|
||||
|
||||
drv = symlinkJoin ({
|
||||
paths = zellij;
|
||||
|
||||
nativeBuildInputs = [makeWrapper];
|
||||
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/zellij \
|
||||
--set-default ZELLIJ_CONFIG_FILE ${config} \
|
||||
--set PATH "${lib.makeBinPath addPath}"
|
||||
'';
|
||||
}
|
||||
// {inherit (zellij) name pname meta;});
|
||||
in
|
||||
pkgs.stdenv.mkDerivation (rec {
|
||||
name = drv.name;
|
||||
pname = drv.pname;
|
||||
|
||||
buildCommand = let
|
||||
desktopEntry = pkgs.makeDesktopItem {
|
||||
name = pname;
|
||||
desktopName = name;
|
||||
exec = "${lib.getExe drv}";
|
||||
terminal = true;
|
||||
};
|
||||
in ''
|
||||
mkdir -p $out/bin
|
||||
cp ${lib.getExe drv} $out/bin
|
||||
|
||||
mkdir -p $out/share/applications
|
||||
cp ${desktopEntry}/share/applications/${pname}.desktop $out/share/applications/${pname}.desktop
|
||||
'';
|
||||
}
|
||||
// {inherit (zellij) meta;})
|
||||
Reference in New Issue
Block a user