GithubHelp home page GithubHelp logo

codyschrank / gswitch Goto Github PK

View Code? Open in Web Editor NEW
875.0 20.0 45.0 21.22 MB

macOS menu bar app that allows control over the gpu on dual gpu macbooks

License: MIT License

Swift 88.44% Objective-C 8.40% Shell 0.16% HTML 2.99%

gswitch's Introduction

gSwitch

gSwitch lets you set which graphics card your macbook pro can use, mainly to prevent it from using the discrete graphics card when it is simply unnecessary. Why would you want to do that you ask? Well the discrete graphics card uses significantly more power than the integrated one, which can ruin your battery life. There are also problems on some macbooks with glitchy and buggy graphics card drivers that apple still hasn't fixed!

gSwitch is and always will be free. However, if you want to thank me I will gladly take a donation :)

Donate

Install

With Zip

Download the most recent release (click download .zip).

Then after unzipping move the gSwitch.app file to your applications folder.

With Brew

brew install gswitch

From Source

brew update
brew install carthage

And then in the project folder bootstrap the frameworks:

carthage bootstrap

And then build in xcode

Usage

The app is simple to control with integrated only, discrete only, and dynamic switching in the menu.

You can also enable notifications for when your gpu changes (off by default)

You can also launch it from the terminal and set the desired setting using --integrated, --discrete, and --dynamic.

FAQ

Why won't the app start?

You probably need to allow the application to run in Settings -> Security & Privacy

How do I know which gpu is active?

The gear will have a dot in the middle when the discrete gpu is active. Otherwise, it will just look like a gear. The current gpu is also reported in the menu.

Why does the app go back to dynamic switching when a display is plugged in?

Unfortunately your mac is designed such that in order to use an external display, it has to use the discrete graphics card. And since you plugged in the cable I'm assuming you want to use the display.

What is a dependent process vs a hungry process?

A dependent process is one that is currently using your discrete gpu. A hungry process is one that wants to use the discrete gpu but is not allowed because you have set integrated only. If you change to dynamic switching or discrete only any process that was hungry will become dependent. You can force integrated only when you have dependent processes but it might crash those processes. You cannot force integrated only if you have an external display plugged in.

How do I disable my discrete GPU?

You can't, your macbook was designed to use both, but gSwitch can trick it into using the integrated one most of the time. However gSwitch cannot prevent your discrete gpu from being accessed by the operating system, and it will be accessed for a short period of time when a process requests the use of it. gSwitch just switches back to the integrated one as fast as it can.

Ok I lied you technically can but I DO NOT RECOMMEND IT. This could potentially brick your computer https://apple.stackexchange.com/questions/166876/macbook-pro-how-to-disable-discrete-gpu-permanently-from-efi/285896#285896

Legacy

At this time it seems like gSwitch will not work on macbooks older than 2011. It appears that apple has removed the necessary API's from these macbooks on the modern macOS. However there could be other API's that could work, I just can't find any. GPU control with apple is mostly guess work since there isn't any documentation, so, If anyone finds anything let me know here!

Notes

Requires macOS >= 10.12

gswitch's People

Contributors

accolon avatar ardacebi avatar boggydigital avatar codyschrank avatar grishamsc avatar hackintoshhd avatar ryandesign avatar ubuntudroid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gswitch's Issues

Unnecessary Integrated Only Warning On Wake

If integrated only was set but overridden by a connected display, and then the mac is closed and reopened again it attempts to go back to integrated only, which causes an unnecessary warning.

German translations truncated

The string labels in the Settings dialog are truncated when the app is displayed in German (both for the checkboxes and the buttons). I assume that the width of the buttons and labels is somehow hardcoded and the German strings are too long.

Help me localize gSwitch to your language!

If you want gSwitch localized to your language, I'll add it if you translate the following phrases for me:

About
Help
Preferences
Integrated Only
Discrete Only
Dynamic Switching
Dependencies
Quit
Created By
Report A Problem
Donate
Start At Login
Automatically Update
Remember Last GPU Mode
Show GPU Change Notifications
Do Not Show Warning When Forcing to iGPU
Check For Updates
Open Advanced Pane

Save last used state after disconnecting monitor

