layout {
    tab {
        pane
    }

    swap_tiled_layout name="T1" {
        tab max_panes=4 {
            pane split_direction="vertical" {
                pane
                pane { children; }
            }
        }
        tab max_panes=7 {
            pane split_direction="vertical" {
                pane { pane; pane; }
                pane { children; }
            }
        }
        tab max_panes=12 {
            pane split_direction="vertical" {
                pane { pane; pane; }
                pane { pane; pane; pane; pane; }
                pane { children; }
            }
        }
    }

    swap_tiled_layout name="T2" {
        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="T3" {
        tab max_panes=4 {
            pane split_direction="vertical" {
                pane
                pane {
                    pane size="10%"
                    pane size="90%"
                }
            }
        }
        tab max_panes=5 {
            pane split_direction="vertical" {
                pane
                pane {
                    pane size="10%"
                    pane size="45%"
                    pane size="45%"
                }
            }
        }
        tab max_panes=7 {
            pane split_direction="vertical" {
                pane {
                    children
                }
                pane {
                    pane size="10%"
                    pane size="45%"
                    pane size="45%"
                }
            }
        }
        tab max_panes=10 {
            pane split_direction="vertical" {
                pane { pane; pane; }
                pane { children; }
                pane {
                    pane size="10%"
                    pane size="45%"
                    pane size="45%"
                }
            }
        }
        tab max_panes=14 {
            pane split_direction="vertical" {
                pane { pane; pane; pane;}
                pane { children; }
                pane {
                    pane size="10%"
                    pane size="45%"
                    pane size="45%"
                }
            }
        }
    }

    swap_floating_layout name="FL1" {
        floating_panes max_panes=1 {
            pane
        }
        floating_panes max_panes=2 {
            pane x="2%" width="46%"
            pane x="52%" width="46%"
        }
        floating_panes max_panes=3 {
            pane x="2%" width="29%"
            pane x="33%" width="29%"
            pane x="66%" width="29%"
        }
        floating_panes max_panes=6 {
            pane y="2%" x="2%" width="29%" height="46%"
            pane y="2%" x="33%" width="29%" height="46%"
            pane y="2%" x="66%" width="29%" height="46%"
            pane y="52%" x="2%" width="29%" height="46%"
            pane y="52%" x="33%" width="29%" height="46%"
            pane y="52%" x="66%" width="29%" height="46%"
        }
    }


    default_tab_template {
        children
        
        pane size=1 borderless=true {
            plugin location="file:~/.config/zellij/plugins/zjstatus.wasm" {
                format_left   "{mode} #[fg=#89B4FA,bold]" //Add {session} if needed
                format_center "{swap_layout} {tabs}"
                format_right  "{session}" //"{command_music}{datetime}"
                format_space  ""
                format_hide_on_overlength "true"
                format_precedence "lcr"

                border_enabled  "false"
                border_char     "─"
                border_format   "#[fg=#6C7086]{char}"
                border_position "top"

                hide_frame_for_single_pane "false"

                mode_normal  "#[bg=blue] #[] Ctrl + Lock (#[bold]g#[]), #[bold]P#[]ane, #[bold]T#[]ab, Resize (#[bold]n#[]), Move (#[bold]h#[]), #[bold]S#[]earch, Sessi#[bold]o#[]n"
                mode_locked  "#[bg=red] #[]"
                
                mode_pane         "#[bg=blue] {name} (p) #[] #[bold]N#[]ew, Close (#[bold]x#[]), Rename (#[bold]c#[]), #[bold]F#[]ullscreen, Float (#[bold]w#[]), #[bold]E#[]mbed"
                mode_tab          "#[bg=blue] {name} (t) #[] #[bold]N#[]ew, Close (#[bold]x#[]), #[bold]R#[]ename, #[bold]S#[]ync, #[bold]B#[]reak to new tab, Move pane to tab (#[bold][#[]/#[bold]]#[])"
                mode_resize       "#[bg=blue] {name} (n) #[] Resize (#[bold]+/-#[]), Increase (#[bold]←↓↑→#[]), Decrease (#[bold]HJKL#[])"
                mode_move         "#[bg=blue] {name} (h) #[] Move (#[bold]←↓↑→#[])"
                mode_scroll       "#[bg=blue] Search (s) #[] #[bold]S#[]earch, Scroll (#[bold]↓↑#[]), #[bold]E#[]dit"

                mode_rename_tab   "#[bg=blue] {name} #[]"
                mode_rename_pane  "#[bg=blue] {name} #[]"
                mode_session "#[bg=blue] {name} (o) #[] #[bold]D#[]etach, Session Manager (#[bold]w#[]), Plugins (#[bold]p#[]), #[bold]C#[]onfig, Web (#[bold]s#[]), #[bold]A#[]bout"
                
                mode_enter_search "#[bg=blue] Search #[] Enter when done"
                mode_search       "#[bg=blue] Search Results #[] Scroll (#[bold]↓↑#[]), #[bold]N#[]ext, #[bold]P#[]revious, #[bold]C#[]ase-insensitive, #[bold]W#[]rap, Wh#[bold]o#[]le word"

                mode_prompt  "#[bg=blue] {name} #[]"
                mode_tmux    "#[bg=#ffc387] #[] TMUX (ESC)"

                tab_normal   "#[fg=#6C7086] {name} "
                tab_active   "#[fg=#9399B2,bold,italic] {name} "
                tab_display_count         "4"  // limit to showing 3 tabs
                tab_truncate_start_format "#[fg=#6C7086]< +{count} "
                tab_truncate_end_format   "#[fg=#6C7086] +{count} >"


                datetime        "#[fg=#6C7086,bold] {format} "
                datetime_format "%A, %d %b %Y %I:%M:%S %p"
                datetime_timezone "Australia/Sydney"

                command_music_command "/home/nathan/scripts/music.sh"
                command_music_interval "5s"
                command_music_format "#[fg=#6C7086] {stdout} "

            }   
        }   
    }
}
