Skip to content
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

Feature Request: switching based on power source #73

Open
mosemizrahi opened this issue Sep 12, 2020 · 8 comments
Open

Feature Request: switching based on power source #73

mosemizrahi opened this issue Sep 12, 2020 · 8 comments
Assignees
Labels
enhancement New feature or request

Comments

@mosemizrahi
Copy link

mosemizrahi commented Sep 12, 2020

Hello,

I want to use Dynamic Switching when I'm on battery, and Discrete Only when I'm charging my laptop. I'd like it if gSwitch had a feature that let me do this automatically. In theory, I could run the line "sudo pmset -c gpuswitch 1 && sudo pmset -b gpuswitch 2" in terminal to get what I want, but that doesn't work consistently.

The bash script below implements what I ask for in a "hacky" way. I'm currently using a different script that works similarly using the app BetterTouchTool.

#!/bin/bash
OLDSOURCE=""
while true
do
	CURSOURCE=`pmset -g batt | head -n 1 | cut -d \' -f2`
	if [ "$OLDSOURCE" != "$CURSOURCE" ]
	then
		OLDSOURCE=$CURSOURCE
		killall gSwitch
		if [ "$CURSOURCE" == "AC Power" ]
		then
			open -a /Applications/gSwitch.app/Contents/MacOS/gSwitch --args --discrete
		else
			open -a /Applications/gSwitch.app/Contents/MacOS/gSwitch --args --dynamic
		fi
	fi
	sleep 5
done
@CodySchrank
Copy link
Owner

I have considered this before, and unfortunately Apple does not provide a very good API in swift to know when the computer has switched to a different power source. I will leave the issue open if anyone wants to open a PR for this though.

@CodySchrank CodySchrank added the enhancement New feature or request label Sep 29, 2020
@CodySchrank CodySchrank self-assigned this Sep 29, 2020
@zzonderr
Copy link

zzonderr commented Oct 1, 2020

I don't know how much this will help, but i hope it may be useful. The Turbo Boost Switcher Pro program has an option, which when switching to the battery turns off Turbo Boost for the Intel processor.
Can try to contact the author and find out how he did it?
Screenshot 2020-10-01 at 18 32 21

@CodySchrank
Copy link
Owner

Looks like this might be easier than I thought when I looked this up a few years ago.

Yea I can probably add this in.

ref

@pencilcheck
Copy link

Would be nice to see because right now the default dynamic switching behavior is reversed for me (discrete on battery, and integrated on power for some reason derp), this tells me that mac internally tried to switch based on power source.

@robertocaldas
Copy link

Having that would be great. I have a 16" 2019 MBP and I can feel it's a little sluggish on Safari when on integrated.

@JeffFlowerday
Copy link

Just to chime in, this would be an awesome feature. I use discrete when plugged in for the same reason as @robertocaldas.

@alexander-potemkin
Copy link

Please! I'm already paying for Turbo Boost to disable extra CPU power (that I don't really need), would love to pay for automatic switching in here - to increase battery time and a cooler laptop :)

Off-topic: it's a wonderful new world - you pay to get less power, but for a longer time... :)

@natjsbelza
Copy link

This app is awesome, the idea is awesome and it's real awesome in application. But it will be a leap more awesome if this feature is added. OMG! I'd love to have this. My MBP 16 would drain really fast with discreet GPU when on battery. Please! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

8 participants