An external monitor requires the dgpu and changes the program to dynamic switching. I need to figure out how to detect when an external monitor is unplugged in order to restore the last used state.

Feature request: Localizations

I'm thinking about adding French and German localizations to gSwitch. Would it be possible for you to already add the necessary additional (untranslated) Interface ressources to the development branch, so that (pull request) contributors would only need to replace the strings? - Thank you.

MBP 16" Kernel Panic on 10.15.4

Hi,

I was using this all fine for over 4 months however after 15.4 catalina update the system started to reboot on waking from sleep. Somwehere it was crashing after going in deep sleep state due to a kernel panic.
After testing and switching on and off all the kernels installed. I isolated the problem to Gswitch. After disbling it now all my issues with Sleep are gone. I think app needs to be updated.
I can submit kernel panic logs if req to diagnose.

Starting a hungry processes switches to discrete GPU when it shouldn't

Starting a hungry process switches to discrete GPU when integrated is forced (macOS 10.14.2 Beta 18C48a):
image

Quitting the process leaves the GPU at discrete with no way to switch back to integrated.

Edit: Seems like something with the states gets messed up as gfxCardStatus switches between modes without actually doing anything after this occurring.

Edit2: Sleeping and waking the device allows for the GPU to be changed again.

Annoying confirmation boxes

Hi, is there a way to remove confirmation boxes on every switch?
It is enough to show the message once, no need to do it every time…

Screenshot 2019-12-16 at 13 21 44

App incorrectly handles multi-user enviroment

If a specific mode is selected ("integrated only", for example), and then another user launches the gSwitch app, a "hungry" app will immediately cause the discrete GPU to become active. Obviously, "integrated only" mode can't be selected again until the dependency is resolved. Expectation is that launching another instance of the app (by another user) doesn't cause a change in the selected mode. (selected mode of dynamic, integrated only, or discrete only should be global across users)

Stay on Integrated Only when using Airplay Display

When I'm on "Integrated Only" mode and connect to Airplay display, gSwitch changes to dynamic switching mode. This causes all the currently running "hungry" apps to become dependancies. I understand that connecting a physical external display requires high perf. GPU, but the Airplay display feature on MacOS doesn't require the high perf. GPU at all (it runs off the video decoders on the iGPU and doesn't turn on the high perf. GPU)

If possible, please could you implement a way for gSwitch to stay on integrated only mode when Airplay display is connected, instead of changing to dynamic switching? Thanks! :)

External display conflicts with integrated only

I was running Unity with an external monitor connected. I unplugged the monitor and gSwitch reverted back to integrated only and reports that Unity is "hungry". But Radeon High Side is still reporting ~10-20W power and activity monitor GPU history is showing activity for the Radeon.

image

Add advanced pane

  • Can select gpu state with no checks
  • Dump full state of current gpu
  • Manually input gpu state values to see what it spits out.

Discrete only is not always enforced

On dynamic switching and there is a dpu dependency. Switch to discrete only and quit the hungry process and it will not enforce discrete only, instead it switches back to the igpu and still shows discrete only in the menu

dyld: Symbol not found: __T0SbMa

gSwitch just updated itself from 1.9.5 to 1.9.6 and now it doesn't launch anymore. If I launch it from the Terminal we see what the problem is:

$ /Applications/gSwitch.app/Contents/MacOS/gSwitch
dyld: Symbol not found: __T0SbMa
  Referenced from: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/libswiftDarwin.dylib
  Expected in: /Applications/gSwitch.app/Contents/MacOS/../Frameworks/libswiftCore.dylib
 in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/libswiftDarwin.dylib
Abort trap: 6

I am running macOS High Sierra 10.13.6 with Xcode 9.4.1.

It seems like gSwitch should be self-contained and should not be referencing anything inside the Xcode app bundle.

Getting an error while installing

I see below error when I run "carthage bootstrap"

Failed to read file or folder at /Users/avinashp/Cartfile: Error Domain=NSCocoaErrorDomain Code=260 "The file “Cartfile” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Users/pranavm/Cartfile, NSUnderlyingError=0x7ff08cf55220 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

Increased command-line functionality

First off: thank you for this great piece of software! Long time gfxCardStatus user here.

