diff options
-rw-r--r-- | options/options.c | 2 | ||||
-rw-r--r-- | options/options.h | 1 | ||||
-rw-r--r-- | video/out/x11_common.c | 18 |
3 files changed, 21 insertions, 0 deletions
diff --git a/options/options.c b/options/options.c index d5a86fe204..59c7c4d236 100644 --- a/options/options.c +++ b/options/options.c @@ -169,6 +169,7 @@ static const m_option_t mp_vo_opt_list[] = { {"keepaspect-window", OPT_BOOL(keepaspect_window)}, {"hidpi-window-scale", OPT_BOOL(hidpi_window_scale)}, {"native-fs", OPT_BOOL(native_fs)}, + {"show-in-taskbar", OPT_BOOL(show_in_taskbar)}, {"display-fps-override", OPT_DOUBLE(display_fps_override), M_RANGE(0, DBL_MAX)}, {"video-timing-offset", OPT_DOUBLE(timing_offset), M_RANGE(0.0, 1.0)}, @@ -243,6 +244,7 @@ const struct m_sub_options vo_sub_opts = { .keepaspect_window = true, .native_fs = true, .taskbar_progress = true, + .show_in_taskbar = true, .border = true, .title_bar = true, .appid = "mpv", diff --git a/options/options.h b/options/options.h index 69a50b3350..ae75ec9d11 100644 --- a/options/options.h +++ b/options/options.h @@ -56,6 +56,7 @@ typedef struct mp_vo_opts { bool keepaspect_window; bool hidpi_window_scale; bool native_fs; + bool show_in_taskbar; int64_t WinID; diff --git a/video/out/x11_common.c b/video/out/x11_common.c index f0588bcbf3..a483186bdc 100644 --- a/video/out/x11_common.c +++ b/video/out/x11_common.c @@ -149,6 +149,7 @@ static void set_screensaver(struct vo_x11_state *x11, bool enabled); static void vo_x11_selectinput_witherr(struct vo *vo, Display *display, Window w, long event_mask); static void vo_x11_setlayer(struct vo *vo, bool ontop); +static void vo_x11_set_in_taskbar(struct vo *vo, bool in); static void vo_x11_xembed_handle_message(struct vo *vo, XClientMessageEvent *ce); static void vo_x11_xembed_send_message(struct vo_x11_state *x11, long m[4]); static void vo_x11_move_resize(struct vo *vo, bool move, bool resize, @@ -1832,6 +1833,8 @@ void vo_x11_config_vo_window(struct vo *vo) if (opts->ontop) vo_x11_setlayer(vo, opts->ontop); + if (!opts->show_in_taskbar) + vo_x11_set_in_taskbar(vo, opts->show_in_taskbar); vo_x11_fullscreen(vo); @@ -1892,6 +1895,19 @@ static void vo_x11_setlayer(struct vo *vo, bool ontop) } } +static void vo_x11_set_in_taskbar(struct vo *vo, bool in) +{ + struct vo_x11_state *x11 = vo->x11; + if (x11->parent || !x11->window) + return; + + if (x11->wm_type & (vo_wm_SKIP_TASKBAR)) { + char *state = "_NET_WM_STATE_SKIP_TASKBAR"; + x11_set_ewmh_state(x11, state, !in); + MP_VERBOSE(x11, "NET style set skip taskbar (%d).\n", !in); + } +} + static bool rc_overlaps(struct mp_rect rc1, struct mp_rect rc2) { return mp_rect_intersection(&rc1, &rc2); // changes the first argument @@ -2076,6 +2092,8 @@ int vo_x11_control(struct vo *vo, int *events, int request, void *arg) vo_x11_fullscreen(vo); if (opt == &opts->ontop) vo_x11_setlayer(vo, opts->ontop); + if (opt == &opts->show_in_taskbar) + vo_x11_set_in_taskbar(vo, opts->show_in_taskbar); if (opt == &opts->border || opt == &opts->title_bar) vo_x11_decoration(vo, opts->border, opts->title_bar); if (opt == &opts->all_workspaces) |