Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Quark Shell for Mac helps web developers to create native-like Mac menubar app using HTML and JavaScript without writing any native code.

License

NotificationsYou must be signed in to change notification settings

HackPlan/quark-shell-mac

Repository files navigation

Quark Shell helps you create cross-platform (currently Mac-only, Windows version coming soon) menubar/tray app using HTML and JavaScript without writing any native code. Quark Shell exposes a JavaScript object calledquark to provide system functions.Quark Shell for Mac is based on WebKit.

Screenshot

Integrating Web App

app/index.html is the portal of your menubar app.app/preferences/[identifier].html are the preference pages (for example,app/preferences/general.html).

To build your app:

  1. Delete the currentapp folder
  2. Put your files intoapp folder
  3. Openquark-shell.xcworkspace in Xcode
  4. Change bundle name and bundle identifier (seeIssue #50 for details)
  5. Build and have fun!

Remember that Quark Shell is still a WIP. When the project is stable enough, the build process will be simplified.

API

APIs may change rapidly before 1.0.

quark.platform// returns "mac" or "windows"// App info (configurable in Xcode)quark.appVersionquark.appBundleVersion// Enable/disable Web Inspectorquark.debug=true// Manipulate the popup windowquark.openPopup()quark.closePopup()quark.togglePopup()quark.resizePopup({width:326,height:623})// Quit applicationquark.quit()// Open URL in default browserquark.openURL("https://pomotodo.com/")// Set menubar iconquark.setMenubarIcon("data:image/png;base64,iVBORw...SuQmCC")quark.setMenubarHighlightedIcon("data:image/png;base64,iVBORw...SuQmCC")quark.resetMenubarIcon()// Set menubar icon click actionquark.setClickAction(function(){console.log("Don’t click me!");})quark.setSecondaryClickAction(function(){console.log("What did I say?");})// Set menubar labelquark.setLabel("03:14 AM")// Auto launch at login// You also need to change bundle identifier "com.hackplan.quark-shell-helper" to a proper one in quark-shell-helper.xcodeproj and QSHWebViewDelegate.mquark.setLaunchAtLogin(true)// Send system notificationquark.notify({title:"Pomotodo",content:"Break is over!",time:"2038-01-19T03:14:07Z",// (optional) delivery date for scheduled notification, in ISO 8601popupOnClick:true// popup when clicking notification})// Remove all scheduled notificationsquark.removeAllScheduledNotifications()// Remove all delivered notifications from notification centerquark.removeAllDeliveredNotifications()// Open new window// "url" is relative to "app" folder// Notice: You can only open one window at the same time,// or the later window will replace the former window.quark.newWindow({url:"about.html",width:600,height:400,// optional optionsx:100,y:100,// x and y should both be provided, "center" is also a valid valueborder:true,// whether the window has a border, default is trueshadow:true,// whether the window has a shadow, default is truealwaysOnTop:false,// whether the window should always on top, default is falsealpha:1.0// the alpha value of the window, between 0 and 1, default is 1.0})// Close new windowquark.closeWindow()// Pin/unpin pop-up window (won’t close when click outside the window)quark.pin()quark.unpin()// Exchange messages between webviewsquark.emit("MessageName","payload")quark.on("MessageName",function(message){console.log(message)})// Show a context menuquark.showMenu({items:[{label:"Test",click:function(){console.log("I am completely operational")}},{type:"separator"},{label:"Exit",click:function(){console.log("LIFE FUNCTION TERMINATED")}}],x:100,y:200])

Global Shortcuts

// Set global keyboard shortcutquark.addKeyboardShortcut({keycode:0x7A,// F1 keymodifierFlags:0,// no modifier keycallback:functionsuchCallback(){console.log("wow")quark.togglePopup()}})// Clear global keyboard shortcutquark.clearKeyboardShortcut()

Please followNSEvent Class Reference for documentation about modifier flags.

Also, Quark Shell for Mac allows you to record shortcuts vianative components in Preferences window.

Preferences

quark.setupPreferences([{"label":"General","identifier":"general","icon":"NSPreferencesGeneral","height":192},{"label":"Account","identifier":"account","icon":"NSUserAccounts","height":102},{"label":"Shortcut","identifier":"shortcut","icon":"NSAdvanced","height":120}])// Must be called after quark.setupPreferences()quark.openPreferences()quark.closePreferences()

Quark Shell for Mac also provides some native components for preferences.

More detail:Preferences.md

Auto Updating

// Check for updatequark.checkUpdate("https://rawgit.com/HackPlan/quark-shell-mac/master/updater/SampleAppcast.xml")quark.checkUpdateInBackground("https://rawgit.com/HackPlan/quark-shell-mac/master/updater/SampleAppcast.xml")

More detail:AutoUpdate.md

FAQ

  • Can I uselocal storage? Yes.
  • Can I useWebSQL? Yes.
  • Can I useIndexedDB? No, because we are using NSWebView. A future Yosemite-only version using WKWebView will support IndexedDB.
  • Is Quark Shell compatible with Mac App Store? Absolutely yes.

Story

Quark Shell was originally Menubar WebKit. It was created forPomotodo for Mac. Later on, we decided to create a Windows version based on Atom Shell. The project was highly inspired byAtom Shell (now Electron),node-webkit (now nw.js), andMacGap. As a cross-platform project, Menubar WebKit is no longer an appropriate name, so we started to use Quark Shell.

Credits

Quark Shell for Mac was created byLIU Dongyuan (@xhacker) in the development ofPomotodo for Mac.

Some of the code are taken from:

Used third-party libraries:

Contribution

Pull requests are welcome! If you want to do something big, please open an issue first.

License

MIT

About

Quark Shell for Mac helps web developers to create native-like Mac menubar app using HTML and JavaScript without writing any native code.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors3

  •  
  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp