Added config option with default being off
This commit is contained in:
parent
afd2611ed2
commit
64e76f1612
12 changed files with 60 additions and 16 deletions
|
@ -26,6 +26,7 @@ Sway is an incredible window manager, and certainly one of the most well establi
|
|||
- `dim_inactive_colors.urgent <hex color> ex, #900000FF`
|
||||
+ Application saturation: `for_window [CRITERIA HERE] saturation <set|plus|minus> <val 0.0 <-> 2.0>`
|
||||
+ Keep/remove separator border between titlebar and content: `titlebar_separator enable|disable`
|
||||
+ Treat Scratchpad as minimized: `scratchpad_minimize on|off`
|
||||
|
||||
## Roadmap
|
||||
|
||||
|
|
|
@ -34,6 +34,9 @@ dim_inactive 0.0
|
|||
dim_inactive_colors.unfocused #000000FF
|
||||
dim_inactive_colors.urgent #900000FF
|
||||
|
||||
# Move minimized windows into Scratchpad
|
||||
scratchpad_minimize off
|
||||
|
||||
### Output configuration
|
||||
#
|
||||
# Default wallpaper (more resolutions are available in @datadir@/backgrounds/sway/)
|
||||
|
|
|
@ -176,6 +176,7 @@ sway_cmd cmd_reload;
|
|||
sway_cmd cmd_rename;
|
||||
sway_cmd cmd_resize;
|
||||
sway_cmd cmd_scratchpad;
|
||||
sway_cmd cmd_scratchpad_minimize;
|
||||
sway_cmd cmd_seamless_mouse;
|
||||
sway_cmd cmd_set;
|
||||
sway_cmd cmd_shortcuts_inhibitor;
|
||||
|
|
|
@ -488,6 +488,7 @@ struct sway_config {
|
|||
int shadow_blur_sigma;
|
||||
float shadow_color[4];
|
||||
bool titlebar_separator;
|
||||
bool scratchpad_minimize;
|
||||
|
||||
char *swaynag_command;
|
||||
struct swaynag_instance swaynag_config_errors;
|
||||
|
|
|
@ -115,6 +115,7 @@ static const struct cmd_handler handlers[] = {
|
|||
static const struct cmd_handler config_handlers[] = {
|
||||
{ "default_orientation", cmd_default_orientation },
|
||||
{ "include", cmd_include },
|
||||
{ "scratchpad_minimize", cmd_scratchpad_minimize },
|
||||
{ "swaybg_command", cmd_swaybg_command },
|
||||
{ "swaynag_command", cmd_swaynag_command },
|
||||
{ "workspace_layout", cmd_workspace_layout },
|
||||
|
|
18
sway/commands/scratchpad_minimize.c
Normal file
18
sway/commands/scratchpad_minimize.c
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include <string.h>
|
||||
#include "sway/commands.h"
|
||||
#include "sway/config.h"
|
||||
#include "log.h"
|
||||
#include "stringop.h"
|
||||
#include "util.h"
|
||||
|
||||
struct cmd_results *cmd_scratchpad_minimize(int argc, char **argv) {
|
||||
struct cmd_results *error = checkarg(argc, "scratchpad_minimize", EXPECTED_AT_LEAST, 1);
|
||||
|
||||
if (error) {
|
||||
return error;
|
||||
}
|
||||
|
||||
config->scratchpad_minimize = parse_boolean(argv[0], config->scratchpad_minimize);
|
||||
|
||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||
}
|
|
@ -344,6 +344,7 @@ static void config_defaults(struct sway_config *config) {
|
|||
config->shadow_blur_sigma = 20.0f;
|
||||
color_to_rgba(config->shadow_color, 0x0000007F);
|
||||
config->titlebar_separator = true;
|
||||
config->scratchpad_minimize = false;
|
||||
|
||||
// The keysym to keycode translation
|
||||
struct xkb_rule_names rules = {0};
|
||||
|
|
|
@ -336,6 +336,11 @@ static void handle_request_maximize(struct wl_listener *listener, void *data) {
|
|||
static void handle_request_minimize(struct wl_listener *listener, void *data) {
|
||||
struct sway_xdg_shell_view *xdg_shell_view =
|
||||
wl_container_of(listener, xdg_shell_view, request_minimize);
|
||||
if (!config->scratchpad_minimize) {
|
||||
struct wlr_xdg_toplevel *toplevel = xdg_shell_view->view.wlr_xdg_toplevel;
|
||||
wlr_xdg_surface_schedule_configure(toplevel->base);
|
||||
return;
|
||||
}
|
||||
|
||||
struct sway_container *container = xdg_shell_view->view.container;
|
||||
if (!container->pending.workspace) {
|
||||
|
|
|
@ -586,6 +586,7 @@ static void handle_request_minimize(struct wl_listener *listener, void *data) {
|
|||
}
|
||||
|
||||
struct wlr_xwayland_minimize_event *e = data;
|
||||
if (config->scratchpad_minimize) {
|
||||
struct sway_container *container = view->container;
|
||||
if (!container->pending.workspace) {
|
||||
while (container->pending.parent) {
|
||||
|
@ -604,6 +605,11 @@ static void handle_request_minimize(struct wl_listener *listener, void *data) {
|
|||
}
|
||||
}
|
||||
transaction_commit_dirty();
|
||||
return;
|
||||
}
|
||||
struct sway_seat *seat = input_manager_current_seat();
|
||||
bool focused = seat_get_focus(seat) == &view->container->node;
|
||||
wlr_xwayland_surface_set_minimized(xsurface, !focused && e->minimize);
|
||||
}
|
||||
|
||||
static void handle_request_move(struct wl_listener *listener, void *data) {
|
||||
|
|
|
@ -98,6 +98,7 @@ sway_sources = files(
|
|||
'commands/resize.c',
|
||||
'commands/saturation.c',
|
||||
'commands/scratchpad.c',
|
||||
'commands/scratchpad_minimize.c',
|
||||
'commands/seat.c',
|
||||
'commands/seat/attach.c',
|
||||
'commands/seat/cursor.c',
|
||||
|
|
|
@ -71,6 +71,10 @@ The following commands may only be used in the configuration file.
|
|||
*wordexp*(3) for details). The same include file can only be included once;
|
||||
subsequent attempts will be ignored.
|
||||
|
||||
*scratchpad_minimize* <value>
|
||||
Adjusts if minimized windows should be moved into the scratchpad (on|off).
|
||||
Must be set at config-time (when starting sway).
|
||||
|
||||
*swaybg_command* <command>
|
||||
Executes custom background _command_. Default is _swaybg_. Refer to
|
||||
*sway-output*(5) for more information.
|
||||
|
|
|
@ -712,6 +712,8 @@ static void handle_foreign_fullscreen_request(
|
|||
|
||||
static void handle_foreign_minimize(
|
||||
struct wl_listener *listener, void *data) {
|
||||
if (!config->scratchpad_minimize) return;
|
||||
|
||||
struct sway_view *view = wl_container_of(
|
||||
listener, view, foreign_minimize);
|
||||
struct wlr_foreign_toplevel_handle_v1_minimized_event *event = data;
|
||||
|
|
Loading…
Add table
Reference in a new issue