Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making a Checkbox Toggle The Dock Icon On and Off

How would I make a checkbox hide the dock icon if it was checked? I have made a checkbox toggle a menubar item but how would you do it with the dock icon? Looking for some code to do this. Thanks!

like image 838
Joshua Avatar asked Jul 04 '09 15:07

Joshua


1 Answers

i've use this code:

BOOL iconInDock = [[NSUserDefaults standardUserDefaults] boolForKey:smHideShowIcon];
if (iconInDock) {
    ProcessSerialNumber psn = { 0, kCurrentProcess };
    // display dock icon
    TransformProcessType(&psn, kProcessTransformToForegroundApplication);
}

ok, it's work for my application if I to set LSUIElement=1 in the Info.plist. That's code works only for show, but how I can hide icon?

like image 108
khakimov Avatar answered Sep 22 '22 06:09

khakimov