Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

AphoticD

macrumors 68020
Original poster
Feb 17, 2017
2,287
3,475
Shadowless v1.0 PowerPC

A simple command line utility to toggle window shadows on/off in Mac OS X. Disabling the shadows is a Quartz (Core Graphics) Debug option for OS X and can make a dramatic performance improvement on Macs which aren't capable of hardware accelerated window compositing via Quartz Extreme (e.g. Pismo, Clamshell iBook, etc).

ShadowlessPPCv1.0.zip

To install;

'cp shadowless /usr/local/bin' (or /usr/bin if preferred)

(if '/usr/local/bin' doesn't exist: 'mkdir -p /usr/local/bin' )

Ensure '/usr/local/bin' is in your $PATH (e.g. 'echo $PATH'). If not, when using bash, edit '~/.bash_profile' and add 'export PATH=/usr/local/bin:$PATH'. Then restart the bash shell.

You can then execute with just 'shadowless' at the command prompt.

Tested on:
  • Jaguar 10.2.8
  • Panther 10.3.9
  • Tiger 10.4.11
  • Leopard 10.5.8
  • Snow Leopard 10.6.8 (PowerPC binary seamlessly executes via Rosetta).

May also work on Puma and Cheetah (untested).

-AphoticD


The source code is gloriously simple, but I can't take credit for it;
shadowless.c
Code:
#include <stdio.h>
extern void CGSGetDebugOptions(int *shadows);
extern void CGSSetDebugOptions(int shadows);
int main(int argc, char *argv[]) {
    int shadows;
    CGSGetDebugOptions(&shadows);
    shadows ^= 0x4000; //kCGSDebugOptionNoShadows
    CGSSetDebugOptions(shadows);
    return 0;
}
(Built with gcc -framework Cocoa -o shadowless shadowless.c)
 

Attachments

  • ShadowlessPPCv1.0.zip
    3.6 KB · Views: 740
Last edited:
Is this any different than the ShadowKiller app?

Nope. Just a simple command line switch instead of a GUI app.
[doublepost=1516844340][/doublepost]Just for the curious, a Use Case might be:

You have a dozen networked PowerPC Macs and want to toggle shadows on/off for faster ARD/VNC/screen sharing performance.

1. Install shadowless at the same location on each machine (/usr/local/bin/shadowless)
2. Using Remote Desktop (or possibly Timbuktu Pro), select all of your networked machines.
3. From the "Manage" menu, choose "Send UNIX Command..."
4. Enter '/usr/local/bin/shadowless' in the box and hit send.

Execute a second time to switch shadows back on.

The "UNIX Command" could be saved as a Template for future use (or possibly an AppleScript routine).

You could probably achieve the same results with ShadowKiller, but with slightly more overhead.
 
Last edited:
Tested on:
  • Jaguar 10.2.8
  • Panther 10.3.9
  • Tiger 10.4.11
  • Leopard 10.5.8
  • Snow Leopard 10.6.8 (PowerPC binary seamlessly executes via Rosetta).

May also work on Puma and Cheetah (untested).

-AphoticD

Would this work in Mac OS Mojave (10.14.3)? I've been searching desperately for a way to get rid of shadows on my MacBook Pro (Late 2013 15-inch) but I haven't found any solutions.
 
Would this work in Mac OS Mojave (10.14.3)? I've been searching desperately for a way to get rid of shadows on my MacBook Pro (Late 2013 15-inch) but I haven't found any solutions.

No, this only appears to work on the older systems. I just tried a 64 bit build in El Capitan and although it builds and executes without any errors, it doesn't turn off any shadows.

Edit: See attached (Intel) 64-bit build if anyone wants to test on 10.7 or later.
 

Attachments

  • Shadowless_x86_64v1.0.zip
    997 bytes · Views: 162
  • Like
Reactions: B S Magnet
Nope. Just a simple command line switch instead of a GUI app.
[doublepost=1516844340][/doublepost]Just for the curious, a Use Case might be:

You have a dozen networked PowerPC Macs and want to toggle shadows on/off for faster ARD/VNC/screen sharing performance.

1. Install shadowless at the same location on each machine (/usr/local/bin/shadowless)
2. Using Remote Desktop (or possibly Timbuktu Pro), select all of your networked machines.
3. From the "Manage" menu, choose "Send UNIX Command..."
4. Enter '/usr/local/bin/shadowless' in the box and hit send.

Execute a second time to switch shadows back on.

The "UNIX Command" could be saved as a Template for future use (or possibly an AppleScript routine).

You could probably achieve the same results with ShadowKiller, but with slightly more overhead.

I'm tentatively using this in lieu of ShadowKiller and I like it.
 
Last edited:
Edit: See attached (Intel) 64-bit build if anyone wants to test on 10.7 or later.
Here's my results:
  • 10.6.8: not working (Illegal instruction)
  • 10.7.5: not working (Segmentation fault)
  • 10.8.5: working
  • 10.9.5: working
  • 10.10.5: working
  • 10.11.6: not working
  • 10.12.6: not working
  • 10.13.6: not working
  • 10.14.6: not working
 
Last edited:
  • Love
Reactions: AphoticD
Thanks for testing this. I feel that building 64-bit from a Snow Leopard system would then bridge the gap to run on both SL (natively) and Lion.

I’ll have a dig around the CoreGraphics framework for possible updated references to shadow controls in El Cap and up.
 
  • Like
Reactions: Amethyst1
Thanks so much for posting the code for this!

I made a slight riff on this which accepts an explicit on / off command-line option, rather than toggling:

Code:
/* Thanks to https://forums.macrumors.com/threads/shadowless-command-line-shadow-toggle.2102744/ */

#include <stdio.h> // fprintf
#include <string.h> // strcmp

/* Thanks to https://github.com/jrmuizel/cg-debug/blob/master/CGSInternal/CGSDebug.h */
#define kCGSDebugOptionNone (0)
#define kCGSDebugOptionNoShadows (0x4000)
#define CGError void
CGError CGSGetDebugOptions(int *outCurrentOptions);
CGError CGSSetDebugOptions(int options);

void usage(FILE* fd) {
    fprintf(fd, "Usage: shadows-osx on|off\n");
}

void shadows_on() {
    int options;
    CGSGetDebugOptions(&options);
    options &= ~(kCGSDebugOptionNoShadows);
    CGSSetDebugOptions(options);
}

void shadows_off() {
    int options;
    CGSGetDebugOptions(&options);
    options |= kCGSDebugOptionNoShadows;
    CGSSetDebugOptions(options);
}

int main(int argc, char *argv[]) {
    if (argc < 2) {
        usage(stderr);
        return 1;
    } else if (strcmp(argv[1], "--help") == 0) {
        usage(stdout);
        return 0;
    } else if (strcmp(argv[1], "on") == 0) {
        shadows_on();
        return 0;
    } else if (strcmp(argv[1], "off") == 0) {
        shadows_off();
        return 0;
    } else {
        usage(stderr);
        return 1;
    }
}

Makefile:

Code:
shadows-osx: shadows-osx.c
    gcc -framework Cocoa -o shadows-osx shadows-osx.c

clean:
    rm -f shadows-osx
.PHONY: clean

Demo video (captured over VNC, a little slow!):



An interesting quirk is that the shadow doesn't actually change until you select the window. I suppose that's when it redraws.

This led me to discover
https://github.com/jrmuizel/cg-debug which has a bunch of other internal-API options for CoreGraphics, very interesting!

Attached is the binary, compiled on Tiger/G3, so it should run on any Tiger or Leopard PPC machine.
 

Attachments

  • shadows-osx.zip
    3.1 KB · Views: 66
@cellularmitosis this is great! Thanks for the contribution.

I was digging around in the CoreGraphics framework and found the technique to toggle BeamSync mode, which was a bit cumbersome to achieve otherwise (required Dev tools installation, launching the CG tool, modify the setting and then force quit the app to make it stick).

Did you have a play with the cg-debug tool? What other debug settings would be useful to include in a toggle tool like you’ve made? I am thinking it would be good to develop some command line tools and wrap them with a Cocoa app front end.

I haven’t gotten it to work yet, but on another topic, I did find an undocumented “Classic Double Buffering Mode” system call in the Tiger CG framework, which in theory could disable the double buffering feature of Classic, potentially resulting in Jaguar-level Classic performance on Tiger... I will keep playing with this.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.