mortie / swaylock-effects

Swaylock, with fancy effects
MIT License
708 stars 45 forks source link

Feature: Battery indicator (or generic status) #25

Open Thra11 opened 4 years ago

Thra11 commented 4 years ago

Sometimes it's nice to check the battery charge without having to unlock it. It's not uncommon for other desktops to show a battery indicator on their lockscreens.

Having said that, working out how to read the status of different batteries is quite complex (Sometimes it comes from acpi, sometimes you have to read sysfs, and then there's a bunch of different properties which may or may not exist), so probably not something you want to reimplement in a screen locker.

This got me thinking... what if swaylock-effects just had an option to periodically run a command and display the result, the way swaybar does? That way, I could have my battery status with whatever percentage / time left / icon-font combination I happen to prefer by simply running i3status (or whatever your favourite variant is) with a minimal config, but it would also allow a wide variety of other use cases (Maybe someone else wants to show the weather forecast, or the currently playing track).

Options that might be helpful: update frequency, position, font, colour, etc.

mortie commented 4 years ago

Yeah, I've thought about this idea too. I would like to have a battery indicator myself. Some form of "periodically run this command, display the result in this place" would be one way to do it; it probably fits with the spirit of swaylock-effects better than an out-of-the-box battery indicator. Combined with the compose effect, it should be pretty flexible.

I would want it to be possible to run multiple status commands though, in different places. That means designing the command line interface for adding a status command, specifying a position, a color, etc. would be a bit challenging, it should be doable.

luispabon commented 3 years ago

That would be pretty good actually so that we could add custom modules similarly to the way they work in Waybar. Even better if it took waybar custom module output format so that we could reuse stuff like so:

https://github.com/luispabon/sway-dotfiles/blob/master/configs/waybar/modules/cpu_speed.sh https://github.com/luispabon/sway-dotfiles/blob/master/configs/waybar/modules/powermenu.sh

kriive commented 3 years ago

Yes! That would be an awesome feature! One I would gladly help to contribute to. It would be awesome if we also had CSS styling capabilities. I don't know how much that would fit in the project scope

evilrobot-01 commented 3 years ago

+1 for Waybar. I'd love an area on the lock screen showing media playing with a pause/play button. I often stupidly leave Spotify playing when leaving machine, meaning I need to unlock just to stop the music.

Thra11 commented 3 years ago

+1 for Waybar. I'd love an area on the lock screen showing media playing with a pause/play button. I often stupidly leave Spotify playing when leaving machine, meaning I need to unlock just to stop the music.

I sometimes intentionally leave my music playing while not otherwise using my computer. For that, it would be great to be able to play/pause/skip from the lock screen without having to unlock first.

FlorianFranzen commented 3 years ago

If you do not mind using a key binding, sway can be instructed to trigger key bindings even on the lock screen with the addition of --locked when defining the key binding.

Cornelius-Figgle commented 1 year ago

A year on, any update on this? Being able to see my battery level from the lockscreen would be amazing - even if it was just implemented to allow customisation of the current clock text

EDIT: just realised this isn't the current repo