From 8166934d8659b0d9c3a67126f15059f3a6d2e13c Mon Sep 17 00:00:00 2001 From: Tigor Hutasuhut Date: Sun, 4 Aug 2024 16:36:23 +0700 Subject: [PATCH] zjstatus: refactor layout and themes to use timezones --- home/programs/zellij/default.nix | 5 +- .../themes/zjstatus/catppuccin-frappe.nix | 4 +- .../themes/zjstatus/catppuccin-latte.nix | 4 +- .../themes/zjstatus/catppuccin-macchiato.nix | 4 +- .../themes/zjstatus/catppuccin-mocha.nix | 4 +- .../zellij/themes/zjstatus/gruvbox-dark.nix | 99 +++++++++++++++++++ .../zellij/themes/zjstatus/gruvbox-light.nix | 99 +++++++++++++++++++ options/programs.nix | 15 ++- 8 files changed, 221 insertions(+), 13 deletions(-) create mode 100644 home/programs/zellij/themes/zjstatus/gruvbox-dark.nix create mode 100644 home/programs/zellij/themes/zjstatus/gruvbox-light.nix diff --git a/home/programs/zellij/default.nix b/home/programs/zellij/default.nix index 96d1203..582004a 100644 --- a/home/programs/zellij/default.nix +++ b/home/programs/zellij/default.nix @@ -217,6 +217,9 @@ in } ''; - home.file.".config/zellij/layouts/default.kdl".text = import cfg.zjstatus.theme { inherit plugins; }; + home.file.".config/zellij/layouts/default.kdl".text = import cfg.zjstatus.theme { + inherit plugins; + timezone = cfg.zjstatus.timezone; + }; }; } diff --git a/home/programs/zellij/themes/zjstatus/catppuccin-frappe.nix b/home/programs/zellij/themes/zjstatus/catppuccin-frappe.nix index 9da6fda..20903f2 100644 --- a/home/programs/zellij/themes/zjstatus/catppuccin-frappe.nix +++ b/home/programs/zellij/themes/zjstatus/catppuccin-frappe.nix @@ -1,4 +1,4 @@ -{ plugins, ... }: +{ plugins, timezone, ... }: /*kdl*/ '' layout { pane split_direction="vertical" { @@ -92,7 +92,7 @@ datetime "{format}" datetime_format "%Y-%m-%d 󰅐 %H:%M" - datetime_timezone "Europe/Stockholm" + datetime_timezone "${timezone}" } } } diff --git a/home/programs/zellij/themes/zjstatus/catppuccin-latte.nix b/home/programs/zellij/themes/zjstatus/catppuccin-latte.nix index 1f61f46..b641edb 100644 --- a/home/programs/zellij/themes/zjstatus/catppuccin-latte.nix +++ b/home/programs/zellij/themes/zjstatus/catppuccin-latte.nix @@ -1,4 +1,4 @@ -{ plugins, ... }: +{ plugins, timezone, ... }: /*kdl*/ '' layout { pane split_direction="vertical" { @@ -92,7 +92,7 @@ datetime "{format}" datetime_format "%Y-%m-%d 󰅐 %H:%M" - datetime_timezone "Europe/Stockholm" + datetime_timezone "${timezone}" } } } diff --git a/home/programs/zellij/themes/zjstatus/catppuccin-macchiato.nix b/home/programs/zellij/themes/zjstatus/catppuccin-macchiato.nix index 38943be..294d1e8 100644 --- a/home/programs/zellij/themes/zjstatus/catppuccin-macchiato.nix +++ b/home/programs/zellij/themes/zjstatus/catppuccin-macchiato.nix @@ -1,4 +1,4 @@ -{ plugins, ... }: +{ plugins, timezone, ... }: /*kdl*/ '' layout { pane split_direction="vertical" { @@ -92,7 +92,7 @@ datetime "{format}" datetime_format "%Y-%m-%d 󰅐 %H:%M" - datetime_timezone "Europe/Stockholm" + datetime_timezone "${timezone}" } } } diff --git a/home/programs/zellij/themes/zjstatus/catppuccin-mocha.nix b/home/programs/zellij/themes/zjstatus/catppuccin-mocha.nix index c2d1f97..9c0ac14 100644 --- a/home/programs/zellij/themes/zjstatus/catppuccin-mocha.nix +++ b/home/programs/zellij/themes/zjstatus/catppuccin-mocha.nix @@ -1,4 +1,4 @@ -{ plugins, ... }: +{ plugins, timezone, ... }: /*kdl*/ '' layout { pane split_direction="vertical" { @@ -176,7 +176,7 @@ datetime "{format}" datetime_format "%Y-%m-%d 󰅐 %H:%M" - datetime_timezone "Europe/Stockholm" + datetime_timezone "${timezone}" } } } diff --git a/home/programs/zellij/themes/zjstatus/gruvbox-dark.nix b/home/programs/zellij/themes/zjstatus/gruvbox-dark.nix new file mode 100644 index 0000000..471be2a --- /dev/null +++ b/home/programs/zellij/themes/zjstatus/gruvbox-dark.nix @@ -0,0 +1,99 @@ +{ plugins, timezone, ... }: +/*kdl*/ '' + layout { + pane split_direction="vertical" { + pane + } + + pane size=1 borderless=true { + plugin location="file:${plugins.zj-status}" { + // -- Gruvbox Dark mode + color_bg0 "#282828" //dark0 + color_bg1 "#3c3836" //dark1 + color_bg2 "#504945" //dark2 + color_bg3 "#665c54" //dark3 + color_bg4 "#7c6f64" //dark4 + color_fg0 "#fbf1c7" //light0 + color_fg1 "#ebdbb2" //light1 + color_fg2 "#d5c4a1" //light2 + color_fg3 "#bdae93" //light3 + color_fg4 "#a89984" //light4 + color_red "#fb4934" // bright_red + color_green "#b8bb26" //bright_green + color_yellow "#fabd2f" // bright_yellow + color_blue "#83a598" //bright_blue + color_purple "#d3869b" //bright_purple + color_aqua "#8ec07c" //bright_aqua + color_gray "#a89984" //bright_gray + color_orange "#fe8019" //bright_orange + color_neutral_red "#cc241d" //neutral_red + color_neutral_green "#98971a" //neutral_green + color_neutral_yellow "#d79921" //neutral_yellow + color_neutral_blue "#458588" //neutral_blue + color_neutral_purple "#b16286" //neutral_purple + color_neutral_aqua "#689d6a" //neutral_aqua + color_neutral_gray "#928374" //neutral_gray + color_neutral_orange "#d65d0e" //neatural_orange + + format_left "#[bg=$bg2,fg=$fg3] {session} {mode}#[bg=$bg1]{tabs}" + format_center "{notifications}" + format_right "#[bg=$bg1,fg=$bg2]#[bg=$bg2,fg=$fg4] {command_user}@{command_host} #[bg=$bg2,fg=$fg3]#[bg=$fg3,fg=$bg1] {datetime} " + format_space "#[bg=$bg1,fg=$fg1]" + format_hide_on_overlength "true" + format_precedence "lrc" + + border_enabled "true" + border_char "─" + border_format "#[fg=$bg1]{char}" + border_position "top" + + hide_frame_for_single_pane "true" + + mode_normal "#[bg=$bg3,fg=$bg2]#[bg=$bg3,fg=$fg3,bold] NORMAL#[bg=$bg1,fg=$bg3]" + mode_tmux "#[bg=$green,fg=$bg2]#[bg=$green,fg=$bg0,bold] TMUX#[bg=$bg1,fg=$green]" + mode_locked "#[bg=$red,fg=$bg2]#[bg=$red,fg=$bg0,bold] LOCKED#[bg=$bg1,fg=$red]" + mode_pane "#[bg=$aqua,fg=$bg2]#[bg=$aqua,fg=$bg0,bold] PANE#[bg=$bg1,fg=$aqua]" + mode_tab "#[bg=$aqua,fg=$bg2]#[bg=$aqua,fg=$bg0,bold] TAB#[bg=$bg1,fg=$aqua]" + mode_scroll "#[bg=$blue,fg=$bg2]#[bg=$blue,fg=$bg0,bold] SCROLL#[bg=$bg1,fg=$blue]" + mode_enter_search "#[bg=$blue,fg=$bg2]#[bg=$blue,fg=$bg0,bold] ENT-SEARCH#[bg=$bg1,fg=$blue]" + mode_search "#[bg=$blue,fg=$bg2]#[bg=$blue,fg=$bg0,bold] SEARCH#[bg=$bg1,fg=$blue]" + mode_resize "#[bg=$yellow,fg=$bg2]#[bg=$yellow,fg=$bg0,bold] RESIZE#[bg=$bg1,fg=$yellow]" + mode_rename_tab "#[bg=$yellow,fg=$bg2]#[bg=$yellow,fg=$bg0,bold] RESIZE#[bg=$bg1,fg=$yellow]" + mode_rename_pane "#[bg=$yellow,fg=$bg2]#[bg=$yellow,fg=$bg0,bold] RESIZE#[bg=$bg1,fg=$yellow]" + mode_move "#[bg=$yellow,fg=$bg2]#[bg=$yellow,fg=$bg0,bold] MOVE#[bg=$bg1,fg=$yellow]" + mode_session "#[bg=$purple,fg=$bg2]#[bg=$purple,fg=$bg0,bold] MOVE#[bg=$bg1,fg=$purple]" + mode_prompt "#[bg=$purple,fg=$bg2]#[bg=$purple,fg=$bg0,bold] PROMPT#[bg=$bg1,fg=$purple]" + + tab_normal "#[bg=$bg2,fg=$bg1]#[bg=$bg2,fg=$fg1] {index} #[bg=$bg2,fg=$fg1,bold] {name} {floating_indicator}#[bg=$bg1,fg=$bg2]" + tab_normal_fullscreen "#[bg=$bg2,fg=$bg1]#[bg=$bg2,fg=$fg1] {index} #[bg=$bg2,fg=$fg1,bold] {name} {fullscreen_indicator}#[bg=$bg1,fg=$bg2]" + tab_normal_sync "#[bg=$bg2,fg=$bg1]#[bg=$bg2,fg=$fg1] {index} #[bg=$bg2,fg=$fg1,bold] {name} {sync_indicator}#[bg=$bg1,fg=$bg2]" + tab_active "#[bg=$yellow,fg=$bg1]#[bg=$yellow,fg=$bg2] {index} #[bg=$yellow,fg=$bg2,bold] {name} {floating_indicator}#[bg=$bg1,fg=$yellow]" + tab_active_fullscreen "#[bg=$yellow,fg=$bg1]#[bg=$yellow,fg=$bg2] {index} #[bg=$yellow,fg=$bg2,bold] {name} {fullscreen_indicator}#[bg=$bg1,fg=$yellow]" + tab_active_sync "#[bg=$yellow,fg=$bg1]#[bg=$yellow,fg=$bg2] {index} #[bg=$yellow,fg=$bg2,bold] {name} {sync_indicator}#[bg=$bg1,fg=$yellow]" + tab_separator "#[bg=$bg1,fg=$fg1]" + + tab_sync_indicator "" + tab_fullscreen_indicator "󰊓" + tab_floating_indicator "󰹙" + + notification_format_unread "#[bg=$orange,fg=$bg1]#[bg=$orange,fg=$bg1] {message} #[bg=$bg1,fg=$orange]" + notification_format_no_notifications "" + notification_show_interval "10" + + command_host_command "uname -n" + command_host_format "{stdout}" + command_host_interval "0" + command_host_rendermode "static" + + command_user_command "whoami" + command_user_format "{stdout}" + command_user_interval "0" + command_user_rendermode "static" + + datetime "{format}" + datetime_format "%Y-%m-%d %H:%M" + datetime_timezone "${timezone}" + } + } + } +'' diff --git a/home/programs/zellij/themes/zjstatus/gruvbox-light.nix b/home/programs/zellij/themes/zjstatus/gruvbox-light.nix new file mode 100644 index 0000000..56a487e --- /dev/null +++ b/home/programs/zellij/themes/zjstatus/gruvbox-light.nix @@ -0,0 +1,99 @@ +{ plugins, timezone, ... }: +/*kdl*/ '' + layout { + pane split_direction="vertical" { + pane + } + + pane size=1 borderless=true { + plugin location="file:${plugins.zj-status}" { + // -- Gruvbox Light mode + color_bg0 "#fbf1c7" //light0 + color_bg1 "#ebdbb2" //light1 + color_bg2 "#d5c4a1" //light2 + color_bg3 "#bdae93" //light3 + color_bg4 "#a89984" //light4 + color_fg0 "#282828" //dark0 + color_fg1 "#3c3836" //dark1 + color_fg2 "#504945" //dark2 + color_fg3 "#665c54" //dark3 + color_fg4 "#7c6f64" //dark4 + color_red "#9d0006" //faded_red + color_green "#79740e" //faded_green + color_yellow "#b57614" //faded_yellow + color_blue "#076678" //faded_blue + color_purple "#8f3f71" //faded_purple + color_aqua "#427b58" //faded_aqua + color_gray "#7c6f64" //faded_gray + color_orange "#af3a03" //faded_orange + color_neutral_red "#cc241d" //neutral_red + color_neutral_green "#98971a" //neutral_green + color_neutral_yellow "#d79921" //neutral_yellow + color_neutral_blue "#458588" //neutral_blue + color_neutral_purple "#b16286" //neutral_purple + color_neutral_aqua "#689d6a" //neutral_aqua + color_neutral_orange "#d65d0e" //neatural_orange + color_neutral_gray "#928374" //neutral_gray + + format_left "#[bg=$bg2,fg=$fg3] {session} {mode}#[bg=$bg1]{tabs}" + format_center "{notifications}" + format_right "#[bg=$bg1,fg=$bg2]#[bg=$bg2,fg=$fg4] {command_user}@{command_host} #[bg=$bg2,fg=$fg3]#[bg=$fg3,fg=$bg1] {datetime} " + format_space "#[bg=$bg1,fg=$fg1]" + format_hide_on_overlength "true" + format_precedence "lrc" + + border_enabled "true" + border_char "─" + border_format "#[fg=$bg1]{char}" + border_position "top" + + hide_frame_for_single_pane "true" + + mode_normal "#[bg=$bg3,fg=$bg2]#[bg=$bg3,fg=$fg3,bold] NORMAL#[bg=$bg1,fg=$bg3]" + mode_tmux "#[bg=$green,fg=$bg2]#[bg=$green,fg=$bg0,bold] TMUX#[bg=$bg1,fg=$green]" + mode_locked "#[bg=$red,fg=$bg2]#[bg=$red,fg=$bg0,bold] LOCKED#[bg=$bg1,fg=$red]" + mode_pane "#[bg=$aqua,fg=$bg2]#[bg=$aqua,fg=$bg0,bold] PANE#[bg=$bg1,fg=$aqua]" + mode_tab "#[bg=$aqua,fg=$bg2]#[bg=$aqua,fg=$bg0,bold] TAB#[bg=$bg1,fg=$aqua]" + mode_scroll "#[bg=$blue,fg=$bg2]#[bg=$blue,fg=$bg0,bold] SCROLL#[bg=$bg1,fg=$blue]" + mode_enter_search "#[bg=$blue,fg=$bg2]#[bg=$blue,fg=$bg0,bold] ENT-SEARCH#[bg=$bg1,fg=$blue]" + mode_search "#[bg=$blue,fg=$bg2]#[bg=$blue,fg=$bg0,bold] SEARCH#[bg=$bg1,fg=$blue]" + mode_resize "#[bg=$yellow,fg=$bg2]#[bg=$yellow,fg=$bg0,bold] RESIZE#[bg=$bg1,fg=$yellow]" + mode_rename_tab "#[bg=$yellow,fg=$bg2]#[bg=$yellow,fg=$bg0,bold] RESIZE#[bg=$bg1,fg=$yellow]" + mode_rename_pane "#[bg=$yellow,fg=$bg2]#[bg=$yellow,fg=$bg0,bold] RESIZE#[bg=$bg1,fg=$yellow]" + mode_move "#[bg=$yellow,fg=$bg2]#[bg=$yellow,fg=$bg0,bold] MOVE#[bg=$bg1,fg=$yellow]" + mode_session "#[bg=$purple,fg=$bg2]#[bg=$purple,fg=$bg0,bold] MOVE#[bg=$bg1,fg=$purple]" + mode_prompt "#[bg=$purple,fg=$bg2]#[bg=$purple,fg=$bg0,bold] PROMPT#[bg=$bg1,fg=$purple]" + + tab_normal "#[bg=$bg2,fg=$bg1]#[bg=$bg2,fg=$fg1] {index} #[bg=$bg2,fg=$fg1,bold] {name} {floating_indicator}#[bg=$bg1,fg=$bg2]" + tab_normal_fullscreen "#[bg=$bg2,fg=$bg1]#[bg=$bg2,fg=$fg1] {index} #[bg=$bg2,fg=$fg1,bold] {name} {fullscreen_indicator}#[bg=$bg1,fg=$bg2]" + tab_normal_sync "#[bg=$bg2,fg=$bg1]#[bg=$bg2,fg=$fg1] {index} #[bg=$bg2,fg=$fg1,bold] {name} {sync_indicator}#[bg=$bg1,fg=$bg2]" + tab_active "#[bg=$yellow,fg=$bg1]#[bg=$yellow,fg=$bg2] {index} #[bg=$yellow,fg=$bg2,bold] {name} {floating_indicator}#[bg=$bg1,fg=$yellow]" + tab_active_fullscreen "#[bg=$yellow,fg=$bg1]#[bg=$yellow,fg=$bg2] {index} #[bg=$yellow,fg=$bg2,bold] {name} {fullscreen_indicator}#[bg=$bg1,fg=$yellow]" + tab_active_sync "#[bg=$yellow,fg=$bg1]#[bg=$yellow,fg=$bg2] {index} #[bg=$yellow,fg=$bg2,bold] {name} {sync_indicator}#[bg=$bg1,fg=$yellow]" + tab_separator "#[bg=$bg1,fg=$fg1]" + + tab_sync_indicator "" + tab_fullscreen_indicator "󰊓" + tab_floating_indicator "󰹙" + + notification_format_unread "#[bg=$orange,fg=$bg1]#[bg=$orange,fg=$bg1] {message} #[bg=$bg1,fg=$orange]" + notification_format_no_notifications "" + notification_show_interval "10" + + command_host_command "uname -n" + command_host_format "{stdout}" + command_host_interval "0" + command_host_rendermode "static" + + command_user_command "whoami" + command_user_format "{stdout}" + command_user_interval "0" + command_user_rendermode "static" + + datetime "{format}" + datetime_format "%Y-%m-%d %H:%M" + datetime_timezone "${timezone}" + } + } + } +'' diff --git a/options/programs.nix b/options/programs.nix index 4d148eb..ec4a472 100644 --- a/options/programs.nix +++ b/options/programs.nix @@ -94,10 +94,17 @@ default = "Ctrl a"; description = "Mod key to use for zellij to enter tmux mode and exits locked mode."; }; - zjstatus.theme = lib.mkOption { - type = lib.types.path; - default = ../home/programs/zellij/themes/zjstatus/catppuccin-mocha.nix; - description = "Default zellij status theme"; + zjstatus = { + theme = lib.mkOption { + type = lib.types.path; + default = ../home/programs/zellij/themes/zjstatus/catppuccin-mocha.nix; + description = "Default zellij status theme"; + }; + timezone = lib.mkOption { + type = lib.types.str; + default = "Asia/Jakarta"; + description = "Timezone to use for zellij status"; + }; }; }; foot.enable = lib.mkEnableOption "foot";