working zellij

This commit is contained in:
Charlie Root 2024-07-31 02:09:58 +02:00
commit 449de3f702
11 changed files with 242 additions and 12 deletions

View file

@ -96,10 +96,10 @@
beets.enable = true; beets.enable = true;
}; };
editors = { editors = {
emacs.enable = true; emacs.enable = false;
helix.enable = true; helix.enable = true;
kakoune.enable = true; kakoune.enable = false;
neovim.enable = true; neovim.enable = false;
}; };
services = { services = {
pipewire.enable = true; pipewire.enable = true;

View file

@ -30,14 +30,15 @@
system = { system = {
programs = { programs = {
editors = { editors = {
emacs.enable = true; emacs.enable = false;
neovim.enable = true; neovim.enable = false;
helix.enable = true; helix.enable = true;
kakoune.enable = true; kakoune.enable = false;
}; };
discord.enable = true; discord.enable = true;
firefox.enable = true; firefox.enable = true;
zathura.enable = true; zathura.enable = true;
zellij.enable = true;
terminals = { terminals = {
foot.enable = true; foot.enable = true;
kitty.enable = true; kitty.enable = true;

View file

@ -73,6 +73,7 @@ in {
playerctl playerctl
polkit polkit
prismlauncher prismlauncher
pulsemixer
python3 python3
qbittorrent qbittorrent
r2modman r2modman
@ -104,6 +105,7 @@ in {
wl-clipboard wl-clipboard
xdg-utils xdg-utils
xournalpp xournalpp
yazi
zapzap zapzap
zip zip
]; ];

View file

@ -1 +1,9 @@
_: {imports = [./fish.nix ./nh.nix ./starship.nix ./beets.nix];} _: {
imports = [
./fish.nix
./nh.nix
./starship.nix
./beets.nix
./zellij
];
}

44
modules/cli/zellij.nix Normal file
View file

@ -0,0 +1,44 @@
{
config,
lib,
...
}: let
inherit (config.modules.other.system) username;
cfg = config.modules.system.programs.zellij;
inherit (lib) mkIf;
in {
config = mkIf cfg.enable {
home-manager.users.${username} = {
programs.zellij = {
enable = true;
enableFishIntegration = true;
on_force_close = "quit";
layout_dir = "${./layouts}";
settings = {
pane_frames = false;
default_layout = "compact";
ui = {
pane_frames = {
hide_session_name = true;
rounded.corners = true;
};
};
plugins = {
tab-bar.path = "tab-bar";
status-bar.path = "status-bar";
strider.path = "strider";
compact-bar.path = "compact-bar";
};
keybinds = {
unbind = "Ctrl n";
# resize = {
# bind = "Ctrl n";
# };
};
};
};
};
};
}

View file

@ -0,0 +1,47 @@
{
config,
lib,
...
}: let
inherit (config.modules.other.system) username;
cfg = config.modules.system.programs.zellij;
inherit (lib) mkIf;
in {
config = mkIf cfg.enable {
home-manager.users.${username} = {
programs.zellij = {
enable = true;
enableFishIntegration = true;
settings = {
layout_dir = "${./layouts}";
on_force_close = "quit";
pane_frames = false;
default_layout = "compact";
ui = {
pane_frames = {
hide_session_name = true;
rounded_corners = true;
};
};
plugins = {
tab-bar.path = "tab-bar";
status-bar.path = "status-bar";
strider.path = "strider";
compact-bar.path = "compact-bar";
};
keybinds = {
unbind = "Ctrl n";
# resize = {
# bind = "Ctrl n";
# };
};
};
};
};
};
}

View file

@ -0,0 +1,127 @@
// this is my custom "system" layout, loosely based on the official
// zellij development layout - it's simplified for desktop use
// and allows me to remain in a single workspace even when I'm
// using a tiling window manager and am constrained to a single
// workspace. It provides default tabs for media, file browsing
// which should be everything that I need, but I may add more
// in the future
layout {
// define default tab layout
default_tab_template {
// tab bar on the top
pane size=1 borderless=true {
plugin location="zellij:tab-bar"
}
// child tabs and panes
children
// status bar on the bottom
pane size=2 borderless=true {
plugin location="zellij:status-bar"
}
}
// strider tab uses the strider plugin of zellij
// which is similar to neovim's nvimtree
// ...but slower and much less configurable
tab_template name="strider_tab" {
pane size=1 borderless=true {
plugin location="zellij:tab-bar"
}
// use the strider plugin on the left side of the screen
// to achieve a nvim-tree like layout on the left 15% of
// the terminal window - looks cool but is not flexible
pane split_direction="Vertical" {
pane size="15%" name="Filetree" {
plugin location="zellij:strider"
}
children
}
pane size=2 borderless=true {
plugin location="zellij:status-bar"
}
}
// define a template pane for the terminal
// this once again imitates the neovim layout
// by providing a terminal instance on the bottom
// 25% of the screen that enters the z shell when
// zellij starts - the exec duration for zsh matters
// here as it'll repeat for each "tab" that exists
pane_template name="term" {
// horizontal split to place the terminal
// on the bottom half of the screen like the
// toggleterm neovim plugin
pane split_direction="horizontal" {
children
pane command="fish" size="25%" name="Shell"
}
}
// create a "strider tab" for my system configuration
// which is a tab that utilizes the strider tab template
// that we have defined earlier, provides a file-tree
// view in my system config directory, and opens flake.nix
// with the $EDITOR variable - has focus, is the first tab
strider_tab name="nichts" cwd="~/projects/nichts" focus=true {
term split_direction="vertical" {
// FIXME: edit does not open the file from cwd
// instead opens a buffer named flake.nix in cwd
// which should be the original flake.nix
// but is not
pane edit="./flake.nix" name="Flake"
}
}
// regular vertical tab that will open btop automatically for
// viewing active processes in a standalone tab
// more utilities can go here if seen necessary
tab name="Processes" split_direction="vertical" {
pane {
// open btop in the home directory
// doesn't really matter where you open it
cwd "$HOME"
command "btop"
}
}
// the media tab opens musikcube, the TUI music player
// and pulsemixer for volume control across different
// audio devices - this is split horizontally so that
// the mixer covers less space on the screen, at the
// bottom 35% of the active tab
tab name="Media" split_direction="vertical" {
// run musikcube in the Music directory
// the CWD doesn't really matter as musikcube
// is capable of binding to mpd daemon but
// the music directory seemed suitable as
// the working directory for the player
pane split_direction="horizontal" name="Player" {
pane {
cwd "$HOME/Nextcloud/Media/Music"
command "ncmpcpp"
}
}
// standalone pane for pulsemixer
pane split_direction="horizontal" name="Mixer" {
pane size="35%" {
command "pulsemixer"
}
}
}
// The last tab is a file browser that opens in the home directory
// so that I may freely browse my files and open them using the XDG
// specs when yazi can handle the file type.
tab name="Files" split_direction="horizontal" name="Files" {
pane {
cwd "$HOME"
command "yazi"
}
}
}

View file

@ -31,12 +31,12 @@ in {
]; ];
}); });
settings = { settings = {
theme = "catppuccin_mocha"; # theme = "catppuccin_mocha";
editor = { editor = {
indent-guides.render = true; indent-guides.render = true;
lsp.display-inlay-hints = true; lsp.display-inlay-hints = true;
line-number = "relative"; line-number = "relative";
mouse = false; mouse = true;
bufferline = "multiple"; bufferline = "multiple";
soft-wrap.enable = true; soft-wrap.enable = true;
lsp.display-messages = true; lsp.display-messages = true;

View file

@ -14,6 +14,7 @@ in {
zathura.enable = mkEnableOption "Zathura pdf viewer"; zathura.enable = mkEnableOption "Zathura pdf viewer";
nextcloud.enable = mkEnableOption "Nextcloud sync client"; nextcloud.enable = mkEnableOption "Nextcloud sync client";
firefox.enable = mkEnableOption "Firefox web browser"; firefox.enable = mkEnableOption "Firefox web browser";
zellij.enable = mkEnableOption "Zellij terminal multiplexer";
terminals = { terminals = {
foot.enable = mkEnableOption "Foot terminal emulator"; foot.enable = mkEnableOption "Foot terminal emulator";

View file

@ -7,7 +7,7 @@
file_manager = "nautilus.desktop"; file_manager = "nautilus.desktop";
media_player = "mpv.desktop"; media_player = "mpv.desktop";
image_viewer = "imv.desktop"; image_viewer = "imv.desktop";
text_editor = "nvim.desktop"; text_editor = "helix.desktop";
terminal = "foot.desktop"; terminal = "foot.desktop";
in { in {
environment.sessionVariables = {TERMINAL = "${terminal}";}; environment.sessionVariables = {TERMINAL = "${terminal}";};

View file

@ -14,7 +14,7 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
stylix = { stylix = {
enable = true; enable = true;
autoEnable = true; autoEnable = false;
homeManagerIntegration = { homeManagerIntegration = {
followSystem = true; followSystem = true;
autoImport = true; autoImport = true;
@ -77,7 +77,7 @@ in {
home-manager.users.${username} = { home-manager.users.${username} = {
stylix.targets = { stylix.targets = {
btop.enable = true; btop.enable = true;
helix.enable = false; helix.enable = true;
dunst.enable = true; dunst.enable = true;
firefox.enable = true; firefox.enable = true;
foot.enable = true; foot.enable = true;