I'm inquiring about the possibilty of a standalone (and slightly expanded) command-line functionality. The reason is this bug in the IINA media player, more precisely in the underlying mpv player. It will probably not be fixed for some time, if at all, so it would be great to have a gswitch CLI to (a) read the current state of the GPU (dynamic switching on/off, integrated or discrete), and (b) the ability to set a new GPU state (or lock the current state by disabling dynamic switching) without launching a new instance of the gSwitch GUI app.

Then we could create an IINA launcher app with AppleScript that would disable dynamic switching before launching IINA itself.

CLI possible?

EDIT: no, strike that. It's not important… just tested this with a "hungry" process, while set to integrated-only, and macOS switches to the dGPU for a brief amount of time, then switches back to the iGPU, and the mpv bug returns. So gSwitch won't be able to help in this matter.

Issue with my integrated gpu

Hi Cody, i have an issue with my macbook pro 15 inch 2017. the integrated graphics card does not work properly, and my mac only works with the dedicated one. i tried gfx card status but on every reboot it changes back to integrated. does your program properly disable the integrated one even after reboot? right now im working on this with "automatic graphics switching" turned off, but still get some problems sometimes when watching videos that i get a green screen or crash totally.

thx in advance, Alesander

gSwitch doesn't launch

mid-2012 retina MBP
Mojave 10.14.2
Brew up to date as of today (uninstalled/reinstalled).
GSwitch installed by brew and by zip.

Security prompt comes up. "OPEN ANYWAY" button comes up within Security & Privacy and clicked. Even after all that, the app does not start.

Screen Shot 2020-04-25 at 15 38 31

Screen Shot 2020-04-25 at 15 38 47

Screen Shot 2020-04-25 at 15 38 57

Notify when gpus can not be found

Instead of silently failing when 1 or both gpus are not found instead notify the user that they could not be found.

This is helpful if gSwitch is installed on a computer without dual gpus or if apple eventually uses a different vendor for the dgpu and gswitch doesn't account for it yet.

Preference for starting in specifc mode

As per issue #150 of the gfxCardStatus project, it would be great to have gSwitch either remember the last setting (like @pajp mentions in the 2nd comment on that page, a "sticky" mode), or have a preference to implement a specific mode on launch.

No longer functions on High Sierra 10.13.x

Just installed the pushed update, and noted that gSwitch didn't launch after the update. Upon attempting to launch it manually, I received an error stating "You can't use this version of the application 'gSwitch' with this version of macOS. You have macOS 10.13.6. The application requires 10.14 or later."

Not sure, Cody, whether or not this was your intent. Figured I'd open an issue just in case you meant to support versions <10.14. And if you did intend to drop legacy support, may I suggest a warning before offering it via Sparkle?

Occasional GPU Restarts

Display callback gets called way to many times and sometimes causes a gpu restart. Redesign display callback to use RxSwift observables and throttle the amount of "requests". Also a couple unnecessary calls to getGPUState.

Feature Request: Show current GPU at menu icon using a letter

Thanks for this great app!
I think it would be great if we can have the currently active GPU being shown by a letter on the menu icon. Something like gfxCardStatus did. So we can quickly know which GPU is being used.

gfxCardStatus:
image for integrated GPU.
image for dedicated GPU.

Night Shift doesn't kick in

Night Shift doesn't kick in when using Discrete Only.

Plus, if Night Shift is active by any chance, it gets disabled by itself when screen is locked (and slept) and came back.

While "Integrated-only" is active it's still switching to discrete gfx usage

First of all, thanks for the great job to continue on this topic! ❤️

Maybe this is only an issue because I had "gfxStatus" still running while I was installing/starting "gStatus". Meanwhile I stopped "gfxStatus" and it's still switching to discrete even when "Integrated only" is setup.

Is is related to the fact that I didn't restarted my machine yet?

My NVIDIA GeForce GT 750M is dead.

Hi!

My NVIDIA GeForce GT 750M and I use Gswitch for "integrated only".

What options can I use in "advanced panel" to avoid the system sometymes going into discrete gpu (getgpu set, gpuState, features)? I don't use external dislays but sometimes I see graphic artifacts.

Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.