Bash Script Review: My Battery Power i3Blocks Module

Bryan Jenks · Intermediate ·🛠️ AI Tools & Apps ·6y ago

Key Takeaways

Bryan Jenks reviews his bash script for managing battery power with i3blocks, covering topics such as scripting, status bar customization, and process management using tools like bash, i3blocks, and dunst.

Full Transcript

welcome back everyone I just got some requests to do basically walkthrough bash scripts I put out my video I'll put a card up there about an introduction to bash scripting and just a bash programming language but I had some requests that yeah sure here's the syntax here's how it could be used but it would be helpful to actually walk through a script and say this is what this is doing this is why it's done this way and you know just walk through some scripts so I'm just gonna walk through my battery power script I have up here in my status bar you can see I have two outputs here I'm gonna walk through step by step everything in my script and what they're doing why they're doing it and just how it's put together if you have like specific requests if some things you'd like me to look at I will consider that but for now let's dive in so I'm still using I 3 I three blocks I three gaps actually I three blocks so this is a status bar script so this script actually produces output into my I three blocks status bar if I go to my status bar right here I have a battery module this is basically it will call the script unless you have command if you have command right here then this supersedes whatever's written here in the block name and so in this case I'm calling the battery script on the bat zero input so bat zero is the input into this script and the interval is every five seconds this will execute because it's my battery power it's constantly changing I want it on a short interval so it's constantly updating to a live value and you can see I have two of them here because I have two batteries I have the internal battery for my ThinkPad and then I also have a sliced battery attached to the bottom so I basically have two batteries so if I go to where this these variables are stored the files insist slash class you will see that I have two batteries but in any case let's go back here so currently the shebang is looking for user bin and shell this isn't really unless I actually symlink bash to - it's not really gonna do POSIX shell a goal of mine is to make things more POSIX but for now I'm - so it's fine at the moment currently it does pass she'll check so you know for now it works long-term goal to make things completely posix but we'll get there when we get there so case block button block button if we echo that oops need to add there we go so we got nothing nothing in block button so why is this blank well because this is receiving input so in this case we're going to be receiving the input into battery so let's just do battery batt zero it outputs this so block button is actually going to receive the input which is bat zero or bat one because that's what I have in my I three blocks config file so first thing it does is it has this case statement now this case statement is only going to happen have like output when I actually click on my status bar so one if this was a one it would be a left click if it was a two it would be a middle click and three is a right click so when I right click all of these actions are going to be executed so if I right click come on it'll right click there we go so if I right click it will actually output this it'll tell me about what the battery module is doing but what is all this stuff do so P graph is looking for a process so in this case we're gonna do P grip - X for exact we want an exact name of a process for dunst so what this is doing is it's saying hey does an instance of dunst already exist find a process ID or pit and in this case Dunst currently is running but we also have the output standard output going to dev null which is the null device meaning be quiet run the command but be quiet I don't want to see any output in my terminal so it's out no output but reason why this is what don't we want to know that no we want this to succeed we want to know that a current instance of dunst is running so if this does execute correctly and there is an instance then the status value of this is a zero meaning everything's working fine it's great it's silent the double ampersand as run what is to the left and if it succeeds then run what is to the right it's a stopgap if the first action fails then the ampersand ampersand will make sure that it quits the process it does not continue on if you did a semicolon it would run first thing and then second thing regardless of the success or failure of the first thing so in this case we find a current existing pid' or process ID and then we run if their instance exists we run this notify send which is just that little pop-up notification that shows me that information about the status bar this is pretty standard for i3 blocks and that's all i have set i don't have a left or a middle click setting for this right now i might put something in the future but for now it's just a right click for info so the next thing we have capacity the variable capacity is receiving the output of this command substitution the command substitution the first thing we want to pay attention to is that it has parentheses around this dollar sign one basically that means is that the input into the script this is your bat zero bat one so you're basically filling in the system path with bat zero or bat one depending on which variable you run the output would be the same but we're catting out all of this so let's just run write this out so a command substitution basically says run all this command and whatever the output is that gets assigned to the variable so we're gonna do cat this class power supply and now I'm just going to say bat one and then forward slash capacity because that's what we're looking at and the output is 99 because my battery is currently full at 99% so my capacity is 99 which means capacity now receives the value of 99 for bat 1 if this failed for whatever reason it would exit the script this is that first stopgap you don't want to run other actions if something has failed or if it's a critical failure like for instance if you don't have a battery then this probably should not be running or if you only had one battery and in any case if it failed and there was no output or something broke then you want this to exit and exit immediately technically this should have an exit one meaning like a catch-all status error saying hey if there's something broken this exited something really bad happened so you should know that I've never had it happen but it's there as a stopgap next thing is status it's the exact same thing as before except it's the actual status so if I back that up status then the status is actually unknown so what I found out is that when it comes to the battery power unknown basically just means it's a static charge you could have a full battery with an unknown status or you could have an empty battery with an unknown status and that actually caused some issues with logic I had to fix in my script later on but in any case we are gathering the capacity and the status the current number of battery power we have and the current status of that batteries charging State so with those we have this giant if statement and basically all this is doing is it's saying hey look at the capacity which is that number we got currently I'm at 99 and each of these statements is saying if and then the test is capacity even though it's a number we wrap our variables in double quotes always just in case it's not necessary in this instance because it's a number and not text so we don't to worry about string splitting but just in case wrap your variables and double quotes but it's saying if and test this the test is saying capacity is greater than or equal to 85 currently it is it is 99 so if this test is successful and it is we get a true or a 1 so then the variable color receives a hex code of and then these are all Grove box colors so currently 99 is this 6 8 9 d6 a that is this nice cyan or teal ish looking color you can see that it matches my battery status bar but that's these are all Grove box colors and then basically based on the battery power it will test so if this fails it is not greater than or equal to 85 well then the next test is okay well is it greater than or equal to 65 and it goes down and down and down and down and the lower it gets the more it goes from like green to orange to or from yellow to orange to red and till it gets lower and lower in battery power and this is all doing the exact same thing is capacity greater than equal to this number and as it fails you can easily catch things by saying greater than or equal to because if it fails 85 then it's gonna be less than 85 but it could still be greater than or equal to 65 so these are just like successive levels of catching whatever battery power we're currently at and then assigning the variable color a specific color value hex code now if none of these are true so basically if battery is so low that it is less than 10 that means that this else if or Elif statement fails so the catch-all at that instance is this else statement basically color becomes FB for 934 and that is this very loud red color and the worn variable gets this battery icon from font awesome that has an exclamation point in it now this will all come together in the next few lines of code but that is important to know is that this is where the colors coming from and then if you're critically low on battery power Warren is getting this exclamation point battery from here so the next thing we're gonna test so now we just have some successive tests these are not if statements because if you wanted to say if something is true then run successive actions until something fails or just run them all successfully you can easily just do double ampersands instead of writing long if statements with a lot of extra text you can easily just do you know a test and then if that test passes then double ampersands to successfully run the next thing so what we're testing here is is the warren variable null so if that's true and warren is equal to nothing then warren is equal to absolutely nothing which is this closed double quote basically a null string there is no not even a space that takes up no space and this is just to be doubly sure we will we don't want Warren to be equal to anything if Warren is a null string meaning it the color or the value of bet capacity is not lower than 10 so the next line if status and now now we're dealing the text in status so we have definitely want our variable wrapped in double quotes granted you're not probably not gonna encounter spaces unless you get to ah not charging like you can see here so always wrap with double quotes so we're testing is status equal to charging if that is true then also execute a test to say is warn not null meaning is is the variable warned equal to something does it have this battery value or this battery icon which means that in that case capacity is less than 10 but we're charging so my personal preference was if my battery is so low that it's below 10 percent and it's critical and I have this red exclamation mark battery icon but if I'm charging my battery and I have it plugged in and I'm good now because it's charging I don't want to see that obnoxious you know exclamation point I have got the point I am now charging my battery so I turn that off I say if it's charging and it's warning to me that the battery is critically low turn off warning because I'm charging it so I know it and I'm good and it's charging next one is if the status is discharging meaning it's just releasing energy it is not plugged in and a battery is now losing power by expending it and warning is not null meaning we are now critically below 10 on battery capacity and we are still discharging we are not charging then status equals nothing so status is discharging because we're losing power but we are critically below 10 10 battery power so I don't want to see two icons because discharging has its own battery icon I don't want to see that if it's both if it's critical I want to see the critical one only the exclamation point in the battery so that's why I turn status to zero here now this last one is saying if capacity is equal to zero meaning our battery is empty and status equals unknown which is what happens when you have a static charge either it's completely full or it's completely dead so if the capacity is zero we have a static charge meaning it's not charging it's and warning is not null then that means okay your battery's done it's empty you're not charging in that instance change status to an empty battery icon because it's not warning anymore it's dead it's empty change status to an empty battery and turn off warn because we're past warning we got it the battery is now dead it's empty replace that with an empty battery icon now at that point I've moved some things here I might add those back in you can grab the latest one of my dot files I gotta test this but at this point we're doing a printf statement and this is what is actually output to the status bar this is as it currently stands all of this is just logic this is what is actually putting output into the status bar and the status bar is receiving a printf statement that has in it some HTML and inline CSS and for string inputs that's what these % s's are so printf is a c function that is usable within bash and printf is going to say i have four strings i am inputting into this you know this text string and this text string contains a span HTML element some inline CSS and a newline break so the first input color is equal to a string that string is the variable color which got assigned up here so based on our current battery capacity it gets assigned a color that's what covers the text output and the color of this text is whatever the battery capacity currently is now we have three inputs within the span elements so all the stuff right here the actual output text that's what's going to be added next so what is added the first thing that's added is the icon like you can see here and we're echoing the value of the status variable and now you can see this is in a command substitution so all of this is basically returning the output of the command into printf it's not going to be all this text here it's gonna be the output of this command so echo status and status would be whatever the current status is so charging discharging unknown whatever that status is pipe that into said now we have an e option here so said with the e option is saying it's a script so add the script to the commands to be executed cool so what we're gonna do is we are gonna run successive set functions or regex replacements so we are saying take status discharging not charging charging unknown etc and pipette into said whatever the value is replace it with something so you're gonna find whatever the value currently is so it could be discharging uh if it is replace it with this icon and a space if it's charging replace it with this icon in a space you get the point it finds the status and replaces it with a battery icon and a space so the output is aesthetically pleasing now because color was already set the color of the battery icon will change this is why I use font awesome for my status bar icons instead of I think it's just joy pixels because I don't like the like shiny plastic you look I actually wanted to change the color of my icons to actually be grub box colors so that's why I use font awesome so now we're finding the icon that matches the capacity that I set and I set these all myself I never get not charging that would probably mean something worse is going on but discharging charging unknown if it's like a static charge full all of these are used based on the current battery power now if something you can see that I have all this logic in here the next string added is warned because if warned is active and if it meets the certain conditions in here then the actual status is turned off and now there's no battery icon but then warned is also added so if warned is there then Warren is a exclamation battery and a space or if it is not needed and the other statuses take precedence then Warren is a null string which is why I have it added in to the printf either it warned is on or something else is on there's always a battery icon and then the last argument into printf is echoing as a command substitution echoing the current capacity which is that number so capacity would in this case be like 19 capacity so in this case 99 and we're passing that into said - e basically a substitution that says dollar sign which is the end of the line find the end of the line and replace the end of the line with a percent sign so we can just run that quickly here pipe that into said - e single quote s substitution dollar sign percent and close it off and it does 99 percent which is why we see the percent on the status bar so all of this output all of this logic is basically saying look at how much capacity we have left on the battery change the color based on what the current capacity is and change the icon based on what the current capacity is now I took these out for the sake of the demo I'm gonna test later to see if these actually need to be added in towards the bottom of these statements now though you structure these things top to bottom sometimes based on which thing you want to successfully process first but when it comes to said statements like this when it's just doing all of them it's really just whatever hits is actually what is operated on and then it's not gonna find anything successively so it's just gonna leave it at that current battery icon I'm not sure if this these outputs need to do these inputs need to be added back I'm gonna test that I think it's just if I have a zero or low battery I will test but currently with them added in the current version of this battery script is available on my dot files on github a link to my github is in the description below and this is my battery's script for my status bar so it takes a single battery variable as input in the status bar here bat zero bat one I do this twice because I can easily manage how many batteries I'm running this on and this is how I currently manage my battery power with I three blocks in my status bar I will likely do other script reviews if this is something that people would like to continue to see I do have some other ones I've written myself or heavily edited from other sources if you'd like me to see that you would like to see me just oh I cannot speak if you would like to see me review other scripts let me know in the comments below let me know if you liked the video if you liked the video then like the video and for now that's it and so far thank you to Devon who is my patron on patreon and Alberto who is new patron thank you guys for supporting the channel and to everyone else I will see you next time bye

