Skip to content

Utils.Class.Icon

sravioli edited this page Oct 27, 2024 · 2 revisions

Overview

The Utils.Class.Icons module is designed to provide a comprehensive set of icons for various elements within Wezterm. This class includes icons for separators, battery states, numbers, and program-specific icons. It leverages wezterm.nerdfonts to ensure a consistent and visually appealing set of icons across the terminal.

Usage

local Icons = require("utils.class.icon")

-- Accessing separators
local left_sep = Icons.Sep.tb.left

-- Accessing battery icons
local full_battery = Icons.Bat.Full["100"]
local charging_battery = Icons.Bat.Charging["50"]
local discharging_battery = Icons.Bat.Discharging["30"]

-- Accessing numeric icons
local num_three = Icons.Nums[3]

-- Accessing program icons
local bash_icon = Icons.Progs["bash"]

-- Accessing notification icon
local notification_icon = Icons.Notification

Class Structure

The Utils.Class.Icons class is structured into several sub-classes, each providing a specific set of icons.

Notification

Icons to use when an unseen notification is present.

nf.cod_circle_small_filled

Sep

This sub-class provides various icons to use as separators between various status bar or tab bar elements.

{
  block = "",

  sb = {
    left = nf.pl_left_hard_divider,
    right = nf.pl_right_hard_divider,
    modal = nf.ple_forwardslash_separator,
  },

  tb = {
    leftmost = "",
    left = nf.ple_upper_right_triangle,
    right = nf.ple_lower_left_triangle,
  },
}

Bat

This sub-class provides icons for different battery states, including full, charging, and discharging.

{
  Full = {
    ["100"] = nf.md_battery,
  },

  Charging = {
    ["00"] = nf.md_battery_alert,
    ["10"] = nf.md_battery_charging_10,
    ["20"] = nf.md_battery_charging_20,
    ["30"] = nf.md_battery_charging_30,
    ["40"] = nf.md_battery_charging_40,
    ["50"] = nf.md_battery_charging_50,
    ["60"] = nf.md_battery_charging_60,
    ["70"] = nf.md_battery_charging_70,
    ["80"] = nf.md_battery_charging_80,
    ["90"] = nf.md_battery_charging_90,
    ["100"] = nf.md_battery_charging_100,
  },

  Discharging = {
    ["00"] = nf.md_battery_outline,
    ["10"] = nf.md_battery_10,
    ["20"] = nf.md_battery_20,
    ["30"] = nf.md_battery_30,
    ["40"] = nf.md_battery_40,
    ["50"] = nf.md_battery_50,
    ["60"] = nf.md_battery_60,
    ["70"] = nf.md_battery_70,
    ["80"] = nf.md_battery_80,
    ["90"] = nf.md_battery_90,
    ["100"] = nf.md_battery,
  },
}

Nums

This sub-class provides a set of numeric icons.

{
  nf.md_numeric_1,
  nf.md_numeric_2,
  nf.md_numeric_3,
  nf.md_numeric_4,
  nf.md_numeric_5,
  nf.md_numeric_6,
  nf.md_numeric_7,
  nf.md_numeric_8,
  nf.md_numeric_9,
  nf.md_numeric_10,
}

Progs

This sub-class provides icons associated with specific programs and commands.

{
  ["C:\\WINDOWS\\system32\\cmd.exe"] = nf.md_console_line,
  ["Topgrade"] = nf.md_rocket_launch,
  ["bash"] = nf.cod_terminal_bash,
  ["btm"] = nf.md_chart_donut_variant,
  ["cargo"] = nf.dev_rust,
  ["curl"] = nf.mdi_flattr,
  ["docker"] = nf.linux_docker,
  ["docker-compose"] = nf.linux_docker,
  ["fish"] = nf.md_fish,
  ["gh"] = nf.dev_github_badge,
  ["git"] = nf.dev_git,
  ["go"] = nf.seti_go,
  ["htop"] = nf.md_chart_areaspline,
  ["btop"] = nf.md_chart_areaspline,
  ["kubectl"] = nf.linux_docker,
  ["kuberlr"] = nf.linux_docker,
  ["lazydocker"] = nf.linux_docker,
  ["lua"] = nf.seti_lua,
  ["python"] = nf.seti_python,
  ["perl"] = nf.seti_perl,
  ["make"] = nf.seti_makefile,
  ["node"] = nf.md_nodejs,
  ["nvim"] = nf.custom_neovim,
  ["pacman"] = "󰮯 ",
  ["paru"] = "󰮯 ",
  ["psql"] = nf.dev_postgresql,
  ["pwsh.exe"] = nf.md_console,
  ["ruby"] = nf.cod_ruby,
  ["sudo"] = nf.fa_hashtag,
  ["vim"] = nf.dev_vim,
  ["wget"] = nf.mdi_arrow_down_box,
  ["zsh"] = nf.dev_terminal,
  ["lazygit"] = nf.cod_github,
}

⚙️ Utils

Class
Functions
Clone this wiki locally