diff --git a/SwarselSystems.org b/SwarselSystems.org index d0b4a87..9828311 100644 --- a/SwarselSystems.org +++ b/SwarselSystems.org @@ -2420,7 +2420,7 @@ This app checks for different apps that I keep around in the scratchpad for quic STR=$(swaymsg -t get_tree | jq -r 'recurse(.nodes[]) | select(.name == "__i3_scratch")' | grep kittyterm || true) CHECK=$(swaymsg -t get_tree | grep kittyterm || true) if [ "$CHECK" == "" ]; then - exec kitty -T kittyterm & + exec kitty -T kittyterm -o confirm_os_window_close=0 zellij attach --create kittyterm & sleep 1 fi if [ "$STR" == "" ]; then @@ -2467,6 +2467,28 @@ This app checks for different apps that I keep around in the scratchpad for quic #+end_src +**** swarselzellij + +#+begin_src shell :tangle scripts/swarselzellij.sh + KITTIES=$(($(pgrep -P 1 kitty | wc -l) - 1)) + + if [[ $KITTIES -lt 1 ]]; then + exec kitty -o confirm_os_window_close=0 zellij attach --create main + else + exec kitty -o confirm_os_window_close=0 zellij attach --create "temp $KITTIES" + fi +#+end_src + +#+begin_src nix :tangle pkgs/swarselzellij/default.nix + { self, name, writeShellApplication, kitty }: + writeShellApplication { + inherit name; + runtimeInputs = [ kitty ]; + text = builtins.readFile "${self}/scripts/${name}.sh"; + } + +#+end_src + **** waybarupdate :PROPERTIES: :CUSTOM_ID: h:f93f66f9-6b8b-478e-b139-b2f382c1f25e @@ -8584,6 +8606,7 @@ This is just a separate container for derivations defined in [[#h:64a5cc16-6b16- fhs swarsel-bootstrap swarsel-displaypower + swarselzellij ]; } #+end_src @@ -9329,205 +9352,21 @@ Here we set some aliases (some of them should be shellApplications instead) as w :CUSTOM_ID: h:00de4901-631c-4b4c-86ce-d9d6e62ed8c7 :END: #+begin_src nix :tangle profiles/home/common/zellij.nix - _: - # { pkgs, config, ... }: - # let - # inherit (config.lib.stylix) colors; - # sesh = pkgs.writeScriptBin "sesh" '' - # #! /usr/bin/env sh - - # # Taken from https://github.com/zellij-org/zellij/issues/884#issuecomment-1851136980 - # # select a directory using zoxide - # ZOXIDE_RESULT=$(zoxide query --interactive) - # # checks whether a directory has been selected - # if [[ -z "$ZOXIDE_RESULT" ]]; then - # # if there was no directory, select returns without executing - # exit 0 - # fi - # # extracts the directory name from the absolute path - # SESSION_TITLE=$(echo "$ZOXIDE_RESULT" | sed 's#.*/##') - - # # get the list of sessions - # SESSION_LIST=$(zellij list-sessions -n | awk '{print $1}') - - # # checks if SESSION_TITLE is in the session list - # if echo "$SESSION_LIST" | grep -q "^$SESSION_TITLE$"; then - # # if so, attach to existing session - # zellij attach "$SESSION_TITLE" - # else - # # if not, create a new session - # echo "Creating new session $SESSION_TITLE and CD $ZOXIDE_RESULT" - # cd $ZOXIDE_RESULT - # zellij attach -c "$SESSION_TITLE" - # fi - # ''; - - # in + { self, config, pkgs, ... }: { + programs.zellij = { enable = true; }; - home.packages = [ - # pkgs.tmate - # sesh + + home.packages = with pkgs; [ + zjstatus ]; - # xdg.configFile."zellij/config.kdl".source = ../../../programs/zellij/config.kdl; - # xdg.configFile."zellij/layouts/default.kdl".text = '' - # layout { - # swap_tiled_layout name="vertical" { - # tab max_panes=5 { - # pane split_direction="vertical" { - # pane - # pane { children; } - # } - # } - # tab max_panes=8 { - # pane split_direction="vertical" { - # pane { children; } - # pane { pane; pane; pane; pane; } - # } - # } - # tab max_panes=12 { - # pane split_direction="vertical" { - # pane { children; } - # pane { pane; pane; pane; pane; } - # pane { pane; pane; pane; pane; } - # } - # } - # } - - # swap_tiled_layout name="horizontal" { - # tab max_panes=5 { - # pane - # pane - # } - # tab max_panes=8 { - # pane { - # pane split_direction="vertical" { children; } - # pane split_direction="vertical" { pane; pane; pane; pane; } - # } - # } - # tab max_panes=12 { - # pane { - # pane split_direction="vertical" { children; } - # pane split_direction="vertical" { pane; pane; pane; pane; } - # pane split_direction="vertical" { pane; pane; pane; pane; } - # } - # } - # } - - # swap_tiled_layout name="stacked" { - # tab min_panes=5 { - # pane split_direction="vertical" { - # pane - # pane stacked=true { children; } - # } - # } - # } - - # swap_floating_layout name="staggered" { - # floating_panes - # } - - # swap_floating_layout name="enlarged" { - # floating_panes max_panes=10 { - # pane { x "5%"; y 1; width "90%"; height "90%"; } - # pane { x "5%"; y 2; width "90%"; height "90%"; } - # pane { x "5%"; y 3; width "90%"; height "90%"; } - # pane { x "5%"; y 4; width "90%"; height "90%"; } - # pane { x "5%"; y 5; width "90%"; height "90%"; } - # pane { x "5%"; y 6; width "90%"; height "90%"; } - # pane { x "5%"; y 7; width "90%"; height "90%"; } - # pane { x "5%"; y 8; width "90%"; height "90%"; } - # pane { x "5%"; y 9; width "90%"; height "90%"; } - # pane focus=true { x 10; y 10; width "90%"; height "90%"; } - # } - # } - - # swap_floating_layout name="spread" { - # floating_panes max_panes=1 { - # pane {y "50%"; x "50%"; } - # } - # floating_panes max_panes=2 { - # pane { x "1%"; y "25%"; width "45%"; } - # pane { x "50%"; y "25%"; width "45%"; } - # } - # floating_panes max_panes=3 { - # pane focus=true { y "55%"; width "45%"; height "45%"; } - # pane { x "1%"; y "1%"; width "45%"; } - # pane { x "50%"; y "1%"; width "45%"; } - # } - # floating_panes max_panes=4 { - # pane { x "1%"; y "55%"; width "45%"; height "45%"; } - # pane focus=true { x "50%"; y "55%"; width "45%"; height "45%"; } - # pane { x "1%"; y "1%"; width "45%"; height "45%"; } - # pane { x "50%"; y "1%"; width "45%"; height "45%"; } - # } - # } - - # default_tab_template { - # pane size=2 borderless=true { - # plugin location="file://${pkgs.zjstatus}/bin/zjstatus.wasm" { - # format_left "{mode}#[bg=#${colors.base00}] {tabs}" - # format_center "" - # format_right "#[bg=#${colors.base00},fg=#${colors.base0D}]#[bg=#${colors.base0D},fg=#${colors.base01},bold] #[bg=#${colors.base02},fg=#${colors.base05},bold] {session} #[bg=#${colors.base03},fg=#${colors.base05},bold]" - # format_space "" - # format_hide_on_overlength "true" - # format_precedence "crl" - - # border_enabled "false" - # border_char "─" - # border_format "#[fg=#6C7086]{char}" - # border_position "top" - - # mode_normal "#[bg=#${colors.base0B},fg=#${colors.base02},bold] NORMAL#[bg=#${colors.base03},fg=#${colors.base0B}]█" - # mode_locked "#[bg=#${colors.base04},fg=#${colors.base02},bold] LOCKED #[bg=#${colors.base03},fg=#${colors.base04}]█" - # mode_resize "#[bg=#${colors.base08},fg=#${colors.base02},bold] RESIZE#[bg=#${colors.base03},fg=#${colors.base08}]█" - # mode_pane "#[bg=#${colors.base0D},fg=#${colors.base02},bold] PANE#[bg=#${colors.base03},fg=#${colors.base0D}]█" - # mode_tab "#[bg=#${colors.base07},fg=#${colors.base02},bold] TAB#[bg=#${colors.base03},fg=#${colors.base07}]█" - # mode_scroll "#[bg=#${colors.base0A},fg=#${colors.base02},bold] SCROLL#[bg=#${colors.base03},fg=#${colors.base0A}]█" - # mode_enter_search "#[bg=#${colors.base0D},fg=#${colors.base02},bold] ENT-SEARCH#[bg=#${colors.base03},fg=#${colors.base0D}]█" - # mode_search "#[bg=#${colors.base0D},fg=#${colors.base02},bold] SEARCHARCH#[bg=#${colors.base03},fg=#${colors.base0D}]█" - # mode_rename_tab "#[bg=#${colors.base07},fg=#${colors.base02},bold] RENAME-TAB#[bg=#${colors.base03},fg=#${colors.base07}]█" - # mode_rename_pane "#[bg=#${colors.base0D},fg=#${colors.base02},bold] RENAME-PANE#[bg=#${colors.base03},fg=#${colors.base0D}]█" - # mode_session "#[bg=#${colors.base0E},fg=#${colors.base02},bold] SESSION#[bg=#${colors.base03},fg=#${colors.base0E}]█" - # mode_move "#[bg=#${colors.base0F},fg=#${colors.base02},bold] MOVE#[bg=#${colors.base03},fg=#${colors.base0F}]█" - # mode_prompt "#[bg=#${colors.base0D},fg=#${colors.base02},bold] PROMPT#[bg=#${colors.base03},fg=#${colors.base0D}]█" - # mode_tmux "#[bg=#${colors.base09},fg=#${colors.base02},bold] TMUX#[bg=#${colors.base03},fg=#${colors.base09}]█" - - # // formatting for inactive tabs - # tab_normal "#[bg=#${colors.base03},fg=#${colors.base0D}]█#[bg=#${colors.base0D},fg=#${colors.base02},bold]{index} #[bg=#${colors.base02},fg=#${colors.base05},bold] {name}{floating_indicator}#[bg=#${colors.base03},fg=#${colors.base02},bold]█" - # tab_normal_fullscreen "#[bg=#${colors.base03},fg=#${colors.base0D}]█#[bg=#${colors.base0D},fg=#${colors.base02},bold]{index} #[bg=#${colors.base02},fg=#${colors.base05},bold] {name}{fullscreen_indicator}#[bg=#${colors.base03},fg=#${colors.base02},bold]█" - # tab_normal_sync "#[bg=#${colors.base03},fg=#${colors.base0D}]█#[bg=#${colors.base0D},fg=#${colors.base02},bold]{index} #[bg=#${colors.base02},fg=#${colors.base05},bold] {name}{sync_indicator}#[bg=#${colors.base03},fg=#${colors.base02},bold]█" - - # // formatting for the current active tab - # tab_active "#[bg=#${colors.base03},fg=#${colors.base09}]█#[bg=#${colors.base09},fg=#${colors.base02},bold]{index} #[bg=#${colors.base02},fg=#${colors.base05},bold] {name}{floating_indicator}#[bg=#${colors.base03},fg=#${colors.base02},bold]█" - # tab_active_fullscreen "#[bg=#${colors.base03},fg=#${colors.base09}]█#[bg=#${colors.base09},fg=#${colors.base02},bold]{index} #[bg=#${colors.base02},fg=#${colors.base05},bold] {name}{fullscreen_indicator}#[bg=#${colors.base03},fg=#${colors.base02},bold]█" - # tab_active_sync "#[bg=#${colors.base03},fg=#${colors.base09}]█#[bg=#${colors.base09},fg=#${colors.base02},bold]{index} #[bg=#${colors.base02},fg=#${colors.base05},bold] {name}{sync_indicator}#[bg=#${colors.base03},fg=#${colors.base02},bold]█" - - # // separator between the tabs - # tab_separator "#[bg=#${colors.base00}] " - - # // indicators - # tab_sync_indicator " " - # tab_fullscreen_indicator " 󰊓" - # tab_floating_indicator " 󰹙" - - # command_git_branch_command "git rev-parse --abbrev-ref HEAD" - # command_git_branch_format "#[fg=blue] {stdout} " - # command_git_branch_interval "10" - # command_git_branch_rendermode "static" - - # datetime "#[fg=#6C7086,bold] {format} " - # datetime_format "%A, %d %b %Y %H:%M" - # datetime_timezone "Europe/London" - # } - # } - # children - # } - # } - # ''; + xdg.configFile = { + "zellij/config.kdl".text = import "${self}/programs/zellij/config.kdl.nix" { inherit config; }; + "zellij/layouts/default.kdl".text = import "${self}/programs/zellij/layouts/default.kdl.nix" { inherit config pkgs; }; + }; } #+end_src @@ -10597,7 +10436,7 @@ Currently, I am too lazy to explain every option here, but most of it is very se wrapperFeatures.gtk = true; config = rec { modifier = "Mod4"; - terminal = "kitty"; + # terminal = "kitty"; menu = "fuzzel"; bars = [{ command = "waybar"; @@ -10684,7 +10523,7 @@ Currently, I am too lazy to explain every option here, but most of it is very se "${modifier}+Ctrl+Shift+r" = "exec swarsel-displaypower"; "${modifier}+Shift+e" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'"; "${modifier}+r" = "mode resize"; - "${modifier}+Return" = "exec kitty"; + "${modifier}+Return" = "exec swarselzellij"; "${modifier}+Print" = "exec screenshare"; # "XF86AudioRaiseVolume" = "exec pa 5%"; "XF86AudioRaiseVolume" = "exec pamixer -i 5"; @@ -10713,7 +10552,7 @@ Currently, I am too lazy to explain every option here, but most of it is very se input = config.swarselsystems.standardinputs; workspaceOutputAssign = workplaceOutputs; startup = config.swarselsystems.startup ++ [ - { command = "kitty -T kittyterm"; } + { command = "kitty -T kittyterm -o confirm_os_window_close=0 zellij attach --create kittyterm"; } { command = "sleep 60; kitty -T spotifytui -o confirm_os_window_close=0 spotify_player"; } ]; window = { diff --git a/pkgs/swarselzellij/default.nix b/pkgs/swarselzellij/default.nix new file mode 100644 index 0000000..f2f8fb1 --- /dev/null +++ b/pkgs/swarselzellij/default.nix @@ -0,0 +1,6 @@ +{ self, name, writeShellApplication, kitty }: +writeShellApplication { + inherit name; + runtimeInputs = [ kitty ]; + text = builtins.readFile "${self}/scripts/${name}.sh"; +} diff --git a/profiles/home/common/custom-packages.nix b/profiles/home/common/custom-packages.nix index 6645489..bdadabd 100644 --- a/profiles/home/common/custom-packages.nix +++ b/profiles/home/common/custom-packages.nix @@ -25,5 +25,6 @@ fhs swarsel-bootstrap swarsel-displaypower + swarselzellij ]; } diff --git a/profiles/home/common/sway.nix b/profiles/home/common/sway.nix index 52d81f6..359df63 100644 --- a/profiles/home/common/sway.nix +++ b/profiles/home/common/sway.nix @@ -16,7 +16,7 @@ in wrapperFeatures.gtk = true; config = rec { modifier = "Mod4"; - terminal = "kitty"; + # terminal = "kitty"; menu = "fuzzel"; bars = [{ command = "waybar"; @@ -103,7 +103,7 @@ in "${modifier}+Ctrl+Shift+r" = "exec swarsel-displaypower"; "${modifier}+Shift+e" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'"; "${modifier}+r" = "mode resize"; - "${modifier}+Return" = "exec kitty"; + "${modifier}+Return" = "exec swarselzellij"; "${modifier}+Print" = "exec screenshare"; # "XF86AudioRaiseVolume" = "exec pa 5%"; "XF86AudioRaiseVolume" = "exec pamixer -i 5"; @@ -132,7 +132,7 @@ in input = config.swarselsystems.standardinputs; workspaceOutputAssign = workplaceOutputs; startup = config.swarselsystems.startup ++ [ - { command = "kitty -T kittyterm"; } + { command = "kitty -T kittyterm -o confirm_os_window_close=0 zellij attach --create kittyterm"; } { command = "sleep 60; kitty -T spotifytui -o confirm_os_window_close=0 spotify_player"; } ]; window = { diff --git a/profiles/home/common/zellij.nix b/profiles/home/common/zellij.nix index b8cf5d3..26f7153 100644 --- a/profiles/home/common/zellij.nix +++ b/profiles/home/common/zellij.nix @@ -1,201 +1,17 @@ -_: -# { pkgs, config, ... }: -# let -# inherit (config.lib.stylix) colors; -# sesh = pkgs.writeScriptBin "sesh" '' -# #! /usr/bin/env sh - -# # Taken from https://github.com/zellij-org/zellij/issues/884#issuecomment-1851136980 -# # select a directory using zoxide -# ZOXIDE_RESULT=$(zoxide query --interactive) -# # checks whether a directory has been selected -# if [[ -z "$ZOXIDE_RESULT" ]]; then -# # if there was no directory, select returns without executing -# exit 0 -# fi -# # extracts the directory name from the absolute path -# SESSION_TITLE=$(echo "$ZOXIDE_RESULT" | sed 's#.*/##') - -# # get the list of sessions -# SESSION_LIST=$(zellij list-sessions -n | awk '{print $1}') - -# # checks if SESSION_TITLE is in the session list -# if echo "$SESSION_LIST" | grep -q "^$SESSION_TITLE$"; then -# # if so, attach to existing session -# zellij attach "$SESSION_TITLE" -# else -# # if not, create a new session -# echo "Creating new session $SESSION_TITLE and CD $ZOXIDE_RESULT" -# cd $ZOXIDE_RESULT -# zellij attach -c "$SESSION_TITLE" -# fi -# ''; - -# in +{ self, config, pkgs, ... }: { + programs.zellij = { enable = true; }; - home.packages = [ - # pkgs.tmate - # sesh + + home.packages = with pkgs; [ + zjstatus ]; - # xdg.configFile."zellij/config.kdl".source = ../../../programs/zellij/config.kdl; - # xdg.configFile."zellij/layouts/default.kdl".text = '' - # layout { - # swap_tiled_layout name="vertical" { - # tab max_panes=5 { - # pane split_direction="vertical" { - # pane - # pane { children; } - # } - # } - # tab max_panes=8 { - # pane split_direction="vertical" { - # pane { children; } - # pane { pane; pane; pane; pane; } - # } - # } - # tab max_panes=12 { - # pane split_direction="vertical" { - # pane { children; } - # pane { pane; pane; pane; pane; } - # pane { pane; pane; pane; pane; } - # } - # } - # } - - # swap_tiled_layout name="horizontal" { - # tab max_panes=5 { - # pane - # pane - # } - # tab max_panes=8 { - # pane { - # pane split_direction="vertical" { children; } - # pane split_direction="vertical" { pane; pane; pane; pane; } - # } - # } - # tab max_panes=12 { - # pane { - # pane split_direction="vertical" { children; } - # pane split_direction="vertical" { pane; pane; pane; pane; } - # pane split_direction="vertical" { pane; pane; pane; pane; } - # } - # } - # } - - # swap_tiled_layout name="stacked" { - # tab min_panes=5 { - # pane split_direction="vertical" { - # pane - # pane stacked=true { children; } - # } - # } - # } - - # swap_floating_layout name="staggered" { - # floating_panes - # } - - # swap_floating_layout name="enlarged" { - # floating_panes max_panes=10 { - # pane { x "5%"; y 1; width "90%"; height "90%"; } - # pane { x "5%"; y 2; width "90%"; height "90%"; } - # pane { x "5%"; y 3; width "90%"; height "90%"; } - # pane { x "5%"; y 4; width "90%"; height "90%"; } - # pane { x "5%"; y 5; width "90%"; height "90%"; } - # pane { x "5%"; y 6; width "90%"; height "90%"; } - # pane { x "5%"; y 7; width "90%"; height "90%"; } - # pane { x "5%"; y 8; width "90%"; height "90%"; } - # pane { x "5%"; y 9; width "90%"; height "90%"; } - # pane focus=true { x 10; y 10; width "90%"; height "90%"; } - # } - # } - - # swap_floating_layout name="spread" { - # floating_panes max_panes=1 { - # pane {y "50%"; x "50%"; } - # } - # floating_panes max_panes=2 { - # pane { x "1%"; y "25%"; width "45%"; } - # pane { x "50%"; y "25%"; width "45%"; } - # } - # floating_panes max_panes=3 { - # pane focus=true { y "55%"; width "45%"; height "45%"; } - # pane { x "1%"; y "1%"; width "45%"; } - # pane { x "50%"; y "1%"; width "45%"; } - # } - # floating_panes max_panes=4 { - # pane { x "1%"; y "55%"; width "45%"; height "45%"; } - # pane focus=true { x "50%"; y "55%"; width "45%"; height "45%"; } - # pane { x "1%"; y "1%"; width "45%"; height "45%"; } - # pane { x "50%"; y "1%"; width "45%"; height "45%"; } - # } - # } - - # default_tab_template { - # pane size=2 borderless=true { - # plugin location="file://${pkgs.zjstatus}/bin/zjstatus.wasm" { - # format_left "{mode}#[bg=#${colors.base00}] {tabs}" - # format_center "" - # format_right "#[bg=#${colors.base00},fg=#${colors.base0D}]#[bg=#${colors.base0D},fg=#${colors.base01},bold] #[bg=#${colors.base02},fg=#${colors.base05},bold] {session} #[bg=#${colors.base03},fg=#${colors.base05},bold]" - # format_space "" - # format_hide_on_overlength "true" - # format_precedence "crl" - - # border_enabled "false" - # border_char "─" - # border_format "#[fg=#6C7086]{char}" - # border_position "top" - - # mode_normal "#[bg=#${colors.base0B},fg=#${colors.base02},bold] NORMAL#[bg=#${colors.base03},fg=#${colors.base0B}]█" - # mode_locked "#[bg=#${colors.base04},fg=#${colors.base02},bold] LOCKED #[bg=#${colors.base03},fg=#${colors.base04}]█" - # mode_resize "#[bg=#${colors.base08},fg=#${colors.base02},bold] RESIZE#[bg=#${colors.base03},fg=#${colors.base08}]█" - # mode_pane "#[bg=#${colors.base0D},fg=#${colors.base02},bold] PANE#[bg=#${colors.base03},fg=#${colors.base0D}]█" - # mode_tab "#[bg=#${colors.base07},fg=#${colors.base02},bold] TAB#[bg=#${colors.base03},fg=#${colors.base07}]█" - # mode_scroll "#[bg=#${colors.base0A},fg=#${colors.base02},bold] SCROLL#[bg=#${colors.base03},fg=#${colors.base0A}]█" - # mode_enter_search "#[bg=#${colors.base0D},fg=#${colors.base02},bold] ENT-SEARCH#[bg=#${colors.base03},fg=#${colors.base0D}]█" - # mode_search "#[bg=#${colors.base0D},fg=#${colors.base02},bold] SEARCHARCH#[bg=#${colors.base03},fg=#${colors.base0D}]█" - # mode_rename_tab "#[bg=#${colors.base07},fg=#${colors.base02},bold] RENAME-TAB#[bg=#${colors.base03},fg=#${colors.base07}]█" - # mode_rename_pane "#[bg=#${colors.base0D},fg=#${colors.base02},bold] RENAME-PANE#[bg=#${colors.base03},fg=#${colors.base0D}]█" - # mode_session "#[bg=#${colors.base0E},fg=#${colors.base02},bold] SESSION#[bg=#${colors.base03},fg=#${colors.base0E}]█" - # mode_move "#[bg=#${colors.base0F},fg=#${colors.base02},bold] MOVE#[bg=#${colors.base03},fg=#${colors.base0F}]█" - # mode_prompt "#[bg=#${colors.base0D},fg=#${colors.base02},bold] PROMPT#[bg=#${colors.base03},fg=#${colors.base0D}]█" - # mode_tmux "#[bg=#${colors.base09},fg=#${colors.base02},bold] TMUX#[bg=#${colors.base03},fg=#${colors.base09}]█" - - # // formatting for inactive tabs - # tab_normal "#[bg=#${colors.base03},fg=#${colors.base0D}]█#[bg=#${colors.base0D},fg=#${colors.base02},bold]{index} #[bg=#${colors.base02},fg=#${colors.base05},bold] {name}{floating_indicator}#[bg=#${colors.base03},fg=#${colors.base02},bold]█" - # tab_normal_fullscreen "#[bg=#${colors.base03},fg=#${colors.base0D}]█#[bg=#${colors.base0D},fg=#${colors.base02},bold]{index} #[bg=#${colors.base02},fg=#${colors.base05},bold] {name}{fullscreen_indicator}#[bg=#${colors.base03},fg=#${colors.base02},bold]█" - # tab_normal_sync "#[bg=#${colors.base03},fg=#${colors.base0D}]█#[bg=#${colors.base0D},fg=#${colors.base02},bold]{index} #[bg=#${colors.base02},fg=#${colors.base05},bold] {name}{sync_indicator}#[bg=#${colors.base03},fg=#${colors.base02},bold]█" - - # // formatting for the current active tab - # tab_active "#[bg=#${colors.base03},fg=#${colors.base09}]█#[bg=#${colors.base09},fg=#${colors.base02},bold]{index} #[bg=#${colors.base02},fg=#${colors.base05},bold] {name}{floating_indicator}#[bg=#${colors.base03},fg=#${colors.base02},bold]█" - # tab_active_fullscreen "#[bg=#${colors.base03},fg=#${colors.base09}]█#[bg=#${colors.base09},fg=#${colors.base02},bold]{index} #[bg=#${colors.base02},fg=#${colors.base05},bold] {name}{fullscreen_indicator}#[bg=#${colors.base03},fg=#${colors.base02},bold]█" - # tab_active_sync "#[bg=#${colors.base03},fg=#${colors.base09}]█#[bg=#${colors.base09},fg=#${colors.base02},bold]{index} #[bg=#${colors.base02},fg=#${colors.base05},bold] {name}{sync_indicator}#[bg=#${colors.base03},fg=#${colors.base02},bold]█" - - # // separator between the tabs - # tab_separator "#[bg=#${colors.base00}] " - - # // indicators - # tab_sync_indicator " " - # tab_fullscreen_indicator " 󰊓" - # tab_floating_indicator " 󰹙" - - # command_git_branch_command "git rev-parse --abbrev-ref HEAD" - # command_git_branch_format "#[fg=blue] {stdout} " - # command_git_branch_interval "10" - # command_git_branch_rendermode "static" - - # datetime "#[fg=#6C7086,bold] {format} " - # datetime_format "%A, %d %b %Y %H:%M" - # datetime_timezone "Europe/London" - # } - # } - # children - # } - # } - # ''; + xdg.configFile = { + "zellij/config.kdl".text = import "${self}/programs/zellij/config.kdl.nix" { inherit config; }; + "zellij/layouts/default.kdl".text = import "${self}/programs/zellij/layouts/default.kdl.nix" { inherit config pkgs; }; + }; } diff --git a/programs/zellij/config.kdl b/programs/zellij/config.kdl deleted file mode 100644 index fb437e1..0000000 --- a/programs/zellij/config.kdl +++ /dev/null @@ -1,264 +0,0 @@ -theme "catppuccin-mocha" -pane_frames false -simplified_ui true -default_shell "zsh" -copy_on_select true - -// If you'd like to override the default keybindings completely, be sure to change "keybinds" to "keybinds clear-defaults=true" -keybinds { - unbind "Ctrl q" - normal { - // uncomment this and adjust key if using copy_on_select=false - // bind "Alt c" { Copy; } - } - locked clear-defaults=true { - bind "Alt u" { SwitchToMode "Normal"; } - } - - resize clear-defaults=true { - bind "Alt r" "Esc" "Ctrl {" { 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 clear-defaults=true { - bind "Alt p" "Esc" "Ctrl {" { SwitchToMode "Normal"; } - - bind "Alt h" "h" "Left" { MoveFocus "Left"; } - bind "Alt l" "l" "Right" { MoveFocus "Right"; } - bind "Alt j" "j" "Down" { MoveFocus "Down"; } - bind "Alt k" "k" "Up" { MoveFocus "Up"; } - bind "p" { SwitchFocus; } - bind "n" { SwitchToMode "Normal"; } - bind "d" { NewPane "Down"; SwitchToMode "Normal"; } - bind "r" { NewPane "Right"; SwitchToMode "Normal"; } - bind "x" { CloseFocus; SwitchToMode "Normal"; } - bind "f" { ToggleFocusFullscreen; SwitchToMode "Normal"; } - bind "z" { TogglePaneFrames; SwitchToMode "Normal"; } - bind "w" { ToggleFloatingPanes; SwitchToMode "Normal"; } - bind "e" { TogglePaneEmbedOrFloating; SwitchToMode "Normal"; } - bind "c" { SwitchToMode "RenamePane"; PaneNameInput 0;} - } - - move clear-defaults=true { - bind "Alt m" "Esc" "Ctrl {" { 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 clear-defaults=true { - bind "Alt t" "Esc" "Ctrl {" { SwitchToMode "Normal"; } - - bind "r" { SwitchToMode "RenameTab"; TabNameInput 0; } - bind "h" "Left" "Up" "k" { GoToPreviousTab; } - bind "l" "Right" "Down" "j" { GoToNextTab; } - bind "n" { NewTab; SwitchToMode "Normal"; } - bind "x" { CloseTab; SwitchToMode "Normal"; } - bind "s" { ToggleActiveSyncTab; SwitchToMode "Normal"; } - bind "1" { GoToTab 1; SwitchToMode "Normal"; } - bind "2" { GoToTab 2; SwitchToMode "Normal"; } - bind "3" { GoToTab 3; SwitchToMode "Normal"; } - bind "4" { GoToTab 4; SwitchToMode "Normal"; } - bind "5" { GoToTab 5; SwitchToMode "Normal"; } - bind "6" { GoToTab 6; SwitchToMode "Normal"; } - bind "7" { GoToTab 7; SwitchToMode "Normal"; } - bind "8" { GoToTab 8; SwitchToMode "Normal"; } - bind "9" { GoToTab 9; SwitchToMode "Normal"; } - bind "Tab" { ToggleTab; } - } - - scroll clear-defaults=true { - bind "Alt f" "Esc" "Ctrl {" { SwitchToMode "Normal"; } - - bind "e" { EditScrollback; SwitchToMode "Normal"; } - bind "s" { SwitchToMode "EnterSearch"; SearchInput 0; } - bind "Ctrl c" { ScrollToBottom; SwitchToMode "Normal"; } - 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; } - // uncomment this and adjust key if using copy_on_select=false - // bind "Alt c" { Copy; } - } - - search clear-defaults=true { - bind "Alt f" "Esc" "Ctrl {" { SwitchToMode "Normal"; } - - bind "Ctrl c" "Esc" "Ctrl {" { ScrollToBottom; SwitchToMode "Normal"; } - 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 clear-defaults=true { - bind "Ctrl c" "Esc" "Ctrl {" { SwitchToMode "Scroll"; } - bind "Enter" { SwitchToMode "Search"; } - } - - renametab clear-defaults=true { - bind "Ctrl c" "Enter" { SwitchToMode "Normal"; } - bind "Esc" "Ctrl {"{ UndoRenameTab; SwitchToMode "Tab"; } - } - - renamepane clear-defaults=true { - bind "Ctrl c" { SwitchToMode "Normal"; } - bind "Esc" "Ctrl {" { UndoRenamePane; SwitchToMode "Pane"; } - } - - session clear-defaults=true { - bind "Alt s" "Esc" "Ctrl {" { SwitchToMode "Normal"; } - - bind "Alt f" { SwitchToMode "Scroll"; } - bind "d" { Detach; } - bind "w" { - LaunchOrFocusPlugin "zellij:session-manager" { - floating false - move_to_focused_tab true - }; - SwitchToMode "Normal" - } - } - - tmux clear-defaults=true { - bind "Ctrl b" "Esc" "Ctrl {" { Write 2; SwitchToMode "Normal"; } - bind "[" { SwitchToMode "Scroll"; } - 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" { - bind "Alt u" { SwitchToMode "Locked"; } - - bind "Alt q" { Quit; } - bind "Alt n" { NewPane; } - bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } - bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } - bind "Alt j" "Alt Down" { MoveFocus "Down"; } - bind "Alt k" "Alt Up" { MoveFocus "Up"; } - bind "Alt =" "Alt +" { Resize "Increase"; } - bind "Alt -" { Resize "Decrease"; } - bind "Alt [" { PreviousSwapLayout; } - bind "Alt ]" { NextSwapLayout; } - //bind "Ctrl h" { - // MessagePlugin "https://github.com/hiasr/vim-zellij-navigator/releases/download/0.2.1/vim-zellij-navigator.wasm" { - // name "move_focus_or_tab"; - // payload "left"; - - // // Plugin Configuration - // move_mod "ctrl"; // Optional, should be added on every command if you want to use it - // resize_mod "alt"; // Optional, should be added on every command if you want to use it - // }; - //} - - //bind "Ctrl j" { - // MessagePlugin "https://github.com/hiasr/vim-zellij-navigator/releases/download/0.2.1/vim-zellij-navigator.wasm" { - // name "move_focus"; - // payload "down"; - - // move_mod "ctrl"; - // resize_mod "alt"; - // }; - //} - - //bind "Ctrl k" { - // MessagePlugin "https://github.com/hiasr/vim-zellij-navigator/releases/download/0.2.1/vim-zellij-navigator.wasm" { - // name "move_focus"; - // payload "up"; - - // move_mod "ctrl"; - // resize_mod "alt"; - // }; - //} - - //bind "Ctrl l" { - // MessagePlugin "https://github.com/hiasr/vim-zellij-navigator/releases/download/0.2.1/vim-zellij-navigator.wasm" { - // name "move_focus_or_tab"; - // payload "right"; - - // move_mod "ctrl"; - // resize_mod "alt"; - // }; - //} - } - - shared_except "normal" "locked" { - unbind "Ctrl g" - bind "Enter" "Esc" "Alt u" { SwitchToMode "Normal"; } - } - - shared_except "pane" "locked" { - unbind "Ctrl p" - bind "Alt p" { SwitchToMode "Pane"; } - } - - shared_except "resize" "locked" { - unbind "Ctrl n" - bind "Alt r" { SwitchToMode "Resize"; } - } - - shared_except "scroll" "locked" { - unbind "Ctrl s" - bind "Alt f" { SwitchToMode "Scroll"; } - } - - shared_except "session" "locked" { - unbind "Ctrl o" - bind "Alt s" { SwitchToMode "Session"; } - } - - shared_except "tab" "locked" { - unbind "Ctrl t" - bind "Alt t" { SwitchToMode "Tab"; } - } - - shared_except "move" "locked" { - unbind "Ctrl h" - bind "Alt m" { SwitchToMode "Move"; } - } - - shared_except "tmux" "locked" { - unbind "Ctrl b" - // bind "Ctrl b" { SwitchToMode "Tmux"; } - } -} diff --git a/programs/zellij/config.kdl.nix b/programs/zellij/config.kdl.nix new file mode 100644 index 0000000..7ae009d --- /dev/null +++ b/programs/zellij/config.kdl.nix @@ -0,0 +1,342 @@ +{ config }: +'' + pane_frames false + simplified_ui false + default_shell "zsh" + copy_on_select true + on_force_close "detach" + session_name "main" + attach_to_session true + + default_layout "default" + layout_dir "${config.home.homeDirectory}/.config/zellij/layouts" + theme_dir "${config.home.homeDirectory}/.config/zellij/themes" + + keybinds clear-defaults=true { + locked { + bind "Ctrl g" { SwitchToMode "normal"; } + } + pane { + bind "left" { MoveFocus "left"; } + bind "down" { MoveFocus "down"; } + bind "up" { MoveFocus "up"; } + bind "right" { MoveFocus "right"; } + bind "c" { SwitchToMode "renamepane"; PaneNameInput 0; } + bind "d" { NewPane "down"; SwitchToMode "normal"; } + bind "e" { TogglePaneEmbedOrFloating; SwitchToMode "normal"; } + bind "f" { ToggleFocusFullscreen; SwitchToMode "normal"; } + bind "h" { MoveFocus "left"; } + bind "j" { MoveFocus "down"; } + bind "k" { MoveFocus "up"; } + bind "l" { MoveFocus "right"; } + bind "n" { NewPane; SwitchToMode "normal"; } + bind "p" { SwitchFocus; } + bind "Ctrl p" { SwitchToMode "normal"; } + bind "r" { NewPane "right"; SwitchToMode "normal"; } + bind "w" { ToggleFloatingPanes; SwitchToMode "normal"; } + bind "z" { TogglePaneFrames; SwitchToMode "normal"; } + } + tab { + bind "left" { GoToPreviousTab; } + bind "down" { GoToNextTab; } + bind "up" { GoToPreviousTab; } + bind "right" { GoToNextTab; } + bind "1" { GoToTab 1; SwitchToMode "normal"; } + bind "2" { GoToTab 2; SwitchToMode "normal"; } + bind "3" { GoToTab 3; SwitchToMode "normal"; } + bind "4" { GoToTab 4; SwitchToMode "normal"; } + bind "5" { GoToTab 5; SwitchToMode "normal"; } + bind "6" { GoToTab 6; SwitchToMode "normal"; } + bind "7" { GoToTab 7; SwitchToMode "normal"; } + bind "8" { GoToTab 8; SwitchToMode "normal"; } + bind "9" { GoToTab 9; SwitchToMode "normal"; } + bind "[" { BreakPaneLeft; SwitchToMode "normal"; } + bind "]" { BreakPaneRight; SwitchToMode "normal"; } + bind "b" { BreakPane; SwitchToMode "normal"; } + bind "h" { GoToPreviousTab; } + bind "j" { GoToNextTab; } + bind "k" { GoToPreviousTab; } + bind "l" { GoToNextTab; } + bind "n" { NewTab; SwitchToMode "normal"; } + bind "r" { SwitchToMode "renametab"; TabNameInput 0; } + bind "s" { ToggleActiveSyncTab; SwitchToMode "normal"; } + bind "Ctrl t" { SwitchToMode "normal"; } + bind "x" { CloseTab; SwitchToMode "normal"; } + bind "tab" { ToggleTab; } + } + resize { + bind "left" { Resize "Increase left"; } + bind "down" { Resize "Increase down"; } + bind "up" { Resize "Increase up"; } + bind "right" { Resize "Increase right"; } + bind "+" { Resize "Increase"; } + bind "-" { Resize "Decrease"; } + bind "=" { Resize "Increase"; } + bind "H" { Resize "Decrease left"; } + bind "J" { Resize "Decrease down"; } + bind "K" { Resize "Decrease up"; } + bind "L" { Resize "Decrease right"; } + bind "h" { Resize "Increase left"; } + bind "j" { Resize "Increase down"; } + bind "k" { Resize "Increase up"; } + bind "l" { Resize "Increase right"; } + bind "Ctrl n" { SwitchToMode "normal"; } + } + move { + bind "left" { MovePane "left"; } + bind "down" { MovePane "down"; } + bind "up" { MovePane "up"; } + bind "right" { MovePane "right"; } + bind "h" { MovePane "left"; } + bind "Ctrl h" { SwitchToMode "normal"; } + bind "j" { MovePane "down"; } + bind "k" { MovePane "up"; } + bind "l" { MovePane "right"; } + bind "n" { MovePane; } + bind "p" { MovePaneBackwards; } + bind "tab" { MovePane; } + } + scroll { + bind "e" { EditScrollback; SwitchToMode "normal"; } + bind "s" { SwitchToMode "entersearch"; SearchInput 0; } + } + search { + bind "c" { SearchToggleOption "CaseSensitivity"; } + bind "n" { Search "down"; } + bind "o" { SearchToggleOption "WholeWord"; } + bind "p" { Search "up"; } + bind "w" { SearchToggleOption "Wrap"; } + } + session { + bind "c" { + LaunchOrFocusPlugin "configuration" { + floating true + move_to_focused_tab true + } + SwitchToMode "normal" + } + bind "Ctrl o" { SwitchToMode "normal"; } + bind "p" { + LaunchOrFocusPlugin "plugin-manager" { + floating true + move_to_focused_tab true + } + SwitchToMode "normal" + } + bind "w" { + LaunchOrFocusPlugin "session-manager" { + floating true + move_to_focused_tab true + } + SwitchToMode "normal" + } + } + shared_except "locked" { + bind "Alt left" { MoveFocusOrTab "left"; } + bind "Alt down" { MoveFocus "down"; } + bind "Alt up" { MoveFocus "up"; } + bind "Alt right" { MoveFocusOrTab "right"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt [" { PreviousSwapLayout; } + bind "Alt ]" { NextSwapLayout; } + bind "Alt f" { ToggleFloatingPanes; } + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Alt h" { MoveFocusOrTab "left"; } + bind "Alt i" { MoveTab "left"; } + bind "Alt j" { MoveFocus "down"; } + bind "Alt k" { MoveFocus "up"; } + bind "Alt l" { MoveFocusOrTab "right"; } + bind "Alt n" { NewPane; } + bind "Alt o" { MoveTab "right"; } + bind "Ctrl q" { Quit; } + } + shared_except "locked" "move" { + bind "Ctrl h" { SwitchToMode "move"; } + } + shared_except "locked" "session" { + bind "Ctrl o" { SwitchToMode "session"; } + } + shared_except "locked" "scroll" "search" "tmux" { + bind "Ctrl b" { SwitchToMode "tmux"; } + } + shared_except "locked" "scroll" "search" { + bind "Ctrl s" { SwitchToMode "scroll"; } + } + shared_except "locked" "tab" { + bind "Ctrl t" { SwitchToMode "tab"; } + } + shared_except "locked" "pane" { + bind "Ctrl p" { SwitchToMode "pane"; } + } + shared_except "locked" "resize" { + bind "Ctrl n" { SwitchToMode "resize"; } + } + shared_except "normal" "locked" "entersearch" { + bind "enter" { SwitchToMode "normal"; } + } + shared_except "normal" "locked" "entersearch" "renametab" "renamepane" { + bind "esc" { SwitchToMode "normal"; } + } + shared_among "pane" "tmux" { + bind "x" { CloseFocus; SwitchToMode "normal"; } + } + shared_among "scroll" "search" { + bind "PageDown" { PageScrollDown; } + bind "PageUp" { PageScrollUp; } + bind "left" { PageScrollUp; } + bind "down" { ScrollDown; } + bind "up" { ScrollUp; } + bind "right" { PageScrollDown; } + bind "Ctrl b" { PageScrollUp; } + bind "Ctrl c" { ScrollToBottom; SwitchToMode "normal"; } + bind "d" { HalfPageScrollDown; } + bind "Ctrl f" { PageScrollDown; } + bind "h" { PageScrollUp; } + bind "j" { ScrollDown; } + bind "k" { ScrollUp; } + bind "l" { PageScrollDown; } + bind "Ctrl s" { SwitchToMode "normal"; } + bind "u" { HalfPageScrollUp; } + } + entersearch { + bind "Ctrl c" { SwitchToMode "scroll"; } + bind "esc" { SwitchToMode "scroll"; } + bind "enter" { SwitchToMode "search"; } + } + renametab { + bind "esc" { UndoRenameTab; SwitchToMode "tab"; } + } + shared_among "renametab" "renamepane" { + bind "Ctrl c" { SwitchToMode "normal"; } + } + renamepane { + bind "esc" { UndoRenamePane; SwitchToMode "pane"; } + } + shared_among "session" "tmux" { + bind "d" { Detach; } + } + tmux { + bind "left" { MoveFocus "left"; SwitchToMode "normal"; } + bind "down" { MoveFocus "down"; SwitchToMode "normal"; } + bind "up" { MoveFocus "up"; SwitchToMode "normal"; } + bind "right" { MoveFocus "right"; SwitchToMode "normal"; } + bind "space" { NextSwapLayout; } + bind "\"" { NewPane "down"; SwitchToMode "normal"; } + bind "%" { NewPane "right"; SwitchToMode "normal"; } + bind "," { SwitchToMode "renametab"; } + bind "[" { SwitchToMode "scroll"; } + bind "Ctrl b" { Write 2; SwitchToMode "normal"; } + bind "c" { NewTab; SwitchToMode "normal"; } + bind "h" { MoveFocus "left"; SwitchToMode "normal"; } + bind "j" { MoveFocus "down"; SwitchToMode "normal"; } + bind "k" { MoveFocus "up"; SwitchToMode "normal"; } + bind "l" { MoveFocus "right"; SwitchToMode "normal"; } + bind "n" { GoToNextTab; SwitchToMode "normal"; } + bind "o" { FocusNextPane; } + bind "p" { GoToPreviousTab; SwitchToMode "normal"; } + bind "z" { ToggleFocusFullscreen; SwitchToMode "normal"; } + } + } + + // Plugin aliases - can be used to change the implementation of Zellij + // changing these requires a restart to take effect + plugins { + compact-bar location="zellij:compact-bar" + configuration location="zellij:configuration" + filepicker location="zellij:strider" { + cwd "/" + } + plugin-manager location="zellij:plugin-manager" + session-manager location="zellij:session-manager" + status-bar location="zellij:status-bar" + strider location="zellij:strider" + tab-bar location="zellij:tab-bar" + welcome-screen location="zellij:session-manager" { + welcome_screen true + } + } + + // Plugins to load in the background when a new session starts + // eg. "file:/path/to/my-plugin.wasm" + // eg. "https://example.com/my-plugin.wasm" + load_plugins { + } + + // 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 + // + // copy_command "pbcopy" + + // 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 "primary" + + // Path to the default editor to use to edit pane scrollbuffer + // Default: $EDITOR or $VISUAL + // scrollback_editor "/usr/bin/vim" + + // Toggle between having Zellij lay out panes according to a predefined set of layouts whenever possible + // Options: + // - true (default) + // - false + // + // auto_layout false + + // 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 false + + // Whether pane viewports are serialized along with the session, default is false + // Options: + // - true + // - false (default) + // + // serialize_pane_viewport false + + // 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 10000 + + // Enable or disable the rendering of styled and colored underlines (undercurl). + // May need to be disabled for certain unsupported terminals + // (Requires restart) + // Default: true + // + // styled_underlines false + + // How often in seconds sessions are serialized + // + // serialization_interval 10000 + + // Enable or disable writing of session metadata to disk (if disabled, other sessions might not know + // metadata info on this session) + // (Requires restart) + // Default: false + // + // disable_session_metadata false + + // Enable or disable support for the enhanced Kitty Keyboard Protocol (the host terminal must also support it) + // (Requires restart) + // Default: true (if the host terminal supports it) + // + // support_kitty_keyboard_protocol false +'' diff --git a/programs/zellij/layouts/default.kdl.nix b/programs/zellij/layouts/default.kdl.nix new file mode 100644 index 0000000..941c3e9 --- /dev/null +++ b/programs/zellij/layouts/default.kdl.nix @@ -0,0 +1,159 @@ +{ config, pkgs }: +let + inherit (config.lib.stylix) colors; +in +'' + layout { + swap_tiled_layout name="vertical" { + tab max_panes=5 { + pane split_direction="vertical" { + pane + pane { children; } + } + } + tab max_panes=8 { + pane split_direction="vertical" { + pane { children; } + pane { pane; pane; pane; pane; } + } + } + tab max_panes=12 { + pane split_direction="vertical" { + pane { children; } + pane { pane; pane; pane; pane; } + pane { pane; pane; pane; pane; } + } + } + } + + swap_tiled_layout name="horizontal" { + tab max_panes=5 { + pane + pane + } + tab max_panes=8 { + pane { + pane split_direction="vertical" { children; } + pane split_direction="vertical" { pane; pane; pane; pane; } + } + } + tab max_panes=12 { + pane { + pane split_direction="vertical" { children; } + pane split_direction="vertical" { pane; pane; pane; pane; } + pane split_direction="vertical" { pane; pane; pane; pane; } + } + } + } + + swap_tiled_layout name="stacked" { + tab min_panes=5 { + pane split_direction="vertical" { + pane + pane stacked=true { children; } + } + } + } + + swap_floating_layout name="staggered" { + floating_panes + } + + swap_floating_layout name="enlarged" { + floating_panes max_panes=10 { + pane { x "5%"; y 1; width "90%"; height "90%"; } + pane { x "5%"; y 2; width "90%"; height "90%"; } + pane { x "5%"; y 3; width "90%"; height "90%"; } + pane { x "5%"; y 4; width "90%"; height "90%"; } + pane { x "5%"; y 5; width "90%"; height "90%"; } + pane { x "5%"; y 6; width "90%"; height "90%"; } + pane { x "5%"; y 7; width "90%"; height "90%"; } + pane { x "5%"; y 8; width "90%"; height "90%"; } + pane { x "5%"; y 9; width "90%"; height "90%"; } + pane focus=true { x 10; y 10; width "90%"; height "90%"; } + } + } + + swap_floating_layout name="spread" { + floating_panes max_panes=1 { + pane {y "50%"; x "50%"; } + } + floating_panes max_panes=2 { + pane { x "1%"; y "25%"; width "45%"; } + pane { x "50%"; y "25%"; width "45%"; } + } + floating_panes max_panes=3 { + pane focus=true { y "55%"; width "45%"; height "45%"; } + pane { x "1%"; y "1%"; width "45%"; } + pane { x "50%"; y "1%"; width "45%"; } + } + floating_panes max_panes=4 { + pane { x "1%"; y "55%"; width "45%"; height "45%"; } + pane focus=true { x "50%"; y "55%"; width "45%"; height "45%"; } + pane { x "1%"; y "1%"; width "45%"; height "45%"; } + pane { x "50%"; y "1%"; width "45%"; height "45%"; } + } + } + + default_tab_template { + children + pane size=1 borderless=true { + plugin location="file://${pkgs.zjstatus}/bin/zjstatus.wasm" { + format_left "{mode}#[bg=#${colors.base00}] {tabs}" + format_center "" + format_right "#[bg=#${colors.base00},fg=#${colors.base02}]#[bg=#${colors.base02},fg=#${colors.base01},bold] #[bg=#${colors.base02},fg=#${colors.base01},bold] {session} #[bg=#${colors.base02},fg=#${colors.base01},bold]" + format_space "" + format_hide_on_overlength "true" + format_precedence "crl" + + border_enabled "false" + border_char "─" + border_format "#[fg=#6C7086]{char}" + border_position "top" + + mode_normal "#[bg=#${colors.base0B},fg=#${colors.base01},bold] NORMAL#[bg=#${colors.base01},fg=#${colors.base0B}]█" + mode_locked "#[bg=#${colors.base04},fg=#${colors.base01},bold] LOCKED #[bg=#${colors.base01},fg=#${colors.base04}]█" + mode_resize "#[bg=#${colors.base08},fg=#${colors.base01},bold] RESIZE#[bg=#${colors.base01},fg=#${colors.base08}]█" + mode_pane "#[bg=#${colors.base0D},fg=#${colors.base01},bold] PANE#[bg=#${colors.base01},fg=#${colors.base0D}]█" + mode_tab "#[bg=#${colors.base07},fg=#${colors.base01},bold] TAB#[bg=#${colors.base01},fg=#${colors.base07}]█" + mode_scroll "#[bg=#${colors.base0A},fg=#${colors.base01},bold] SCROLL#[bg=#${colors.base01},fg=#${colors.base0A}]█" + mode_enter_search "#[bg=#${colors.base0D},fg=#${colors.base01},bold] ENT-SEARCH#[bg=#${colors.base01},fg=#${colors.base0D}]█" + mode_search "#[bg=#${colors.base0D},fg=#${colors.base01},bold] SEARCHARCH#[bg=#${colors.base01},fg=#${colors.base0D}]█" + mode_rename_tab "#[bg=#${colors.base07},fg=#${colors.base01},bold] RENAME-TAB#[bg=#${colors.base01},fg=#${colors.base07}]█" + mode_rename_pane "#[bg=#${colors.base0D},fg=#${colors.base01},bold] RENAME-PANE#[bg=#${colors.base01},fg=#${colors.base0D}]█" + mode_session "#[bg=#${colors.base0E},fg=#${colors.base01},bold] SESSION#[bg=#${colors.base01},fg=#${colors.base0E}]█" + mode_move "#[bg=#${colors.base0F},fg=#${colors.base01},bold] MOVE#[bg=#${colors.base01},fg=#${colors.base0F}]█" + mode_prompt "#[bg=#${colors.base0D},fg=#${colors.base01},bold] PROMPT#[bg=#${colors.base01},fg=#${colors.base0D}]█" + mode_tmux "#[bg=#${colors.base09},fg=#${colors.base01},bold] TMUX#[bg=#${colors.base01},fg=#${colors.base09}]█" + + // formatting for inactive tabs + tab_normal "#[bg=#${colors.base01},fg=#${colors.base0C}]█#[bg=#${colors.base0C},fg=#${colors.base01},bold]{index} #[bg=#${colors.base01},fg=#${colors.base0C},bold] {name}{floating_indicator}#[bg=#${colors.base01},fg=#${colors.base01},bold]█" + tab_normal_fullscreen "#[bg=#${colors.base01},fg=#${colors.base0C}]█#[bg=#${colors.base0C},fg=#${colors.base01},bold]{index} #[bg=#${colors.base01},fg=#${colors.base0C},bold] {name}{fullscreen_indicator}#[bg=#${colors.base01},fg=#${colors.base01},bold]█" + tab_normal_sync "#[bg=#${colors.base01},fg=#${colors.base0C}]█#[bg=#${colors.base0C},fg=#${colors.base01},bold]{index} #[bg=#${colors.base01},fg=#${colors.base0C},bold] {name}{sync_indicator}#[bg=#${colors.base01},fg=#${colors.base01},bold]█" + + // formatting for the current active tab + tab_active "#[bg=#${colors.base01},fg=#${colors.base09}]█#[bg=#${colors.base09},fg=#${colors.base01},bold]{index} #[bg=#${colors.base01},fg=#${colors.base09},bold] {name}{floating_indicator}#[bg=#${colors.base01},fg=#${colors.base01},bold]█" + tab_active_fullscreen "#[bg=#${colors.base01},fg=#${colors.base09}]█#[bg=#${colors.base09},fg=#${colors.base01},bold]{index} #[bg=#${colors.base01},fg=#${colors.base09},bold] {name}{fullscreen_indicator}#[bg=#${colors.base01},fg=#${colors.base01},bold]█" + tab_active_sync "#[bg=#${colors.base01},fg=#${colors.base09}]█#[bg=#${colors.base09},fg=#${colors.base01},bold]{index} #[bg=#${colors.base01},fg=#${colors.base09},bold] {name}{sync_indicator}#[bg=#${colors.base01},fg=#${colors.base01},bold]█" + + // separator between the tabs + tab_separator "#[bg=#${colors.base00}] " + + // indicators + tab_sync_indicator " " + tab_fullscreen_indicator " 󰊓" + tab_floating_indicator " 󰹙" + + command_git_branch_command "git rev-parse --abbrev-ref HEAD" + command_git_branch_format "#[fg=blue] {stdout} " + command_git_branch_interval "10" + command_git_branch_rendermode "static" + + datetime "#[fg=#6C7086,bold] {format} " + datetime_format "%A, %d %b %Y %H:%M" + datetime_timezone "Europe/Vienna" + } + } + } + } +'' diff --git a/scripts/swarselcheck.sh b/scripts/swarselcheck.sh index 4b54418..e941f1b 100644 --- a/scripts/swarselcheck.sh +++ b/scripts/swarselcheck.sh @@ -25,7 +25,7 @@ if [[ $kitty -eq 1 ]]; then STR=$(swaymsg -t get_tree | jq -r 'recurse(.nodes[]) | select(.name == "__i3_scratch")' | grep kittyterm || true) CHECK=$(swaymsg -t get_tree | grep kittyterm || true) if [ "$CHECK" == "" ]; then - exec kitty -T kittyterm & + exec kitty -T kittyterm -o confirm_os_window_close=0 zellij attach --create kittyterm & sleep 1 fi if [ "$STR" == "" ]; then diff --git a/scripts/swarselzellij.sh b/scripts/swarselzellij.sh new file mode 100644 index 0000000..96a3f29 --- /dev/null +++ b/scripts/swarselzellij.sh @@ -0,0 +1,7 @@ +KITTIES=$(($(pgrep -P 1 kitty | wc -l) - 1)) + +if [[ $KITTIES -lt 1 ]]; then + exec kitty -o confirm_os_window_close=0 zellij attach --create main +else + exec kitty -o confirm_os_window_close=0 zellij attach --create "temp $KITTIES" +fi