Original Description

▬▬▬▬▬▬▬▬▬▬ ► CHECK THESE OUT ◀︎▬▬▬▬▬▬▬▬▬▬ 📧️ NEWSLETTER: https://bryanjenkstech.ck.page/d4ec0713d5 💬 DISCORD: https://discord.gg/MxCVshN 🗣️ SOCIALS: https://streamerlinks.com/tallguyjenks ▬▬▬▬▬▬▬▬▬▬ ► SUPPORT THE CHANNEL ◀︎▬▬▬▬▬▬▬▬▬▬ 👨🏻‍💻️ GITHUB SPONSOR: https://github.com/sponsors/tallguyjenks 🙏🏻️ AMAZON WISHLIST: https://www.amazon.com/hz/wishlist/ls/17FRLE35NC7G8?ref_=wl_share 😇 PATREON: https://www.patreon.com/bryanjenks?fan_landing=true 🙌🏻️ YOUTUBE MEMBERSHIP: https://www.youtube.com/c/BryanJenksTech/join ☕ BUY ME A COFFEE: https://www.buymeacoffee.com/tallguyjenks 💵 PAYPAL: https://www.paypal.me/tallguyjenks 📊️ FREE STOCKS: http://join.robinhood.com/bryanj67 ▬▬▬▬▬▬▬▬▬▬ ► My Newsletter ◀︎▬▬▬▬▬▬▬▬▬▬ 📧️ NEWSLETTER: https://bryanjenkstech.ck.page/d4ec0713d5 ▬▬▬▬▬▬▬▬▬▬ ► My Gear ◀︎▬▬▬▬▬▬▬▬▬▬ ⚙️GEAR: https://kit.co/tallguyjenks/my-gear ▬▬▬▬▬▬▬▬▬▬ ► Questions? ◀︎▬▬▬▬▬▬▬▬▬▬ ❓️FAQ: https://github.com/BryanJenksCommunity/FAQ/discussions ▬▬▬▬▬▬▬▬▬▬ ► Social ◀︎▬▬▬▬▬▬▬▬▬▬ 💬 DISCORD: https://discord.gg/MxCVshN 🐦 TWITTER: https://twitter.com/tallguyjenks 📺 TWITCH: https://www.twitch.tv/tallguyjenks 📜️ MEDIUM: https://medium.com/@tallguyjenks 💼️ LINKEDIN: https://www.linkedin.com/in/bryanjenks/ 🖥️ GITHUB: https://github.com/tallguyjenks 🌎 WEBSITE: https://www.bryanjenks.dev/ ▬▬▬▬▬▬▬▬▬▬ ► The Rest ◀︎▬▬▬▬▬▬▬▬▬▬ Thanks for watching and if you liked this video please leave a 👍🏻 Subscribe to my channel and click the 🔔 icon for notifications when I post a new video If you read this far put a 🐄 in the comments! ▬▬▬▬▬▬▬▬▬▬ ► TAGS ◀︎▬▬▬▬▬▬▬▬▬▬ #obsidian #zettelkasten #bryanjenks
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Bryan Jenks · Bryan Jenks · 36 of 60

