da-rth / yasb

A highly configurable cross-platform (Windows) status bar written in Python.
MIT License
1.29k stars 79 forks source link

feat: Create power buttons widget #112

Open JonAnderBeroz opened 8 months ago

JonAnderBeroz commented 8 months ago

Widget to be able to shutdown , restart or lock the computer

Pimiovdb commented 1 month ago

how do you style? can you give some documentation?

Welpyes commented 1 month ago

how do you style? can you give some documentation?

you can do this by having a custom widget in the config.yaml


  shutdown:
    type: "yasb.custom.CustomWidget"
    options: 
      label: "\uf011"
      label_alt: "\uf011"
      class_name: "shutdown-button"
      callbacks:
        on_left: "exec cmd /c shutdown /s /t 5"

this shuts down your computer by clicking on it, but i suggest putting the callback as on_right instead of on_left to avoid accidents