-
Notifications
You must be signed in to change notification settings - Fork 334
fix: Hide when on a desktop #354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 WalkthroughWalkthroughThe changes remove the configuration option and logic for hiding the battery widget on desktop PCs. Documentation describing the Changes
Possibly related PRs
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
scripts/battery.sh (1)
175-178
: Strip the leading space when the battery label is disabled.If
@dracula-battery-label
is set tofalse
,bat_label
becomes an empty string.
The current branch will emit" $bat_perc"
(note the leading space).
A tiny tweak avoids the extra whitespace:- elif [ -z "$bat_stat" ]; then # Test if status is empty or not - echo "$bat_label $bat_perc" + elif [ -z "$bat_stat" ]; then # Test if status is empty or not + # Only add a space when the label is not empty + if [ -n "$bat_label" ]; then + echo "$bat_label $bat_perc" + else + echo "$bat_perc" + fi
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
docs/CONFIG.md
(0 hunks)scripts/battery.sh
(1 hunks)
💤 Files with no reviewable changes (1)
- docs/CONFIG.md
🔇 Additional comments (1)
scripts/battery.sh (1)
175-178
: LGTM – re-ordering fixes the desktop/AC detection bug.The early
bat_perc
check now short-circuits correctly when no battery is present. 👌
hi, now i must apologize because you're putting in the effort and i'm asking you to do more 😅 would you mind testing #348 where i'm making major changes to the battery script? # setting no label
set -g @dracula-battery-label false
set -g @dracula-no-battery-label false to get no output. though to be fair that would kinda limit reusability of the same config on different machines in the sense that you either have a label which will prevent the plugin from disappearing on desktop, or you remove the label and thus can't have it on the laptop either. |
@Theoreticallyhugo It's no worries at all! I've just tested it and it works completely fine. I added this on both my desktop and laptop set -g @dracula-battery-label false
set -g @dracula-no-battery-label false
set -g @dracula-show-battery-status true and on my desktop the battery widget disappears while on the laptop it has the battery icon and percentage still, so the same config can still be used on both devices. Feel free to close this PR out (or I can do it if its easier) and also feel free to remove the other code I added on #354 . Thank you! |
thank you very much for your help! |
Moved the check of the battery percentage to the top as it was always hitting the $bat_stat check making it to never hide the label and always display a <3