Skip to content

Commit 1665e05

Browse files
committed
Don't set battery options if there's no battery
1 parent a46c002 commit 1665e05

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

roles/macos/tasks/dock.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
# Settings -> Dock & Menu Bar -> Sound -> Show in Menu Bar (always)
2121
- name: Enabling always show sound in the menu bar
22+
when: islaptop == 'true'
2223
community.general.osx_defaults:
2324
domain: com.apple.controlcenter
2425
host: currentHost
@@ -28,6 +29,7 @@
2829

2930
# Settings -> Dock & Menu Bar -> Battery -> *
3031
- name: Configuring battery settings for menu bar
32+
when: islaptop == 'true'
3133
community.general.osx_defaults:
3234
domain: com.apple.controlcenter
3335
host: currentHost
@@ -39,6 +41,7 @@
3941

4042
# Settings -> Dock & Menu Bar -> Battery -> Show percentage
4143
- name: Enabling battery percentage in the menu bar
44+
when: islaptop == 'true'
4245
community.general.osx_defaults:
4346
domain: com.apple.controlcenter
4447
host: currentHost

run.bash

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ needsudo=""
9595
# needsudo=-K # --ask-become-password
9696
# fi
9797

98+
macoslaptop="false"
99+
if [[ $(uname) == Darwin ]]; then
100+
if pmset -g batt | grep -q InternalBattery; then
101+
macoslaptop="true"
102+
fi
103+
fi
104+
98105
if [[ $mtype != server ]]; then
99106
vaultoption="--vault-id ${VAULT_ID}"
100107

@@ -143,6 +150,7 @@ ansible-playbook $needsudo $vaultoption $tags \
143150
--extra-vars mtype=$mtype \
144151
--extra-vars wedition=$wedition \
145152
--extra-vars isgaming=$isgaming \
153+
--extra-vars islaptop=$macoslaptop \
146154
dotfiles.yml
147155

148156
# we set ANSIBLE_HOME now, but this might be left over after the initial run:

0 commit comments

Comments
 (0)