Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/user/keybinds.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ These take no argument.
The first time a window floats, Umbriel places it slightly below and to the
right of its tiled position while keeping it on-screen.

`window-focus-toggle-floating-tiling` switches focus between floating and tiling windows.

`window-toggle-pinned` makes the focused window float and keeps it above
fullscreen windows on its output. Pinned windows remain visible when you
switch workspaces. You cannot pin a fullscreen window, and making a pinned
Expand Down
1 change: 1 addition & 0 deletions examples/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ follows_mouse = false
[keybinds]
"Mod+Return" = "spawn:kitty"
"Mod+T" = "window-toggle-floating"
"Mod+Shift+T" = "window-focus-toggle-floating-tiling"
"Mod+P" = "window-toggle-pinned"
"Mod+M" = "window-toggle-maximize-to-edges"
"Mod+Shift+Q" = "window-close"
Expand Down
1 change: 1 addition & 0 deletions src/config/keybind_parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ namespace umbriel {
{"window-focus-left", "", KeybindAction::WindowFocusLeft},
{"window-focus-next", "", KeybindAction::WindowFocusNext},
{"window-focus-right", "", KeybindAction::WindowFocusRight},
{"window-focus-toggle-floating-tiling", "", KeybindAction::WindowFocusFloatingOrTiling},
{"window-focus-up", "", KeybindAction::WindowFocusUp},
{"window-modify-width", "<delta>", KeybindAction::WindowModifyWidth, ActionArgKind::WidthDelta},
{"window-move-down", "", KeybindAction::WindowMoveDown},
Expand Down
1 change: 1 addition & 0 deletions src/config/keybind_parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ namespace umbriel {
WindowFocusRight,
WindowFocusUp,
WindowFocusDown,
WindowFocusFloatingOrTiling,
ColumnMoveLeft,
ColumnMoveRight,
WindowMoveUp,
Expand Down
1 change: 1 addition & 0 deletions src/scene/cheatsheet_rows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ namespace {
case A::WindowFocusDown:
case A::WindowFocusNext:
case A::WindowFocusId:
case A::WindowFocusFloatingOrTiling:
return Group::Focus;
case A::ColumnMoveLeft:
case A::ColumnMoveRight:
Expand Down
26 changes: 26 additions & 0 deletions src/server/actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,31 @@ namespace umbriel {
return true;
}

bool actionFocusFloatingOrTiling(Server& server, const Keybind& /*bind*/, std::string* /*error*/) {
Workspace* workspace = activeWorkspace(server);
if (workspace == nullptr) {
return true;
}
View* focused = workspace->focusedView();
const bool seekFloating = focused == nullptr || !focused->floating();
View* target = nullptr;
for (const auto& entry : server.registry().all()) {
View* view = entry.get();
if (view == focused || !view->mapped() || view->workspace() != workspace) {
continue;
}
if (view->floating() != seekFloating) {
continue;
}
target = view;
break;
}
if (target != nullptr && target != focused) {
server.focusView(target, FocusReason::Directional);
}
return true;
}

// Workspaces
bool actionWorkspace(Server& server, const Keybind& bind, std::string* error) {
const std::expected<Workspace*, std::string> target = resolveWorkspaceSelector(server, bind);
Expand Down Expand Up @@ -839,6 +864,7 @@ namespace umbriel {
&actionFocusAdjacent<1>,
&actionFocusVertical<-1>,
&actionFocusVertical<1>,
&actionFocusFloatingOrTiling,
&actionMoveColumn<-1>,
&actionMoveColumn<1>,
&actionMoveVertical<-1>,
Expand Down