{"id":471303,"date":"2025-08-20T03:00:58","date_gmt":"2025-08-20T03:00:58","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=471303"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=471303","title":{"rendered":"<span>\u0414\u0435\u0433\u0440\u0430\u0434\u0430\u0446\u0438\u044f \u0431\u0430\u0442\u0430\u0440\u0435\u0438 \u0432 Linux<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041c\u044b \u0432\u0441\u0435 \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0431\u0430\u0442\u0430\u0440\u0435\u044f \u043d\u0435 \u0432\u0435\u0447\u043d\u0430. \u042d\u0442\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u2014 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u0437\u043d\u043e\u0448\u0435\u043d\u043d\u0443\u044e \u0431\u0430\u0442\u0430\u0440\u0435\u044e \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u0438 \u0441\u043d\u043e\u0432\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e. \u041d\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0432\u0438\u0434\u0435\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0431\u0430\u0442\u0430\u0440\u0435\u0438. \u0412 MacOS \u044d\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u0432 Linux \u043c\u044b, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f!<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u043f\u043e\u0439\u043c\u0451\u043c, \u043a\u0430\u043a \u043d\u0430\u0439\u0442\u0438 \u043d\u0443\u0436\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0430 \u0437\u0430\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0439 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f waybar.<\/p>\n<h3>\u041d\u0430\u0445\u043e\u0434\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u0435\u0433\u0440\u0430\u0434\u0430\u0446\u0438\u0438 \u0431\u0430\u0442\u0430\u0440\u0435\u0438<\/h3>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u043f\u0438\u0442\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"bash\">upower -e<\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u043d\u0430\u0439\u0434\u0451\u043c \u0431\u0430\u0442\u0430\u0440\u0435\u044e \u0432 \u044d\u0442\u043e\u043c \u0441\u043f\u0438\u0441\u043a\u0435:<\/p>\n<pre><code class=\"bash\">upower -e | grep BAT  # For example: # \/org\/freedesktop\/UPower\/devices\/battery_BATT<\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u044d\u0442\u043e\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435:<\/p>\n<pre><code class=\"bash\">upower -i $(upower -e | grep BAT)<\/code><\/pre>\n<p>\u041c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u044d\u0442\u043e\u0433\u043e:<\/p>\n<pre><code>  native-path:          BATT   vendor:               DESAY   model:                BASE-BAT   serial:               1   power supply:         yes   updated:              Fri Jul 11 11:37:00 2025 (7 seconds ago)   has history:          yes   has statistics:       yes   battery     present:             yes     rechargeable:        yes     state:               charging     warning-level:       none     energy:              25.514 Wh     energy-empty:        0 Wh     energy-full:         47.5052 Wh     energy-full-design:  59.4247 Wh     energy-rate:         11.1573 W     voltage:             11.972 V     charge-cycles:       650     time to full:        2.0 hours     percentage:          53%     capacity:            79.9417%     technology:          lithium-ion     charge-start-threshold:        75%     charge-end-threshold:          80%     charge-threshold-supported:    yes     icon-name:          'battery-good-charging-symbolic'   History (charge):     175222292753.000charging   History (rate):     175222302011.157charging     175222299011.123charging     175222298711.192charging     175222295710.822charging     175222292710.857charging<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0446\u0438\u043a\u043b\u043e\u0432 \u0437\u0430\u0440\u044f\u0434\u043a\u0438, \u0432\u0440\u0435\u043c\u044f \u0434\u043e \u043f\u043e\u043b\u043d\u043e\u0439 \u0437\u0430\u0440\u044f\u0434\u043a\u0438 \u0438 \u0442.\u0434. \u0421\u0435\u0439\u0447\u0430\u0441 \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0442 \u0434\u0432\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430:<\/p>\n<ul>\n<li>\n<p><code>energy-full-design<\/code> \u2014 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u043b\u043d\u044b\u0439 \u043e\u0431\u044a\u0451\u043c \u0431\u0430\u0442\u0430\u0440\u0435\u0438<\/p>\n<\/li>\n<li>\n<p><code>energy-full<\/code> \u2014 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043e\u0431\u044a\u0451\u043c \u0431\u0430\u0442\u0430\u0440\u0435\u0438<\/p>\n<\/li>\n<\/ul>\n<p>\u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0438\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0438 \u0435\u0441\u0442\u044c \u0434\u0435\u0433\u0440\u0430\u0434\u0430\u0446\u0438\u044f \u0431\u0430\u0442\u0430\u0440\u0435\u0438:<\/p>\n<p><img decoding=\"async\" class=\"formula\" source=\"\\text{Degradation} = \\left(1 - \\frac{E_{\\text{full}}}{E_{\\text{design}}}\\right) \\times 100\\%\" alt=\"\\text{Degradation} = \\left(1 - \\frac{E_{\\text{full}}}{E_{\\text{design}}}\\right) \\times 100\\%\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/6\/6a\/6a4\/6a4184a0f637cb40da675a984a47d6bb.svg\" width=\"296\" height=\"40\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/6\/6a\/6a4\/6a4184a0f637cb40da675a984a47d6bb.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/formulas\/6\/6a\/6a4\/6a4184a0f637cb40da675a984a47d6bb.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u044d\u0442\u043e\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0432 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0430\u0445.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0439\u0434\u0451\u043c \u044d\u0442\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043c \u0438\u0445:<\/p>\n<pre><code class=\"bash\">upower -i $(upower -e | grep BAT) | awk '\\ \/energy-full:\/ {ef=$2}\\ \/energy-full-design:\/ {efd=$2}\\ END {print ef\/efd}'<\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"bash\">echo \"(1 - $(upower -i $(upower -e | grep BAT) | awk '\\         \/energy-full:\/ {ef=$2}\\         \/energy-full-design:\/ {efd=$2}\\         END {print ef\/efd}')) * 100 + 0.5\" \\ | bc  # Output example: # 20.558200<\/code><\/pre>\n<p>\u041d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u0448\u0430\u0433\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u043a\u0440\u0443\u0433\u043b\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"bash\">echo \"(1 - $(upower -i $(upower -e | grep BAT) | awk '\\         \/energy-full:\/ {ef=$2}\\         \/energy-full-design:\/ {efd=$2}\\         END {print ef\/efd}')) * 100 + 0.5\" \\ | bc \\ | cut -d'.' -f1  # Output example: # 20<\/code><\/pre>\n<h3>\u041c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f Waybar<\/h3>\n<p>\u0412 \u043c\u043e\u0451\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0435 waybar <code>~\/.config\/waybar\/config.json<\/code> \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0434\u0432\u0430 \u043c\u043e\u0434\u0443\u043b\u044f \u0432 \u043f\u0440\u0430\u0432\u0443\u044e \u0441\u0435\u043a\u0446\u0438\u044e, \u043d\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u0430\u043a \u0432\u0430\u043c \u0443\u0434\u043e\u0431\u043d\u043e. \u0412 \u0438\u0442\u043e\u0433\u0435 \u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u044d\u0442\u043e: <\/p>\n<figure class=\"bordered full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/100\/1c2\/26a\/1001c226af91298dbea4835a891a32d4.png\" width=\"2095\" height=\"1375\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/100\/1c2\/26a\/1001c226af91298dbea4835a891a32d4.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/100\/1c2\/26a\/1001c226af91298dbea4835a891a32d4.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<blockquote>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0440\u0430\u0432\u044f\u0442\u0441\u044f \u043c\u043e\u0438 \u043e\u0431\u043e\u0438, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0438\u0445 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u043d\u044b\u0435 \u0448\u0442\u0443\u043a\u0438 \u0432 \u043c\u043e\u0451\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 <code>dotfiles<\/code> \u043d\u0430 <a href=\"https:\/\/github.com\/alchemmist\/dotfiles\/tree\/main\/wallpapers\" rel=\"noopener noreferrer nofollow\">GitHub<\/a>. \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435: \u044f \u043b\u044e\u0431\u043b\u044e \u0432\u0430\u0448\u0438 \u0437\u0432\u0451\u0437\u0434\u044b! <\/p>\n<\/blockquote>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c:<\/p>\n<pre><code class=\"json\">{   ...   \"modules-left\": [...],   \"modules-center\": [...],   \"modules-right\": [     \"battery\",     \"custom\/battery-degradation\", ...   ],   ...<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u2014 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 <code>battery<\/code>, \u0443 \u043c\u0435\u043d\u044f \u043e\u043d \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 hyprland. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0443\u0440\u043e\u0432\u043d\u0438 \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e, \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u044e\u0449\u0435\u0433\u043e \u0438 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0437\u0430\u0440\u044f\u0434\u0430, \u0437\u0430\u0434\u0430\u0451\u043c nerd-\u0438\u043a\u043e\u043d\u043a\u0438 \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u0431\u0430\u0442\u0430\u0440\u0435\u0438:<\/p>\n<pre><code class=\"json\">\"battery\": {   \"states\": {     \"good\": 90,     \"warning\": 25,     \"critical\": 10   },   \"format\": \"{icon} {capacity}%\",   \"format-charging\": \"\uf1e6 {capacity}%\",   \"format-plugged\": \"\uf1e6 {capacity}%\",   \"format-icons\": [\"\udb80\udc8e\", \"\udb80\udc7a\", \"\udb80\udc7b\", \"\udb80\udc7c\", \"\udb80\udc7d\", \"\udb80\udc7e\", \"\udb80\udc7f\", \"\udb80\udc80\", \"\udb80\udc81\", \"\udb80\udc82\", \"\udb80\udc79\"],   \"tooltip\": \"{time}\",   \"style\": \"{capacity &amp;lt; 10 ? 'color: red;' : 'color: normal;'}\" }<\/code><\/pre>\n<p>\u0412\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u2014 \u0442\u0435\u043c\u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0435\u0433\u043e \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u0430:<\/p>\n<pre><code class=\"json\">\"custom\/battery-degradation\": {   \"format\": \"\uee15 {}%\",   \"interval\": \"once\",   \"exec\": \"~\/scripts\/battery-degradation.sh\",   \"tooltip\": false }<\/code><\/pre>\n<p>\u042f \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043b \u043d\u0430\u0448\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0432 \u0441\u043a\u0440\u0438\u043f\u0442 \u2014 \u0442\u0430\u043a \u0443\u0434\u043e\u0431\u043d\u0435\u0435. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a \u0436\u0435, \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c shebang <code>#!\/bin\/bash<\/code> \u0438:<\/p>\n<pre><code>chmod +x ~\/scripts\/battery-degradation.sh<\/code><\/pre>\n<p>\u0412 \u043c\u043e\u0434\u0443\u043b\u0435 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0444\u043e\u0440\u043c\u0430\u0442 \u0441 nerd-\u0438\u043a\u043e\u043d\u043a\u043e\u0439 \u0438 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043e\u043c, \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0443 \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 waybar.<\/p>\n<p>\u0418 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u043c \u044d\u0442\u0438 \u043c\u043e\u0434\u0443\u043b\u0438 CSS-\u0441\u0442\u0438\u043b\u0435\u043c:<\/p>\n<pre><code class=\"css\">#battery, #custom-battery-degradation {   background: #1e1e2e;   opacity: 0.7;   padding: 0px 10px;   margin: 3px 0px;   margin-top: 5px;   border: 0px solid #181825; }  #battery {   padding-right: 10px;   border-radius: 10px 0px 0px 10px;   min-width: 50px; }  #custom-battery-degradation {   border-radius: 0px 10px 10px 0px;   margin-right: 5px;   min-width: 35px; }  #battery.critical {   color: red; } <\/code><\/pre>\n<p>\u0413\u043e\u0442\u043e\u0432\u043e! \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435:<\/p>\n<div class=\"floating-image\">\n<figure class=\"float\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/66c\/b38\/68f\/66cb3868f785324a22045560b43a8913.png\" width=\"151\" height=\"41\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/66c\/b38\/68f\/66cb3868f785324a22045560b43a8913.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/66c\/b38\/68f\/66cb3868f785324a22045560b43a8913.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u043e\u0441\u044c, \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0435 \u043d\u0430 <a href=\"https:\/\/alchemmist.xyz?utm_source=habr\" rel=\"noopener noreferrer nofollow\">\u0431\u043b\u043e\u0433<\/a> \u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u0432 <a href=\"https:\/\/t.me\/alchemmist_blog\" rel=\"noopener noreferrer nofollow\">Telegram<\/a>!<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/938812\/\"> https:\/\/habr.com\/ru\/articles\/938812\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041c\u044b \u0432\u0441\u0435 \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0431\u0430\u0442\u0430\u0440\u0435\u044f \u043d\u0435 \u0432\u0435\u0447\u043d\u0430. \u042d\u0442\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u2014 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u0437\u043d\u043e\u0448\u0435\u043d\u043d\u0443\u044e \u0431\u0430\u0442\u0430\u0440\u0435\u044e \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u0438 \u0441\u043d\u043e\u0432\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e. \u041d\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0432\u0438\u0434\u0435\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0431\u0430\u0442\u0430\u0440\u0435\u0438. \u0412 MacOS \u044d\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u0432 Linux \u043c\u044b, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f!<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u043f\u043e\u0439\u043c\u0451\u043c, \u043a\u0430\u043a \u043d\u0430\u0439\u0442\u0438 \u043d\u0443\u0436\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0430 \u0437\u0430\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0439 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f waybar.<\/p>\n<h3>\u041d\u0430\u0445\u043e\u0434\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u0435\u0433\u0440\u0430\u0434\u0430\u0446\u0438\u0438 \u0431\u0430\u0442\u0430\u0440\u0435\u0438<\/h3>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u043f\u0438\u0442\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"bash\">upower -e<\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u043d\u0430\u0439\u0434\u0451\u043c \u0431\u0430\u0442\u0430\u0440\u0435\u044e \u0432 \u044d\u0442\u043e\u043c \u0441\u043f\u0438\u0441\u043a\u0435:<\/p>\n<pre><code class=\"bash\">upower -e | grep BAT  # For example: # \/org\/freedesktop\/UPower\/devices\/battery_BATT<\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u044d\u0442\u043e\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435:<\/p>\n<pre><code class=\"bash\">upower -i $(upower -e | grep BAT)<\/code><\/pre>\n<p>\u041c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u044d\u0442\u043e\u0433\u043e:<\/p>\n<pre><code>  native-path:          BATT   vendor:               DESAY   model:                BASE-BAT   serial:               1   power supply:         yes   updated:              Fri Jul 11 11:37:00 2025 (7 seconds ago)   has history:          yes   has statistics:       yes   battery     present:             yes     rechargeable:        yes     state:               charging     warning-level:       none     energy:              25.514 Wh     energy-empty:        0 Wh     energy-full:         47.5052 Wh     energy-full-design:  59.4247 Wh     energy-rate:         11.1573 W     voltage:             11.972 V     charge-cycles:       650     time to full:        2.0 hours     percentage:          53%     capacity:            79.9417%     technology:          lithium-ion     charge-start-threshold:        75%     charge-end-threshold:          80%     charge-threshold-supported:    yes     icon-name:          'battery-good-charging-symbolic'   History (charge):     175222292753.000charging   History (rate):     175222302011.157charging     175222299011.123charging     175222298711.192charging     175222295710.822charging     175222292710.857charging<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0446\u0438\u043a\u043b\u043e\u0432 \u0437\u0430\u0440\u044f\u0434\u043a\u0438, \u0432\u0440\u0435\u043c\u044f \u0434\u043e \u043f\u043e\u043b\u043d\u043e\u0439 \u0437\u0430\u0440\u044f\u0434\u043a\u0438 \u0438 \u0442.\u0434. \u0421\u0435\u0439\u0447\u0430\u0441 \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0442 \u0434\u0432\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430:<\/p>\n<ul>\n<li>\n<p><code>energy-full-design<\/code> \u2014 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u043b\u043d\u044b\u0439 \u043e\u0431\u044a\u0451\u043c \u0431\u0430\u0442\u0430\u0440\u0435\u0438<\/p>\n<\/li>\n<li>\n<p><code>energy-full<\/code> \u2014 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043e\u0431\u044a\u0451\u043c \u0431\u0430\u0442\u0430\u0440\u0435\u0438<\/p>\n<\/li>\n<\/ul>\n<p>\u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0438\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0438 \u0435\u0441\u0442\u044c \u0434\u0435\u0433\u0440\u0430\u0434\u0430\u0446\u0438\u044f \u0431\u0430\u0442\u0430\u0440\u0435\u0438:<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u044d\u0442\u043e\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0432 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0430\u0445.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0439\u0434\u0451\u043c \u044d\u0442\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043c \u0438\u0445:<\/p>\n<pre><code class=\"bash\">upower -i $(upower -e | grep BAT) | awk '\\ \/energy-full:\/ {ef=$2}\\ \/energy-full-design:\/ {efd=$2}\\ END {print ef\/efd}'<\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"bash\">echo \"(1 - $(upower -i $(upower -e | grep BAT) | awk '\\         \/energy-full:\/ {ef=$2}\\         \/energy-full-design:\/ {efd=$2}\\         END {print ef\/efd}')) * 100 + 0.5\" \\ | bc  # Output example: # 20.558200<\/code><\/pre>\n<p>\u041d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u0448\u0430\u0433\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u043a\u0440\u0443\u0433\u043b\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"bash\">echo \"(1 - $(upower -i $(upower -e | grep BAT) | awk '\\         \/energy-full:\/ {ef=$2}\\         \/energy-full-design:\/ {efd=$2}\\         END {print ef\/efd}')) * 100 + 0.5\" \\ | bc \\ | cut -d'.' -f1  # Output example: # 20<\/code><\/pre>\n<h3>\u041c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f Waybar<\/h3>\n<p>\u0412 \u043c\u043e\u0451\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0435 waybar <code>~\/.config\/waybar\/config.json<\/code> \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0434\u0432\u0430 \u043c\u043e\u0434\u0443\u043b\u044f \u0432 \u043f\u0440\u0430\u0432\u0443\u044e \u0441\u0435\u043a\u0446\u0438\u044e, \u043d\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u0430\u043a \u0432\u0430\u043c \u0443\u0434\u043e\u0431\u043d\u043e. \u0412 \u0438\u0442\u043e\u0433\u0435 \u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u044d\u0442\u043e: <\/p>\n<figure class=\"bordered full-width\"><\/figure>\n<blockquote>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0440\u0430\u0432\u044f\u0442\u0441\u044f \u043c\u043e\u0438 \u043e\u0431\u043e\u0438, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0438\u0445 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u043d\u044b\u0435 \u0448\u0442\u0443\u043a\u0438 \u0432 \u043c\u043e\u0451\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 <code>dotfiles<\/code> \u043d\u0430 <a href=\"https:\/\/github.com\/alchemmist\/dotfiles\/tree\/main\/wallpapers\" rel=\"noopener noreferrer nofollow\">GitHub<\/a>. \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435: \u044f \u043b\u044e\u0431\u043b\u044e \u0432\u0430\u0448\u0438 \u0437\u0432\u0451\u0437\u0434\u044b! <\/p>\n<\/blockquote>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c:<\/p>\n<pre><code class=\"json\">{   ...   \"modules-left\": [...],   \"modules-center\": [...],   \"modules-right\": [     \"battery\",     \"custom\/battery-degradation\", ...   ],   ...<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u2014 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 <code>battery<\/code>, \u0443 \u043c\u0435\u043d\u044f \u043e\u043d \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 hyprland. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0443\u0440\u043e\u0432\u043d\u0438 \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e, \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u044e\u0449\u0435\u0433\u043e \u0438 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0437\u0430\u0440\u044f\u0434\u0430, \u0437\u0430\u0434\u0430\u0451\u043c nerd-\u0438\u043a\u043e\u043d\u043a\u0438 \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u0431\u0430\u0442\u0430\u0440\u0435\u0438:<\/p>\n<pre><code class=\"json\">\"battery\": {   \"states\": {     \"good\": 90,     \"warning\": 25,     \"critical\": 10   },   \"format\": \"{icon} {capacity}%\",   \"format-charging\": \"\uf1e6 {capacity}%\",   \"format-plugged\": \"\uf1e6 {capacity}%\",   \"format-icons\": [\"\udb80\udc8e\", \"\udb80\udc7a\", \"\udb80\udc7b\", \"\udb80\udc7c\", \"\udb80\udc7d\", \"\udb80\udc7e\", \"\udb80\udc7f\", \"\udb80\udc80\", \"\udb80\udc81\", \"\udb80\udc82\", \"\udb80\udc79\"],   \"tooltip\": \"{time}\",   \"style\": \"{capacity &amp;lt; 10 ? 'color: red;' : 'color: normal;'}\" }<\/code><\/pre>\n<p>\u0412\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u2014 \u0442\u0435\u043c\u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0435\u0433\u043e \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u0430:<\/p>\n<pre><code class=\"json\">\"custom\/battery-degradation\": {   \"format\": \"\uee15 {}%\",   \"interval\": \"once\",   \"exec\": \"~\/scripts\/battery-degradation.sh\",   \"tooltip\": false }<\/code><\/pre>\n<p>\u042f \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043b \u043d\u0430\u0448\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0432 \u0441\u043a\u0440\u0438\u043f\u0442 \u2014 \u0442\u0430\u043a \u0443\u0434\u043e\u0431\u043d\u0435\u0435. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a \u0436\u0435, \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c shebang <code>#!\/bin\/bash<\/code> \u0438:<\/p>\n<pre><code>chmod +x ~\/scripts\/battery-degradation.sh<\/code><\/pre>\n<p>\u0412 \u043c\u043e\u0434\u0443\u043b\u0435 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0444\u043e\u0440\u043c\u0430\u0442 \u0441 nerd-\u0438\u043a\u043e\u043d\u043a\u043e\u0439 \u0438 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043e\u043c, \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0443 \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 waybar.<\/p>\n<p>\u0418 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u043c \u044d\u0442\u0438 \u043c\u043e\u0434\u0443\u043b\u0438 CSS-\u0441\u0442\u0438\u043b\u0435\u043c:<\/p>\n<pre><code class=\"css\">#battery, #custom-battery-degradation {   background: #1e1e2e;   opacity: 0.7;   padding: 0px 10px;   margin: 3px 0px;   margin-top: 5px;   border: 0px solid #181825; }  #battery {   padding-right: 10px;   border-radius: 10px 0px 0px 10px;   min-width: 50px; }  #custom-battery-degradation {   border-radius: 0px 10px 10px 0px;   margin-right: 5px;   min-width: 35px; }  #battery.critical {   color: red; } <\/code><\/pre>\n<p>\u0413\u043e\u0442\u043e\u0432\u043e! \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435:<\/p>\n<div class=\"floating-image\">\n<figure class=\"float\"><\/figure>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u043e\u0441\u044c, \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0435 \u043d\u0430 <a href=\"https:\/\/alchemmist.xyz?utm_source=habr\" rel=\"noopener noreferrer nofollow\">\u0431\u043b\u043e\u0433<\/a> \u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u0432 <a href=\"https:\/\/t.me\/alchemmist_blog\" rel=\"noopener noreferrer nofollow\">Telegram<\/a>!<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/938812\/\"> https:\/\/habr.com\/ru\/articles\/938812\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-471303","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/471303","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=471303"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/471303\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=471303"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=471303"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=471303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}