Giter Club home page Giter Club logo

tmux-battery's People

Contributors

abhijeetviswam avatar asethwright avatar bcc32 avatar bruno- avatar ctjhoa avatar diegoximenes avatar djural avatar fbettag avatar forkjoseph avatar futuro avatar gordol avatar he8us avatar idabmat avatar janahrens avatar jbleuzen avatar jediahkatz avatar jgeralnik avatar justincampbell avatar kaniaorzel avatar levens avatar m1foley avatar martinbeentjes avatar mas90 avatar pschmitt avatar rux616 avatar ryanfrantz avatar silverezhik avatar sktt avatar vass-david avatar waigx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tmux-battery's Issues

Weird battery value on a desktop computer without battery

I'm running tmux on a debian server Debian 4.9.13-1 (2017-02-27) (so there is no battery), and I'm using the latest version of tmux-batteryโ€ฆ
I have only #{battery_percentage} in my status line and it's showing this value : -2147483647%

I tried to look into scripts and none of the command used return content (when I enter them manually in a term), I don't know where this value can come from...

Any hint ? Maybe I can hide the #{battery_percentage} with a condition ?

Two Battery Laptop (Lenovo Thinkpad T70s)

My laptop is an over achiever and has two batteries. BAT0 and BAT1. Only BAT0 shows up in tmux. While helpful, it only shows me accurate status info when BAT0 acted on.
Is this something that would need extra lines in the script, or is this something I could
accommodate in settings?

Battery percentage displays wrong column

The output of pmset -g batt is

Now drawing from 'AC Power' -InternalBattery-0 (id=3801187) 59%; charging; 1:39 remaining present: true.

Piping it to awk 'NR==2 { gsub(/;/,""); print $2 }' prints (id=3801187). Can this be changed to $3, i noticed this on the new preview of OSX, so I doubt if you'll be able to reproduce it, just a heads up!!

Striping leading and trailing whitespace in status-right and status-left

I noticed this bug when trying to use a space for padding in either sides of the tmux status bar, so that the time and session name don't look so "squashed" against the side of the screen.

If I have something like set -g status-left ' [#S]' and this plugin's enabled, the leading whitespace gets stripped, whereas if I don't include it in the plugins list I get the proper spacing. The same happens for status-right.

Doesn't handle "attached" state

I've discovered an unhandled battery state. My MacBook charging cable was plugged in, but it was a little loose and the light wasn't on.

~$ pmset -g batt
Now drawing from 'AC Power'
 -InternalBattery-0 2%; AC attached; not charging

battery_icon is blank in this scenario because that state (neither charging nor discharging) is not accounted for. Maybe it can be handled by creating @batt_attached_icon defaulted to one of these?

  • ๐ŸŒ
  • ๐Ÿ’ฅ
  • ใ€ฐ๏ธ
  • ๐Ÿ”Œ
  • ๐Ÿ˜
  • โš ๏ธ

Can't get it working

I am sure something is wrong with my config. I am very new to shell scripting, and not sure if I am constructing the battery template right.

Can you please take a look at this change set. nerdpad/dotfiles@4b430ca#diff-e4a99bf3a7fbdabd6456dad3160011e3

I added the following lines to my theme.sh, which is sourced in tmux.config after tmp is loaded.

I am running OSX Sierra

Theme.sh

tm_battery="$battery_icon $battery_percentage $battery_remain"
set -g status-right $tm_tunes' '$tm_battery' '$tm_date' '$tm_host

Tmux Plugin

###########################
### Tmux Plugin Manager ###
###########################

# List of plugins
set -g @tpm_plugins '           \
  tmux-plugins/tpm              \
  tmux-plugins/tmux-sensible    \
  tmux-plugins/tmux-resurrect   \
  tmux-plugins/tmux-battery     \
'

# Initialize TMUX plugin manager
run '~/.tmux/plugins/tpm/tpm'

Tmux.conf

# load tmux plugin manager
source ~/.dotfiles/tmux/tmux.plugins.sh

#######################
### Color & Style Settings ###
#######################
		 
source ~/.dotfiles/tmux/theme.sh

All the plugins are installed.

Battery icon usage inconsistent

Using the following config:

#tmux.conf
set -g @batt_charged_icon "๐Ÿ”‹"
set -g @batt_charging_icon "๐Ÿ”บ"
set -g @batt_discharging_icon "๐Ÿ”ป"
set -g @batt_attached_icon "๐Ÿ”Œ"
set -ga status-right #{battery_percentage}#{battery_icon}  #{battery_remain}

Power and icon states observed

Battery full: ๐Ÿ”‹
Battery charging: ๐Ÿ”บ
Battery discharging: ๐Ÿ”ป
Plug attached: <state never used?>

Perhaps I'm misunderstanding the states? At full power you are either attached or have a full battery (for a few minutes anyway!). The attached icon would be used when the battery is full and the power adapter is connected. This doesn't seem to be the case however.

Alternatively the attached state (plug or battery) could optionally be a separate icon from the charging/discharging status indicator.

No indication at all

I have both acpi and upower installed, but the battery percentage won't show up. I have the plugin installed via tpm, pretty sure I have the status-right correct, but there's no percentage, though I have noticed it appears for a split second when the environment reloads during package installation. Same goes for the battery graph.

Screenshot_20230917-175134_GitHub

OS is Arch Linux, kernel 6.4.12-arch1-1
I am running this netbook with KMSCON only, which made it kinda dificult to get a screenshot to github, but I managed it using fbgrab (and also git ๐Ÿ˜‚).

Note: to save time, I have tried just installing acpi and also just installing upower, no change.

Battery percentage not showing in [OS X El Capitan / iTerm 2.1.4 / Tmux 2.1]

I have tried to follow the setup steps, but it seems not to be working on my env.

Here are the versions I am using:

OSX El Capitan, 10.11.2
iTerm 2.1.4
Tmux 2.1

The final result is that the battery percentage/icon appears for less than a second then disappears. (it just blinks, really)

I've tested with changing the status-interval to 10, 15, 60 seconds but it did not change anything.


2015-01-21

UPDATE: If I run, from inside tmux: run ~/.tmux/plugins/tmux-battery/battery.tmux it starts working. But I have to run it every time I source the ~/.tmux.conf file.

battery_remain doesn't work with upower on Arch

Hello.

in battery_remain.sh

        upower -i $battery | grep remain | awk '{print $4}'

is used to retrieve the remaining battery duration.

However, on Arch I'm not seeing a line that contains "remain". Instead, the field is named "time to empty".