1 rsync for Linux Backups - The Final Barrier to Migration
rsync for Linux Backups - The Final Barrier to Migration
Bryan Jenks
2 (un)Installing Packages From The (AUR) Arch Linux User Repository
(un)Installing Packages From The (AUR) Arch Linux User Repository
Bryan Jenks
3 Full RStudio Set Up On Arch Linux
Full RStudio Set Up On Arch Linux
Bryan Jenks
4 Fix RMarkdown Compilation Outside Of RStudio on Arch Linux
Fix RMarkdown Compilation Outside Of RStudio on Arch Linux
Bryan Jenks
5 Markdown Document Autocompilation on Arch Linux
Markdown Document Autocompilation on Arch Linux
Bryan Jenks
6 Cronjobs, Cronie, & Crontab on Arch Linux
Cronjobs, Cronie, & Crontab on Arch Linux
Bryan Jenks
7 Setting Up Slack With i3 on Arch Linux
Setting Up Slack With i3 on Arch Linux
Bryan Jenks
8 VS Codium (VS Code) on Arch Linux With A Shell Script
VS Codium (VS Code) on Arch Linux With A Shell Script
Bryan Jenks
9 Vimwiki Plugin For Vim Research Management on Arch Linux
Vimwiki Plugin For Vim Research Management on Arch Linux
Bryan Jenks
10 Neomutt with Protonmail on Arch Linux - LARBS - Thinkpad x220
Neomutt with Protonmail on Arch Linux - LARBS - Thinkpad x220
Bryan Jenks
11 Command Line Task Management With Taskwarrior and Taskell On Arch Linux / Thinkpad x220
Command Line Task Management With Taskwarrior and Taskell On Arch Linux / Thinkpad x220
Bryan Jenks
12 Exploring My Fitbit Data With R in RStudio on Arch Linux
Exploring My Fitbit Data With R in RStudio on Arch Linux
Bryan Jenks
13 Tellico Collections On Arch Linux
Tellico Collections On Arch Linux
Bryan Jenks
14 LaTeX, Biber, and Live Compilation on Arch Linux
LaTeX, Biber, and Live Compilation on Arch Linux
Bryan Jenks
15 R Markdown Programming Language Support
R Markdown Programming Language Support
Bryan Jenks
16 R Markdown to make HTML Wiki's with Tabbed pages
R Markdown to make HTML Wiki's with Tabbed pages
Bryan Jenks
17 Announcement: New Video Series on R - "Comprehensive R Package Reviews"
Announcement: New Video Series on R - "Comprehensive R Package Reviews"
Bryan Jenks
18 R Package Review Episode 1: Magrittr
R Package Review Episode 1: Magrittr
Bryan Jenks
19 R Package Review Episode 2: Vitae
R Package Review Episode 2: Vitae
Bryan Jenks
20 My R Workflow for Reproduce-able & Portable Analysis
My R Workflow for Reproduce-able & Portable Analysis
Bryan Jenks
21 R Package Review Episode 2: Here
R Package Review Episode 2: Here
Bryan Jenks
22 Introduction to Regular Expressions
Introduction to Regular Expressions
Bryan Jenks
23 My Workflow for Reading, Organizing, and Maintaining Articles, Papers, & Books
My Workflow for Reading, Organizing, and Maintaining Articles, Papers, & Books
Bryan Jenks
24 My First Python Project Dealing With Finance Data
My First Python Project Dealing With Finance Data
Bryan Jenks
25 R Package Review Episode 4: Beepr
R Package Review Episode 4: Beepr
Bryan Jenks
26 RMarkdown Customized Styles with CSS and HTML Output
RMarkdown Customized Styles with CSS and HTML Output
Bryan Jenks
27 RMarkdown Custom ID Selectors for Dynamic Headers and CSS
RMarkdown Custom ID Selectors for Dynamic Headers and CSS
Bryan Jenks
28 HTML Headers in RMarkdown Documents For Personal/Corporate Branding
HTML Headers in RMarkdown Documents For Personal/Corporate Branding
Bryan Jenks
29 My Semi-Complete VimWiki Workflow
My Semi-Complete VimWiki Workflow
Bryan Jenks
30 How To Make An Automated Resume With Github
How To Make An Automated Resume With Github
Bryan Jenks
31 How I Use Fuzzy Finding In the Terminal with fzf (workflow++)
How I Use Fuzzy Finding In the Terminal with fzf (workflow++)
Bryan Jenks
32 How I Organize and Create My Research Notes (Research Workflow++)
How I Organize and Create My Research Notes (Research Workflow++)
Bryan Jenks
33 How I Use fzf.vim To Improve My Programming Workflow
How I Use fzf.vim To Improve My Programming Workflow
Bryan Jenks
34 Website Updates, JavaScript, R, Shiny, Vue.js And More
Website Updates, JavaScript, R, Shiny, Vue.js And More
Bryan Jenks
35 How To Use AWK (Tutorial)
How To Use AWK (Tutorial)
Bryan Jenks
Bash Script Review: My Battery Power i3Blocks Module
Bash Script Review: My Battery Power i3Blocks Module
Bryan Jenks
37 Channel Updates, Where I've Been, And Where I Want To Go With YouTube
Channel Updates, Where I've Been, And Where I Want To Go With YouTube
Bryan Jenks
38 How To Use Neomutt 📨 From MuttWizard  (Basics Tutorial)
How To Use Neomutt 📨 From MuttWizard (Basics Tutorial)
Bryan Jenks
39 How To Use Jupyter Notebooks 📔 (Basics Tutorial)
How To Use Jupyter Notebooks 📔 (Basics Tutorial)
Bryan Jenks
40 How To Use Trello In 2020 (The Definitive Guide)
How To Use Trello In 2020 (The Definitive Guide)
Bryan Jenks
41 Macbook Pro 16 Inch 2020: Unboxing and Review
Macbook Pro 16 Inch 2020: Unboxing and Review
Bryan Jenks
42 How To Use Github's New Personal README and Wakatime
How To Use Github's New Personal README and Wakatime
Bryan Jenks
43 How I Set Up My 2020 Macbook Pro 16
How I Set Up My 2020 Macbook Pro 16
Bryan Jenks
44 My First Week At WGU (Western Governors University), Coffee, And Channel Updates
My First Week At WGU (Western Governors University), Coffee, And Channel Updates
Bryan Jenks
45 The Best Academic Resources & Citation Managers: OrcID, Zotero, Mendeley & More!
The Best Academic Resources & Citation Managers: OrcID, Zotero, Mendeley & More!
Bryan Jenks
46 R Package Review Episode 5: TodoR
R Package Review Episode 5: TodoR
Bryan Jenks
47 R Package Review Episode 6: Patchwork
R Package Review Episode 6: Patchwork
Bryan Jenks
48 Interview With Bryan of Norseman Leather Works
Interview With Bryan of Norseman Leather Works
Bryan Jenks
49 Zettelkasten Work in Obsidian for Research | VOD
Zettelkasten Work in Obsidian for Research | VOD
Bryan Jenks
50 How I Live With Adult ADHD (Attention Deficit Hyperactivity Disorder) [Time Stamped]
How I Live With Adult ADHD (Attention Deficit Hyperactivity Disorder) [Time Stamped]
Bryan Jenks
51 Zettelkasten Research Work in Obsidian | VOD
Zettelkasten Research Work in Obsidian | VOD
Bryan Jenks
52 Obsidian VS Roam Research: Why I Chose Obsidian
Obsidian VS Roam Research: Why I Chose Obsidian
Bryan Jenks
53 My 2020 Comprehensive Obsidian Workflow For Zettelkasten and Evergreen Notes
My 2020 Comprehensive Obsidian Workflow For Zettelkasten and Evergreen Notes
Bryan Jenks
54 How I Use Raindrop.io As The Entry Point of My Zettelkasten Workflow In Obsidian
How I Use Raindrop.io As The Entry Point of My Zettelkasten Workflow In Obsidian
Bryan Jenks
55 Comprehensive Overview | Obsidian Block References & Transclusion | Sorry Roam!
Comprehensive Overview | Obsidian Block References & Transclusion | Sorry Roam!
Bryan Jenks
56 Easy YouTube Timestamps From Final Cut Pro X With Python!
Easy YouTube Timestamps From Final Cut Pro X With Python!
Bryan Jenks
57 NEW | Obsidian Insiders Release 0.9.10 | Plugins & Official API
NEW | Obsidian Insiders Release 0.9.10 | Plugins & Official API
Bryan Jenks
58 TOP 5️⃣️ | FAVORITE THINGS IN OBSIDIAN
TOP 5️⃣️ | FAVORITE THINGS IN OBSIDIAN
Bryan Jenks
59 Comprehensive Obsidian & Git Sync Workflow 🔄️ | Your Mind Under Version Control
Comprehensive Obsidian & Git Sync Workflow 🔄️ | Your Mind Under Version Control
Bryan Jenks
60 Obsidian Mermaid Livestream Highlights | Zettelkasten Resources, YouTube Advice, Data Science
Obsidian Mermaid Livestream Highlights | Zettelkasten Resources, YouTube Advice, Data Science
Bryan Jenks

This video reviews a bash script for managing battery power with i3blocks, covering topics such as scripting, status bar customization, and process management. The script uses tools like bash, i3blocks, and dunst to manage battery power and customize the status bar. Viewers can learn how to create their own bash script for battery power management and customize their status bar.

Key Takeaways
  1. Execute script every 5 seconds
  2. Check for running process of dunst
  3. Redirect output to dev null for quiet execution
  4. Use case statement for button click actions
  5. Wrap variables in double quotes
  6. Test battery capacity and assign color values
  7. Replace long if statements with double ampersands
  8. Use font awesome battery icon with exclamation point
  9. Test for null string in variable Warren
  10. Turn off warning when battery is charging and critically low
💡 The video demonstrates how to use bash scripting to manage battery power and customize the status bar with i3blocks, providing a useful example for viewers to learn from.

Related AI Lessons

Up next
I Asked ChatGPT to Apply to 500 Jobs (8 Interviews in 48 Hours)
Sabrina Ramonov 🍄
Watch →