Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nimdow to support "reset" escape codes #223

Closed
DrunkenAlcoholic opened this issue Feb 4, 2024 · 1 comment · Fixed by #225
Closed

Nimdow to support "reset" escape codes #223

DrunkenAlcoholic opened this issue Feb 4, 2024 · 1 comment · Fixed by #225
Assignees
Labels
bug Something isn't working
Milestone

Comments

@DrunkenAlcoholic
Copy link
Contributor

DrunkenAlcoholic commented Feb 4, 2024

Describe the bug
This may not be a bug, however it seems that Nimdow is not supporting the "reset" escape code, "\x1b[0m"

To Reproduce
Steps to reproduce the behavior:

const
  RESET: string  = "\x1b[0m"
 
  GREEN_FG: string  = "\x1b[38;2;104;157;106m"
  BLUE_FG:  string  = "\x1b[38;2;69;133;136m"
  ORANGE_FG: string = "\x1b[38;2;249;188;47m"
  RED_FG: string    = "\x1b[38;2;231;104;97m"
  WHITE_FG: string  = "\x1b[38;2;235;219;178m"
  BROWN_FG: string  = "\x1b[38;2;49;51;66m"

  GREEN_BG: string  = "\x1b[48;2;104;157;106m"
  BLUE_BG:  string  = "\x1b[48;2;69;133;136m"
  ORANGE_BG: string = "\x1b[48;2;249;188;47m"
  RED_BG: string    = "\x1b[48;2;231;104;97m"
  WHITE_BG: string  = "\x1b[48;2;235;219;178m"
  BROWN_BG: string  = "\x1b[48;2;49;51;66m"

  CIRCLE_GREEN_L: string  = RESET & GREEN_FG & "" & RESET & GREEN_BG
  CIRCLE_GREEN_R: string  = RESET & GREEN_FG & "" & RESET
  CIRCLE_BLUE_L: string   = RESET & BLUE_FG & "" & RESET & BLUE_BG
  CIRCLE_BLUE_R: string   = RESET & BLUE_FG & "" & RESET
  CIRCLE_ORANGE_L: string = RESET & ORANGE_FG & "" & RESET & ORANGE_BG
  CIRCLE_ORANGE_R: string = RESET & ORANGE_FG & "" & RESET
  CIRCLE_RED_L: string    = RESET & RED_FG & "" & RESET & RED_BG
  CIRCLE_RED_R: string    = RESET & RED_FG & "" & RESET
  CIRCLE_WHITE_L: string  = RESET & WHITE_FG & "" & RESET & WHITE_BG
  CIRCLE_WHITE_R: string  = RESET & WHITE_FG & "" & RESET
  CIRCLE_BROWN_L: string  = RESET & BROWN_FG & "" & RESET & BROWN_BG
  CIRCLE_BROWN_R: string  = RESET & BROWN_FG & "" & RESET

Using the above constants, push the generated string to "xsetroot -name" example below

proc setStatus(sStatus: string) = 
  discard execShellCmd("xsetroot -name " & "\"" & sStatus & "\"")

# Main loop
proc main() =
  while true:
    # create the string using themed arrows and functions
    let sStatusString = fmt"{CIRCLE_GREEN_L}{getWeather()}{CIRCLE_GREEN_R}{CIRCLE_ORANGE_L}{getBatStatus()}{CIRCLE_ORANGE_R}{CIRCLE_BLUE_L}{getMemory()}{CIRCLE_BLUE_R}{CIRCLE_RED_L}{getDateTime()}{CIRCLE_RED_R}{RESET}"
    # set the status
    setStatus(sStatusString)
    # sleep for n seconds
    sleep(UPDATE_INTERVAL * 1000)

Expected behavior
I would expect the foreground and background color to reset to default color of the Nimdow bar when using "RESET" escape code, as screenshot below

Screenshots
This how the result should look like(I have manually inserted escape code for same color bar back ground)
screenshot3

and here it is working in the terminal using "reset" escape code
image

But due to what seems to be not supporting escape code it results in this
screenshot4

@DrunkenAlcoholic DrunkenAlcoholic added the bug Something isn't working label Feb 4, 2024
@avahe-kellenberger
Copy link
Owner

Good find, I'll work on this sometime soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants