{"id":1415,"date":"2015-04-05T21:53:54","date_gmt":"2015-04-05T18:53:54","guid":{"rendered":"http:\/\/hxml.me\/blog\/?p=1415"},"modified":"2015-08-04T01:48:42","modified_gmt":"2015-08-03T22:48:42","slug":"hexlauncher-bystryj-zapusk-prilozhenij-v-mac-os-x","status":"publish","type":"post","link":"https:\/\/hxml.me\/blog\/coding\/hexlauncher-bystryj-zapusk-prilozhenij-v-mac-os-x\/","title":{"rendered":"<!--:en-->HexLauncher: quick apps launch in Mac OS X<!--:--><!--:ru-->HexLauncher: \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0432 Mac OS X<!--:-->"},"content":{"rendered":"<p><!--:ru--><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignleft\" src=\"http:\/\/hxml.me\/img\/post\/hexlauncher.png\" alt=\"\" width=\"256\" height=\"196\" \/>\u0418\u0441\u0442\u043e\u0440\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043c\u0435\u043d\u044f \u043d\u0430 5 \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0430, \u043a\u043e\u0433\u0434\u0430 \u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0430\u043b \u0432\u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u043c\u0438\u0440 Apple \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e &#8212; \u043c\u0438\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 Mac OS X. \u041a\u0430\u043a \u0438 \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u0438\u0445 \u043f\u0435\u043d\u0440\u0435\u0445\u043e\u0434 \u0431\u044b\u043b \u0441\u0432\u044f\u0437\u0430\u043d \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043d\u0435\u0443\u0434\u043e\u0431\u0441\u0442\u0430\u0432\u043c\u0438 \u0438\u0437-\u0437\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439. \u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u043d\u0435\u0434\u043e\u0440\u0430\u0437\u0443\u043c\u0435\u043d\u0435\u0439 \u0441\u0442\u0430\u043b\u043e \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 <strong>\u0430\u043d\u0430\u043b\u043e\u0433\u0430 \u043a\u043d\u043e\u043f\u043a\u0438 \u041f\u0443\u0441\u043a<\/strong> \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u043f\u0443\u0442\u0435\u043c \u0432\u044b\u0431\u043e\u0440\u0430 \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430. \u0427\u0435\u0441\u0442\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u043d\u0435 \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0432 OS X (\u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e Spotlight). \u0418 \u0432\u043e\u0442, \u0441\u043f\u0443\u0441\u0442\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u0435\u0442 \u044f \u0440\u0435\u0448\u0438\u043b \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a.<!--:--><br \/>\n<!--:en--><img loading=\"lazy\" decoding=\"async\" class=\"alignleft\" src=\"http:\/\/hxml.me\/img\/post\/hexlauncher.png\" alt=\"\" width=\"256\" height=\"196\" \/>The story of this project is taking me back to 5 years to the times when I&#8217;ve been just getting\u00a0started to enter to Apple technologies world, to be more prescice when I was migrating to Mac OS X. As a lot of people I was feeling not too good about\u00a0a lack of habitual programs and system interface elements. One of such confusion was a miss of Start button equivalent. To be honest I&#8217;m still not sure wether the way I&#8217;m launching an OS X programs is most traditional (I&#8217;m using a Spotlight). So, after few years I deciced to get rid of this disadvantage.<!--:--><!--more--><br \/>\n<!--:ru--><br \/>\n\u041d\u0430\u0434\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u044f \u043d\u0435\u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u043d\u0430\u0439\u0442\u0438 \u0433\u043e\u0442\u043e\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u041d\u043e \u0432\u0441\u0435, \u0447\u0442\u043e \u044f \u043d\u0430\u0445\u043e\u0434\u0438\u043b \u043f\u043e \u0442\u043e\u0439 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u043d\u0435 \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u043b\u043e \u043c\u0435\u043d\u044f. \u0418 \u044d\u0442\u043e \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0440\u0430\u0437 \u043f\u0440\u0438\u0432\u0435\u043b\u043e \u043c\u0435\u043d\u044f \u043a \u0441\u0430\u043a\u0440\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u0441\u0442\u0438\u043d\u0435: \u0435\u0441\u043b\u0438 \u0445\u043e\u0447\u0435\u0448\u044c \u0447\u0442\u043e-\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0441\u0434\u0435\u043b\u0430\u0439 \u044d\u0442\u043e \u0441\u0430\u043c. \u0414\u0430 \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a!<br \/>\n\u0412\u043e\u043e\u0440\u0443\u0436\u0438\u0432\u0448\u0438\u0441\u044c Xcode&#8217;\u043e\u043c \u0438 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430 \u044f \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043b \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435. \u041a\u0441\u0442\u0430\u0442\u0438, \u0437\u0430\u0431\u0435\u0433\u0430\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u043f\u0435\u0440\u0435\u0434, <strong>\u0441\u043a\u0430\u0447\u0430\u0442\u044c HexLauncher<\/strong> \u043c\u043e\u0436\u043d\u043e <a title=\"\u0421\u043a\u0430\u0447\u0430\u0442\u044c HexLauncher\" href=\"http:\/\/hxml.me\/ru\/product\/hexlauncher\/\" target=\"_blank\">\u0437\u0434\u0435\u0441\u044c<\/a>.<br \/>\n\u0422\u0435\u0445 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c. \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 <strong>\u043f\u043e\u043c\u0435\u0449\u0430\u043b\u043e \u0431\u044b \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0435 \u043c\u0435\u043d\u044e \u0438\u043a\u043e\u043d\u043a\u0443<\/strong>, \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043f\u043e\u044f\u0432\u043b\u044f\u043b\u043e\u0441\u044c \u0431\u044b \u043c\u0435\u043d\u044e \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0438\u0437\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0432\u044b\u0431\u0440\u0430\u0432 \u043e\u0434\u043d\u043e \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a. \u0414\u0430\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u0435\u043d \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u044e\u0437\u0430\u0431\u0438\u043b\u0438\u0442\u0438, \u043d\u0435\u0436\u0435\u043b\u0438 Spotlight, \u0445\u043e\u0442\u044f \u0431\u044b \u0438\u0437 \u0442\u0435\u0445 \u0441\u043e\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u0447\u0442\u043e \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 Spotlight \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u043c\u044b\u0448\u044c \u0438 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0443. <strong>HexLauncher<\/strong> \u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 <strong>\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0434\u0432\u0430 \u043a\u043b\u0438\u043a\u0430<\/strong>. \u0421\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0432 \u043c\u0435\u043d\u044e \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043a\u043d\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a, \u0432\u044b\u0437\u043e\u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0442\u0430\u043a \u0436\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0438\u0437 \u043c\u0435\u043d\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u041f\u0440\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0438 \u043e\u043a\u043d\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0432 \u043d\u0435\u0433\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u0438\u043a\u043e\u043d\u043a\u0438 \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u0445\u0441\u044f \u0432 \u043f\u0430\u043f\u043a\u0435 \/Applications &#8212; \u044d\u0442\u043e \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0432 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435 Mac OS X. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0433\u0430\u043b\u043a\u0430\u043c\u0438 \u0436\u0435\u043b\u0430\u0435\u043c\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0438 \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0432 \u0432\u044b\u043f\u0430\u0434\u0430\u044e\u0449\u0435\u043c \u043c\u0435\u043d\u044e. \u0422\u0430\u043a \u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c <strong>\u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b<\/strong>. <img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/hxml.me\/img\/product\/scr\/orig\/0011_01.png\" alt=\"HexLauncher screenshot\" width=\"600\" height=\"417\" \/> \u0412\u043e\u0442 \u0442\u0430\u043a\u043e\u0435 \u043d\u0435\u0437\u0430\u043c\u044b\u0441\u043b\u043e\u0432\u0430\u0442\u043e\u0435 \u0422\u0417. \u0427\u0442\u043e \u0436, \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c.<br \/>\n\u041c\u0430\u043b\u043e-\u043c\u0430\u043b\u044c\u0441\u043a\u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u043c \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u0441\u0442\u0430\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0449\u0435\u0439.<br \/>\n1. \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, <strong>\u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0438\u043a\u043e\u043d\u043a\u0443 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0435 \u043c\u0435\u043d\u044e Mac OS X<\/strong> \u0438 \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043d\u0438\u043c \u043c\u0435\u043d\u044e. \u041d\u0435 \u0431\u0443\u0434\u0443 \u0434\u043e\u043b\u0433\u043e \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043a\u0443\u0441\u043e\u043a \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u043e\u0434\u0438\u043b\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0439 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0433\u0443\u0433\u043b\u0435\u043d\u0438\u044f.<\/p>\n<pre lang=\"objc\">- (void)setupMenu {\r\n    NSMenu *menu = [[NSMenu alloc] init];\r\n    \/\/    for (NSString * app in self.apps) {\r\n    NSMenuItem * item = [menu addItemWithTitle:@\"HexLauncher Preferences\" action:@selector(setup:) keyEquivalent:@\"\"];\r\n    NSImage *iconImage = [[NSWorkspace sharedWorkspace] iconForFile:[[NSBundle mainBundle] bundlePath]];\r\n    \r\n    item.image = iconImage;\r\n    [menu addItem:[NSMenuItem separatorItem]];\r\n    int count = 0;\r\n    for (int i = 0; i &lt; self.apps.count; i++) {\r\n        AppItem * app = self.apps[i];\r\n        if (!app.checked)\r\n            continue;\r\n        count++;\r\n        NSMenuItem * item = [menu addItemWithTitle:[app.appTitle substringWithRange:NSMakeRange(0, app.appTitle.length - 4)] action:@selector(launchApp:) keyEquivalent:@\"\"];\r\n        item.tag = i;\r\n        item.image = app.icon;\r\n    }\r\n    if (count)\r\n        [menu addItem:[NSMenuItem separatorItem]];\r\n    [menu addItemWithTitle:@\"Quit HexLauncher\" action:@selector(terminate:) keyEquivalent:@\"\"];\r\n    \r\n    self.statusItem.menu = menu;\r\n}\r\n\r\n\r\n- (void)setupStatusItem {\r\n    _statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];\r\n    _statusItem.title = @\"\";\r\n    _statusItem.image = [NSImage imageNamed:@\"StatusItem-Image-rocket\"];\r\n    _statusItem.alternateImage = [NSImage imageNamed:@\"StatusItem-Image-rocket-alt\"];\r\n    _statusItem.highlightMode = YES;\r\n    \r\n    [self gatherAppsList];\r\n    [self setupMenu];\r\n}<\/pre>\n<p>\u0414\u0443\u043c\u0430\u044e, \u0442\u0443\u0442 \u0432\u0441\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e. systemMenu &#8212; \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 NSStatusItem, \u043e\u043d \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438 \u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u0441\u044e \u043c\u0430\u0433\u0438\u044e \u0441 \u0438\u043a\u043e\u043d\u043a\u043e\u0439 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u043c \u043c\u0435\u043d\u044e. \u041c\u0435\u0442\u043e\u0434 gatherAppsList \u0441\u043a\u0430\u043d\u0438\u0440\u0443\u0435\u0442 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \/Applications \u0438 \u0432\u044b\u0434\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043c\u0435\u043d\u044e.<br \/>\n2. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043b\u043e\u0436\u043d\u044b\u043c \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u043c \u0441\u0442\u0430\u043b\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0438\u043a\u043e\u043d\u043e\u043a. \u0415\u0449\u0435 \u043a\u043e\u0433\u0434\u0430 \u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b \u0441\u0432\u043e\u0435 \u043f\u0435\u0440\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f OS X (<a title=\"MacMines by heximal\" href=\"http:\/\/hxml.me\/blog\/coding\/macmines-delaem-igru-pod-mac-os-x\/\" target=\"_blank\">MacMines<\/a>) \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u044d\u0442\u0438\u043c \u0445\u0438\u0442\u0440\u044b\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u043c icns (IconSet), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u0435\u0442 \u0438\u0437 \u0438\u043a\u043e\u043d\u043e\u043a \u0440\u0430\u0437\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u041e\u0447\u0435\u043d\u044c \u0434\u043e\u043b\u0433\u043e \u0438\u0441\u043a\u0430\u043b, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0441 \u043d\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0438 \u043a\u0430\u043a, \u0433\u0440\u0443\u0431\u043e \u0433\u043e\u0432\u043e\u0440\u044f, <strong>\u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c ICNS \u0432 NSImage<\/strong>. \u0418\u0437 \u0447\u0435\u0433\u043e-\u0442\u043e \u0431\u043e\u043b\u0435\u0435-\u043c\u0435\u043d\u0435\u0435 \u0432\u0440\u0430\u0437\u0443\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u043f\u0430\u043b\u0441\u044f \u043a\u0430\u043a\u043e\u0439-\u0442\u043e opensource-\u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 c++. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0443\u0434\u0430\u0447\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u0434\u0430\u043b \u043c\u043d\u0435 \u0433\u0435\u043d\u0438\u0430\u043b\u044c\u043d\u043e-\u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438 \u0438\u0437\u0431\u0430\u0432\u0438\u043b \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043e\u0442 \u0432\u043e\u0437\u043d\u0438 \u0441 \u0441\u043e\u0440\u0446\u0430\u043c\u0438 \u043d\u0430 \u043f\u043b\u044e\u0441\u0430\u0445. \u041e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0432 Cocoa-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0441\u0442\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0412\u043e\u0442 \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442.<\/p>\n<pre lang=\"objc\">NSImage *iconImage = [[NSWorkspace sharedWorkspace] iconForFile:appPath];<\/pre>\n<p>\u0433\u0434\u0435 appPath, \u043a\u0430\u043a \u043d\u0435\u0442\u0440\u0443\u0434\u043d\u043e \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f, \u043f\u0443\u0442\u044c \u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \/Applications\/Skype.app)<br \/>\n3. <strong>\u0417\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Mac OS X \u0438\u0437 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/strong> \u0442\u0430\u043a \u0436\u0435 \u043d\u0435 \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0447\u0435\u043c-\u0442\u043e \u043a\u0440\u0438\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u043c (\u0443 \u043c\u0435\u043d\u044f \u0431\u044b\u043b\u0438 \u043e\u043f\u0430\u0441\u0435\u043d\u0438\u044f, \u0447\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0443\u0442 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c\u044e)<\/p>\n<pre lang=\"objc\">NSWorkspace *sharedWorkspace = [NSWorkspace sharedWorkspace];\r\nBOOL didLaunch = [sharedWorkspace launchApplication:app.appPath];\r\n<\/pre>\n<p>4. \u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439 \u043e\u043a\u0430\u043b\u0430\u0441\u044c \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u043a\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u043f\u043e\u0432\u0435\u0440\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 &#8212; \u0442\u043e \u0435\u0441\u0442\u044c, \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u043d\u0430 \u0441\u0430\u043c\u044b\u0439 \u0432\u0435\u0440\u0445 \u043e\u043a\u043d\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<pre lang=\"objc\">- (void)setup:(id)sender {\r\n    [self.mainWindowController.window makeKeyAndOrderFront:self];\r\n    [NSApp activateIgnoringOtherApps:YES];\r\n}<\/pre>\n<p>5. \u0421\u0430\u043c\u043e\u0439, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0442\u0430\u043b\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 (<strong>Launch app on start up<\/strong>). \u0421\u0430\u043c\u044b\u0439 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e\u043c \u043f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0435 Launch agents. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u0431 \u0430\u0433\u0435\u043d\u0442\u0430\u0445 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0432 Mac OS X \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f <a href=\"https:\/\/developer.apple.com\/library\/mac\/documentation\/MacOSX\/Conceptual\/BPSystemStartup\/Chapters\/CreatingLaunchdJobs.html\" target=\"_blank\">\u0437\u0434\u0435\u0441\u044c<\/a>. \u042f \u043b\u0438\u0448\u044c \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0432 \u043a\u0440\u0430\u0442\u0446\u0435, \u043a\u0430\u043a \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442. \u0410\u0433\u0435\u043d\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e Plist, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0433\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043e \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u0445 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 (\u044d\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0439 cron-\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u043f\u043e \u0441\u0443\u0442\u0438). \u0412\u043e\u0442, \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0430\u0433\u0435\u043d\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0434\u043b\u044f \u043c\u043e\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/p>\n<pre lang=\"xml\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;!DOCTYPE plist PUBLIC \"-\/\/Apple\/\/DTD PLIST 1.0\/\/EN\" \"http:\/\/www.apple.com\/DTDs\/PropertyList-1.0.dtd\"&gt;\r\n&lt;plist version=\"1.0\"&gt;\r\n&lt;dict&gt;\r\n    &lt;key&gt;Label&lt;\/key&gt;\r\n    &lt;string&gt;ru.heximal.HexLauncher&lt;\/string&gt;\r\n    &lt;key&gt;ProgramArguments&lt;\/key&gt;\r\n    &lt;array&gt;\r\n        &lt;string&gt;%APP_DIR%\/Contents\/MacOS\/HexLauncher&lt;\/string&gt;\r\n    &lt;\/array&gt;\r\n    &lt;key&gt;RunAtLoad&lt;\/key&gt;\r\n    &lt;true\/&gt;\r\n&lt;\/dict&gt;\r\n&lt;\/plist&gt;<\/pre>\n<p>\u0414\u0443\u043c\u0430\u044e, \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u0442\u0443\u0442 \u0438\u0437\u043b\u0438\u0448\u043d\u0438. \u0421\u043a\u0430\u0436\u0443 \u043b\u0438\u0448\u044c, \u0447\u0442\u043e %APP_DIR% &#8212; \u044d\u0442\u043e placeholder. \u042d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u043b\u0435\u0436\u0438\u0442 \u0432 \u0431\u0430\u043d\u0434\u043b\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0438 \u043f\u043b\u044d\u0439\u0441\u0445\u043e\u043b\u0434\u0435\u0440 %APP_DIR% \u043f\u043e\u0434\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u0443\u0442\u044c \u043a \u043f\u0430\u043f\u043a\u0435, \u0433\u0434\u0435 \u043b\u0435\u0436\u0438\u0442 \u0441\u0430\u043c\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 <strong>HexLauncher<\/strong>. \u0412\u043e\u0442, \u043a\u0441\u0442\u0430\u0442\u0438, \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0443\u0442\u044c \u0432 \u043f\u0430\u043f\u043a\u0435 Mac OS X \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f:<\/p>\n<pre lang=\"objc\">NSBundle *myBundle = [NSBundle mainBundle];\r\nNSString * bundlePath = [myBundle bundlePath];<\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043f\u0440\u043e \u0430\u0433\u0435\u043d\u0442\u043e\u0432 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435. \u041e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043b\u0438\u0431\u043e \u0432 \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u043b\u044f<\/p>\n<pre lang=\"bash\">~\/Library\/LaunchAgents\/<\/pre>\n<p>\u043b\u0438\u0431\u043e \u0432 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435<\/p>\n<pre lang=\"bash\">\/Library\/LaunchAgents\/<\/pre>\n<p>\u041a\u0430\u043a \u043d\u0435 \u0442\u0440\u0443\u0434\u043d\u043e \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f, \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0430\u0433\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0441\u0430\u043c\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0430 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c &#8212; \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u0412\u043e\u0442, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u0438 \u0432\u0441\u0435 \u043d\u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f.<\/p>\n<p><!--:--><br \/>\n<!--:en-->I have to say, I was trying to find an existing solution of this problem for many times but everything I found did&#8217;t match my expectations and requirements. All this was leading me to a fundamental conlusion: if you wanna do something &#8212; do yourself. So, let it be!<br \/>\nArming myself with Xcode and internet search tools I started the development. By the way, you can visit a <strong>download page for HexLauncher<\/strong> <a title=\"Download HexLauncher\" href=\"http:\/\/hxml.me\/en\/product\/hexlauncher\/\" target=\"_blank\">here<\/a>.<br \/>\nI&#8217;ve created a specification first. It&#8217;s required to develop an application which <strong>puts its icon to a system menu bar<\/strong> so when a user clicks this icon a dropdown menu appears containing a list of favourite applications. When user selects one of the item the associated application is launching. I consider this method much more convenient in compare to\u00a0Spotlight: when you use a Spotlight you need to operate\u00a0both mouse and keyboard, from other side <strong>HexLauncher<\/strong> lets you start apps just in two clicks which is definitely better in terms of usability. A list of applications is populating by means of settings window which is also avialable from drop down menu. When the settings window is open a list of all available apps in \/Applications folder is loaded. User may check a number of apps and that will be a list of quick launch menu. Also it&#8217;s required to provide user with ability to <strong>run<\/strong> HexLauncher on <strong>system start up<\/strong>. That&#8217;s all, let&#8217;s get started. <img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/hxml.me\/img\/product\/scr\/orig\/0011_01.png\" alt=\"HexLauncher screenshot\" width=\"600\" height=\"417\" \/><br \/>\nThere were just about 5 more or less difficult things in this project for me. There they are.<br \/>\n1. <strong>Place an icon to a system menu bar<\/strong> and associate a drop down menu with it. I&#8217;m not gonna give a lot of theory now, just will provide a piece of code which was born after a certain period of searching.<\/p>\n<pre lang=\"objc\">- (void)setupMenu {\r\n    NSMenu *menu = [[NSMenu alloc] init];\r\n    \/\/    for (NSString * app in self.apps) {\r\n    NSMenuItem * item = [menu addItemWithTitle:@\"HexLauncher Preferences\" action:@selector(setup:) keyEquivalent:@\"\"];\r\n    NSImage *iconImage = [[NSWorkspace sharedWorkspace] iconForFile:[[NSBundle mainBundle] bundlePath]];\r\n    \r\n    item.image = iconImage;\r\n    [menu addItem:[NSMenuItem separatorItem]];\r\n    int count = 0;\r\n    for (int i = 0; i &lt; self.apps.count; i++) {\r\n        AppItem * app = self.apps[i];\r\n        if (!app.checked)\r\n            continue;\r\n        count++;\r\n        NSMenuItem * item = [menu addItemWithTitle:[app.appTitle substringWithRange:NSMakeRange(0, app.appTitle.length - 4)] action:@selector(launchApp:) keyEquivalent:@\"\"];\r\n        item.tag = i;\r\n        item.image = app.icon;\r\n    }\r\n    if (count)\r\n        [menu addItem:[NSMenuItem separatorItem]];\r\n    [menu addItemWithTitle:@\"Quit HexLauncher\" action:@selector(terminate:) keyEquivalent:@\"\"];\r\n    \r\n    self.statusItem.menu = menu;\r\n}\r\n\r\n\r\n- (void)setupStatusItem {\r\n    _statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];\r\n    _statusItem.title = @\"\";\r\n    _statusItem.image = [NSImage imageNamed:@\"StatusItem-Image-rocket\"];\r\n    _statusItem.alternateImage = [NSImage imageNamed:@\"StatusItem-Image-rocket-alt\"];\r\n    _statusItem.highlightMode = YES;\r\n    \r\n    [self gatherAppsList];\r\n    [self setupMenu];\r\n}<\/pre>\n<p>I think, it&#8217;s quite clear what&#8217;s happening here. systemMenu is an object of NSStatusItem class, it&#8217;s doing all the magic with placing the icon to system menu bar. gatherAppsList is recursively scanning an \/Applications directory and returns an array which is used for menu list.<br \/>\n2. Next difficult moment was displaying an icons of apps. When I was developing my first OS X application (<a title=\"MacMines by heximal\" href=\"http:\/\/hxml.me\/blog\/coding\/macmines-delaem-igru-pod-mac-os-x\/\" target=\"_blank\">MacMines<\/a>) I faced this complicated icns format (an Icon set). It was very hard to find how to deal with it and actually how to <strong>convert ICON to NSImage<\/strong>. I even found some open source library written in c++. Fortunetely I wasn&#8217;t forced to build a library and to integrate it to my project. I&#8217;ve found a hundred times simplier way to get NSImage from ICNS &#8212; the Cocoa framework has everything what we need. Here it is.<\/p>\n<pre lang=\"objc\">NSImage *iconImage = [[NSWorkspace sharedWorkspace] iconForFile:appPath];<\/pre>\n<p>appPath is the path to required application (like, \/Applications\/Skype.app)<br \/>\n3. <strong>Launch an application from external applcation<\/strong> also wasn&#8217;t something extraordinary or criminal (I was worrying If maybe it could be restricted with security reasons)<\/p>\n<pre lang=\"objc\">NSWorkspace *sharedWorkspace = [NSWorkspace sharedWorkspace];\r\nBOOL didLaunch = [sharedWorkspace launchApplication:app.appPath];<\/pre>\n<p>4. It was interesting challenge to show the <strong>settings window<\/strong> upon all others (show <strong>on top<\/strong>)<\/p>\n<pre lang=\"objc\">- (void)setup:(id)sender {\r\n  [self.mainWindowController.window makeKeyAndOrderFront:self];\r\n  [NSApp activateIgnoringOtherApps:YES];\r\n}<\/pre>\n<p>5. The most difficult task was an implementation of <strong>Launch the app on system start up<\/strong>. The wide spreaded method which is used by most of applications is so called <strong>Launch agents<\/strong>. Mac OS X launch agents are described in details <a href=\"https:\/\/developer.apple.com\/library\/mac\/documentation\/MacOSX\/Conceptual\/BPSystemStartup\/Chapters\/CreatingLaunchdJobs.html\" target=\"_blank\">here<\/a> so we don&#8217;t delay for too long in this post. I&#8217;d like just to tell a little bit about how it works. Launch agent is created with regular plist file which contains an information about the app itself and a rules of launch (it&#8217;s a kind of advanced cron scheduler). This is how my launch agent looks like.<\/p>\n<pre lang=\"xml\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;!DOCTYPE plist PUBLIC \"-\/\/Apple\/\/DTD PLIST 1.0\/\/EN\" \"http:\/\/www.apple.com\/DTDs\/PropertyList-1.0.dtd\"&gt;\r\n&lt;plist version=\"1.0\"&gt;\r\n&lt;dict&gt;\r\n    &lt;key&gt;Label&lt;\/key&gt;\r\n    &lt;string&gt;ru.heximal.HexLauncher&lt;\/string&gt;\r\n    &lt;key&gt;ProgramArguments&lt;\/key&gt;\r\n    &lt;array&gt;\r\n        &lt;string&gt;%APP_DIR%\/Contents\/MacOS\/HexLauncher&lt;\/string&gt;\r\n    &lt;\/array&gt;\r\n    &lt;key&gt;RunAtLoad&lt;\/key&gt;\r\n    &lt;true\/&gt;\r\n&lt;\/dict&gt;\r\n&lt;\/plist&gt;<\/pre>\n<p>I think any comments are redundant here. I&#8217;d just like to say that %APP_DIR% is a placeholder which is replaced with the path to where HexLauncher is currently located. Here is the code to get current app folder.<\/p>\n<pre lang=\"objc\">NSBundle *myBundle = [NSBundle mainBundle];\r\nNSString * bundlePath = [myBundle bundlePath];<\/pre>\n<p>There is one more thing I can mention about Launch agents. They can be wether in user&#8217;s home directory<\/p>\n<pre lang=\"bash\">~\/Library\/LaunchAgents\/<\/pre>\n<p>or in the global library folder<\/p>\n<pre lang=\"bash\">\/Library\/LaunchAgents\/<\/pre>\n<p>It&#8217;s not too hard to understand that in first case launch agent will work only for exactly that user and in second case the agent will work for any user. That&#8217;s all for today.<\/p>\n<p><!--:--><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0418\u0441\u0442\u043e\u0440\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043c\u0435\u043d\u044f \u043d\u0430 5 \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0430, \u043a\u043e\u0433\u0434\u0430 \u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0430\u043b \u0432\u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u043c\u0438\u0440 Apple \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e &#8212; \u043c\u0438\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 Mac OS X. \u041a\u0430\u043a \u0438 \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u0438\u0445 \u043f\u0435\u043d\u0440\u0435\u0445\u043e\u0434 \u0431\u044b\u043b \u0441\u0432\u044f\u0437\u0430\u043d \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043d\u0435\u0443\u0434\u043e\u0431\u0441\u0442\u0430\u0432\u043c\u0438 \u0438\u0437-\u0437\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439. \u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u043d\u0435\u0434\u043e\u0440\u0430\u0437\u0443\u043c\u0435\u043d\u0435\u0439 \u0441\u0442\u0430\u043b\u043e \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0430\u043d\u0430\u043b\u043e\u0433\u0430 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[60,47,68],"tags":[93,83],"class_list":["post-1415","post","type-post","status-publish","format-standard","hentry","category-apple","category-coding","category-products","tag-cocoa","tag-mac-os-x"],"_links":{"self":[{"href":"https:\/\/hxml.me\/blog\/wp-json\/wp\/v2\/posts\/1415","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hxml.me\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hxml.me\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hxml.me\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hxml.me\/blog\/wp-json\/wp\/v2\/comments?post=1415"}],"version-history":[{"count":49,"href":"https:\/\/hxml.me\/blog\/wp-json\/wp\/v2\/posts\/1415\/revisions"}],"predecessor-version":[{"id":1477,"href":"https:\/\/hxml.me\/blog\/wp-json\/wp\/v2\/posts\/1415\/revisions\/1477"}],"wp:attachment":[{"href":"https:\/\/hxml.me\/blog\/wp-json\/wp\/v2\/media?parent=1415"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hxml.me\/blog\/wp-json\/wp\/v2\/categories?post=1415"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hxml.me\/blog\/wp-json\/wp\/v2\/tags?post=1415"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}