cole@pixel ๎‚ฐ ~ ๎‚ฐ upower -i /org/freedesktop/UPower/devices/battery_BAT0
  native-path:          BAT0
  vendor:               SMP-ATL
  model:                A55
  serial:               080A
  power supply:         yes
  updated:              Mon 14 Dec 2015 01:15:07 PM PST (62 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               discharging
    warning-level:       none
    energy:              24.966 Wh
    energy-empty:        0 Wh
    energy-full:         67.0472 Wh
    energy-full-design:  72.314 Wh
    energy-rate:         9.2188 W
    voltage:             7.48 V
    time to empty:       2.7 hours
    percentage:          37%
    capacity:            91.9811%
    technology:          lithium-ion
    icon-name:          'battery-good-symbolic'
  History (rate):
    1450127707  9.219   discharging

battery_percentage showing wrong value

upower has a bug and it shows a wrong info in energy-full after resume. For example, it outputs the following on Xubuntu 17.10:

 battery
    present:             yes
    rechargeable:        yes
    state:               charging
    warning-level:       none
    energy:              33.9598 Wh
    energy-empty:        0 Wh
    energy-full:         52.9452 Wh
    energy-full-design:  52.9452 Wh
    energy-rate:         22.0185 W
    voltage:             8.398 V
    time to full:        51.7 minutes
    percentage:          75%
    capacity:            85.4978%
    technology:          lithium-polymer
    icon-name:          'battery-full-charging-symbolic'

energy-full and energy-full-design are same despite the capacity to be at 85%.

Hence when the script uses these values it yields the wrong percentage.

I was wondering why isn't the percentage value being taken directly?

Using battery Icon

I'm not sure if this is a bug or not.
When my mac is charging it displays the lightning bolt icon, when it's full it displays a battery icon, when it's using the battery, it displays nothing, shouldn't there be a 'on battery power' icon?

p.s. this is an awesome plugin, I love having a status bar at the bottom of my terminal, with battery power in it, sooo useful.

battery_icon not working

Instead of battery_icon I see blank space.

Terminal: iTerm2 3.0.1
OS: Mac OS X 10.11.6
TMUX: 2.3

tmux config line:

set -g status-right 'Battery: #{battery_icon} #{battery_percentage} (#{battery_remain}) | %a %h-%d %H:%M '

I'm not sure if I'm doing something wrong. Everything else I've set up there is working correctly. Is it supported on Mac OS X? I've tried Terminal.app 2.6.1 and the result is same.

can't show emoticons

i was trying to show the ๐Ÿ˜Ž emoticon in my status bar although it's just printing out:

screen shot 2015-02-11 at 09 59 26

what can i do?

Battery metrics flash then disappear

Hi,
I've got a weird bug, I load the plugin, configure it in my status-right - hit reload - battery icon + percentage appears, then .5s later - disappears, never to be seen again. I reload, same thing happens. Restarting tmux, brand new session doesn't fix. Nor does emptying my config of everything but the status-right + TPM.

Every seen this before? How can I fix it, or even debug?

Thanks

Spikes in CPU usage of tmux on long uptimes attributed to tmux-battery

I had been having a problem with tmux whereby after it being running for periods of upwards of 12 or 24 hours I would observe spikes in cpu usage and it would always be caused by tmux. Cpu usage would oscillate between 15% to 80% in 2 seconds and keep on doing so. Similar problems were being faced by users of powerline with tmux. I however don't so I thought it could be tmux-battery as I don't have any intensive plugins and after removing it from the statusline the load vanished.
My .tmux.conf relevant to this is below; the rest doesn't seem to be part of the problem.

#commented out setting including tmux-battery use
#set -g status-right '#{battery_status_fg}Batt:#{battery_icon} #{battery_percentage}\
 #[fg=colour114]cont:#{continuum_status}\
 #[fg=colour233,bg=colour241,bold] %d/%m #[fg=colour233,bg=colour245,bold] %H:%M '

#after removing the use of tmux-battery
set -g status-right '\
#[fg=colour114]cont:#{continuum_status}\
 #[fg=colour233,bg=colour241,bold] %d/%m #[fg=colour233,bg=colour245,bold] %H:%M '

How to conditionally display battery info

I have the following snippet in my status-right:

#{?#{!=:#{battery_percentage},}, #{battery_status_bg} #{battery_remain} [#{battery_percentage}],}

The idea being that I only want to display battery info, etc. if the current machine I'm on actually has a battery. However, when I do have a battery, I get output like ~1:27 [] instead of ~1:27 [22%] as expected.

Is there a better way to detect the presence/absence of a battery rather than just testing the output of #{battery_percentage}?

Broken UI with 2-bytes unicode characters (e.g. ๐Ÿ—ฒ๐Ÿ”‹)

If I set the icons as follow:

set -g @batt_charged_icon "โœ”"
#set -g @batt_charging_icon "๐Ÿ—ฒ"
set -g @batt_discharging_icon '๐Ÿ”‹'
set -g @batt_attached_icon '๐Ÿ”Œ'

The UI broke loose when I unplug my laptop and switch to discharging and the tmux status bar appear twice each time it refresh.

selection_005

If I replace charging icon ๐Ÿ—ฒ (U+1F5F2 LIGHTNING MOOD, UTF-16: 0xD83D 0xDDF2) by โšก (U+26A1 HIGH VOLTAGE SIGN, UTF-16: 0x26A1) there is no more problem while charging.

I'm using Noto Sans as main font but the 2-bytes unicode character are rendered by Symbola Font.

Support for custom background colors

I am facing a problem with background color and my font color, I would need to edit plugin colors to be easy to read.
I know I can set the color to {battery_status_fg} but, It would be cool, add your custom colors ๐Ÿ˜Ž
screenshot from 2019-01-25 09-35-13

battery status does not work with acpi (but with upower)

I'd like to follow your recommendation to use acpi over upower.

However, I get no battery status via acpid, only via upowerd. Each or both
are lauched via systemd.

I assume acpi should work though.

Can you please give a hint where to start debugging? I do not see any error
messages and such.

just curious

when would the contributors section in README.md be updated? XD

UPS support

Hi,

Thanks for great tmux plug-in!
It might be great to have UPS support. On my workstation it's reported as ups device

>> upower -e    
/org/freedesktop/UPower/devices/ups_hiddev0
/org/freedesktop/UPower/devices/mouse_0003
/org/freedesktop/UPower/devices/mouse_hidpp_battery_0
/org/freedesktop/UPower/devices/DisplayDevice

Thank you in advance!

Time to charge display

The Mac calculates the time until the battery is fully charged. It would be useful to display this with the #{battery_remain} flag when the battery is charging rather than showing nothing.

Mac Sierra on MacBook #{battery_percent} #{battery_remain} displays (id: 3997795) ___

Hi - Thank you for providing and maintaining this plugin. It's a nice addition to my tmux status.

Please note that I have updated the plugins and see the battery image icon. However, the percent remaining displays the id:xxxx and time remaining output is blank. Is this a formatting issue? Thanks for letting me know if there is anything I can add to the configuration. - E

No indication at powerline

Hi,

I'm new to tux and pwerline, and I'm trying to use this plugin. Though, there is no indication at the pwerline status bar. I only get Batt: and no other indication (OK, plus the | date at the end). Can you please help?

My laptop is MacOS and it has the pmset and I also installed the acpi from brew. But still nothing.

Can I use this on WSL?

I am using Ubuntu installed through the Microsoft Store. Here is my .tmux.conf:

set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-battery'

set -g status-right "#{battery_status_bg} #{battery_percentage} #[bg=default,fg=default] #H %d/%m %H:%M"

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'

After sourcing with tmux source ~/.tmux.conf and installing with <prefix> I, the battery info does not show up in my status bar. Could this have something to do with WSL or am I just doing something wrong? Please let me know if you need any more information.

Contributor name fix

Hi Martin,

Back in the day, I contributed to tmux-battery by adding the support for chromebooks. Could you update my name on contributor from Joseph to HyunJong (Joseph) Lee?

Thanks!

battery_remain interpolation issue with "No estimate"

@asethwright Hey, I found a bug:

On OS X, when it's unplugged, this can be the output for battery_remain:

Now drawing from 'Battery Power'
 -InternalBattery-0     100%; discharging; (no estimate)

In this case the battery_remain interpolation will show only (no in tmux status line.

Sierra upgrade broke battery display

Hey, I recently upgraded to Sierra and noticed that my tmux battery display broke.

screen shot 2016-11-03 at 12 15 43 pm

From ~/.tmux.conf:

set -g status-right '#[fg=Cyan]#S #[fg=yellow]#{battery_percentage} #[fg=white]%a %b %d %R'

I use tmux plugin manager. Anyone know what's going on here?

Add colour for battery_status when charging

At the moment battery_status colour is defined only based on battery percentage. When using short format for remaining time, one can't distinguish between charging and discharging.

Therefore a colour indicating charging could be added.

Unable to see battery_percentage in status-right

Do you know what might be going on here?

Screen Shot 2019-06-11 at 2 24 48 AM

I'm able to run the script and get the right battery percentage from the command line, but I'm not able to do the same within the tmux status-right.

battery_remain interpolation: show it only when the battery state is `discharging`

The battery_remain interpolation currently shows both the discharging and time to fully charge.

To keep this simple I think only the remaining time (when the laptop is discharging) should be shown. We don't want to have any output when the laptop is plugged in.

We might wanna consider adding another interpolation that will show the time till fully charged.

@asethwright looping you in on this.

Importance of battery icons

Hey! Thanks for using the plugin, I am currently planning out some future works for this. I would like to receive your feedback on this.

I became the maintainer for this plugins after some contributions to get the plugin working when upgrading to macOS Sierra (pmset -g batt output format changed). Thanks to you, we now support ChromeOS. It is also possible to add a changing background color based on the battery percentage.

But, one of the functionalities is adding emoji characters (two byte unicode characters) based on the status (charging/discharging et cetera). However, I encountered multiple issues regarding this problem. And I have been thinking of the importance of this functionality.

As this is an enhancement to the tmux status bar, I prefer not to use emoji characters. So, personally I do not prefer to use it.

With this issue, I want to know what you prefer. Should we keep the battery icon, or is it something we could get rid of?

Battery status changes causes incorrect window refresh

Hi, this is what started to happen on battery status change after some weeks ago. It made me stop using the plugin:

screenshot from 2016-11-22 12-25-23

When I press Enter after that kind of status change, I get:

screenshot from 2016-11-22 12-31-19

As can be seen, a caret is shown in the left-bottom corner, not the tmux bar, which got hidden bellow the window canvas.

~ โฏโฏโฏ tmux -V
tmux 2.3

~ โฏโฏโฏ xfce4-terminal --version
Copyright (c) 2003-2016
        The Xfce development team. All rights reserved.

No data display.

set -g status-right "CPU: #{cpu_icon} #{cpu_percentage} Batt: #{battery_icon} #{battery_percentage} #{battery_remain} | %a %h-%d %H:%M"

CPU: โ 12.85% Batt: | Tue Jun-28 01:12

No data for Battery.

Separate custom background and foreground colors

Right know, the setting of custom and background colors is the same, in the sense that if I set @batt_color_high_charge, it will be the same for fg and bg. It would be good to be able to set those to separately, as to generate some cool combinations.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.