to Virtual Machines, VNC clients or nested compositors.
A second call will restore all original keybinds.
+ This action will only affect the window that had keyboard focus when
+ the binding was executed. Thus when switching to another window, all
+ the usual keybinds will function again until switching back to the
+ original window. There can be multiple windows with this mode set.
+
*<action name="FocusOutput" output="HDMI-A-1" />*
Give focus to topmost window on given output and warp the cursor
to the center of the window. If the given output does not contain
*window.inactive.border.color*
Border color of inactive window
+*window.active.indicator.toggled-keybind.color*
+ Status indicator for the ToggleKeybinds action. Can be set to the same
+ value as set for window.active.border.color to disable the status indicator.
+
*window.active.title.bg.color*
Background color for the focused window's titlebar
window.active.border.color: #dddad6
window.inactive.border.color: #f6f5f4
+# ToggleKeybinds status indicator
+window.active.indicator.toggled-keybind.color: #ff0000
+
# window titlebar background
window.active.title.bg.color: #dddad6
window.inactive.title.bg.color: #f6f5f4
struct wlr_idle_inhibit_manager_v1 *wlr_idle_inhibit_manager;
/* In support for ToggleKeybinds */
- bool inhibit_keybinds;
+ uint32_t nr_inhibited_keybind_views;
/* Used to hide the workspace OSD after switching workspaces */
struct wl_event_source *workspace_osd_timer;
void ssd_update_geometry(struct ssd *ssd);
void ssd_destroy(struct ssd *ssd);
+void ssd_enable_keybind_inhibit_indicator(struct ssd *ssd, bool enable);
+
struct ssd_hover_state *ssd_hover_state_new(void);
void ssd_update_button_hover(struct wlr_scene_node *node,
struct ssd_hover_state *hover_state);
float window_active_border_color[4];
float window_inactive_border_color[4];
+ float window_toggled_keybinds_color[4];
+
float window_active_title_bg_color[4];
float window_inactive_title_bg_color[4];
bool maximized;
bool fullscreen;
uint32_t tiled; /* private, enum view_edge in src/view.c */
+ bool inhibits_keybinds;
/* Pointer to an output owned struct region, may be NULL */
struct region *tiled_region;
struct wl_listener new_popup;
};
+bool view_inhibits_keybinds(struct view *view);
+void view_toggle_keybinds(struct view *view);
+
void view_set_activated(struct view *view);
void view_set_output(struct view *view, struct output *output);
void view_close(struct view *view);
}
break;
case ACTION_TYPE_TOGGLE_KEYBINDS:
- server->seat.inhibit_keybinds = !server->seat.inhibit_keybinds;
- wlr_log(WLR_DEBUG, "%s keybinds",
- server->seat.inhibit_keybinds ? "Disabled" : "Enabled");
+ if (view) {
+ view_toggle_keybinds(view);
+ }
break;
case ACTION_TYPE_FOCUS_OUTPUT:
{
if (modifiers ^ keybind->modifiers) {
continue;
}
- if (server->seat.inhibit_keybinds
+ if (server->seat.nr_inhibited_keybind_views
+ && view_inhibits_keybinds(desktop_focused_view(server))
&& !actions_contain_toggle_keybinds(&keybind->actions)) {
continue;
}
ssd_titlebar_create(ssd);
ssd->margin = ssd_thickness(view);
ssd_set_active(ssd, active);
+ ssd_enable_keybind_inhibit_indicator(ssd, view->inhibits_keybinds);
ssd->state.geometry = view->current;
return ssd;
wlr_scene_node_set_enabled(&ssd->titlebar.inactive.tree->node, !active);
}
+void
+ssd_enable_keybind_inhibit_indicator(struct ssd *ssd, bool enable)
+{
+ if (!ssd) {
+ return;
+ }
+
+ float *color = enable
+ ? rc.theme->window_toggled_keybinds_color
+ : rc.theme->window_active_border_color;
+
+ struct ssd_part *part = ssd_get_part(&ssd->border.active.parts, LAB_SSD_PART_TOP);
+ struct wlr_scene_rect *rect = lab_wlr_scene_get_rect(part->node);
+ wlr_scene_rect_set_color(rect, color);
+}
+
struct ssd_hover_state *
ssd_hover_state_new(void)
{
parse_hexstr("#dddad6", theme->window_active_border_color);
parse_hexstr("#f6f5f4", theme->window_inactive_border_color);
+ parse_hexstr("#ff0000", theme->window_toggled_keybinds_color);
+
parse_hexstr("#dddad6", theme->window_active_title_bg_color);
parse_hexstr("#f6f5f4", theme->window_inactive_title_bg_color);
parse_hexstr(value, theme->window_inactive_border_color);
}
+ if (match_glob(key, "window.active.indicator.toggled-keybind.color")) {
+ parse_hexstr(value, theme->window_toggled_keybinds_color);
+ }
+
if (match_glob(key, "window.active.title.bg.color")) {
parse_hexstr(value, theme->window_active_title_bg_color);
}
}
}
+static void
+inhibit_keybinds(struct view *view, bool inhibit)
+{
+ assert(view->inhibits_keybinds != inhibit);
+
+ view->inhibits_keybinds = inhibit;
+ if (inhibit) {
+ view->server->seat.nr_inhibited_keybind_views++;
+ } else {
+ view->server->seat.nr_inhibited_keybind_views--;
+ }
+
+ if (view->ssd_enabled) {
+ ssd_enable_keybind_inhibit_indicator(view->ssd, inhibit);
+ }
+}
+
+bool
+view_inhibits_keybinds(struct view *view)
+{
+ return view && view->inhibits_keybinds;
+}
+
+void
+view_toggle_keybinds(struct view *view)
+{
+ assert(view);
+ inhibit_keybinds(view, !view->inhibits_keybinds);
+}
+
void
view_destroy(struct view *view)
{
zfree(view->tiled_region_evacuate);
}
+ if (view->inhibits_keybinds) {
+ view->inhibits_keybinds = false;
+ server->seat.nr_inhibited_keybind_views--;
+ }
+
osd_on_view_destroy(view);
undecorate(view);