Fixing the upower warning - WSL/ZSH/Spaceship prompt

 



There are many cool prompts with ZSH. It's one of the reasons I made the switch from using BASH.

However, after installing the spaceship prompt on Windows subsystem for Linux, I noticed the following error: 

(upower:26251): UPower-WARNING **: 10:47:25.757: Cannot connect to upowerd: Could not connect: No such file or directory


upowerd isn't running on WSL. There is no need for it to run. I don't even believe there is support for it on WSL.

After doing some digging in the spaceship prompt code, it turns out this feature can be disabled with a simple environment variable. I've added the following to my ~/.profile:


 # Turn off power status when using spaceship prompt
 export SPACESHIP_BATTERY_SHOW=false

Comments

  1. Hi, I have the same problem, but adding a variable to .profile doesn't change anything. Is there anything else I can try?

    ReplyDelete
  2. Hey, go to .zshrc and where you find the list of spaceship configs "SPACESHIP_PROPMT_ORDER" go to almost the end , and just comment the line

    ```battery # Battery level and status```

    turn to

    ```# battery # Battery level and status```

    This solve the issue for me , hope it helps !

    ReplyDelete
  3. In my .zshrc file, I don't have any spaceship settings and neither does the ```battery # Battery level and status line```

    ReplyDelete
  4. thanks for post this <3, helped me.

    ReplyDelete
  5. I added "export SPACESHIP_BATTERY_SHOW=false" at the end of .zprofile file and it worked for me.

    ReplyDelete

Post a Comment