diff --git a/atom/browser/api/atom_api_window.cc b/atom/browser/api/atom_api_window.cc index 7f433321b43..e0816755f9c 100644 --- a/atom/browser/api/atom_api_window.cc +++ b/atom/browser/api/atom_api_window.cc @@ -259,6 +259,10 @@ void Window::FlashFrame(bool flash) { window_->FlashFrame(flash); } +void Window::SetSkipTaskbar(bool skip) { + window_->SetSkipTaskbar(skip); +} + void Window::SetKiosk(bool kiosk) { window_->SetKiosk(kiosk); } @@ -366,6 +370,7 @@ void Window::BuildPrototype(v8::Isolate* isolate, .SetMethod("setTitle", &Window::SetTitle) .SetMethod("getTitle", &Window::GetTitle) .SetMethod("flashFrame", &Window::FlashFrame) + .SetMethod("setSkipTaskbar", &Window::SetSkipTaskbar) .SetMethod("setKiosk", &Window::SetKiosk) .SetMethod("isKiosk", &Window::IsKiosk) .SetMethod("setRepresentedFilename", &Window::SetRepresentedFilename) diff --git a/atom/browser/api/atom_api_window.h b/atom/browser/api/atom_api_window.h index 1aa9cee9691..820651f3925 100644 --- a/atom/browser/api/atom_api_window.h +++ b/atom/browser/api/atom_api_window.h @@ -90,6 +90,7 @@ class Window : public mate::EventEmitter, void SetTitle(const std::string& title); std::string GetTitle(); void FlashFrame(bool flash); + void SetSkipTaskbar(bool skip); void SetKiosk(bool kiosk); bool IsKiosk(); void OpenDevTools(); diff --git a/atom/browser/native_window.cc b/atom/browser/native_window.cc index 949dff1caee..7b3e2e38a8a 100644 --- a/atom/browser/native_window.cc +++ b/atom/browser/native_window.cc @@ -176,6 +176,10 @@ void NativeWindow::InitFromOptions(base::DictionaryValue* options) { if (options->GetBoolean(switches::kFullscreen, &fullscreen) && fullscreen) { SetFullscreen(true); } + bool skip; + if (options->GetBoolean(switches::kSkipTaskbar, &skip) && skip) { + SetSkipTaskbar(skip); + } bool kiosk; if (options->GetBoolean(switches::kKiosk, &kiosk) && kiosk) { SetKiosk(kiosk); diff --git a/atom/browser/native_window.h b/atom/browser/native_window.h index a29b8285b52..cb539a4c3e6 100644 --- a/atom/browser/native_window.h +++ b/atom/browser/native_window.h @@ -127,6 +127,7 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate, virtual void SetTitle(const std::string& title) = 0; virtual std::string GetTitle() = 0; virtual void FlashFrame(bool flash) = 0; + virtual void SetSkipTaskbar(bool skip) = 0; virtual void SetKiosk(bool kiosk) = 0; virtual bool IsKiosk() = 0; virtual void SetRepresentedFilename(const std::string& filename); diff --git a/atom/browser/native_window_gtk.cc b/atom/browser/native_window_gtk.cc index ea78f5e23e9..df788d28fd1 100644 --- a/atom/browser/native_window_gtk.cc +++ b/atom/browser/native_window_gtk.cc @@ -366,6 +366,11 @@ void NativeWindowGtk::FlashFrame(bool flash) { gtk_window_set_urgency_hint(window_, flash); } +void NativeWindowGtk::SetSkipTaskbar(bool skip) { + gtk_window_set_skip_taskbar_hint(window_, skip); + gtk_window_set_skip_pager_hint(window_, skip); +} + void NativeWindowGtk::SetKiosk(bool kiosk) { SetFullscreen(kiosk); } diff --git a/atom/browser/native_window_gtk.h b/atom/browser/native_window_gtk.h index be5ff6914c0..725b1d3b02c 100644 --- a/atom/browser/native_window_gtk.h +++ b/atom/browser/native_window_gtk.h @@ -62,6 +62,7 @@ class NativeWindowGtk : public NativeWindow, virtual void SetTitle(const std::string& title) OVERRIDE; virtual std::string GetTitle() OVERRIDE; virtual void FlashFrame(bool flash) OVERRIDE; + virtual void SetSkipTaskbar(bool skip) OVERRIDE; virtual void SetKiosk(bool kiosk) OVERRIDE; virtual bool IsKiosk() OVERRIDE; virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; diff --git a/atom/browser/native_window_mac.h b/atom/browser/native_window_mac.h index 3739517e78e..c2bd8441c56 100644 --- a/atom/browser/native_window_mac.h +++ b/atom/browser/native_window_mac.h @@ -54,6 +54,7 @@ class NativeWindowMac : public NativeWindow { virtual void SetTitle(const std::string& title) OVERRIDE; virtual std::string GetTitle() OVERRIDE; virtual void FlashFrame(bool flash) OVERRIDE; + virtual void SetSkipTaskbar(bool skip) OVERRIDE; virtual void SetKiosk(bool kiosk) OVERRIDE; virtual bool IsKiosk() OVERRIDE; virtual void SetRepresentedFilename(const std::string& filename) OVERRIDE; diff --git a/atom/browser/native_window_mac.mm b/atom/browser/native_window_mac.mm index 5a220772f43..f1c9c9fec8b 100644 --- a/atom/browser/native_window_mac.mm +++ b/atom/browser/native_window_mac.mm @@ -416,6 +416,9 @@ void NativeWindowMac::FlashFrame(bool flash) { } } +void NativeWindowMac::SetSkipTaskbar(bool skip) { +} + void NativeWindowMac::SetKiosk(bool kiosk) { if (kiosk && !is_kiosk_) { kiosk_options_ = [NSApp currentSystemPresentationOptions]; diff --git a/atom/browser/native_window_win.cc b/atom/browser/native_window_win.cc index f78a3fec725..84b26e953ad 100644 --- a/atom/browser/native_window_win.cc +++ b/atom/browser/native_window_win.cc @@ -4,6 +4,8 @@ #include "atom/browser/native_window_win.h" +#include + #include #include @@ -14,6 +16,7 @@ #include "atom/common/options_switches.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" +#include "base/win/scoped_comptr.h" #include "content/public/browser/native_web_keyboard_event.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/render_widget_host_view.h" @@ -395,6 +398,18 @@ void NativeWindowWin::FlashFrame(bool flash) { window_->FlashFrame(flash); } +void NativeWindowWin::SetSkipTaskbar(bool skip) { + base::win::ScopedComPtr taskbar; + if (FAILED(taskbar.CreateInstance(CLSID_TaskbarList, NULL, + CLSCTX_INPROC_SERVER)) || + FAILED(taskbar->HrInit())) + return; + if (skip) + taskbar->DeleteTab(GetNativeWindow()); + else + taskbar->AddTab(GetNativeWindow()); +} + void NativeWindowWin::SetKiosk(bool kiosk) { SetFullscreen(kiosk); } diff --git a/atom/browser/native_window_win.h b/atom/browser/native_window_win.h index 9d34098a72c..44d158e9c5a 100644 --- a/atom/browser/native_window_win.h +++ b/atom/browser/native_window_win.h @@ -71,6 +71,7 @@ class NativeWindowWin : public NativeWindow, virtual void SetTitle(const std::string& title) OVERRIDE; virtual std::string GetTitle() OVERRIDE; virtual void FlashFrame(bool flash) OVERRIDE; + virtual void SetSkipTaskbar(bool skip) OVERRIDE; virtual void SetKiosk(bool kiosk) OVERRIDE; virtual bool IsKiosk() OVERRIDE; virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; diff --git a/atom/common/options_switches.cc b/atom/common/options_switches.cc index 05fc8b0f359..2a99831d7a6 100644 --- a/atom/common/options_switches.cc +++ b/atom/common/options_switches.cc @@ -24,6 +24,9 @@ const char kMaxHeight[] = "max-height"; const char kResizable[] = "resizable"; const char kFullscreen[] = "fullscreen"; +// Whether the window should show in taskbar. +const char kSkipTaskbar[] = "skip-taskbar"; + // Start with the kiosk mode, see Opera's page for description: // http://www.opera.com/support/mastering/kiosk/ const char kKiosk[] = "kiosk"; diff --git a/atom/common/options_switches.h b/atom/common/options_switches.h index 31463e64d9f..f08c3339367 100644 --- a/atom/common/options_switches.h +++ b/atom/common/options_switches.h @@ -24,6 +24,7 @@ extern const char kMaxWidth[]; extern const char kMaxHeight[]; extern const char kResizable[]; extern const char kFullscreen[]; +extern const char kSkipTaskbar[]; extern const char kKiosk[]; extern const char kAlwaysOnTop[]; extern const char kNodeIntegration[]; diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index 982d8aa3d15..11c346976eb 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -42,6 +42,7 @@ You can also create a window without chrome by using * `always-on-top` Boolean - Whether the window should always stay on top of other windows * `fullscreen` Boolean - Whether the window should show in fullscreen + * `skip-taskbar` Boolean - Do not show window in taskbar * `kiosk` Boolean - The kiosk mode * `title` String - Default window title * `icon` String - The path of icon file @@ -353,6 +354,12 @@ Returns the title of the native window. Flashes the window to attract user's attention. +### BrowserWindow.setSkipTaskbar(skip) + +* `skip` Boolean + +Makes the window do not show in taskbar. + ### BrowserWindow.setKiosk(flag) * `flag` Boolean