Skip to content

Commit

Permalink
chore: move from {alias} to $alias
Browse files Browse the repository at this point in the history
  • Loading branch information
dj95 committed Jul 15, 2024
1 parent 68d8d49 commit 4fc3742
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
32 changes: 16 additions & 16 deletions plugin-dev-workspace.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ layout {
color_yellow "yellow"
color_bg "#181825"

format_left "{mode}#[fg={blue},bg={bg},bold] {session}"
format_left "{mode}#[fg=$blue,bg=$bg,bold] {session}"
format_center "{tabs} {command_3}"
format_right "{datetime}"
format_space "#[bg={bg}]"
format_space "#[bg=$bg]"
format_precedence "lrc"
format_hide_on_overlength "false"

notification_format_unread "#[fg={blue},bg={bg},blink]  #[fg={blue},bg={bg}] {message} "
notification_format_no_notifications "#[fg={blue},bg={bg},dim]  "
notification_format_unread "#[fg=$blue,bg=$bg,blink]  #[fg=$blue,bg=$bg] {message} "
notification_format_no_notifications "#[fg=$blue,bg=$bg,dim]  "
notification_show_interval "10"

border_enabled "true"
Expand All @@ -30,22 +30,22 @@ layout {

hide_frame_for_single_pane "true"

mode_normal "#[bg={blue}] #[bg={yellow}] "
mode_tmux "#[bg={yellow}] "
mode_normal "#[bg=$blue] #[bg=yellow] "
mode_tmux "#[bg=$yellow] "
mode_default_to_mode "tmux"

tab_normal "#[fg=#6C7086,bg={bg}] {index} {name} {floating_indicator} "
tab_rename "#[fg=#eba0ac,bg={bg}] {index} {name} {floating_indicator} "
tab_normal_fullscreen "#[fg=#6C7086,bg={bg}] {index} {name} [] "
tab_normal_sync "#[fg=#6C7086,bg={bg}] {index} {name} <> "
tab_active "#[fg=#9399B2,bg={bg},bold,italic] {index} {name} {floating_total_count}{floating_indicator}{sync_indicator}{fullscreen_indicator}"
tab_separator "#[fg=#6C7086,bg={bg}] | "
tab_normal "#[fg=#6C7086,bg=$bg] {index} {name} {floating_indicator} "
tab_rename "#[fg=#eba0ac,bg=$bg] {index} {name} {floating_indicator} "
tab_normal_fullscreen "#[fg=#6C7086,bg=$bg] {index} {name} [] "
tab_normal_sync "#[fg=#6C7086,bg=$bg] {index} {name} <> "
tab_active "#[fg=#9399B2,bg=$bg,bold,italic] {index} {name} {floating_total_count}{floating_indicator}{sync_indicator}{fullscreen_indicator}"
tab_separator "#[fg=#6C7086,bg=$bg] | "
tab_floating_indicator "F"
tab_sync_indicator "S"
tab_fullscreen_indicator "FS"
tab_display_count "3"
tab_truncate_start_format "#[fg=red,bg={bg}] < +{count} ..."
tab_truncate_end_format "#[fg=red,bg={bg}] ... +{count} >"
tab_truncate_start_format "#[fg=red,bg=$bg] < +{count} ..."
tab_truncate_end_format "#[fg=red,bg=$bg] ... +{count} >"

command_0_command "echo \"平仮名, ひらがな 📦\""
command_0_clickaction "bash -c \"zellij --session zjstatus-dev pipe 'zjstatus::notify::hello world!' -n zjstatus\""
Expand All @@ -65,12 +65,12 @@ layout {
command_git_branch_format "#[fg=red] {stdout} "
command_git_branch_interval "2"

command_3_command "echo -e \"#[fg={yellow},italic,bold] foo #[dim,bold,italic] bar \""
command_3_command "echo -e \"#[fg=$yellow,italic,bold] foo #[dim,bold,italic] bar \""
command_3_format "{stdout}"
command_3_interval "10"
command_3_rendermode "dynamic"

datetime "#[fg=#6C7086,bg={bg},bold] {format} #[bg=#6C7086,fg={bg},bold] {time}"
datetime "#[fg=#6C7086,bg=$bg,bold] {format} #[bg=#6C7086,fg=$bg,bold] {time}"
datetime_time_format "%H:%M:%S"
datetime_format "%A, %d %b %Y %H:%M"
datetime_timezone "Europe/Berlin"
Expand Down
8 changes: 4 additions & 4 deletions src/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,8 @@ fn hex_to_rgb(s: &str) -> anyhow::Result<Vec<u8>> {
)]
fn parse_color(color: &str, config: &BTreeMap<String, String>) -> Option<Color> {
let mut color = color;
if color.starts_with('{') {
let alias_name = &color[1..color.len() - 1];
if color.starts_with('$') {
let alias_name = color.strip_prefix('$').unwrap();

color = match config.get(&format!("color_{alias_name}")) {
Some(color_str) => color_str,
Expand Down Expand Up @@ -411,11 +411,11 @@ mod test {
let result = parse_color("#365", &config);
assert_eq!(result, None);

let result = parse_color("{green}", &config);
let result = parse_color("$green", &config);
let expected = RgbColor(0, 255, 0);
assert_eq!(result, Some(expected.into()));

let result = parse_color("{blue}", &config);
let result = parse_color("$blue", &config);
assert_eq!(result, None);
}
}

0 comments on commit 4fc3742

Please sign in to comment.