mirror of
https://github.com/swaywm/sway.git
synced 2026-06-15 14:33:54 -04:00
Compare commits
21 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0251e51986 | ||
|
|
d9ae930729 | ||
|
|
655b9a7e55 | ||
|
|
7afe37fcf3 | ||
|
|
4cc78e9434 | ||
|
|
2617212f62 | ||
|
|
0fbae654f7 | ||
|
|
e2178261fd | ||
|
|
93bba7dad5 | ||
|
|
41c94c2c72 | ||
|
|
0df0173102 | ||
|
|
faedde4e77 | ||
|
|
4e673a3515 | ||
|
|
1e96e73767 | ||
|
|
3aa4c46c13 | ||
|
|
fa889d020b | ||
|
|
257a0a7548 | ||
|
|
9d77163d6e | ||
|
|
948d481cfa | ||
|
|
07e3c06741 | ||
|
|
1826c38ecd |
14 changed files with 44 additions and 59 deletions
|
|
@ -25,7 +25,7 @@ packages:
|
||||||
- hwdata-dev
|
- hwdata-dev
|
||||||
sources:
|
sources:
|
||||||
- https://github.com/swaywm/sway
|
- https://github.com/swaywm/sway
|
||||||
- https://gitlab.freedesktop.org/wlroots/wlroots.git
|
- https://gitlab.freedesktop.org/wlroots/wlroots.git#0.20
|
||||||
tasks:
|
tasks:
|
||||||
- wlroots: |
|
- wlroots: |
|
||||||
cd wlroots
|
cd wlroots
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ packages:
|
||||||
- hwdata
|
- hwdata
|
||||||
sources:
|
sources:
|
||||||
- https://github.com/swaywm/sway
|
- https://github.com/swaywm/sway
|
||||||
- https://gitlab.freedesktop.org/wlroots/wlroots.git
|
- https://gitlab.freedesktop.org/wlroots/wlroots.git#0.20
|
||||||
tasks:
|
tasks:
|
||||||
- wlroots: |
|
- wlroots: |
|
||||||
cd wlroots
|
cd wlroots
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ packages:
|
||||||
- misc/hwdata
|
- misc/hwdata
|
||||||
sources:
|
sources:
|
||||||
- https://github.com/swaywm/sway
|
- https://github.com/swaywm/sway
|
||||||
- https://gitlab.freedesktop.org/wlroots/wlroots.git
|
- https://gitlab.freedesktop.org/wlroots/wlroots.git#0.20
|
||||||
tasks:
|
tasks:
|
||||||
- setup: |
|
- setup: |
|
||||||
cd sway
|
cd sway
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ Si vous utilisez déjà i3, copiez votre configuration i3 vers
|
||||||
`~/.config/sway/config` et sway fonctionnera directement. Sinon, copiez
|
`~/.config/sway/config` et sway fonctionnera directement. Sinon, copiez
|
||||||
l'exemple de fichier de configuration vers `~/.config/sway/config`. Il se
|
l'exemple de fichier de configuration vers `~/.config/sway/config`. Il se
|
||||||
trouve généralement dans `/etc/sway/config`. Exécutez `man 5 sway` pour lire la
|
trouve généralement dans `/etc/sway/config`. Exécutez `man 5 sway` pour lire la
|
||||||
documentation sur la configuration de sway.
|
documentation pour la configuration de sway.
|
||||||
|
|
||||||
## Exécution
|
## Exécution
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
project(
|
project(
|
||||||
'sway',
|
'sway',
|
||||||
'c',
|
'c',
|
||||||
version: '1.13-dev',
|
version: '1.12-rc3',
|
||||||
license: 'MIT',
|
license: 'MIT',
|
||||||
meson_version: '>=1.3',
|
meson_version: '>=1.3',
|
||||||
default_options: [
|
default_options: [
|
||||||
|
|
@ -39,14 +39,14 @@ if is_freebsd
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Execute the wlroots subproject, if any
|
# Execute the wlroots subproject, if any
|
||||||
wlroots_version = ['>=0.21.0', '<0.22.0']
|
wlroots_version = ['>=0.20.0', '<0.21.0']
|
||||||
subproject(
|
subproject(
|
||||||
'wlroots',
|
'wlroots',
|
||||||
default_options: ['examples=false'],
|
default_options: ['examples=false'],
|
||||||
required: false,
|
required: false,
|
||||||
version: wlroots_version,
|
version: wlroots_version,
|
||||||
)
|
)
|
||||||
wlroots = dependency('wlroots-0.21', version: wlroots_version, fallback: 'wlroots')
|
wlroots = dependency('wlroots-0.20', version: wlroots_version, fallback: 'wlroots')
|
||||||
wlroots_features = {
|
wlroots_features = {
|
||||||
'xwayland': false,
|
'xwayland': false,
|
||||||
'libinput_backend': false,
|
'libinput_backend': false,
|
||||||
|
|
|
||||||
|
|
@ -1133,6 +1133,8 @@ static void seat_set_workspace_focus(struct sway_seat *seat, struct sway_node *n
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct sway_workspace *last_workspace = seat_get_focused_workspace(seat);
|
||||||
|
|
||||||
if (node == NULL) {
|
if (node == NULL) {
|
||||||
seat_send_unfocus(last_focus, seat);
|
seat_send_unfocus(last_focus, seat);
|
||||||
sway_input_method_relay_set_focus(&seat->im_relay, NULL);
|
sway_input_method_relay_set_focus(&seat->im_relay, NULL);
|
||||||
|
|
@ -1155,15 +1157,17 @@ static void seat_set_workspace_focus(struct sway_seat *seat, struct sway_node *n
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the output's last workspace, which might have to be removed if empty
|
|
||||||
struct sway_output *new_output =
|
struct sway_output *new_output =
|
||||||
new_workspace ? new_workspace->output : NULL;
|
new_workspace ? new_workspace->output : NULL;
|
||||||
struct sway_workspace *last_workspace =
|
|
||||||
new_output ? output_get_active_workspace(new_output) : NULL;
|
|
||||||
if (last_workspace != new_workspace && new_output) {
|
if (last_workspace != new_workspace && new_output) {
|
||||||
node_set_dirty(&new_output->node);
|
node_set_dirty(&new_output->node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// find new output's old workspace, which might have to be removed if empty
|
||||||
|
struct sway_workspace *new_output_last_ws =
|
||||||
|
new_output ? output_get_active_workspace(new_output) : NULL;
|
||||||
|
|
||||||
// Unfocus the previous focus
|
// Unfocus the previous focus
|
||||||
if (last_focus) {
|
if (last_focus) {
|
||||||
seat_send_unfocus(last_focus, seat);
|
seat_send_unfocus(last_focus, seat);
|
||||||
|
|
@ -1207,11 +1211,11 @@ static void seat_set_workspace_focus(struct sway_seat *seat, struct sway_node *n
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move sticky containers to new workspace
|
// Move sticky containers to new workspace
|
||||||
if (new_workspace && last_workspace
|
if (new_workspace && new_output_last_ws
|
||||||
&& new_workspace != last_workspace) {
|
&& new_workspace != new_output_last_ws) {
|
||||||
for (int i = 0; i < last_workspace->floating->length; ++i) {
|
for (int i = 0; i < new_output_last_ws->floating->length; ++i) {
|
||||||
struct sway_container *floater =
|
struct sway_container *floater =
|
||||||
last_workspace->floating->items[i];
|
new_output_last_ws->floating->items[i];
|
||||||
if (container_is_sticky(floater)) {
|
if (container_is_sticky(floater)) {
|
||||||
container_detach(floater);
|
container_detach(floater);
|
||||||
workspace_add_floating(new_workspace, floater);
|
workspace_add_floating(new_workspace, floater);
|
||||||
|
|
@ -1240,9 +1244,13 @@ static void seat_set_workspace_focus(struct sway_seat *seat, struct sway_node *n
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (last_workspace) {
|
if (new_output_last_ws) {
|
||||||
|
workspace_consider_destroy(new_output_last_ws);
|
||||||
|
}
|
||||||
|
if (last_workspace && last_workspace != new_output_last_ws) {
|
||||||
workspace_consider_destroy(last_workspace);
|
workspace_consider_destroy(last_workspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
seat->has_focus = true;
|
seat->has_focus = true;
|
||||||
|
|
||||||
if (config->smart_gaps && new_workspace) {
|
if (config->smart_gaps && new_workspace) {
|
||||||
|
|
|
||||||
|
|
@ -234,31 +234,26 @@ static void handle_motion_postthreshold(struct sway_seat *seat) {
|
||||||
if (layout == L_HORIZ || layout == L_TABBED) {
|
if (layout == L_HORIZ || layout == L_TABBED) {
|
||||||
if (cursor->cursor->y < thresh_top) {
|
if (cursor->cursor->y < thresh_top) {
|
||||||
edge = WLR_EDGE_TOP;
|
edge = WLR_EDGE_TOP;
|
||||||
if (thresh_top < box.y) thresh_top = box.y;
|
|
||||||
box.height = thresh_top - box.y;
|
box.height = thresh_top - box.y;
|
||||||
} else if (cursor->cursor->y > thresh_bottom) {
|
} else if (cursor->cursor->y > thresh_bottom) {
|
||||||
edge = WLR_EDGE_BOTTOM;
|
edge = WLR_EDGE_BOTTOM;
|
||||||
if (thresh_bottom > box.y + box.height) thresh_bottom = box.y + box.height;
|
|
||||||
box.height = box.y + box.height - thresh_bottom;
|
box.height = box.y + box.height - thresh_bottom;
|
||||||
box.y = thresh_bottom;
|
box.y = thresh_bottom;
|
||||||
}
|
}
|
||||||
} else if (layout == L_VERT || layout == L_STACKED) {
|
} else if (layout == L_VERT || layout == L_STACKED) {
|
||||||
if (cursor->cursor->x < thresh_left) {
|
if (cursor->cursor->x < thresh_left) {
|
||||||
edge = WLR_EDGE_LEFT;
|
edge = WLR_EDGE_LEFT;
|
||||||
if (thresh_left < box.x) thresh_left = box.x;
|
|
||||||
box.width = thresh_left - box.x;
|
box.width = thresh_left - box.x;
|
||||||
} else if (cursor->cursor->x > thresh_right) {
|
} else if (cursor->cursor->x > thresh_right) {
|
||||||
edge = WLR_EDGE_RIGHT;
|
edge = WLR_EDGE_RIGHT;
|
||||||
if (thresh_right > box.x + box.width) thresh_right = box.x + box.width;
|
|
||||||
box.width = box.x + box.width - thresh_right;
|
box.width = box.x + box.width - thresh_right;
|
||||||
box.x = thresh_right;
|
box.x = thresh_right;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (edge) {
|
if (edge) {
|
||||||
e->target_node = node_get_parent(&con->node);
|
e->target_node = node_get_parent(&con->node);
|
||||||
if (e->target_node && (e->target_node == &e->con->node ||
|
if (e->target_node == &e->con->node) {
|
||||||
node_has_ancestor(e->target_node, &e->con->node))) {
|
e->target_node = node_get_parent(e->target_node);
|
||||||
e->target_node = node_get_parent(&e->con->node);
|
|
||||||
}
|
}
|
||||||
e->target_edge = edge;
|
e->target_edge = edge;
|
||||||
update_indicator(e, &box);
|
update_indicator(e, &box);
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,6 @@
|
||||||
#define SWAY_LAYER_SHELL_VERSION 5
|
#define SWAY_LAYER_SHELL_VERSION 5
|
||||||
#define SWAY_FOREIGN_TOPLEVEL_LIST_VERSION 1
|
#define SWAY_FOREIGN_TOPLEVEL_LIST_VERSION 1
|
||||||
#define SWAY_PRESENTATION_VERSION 2
|
#define SWAY_PRESENTATION_VERSION 2
|
||||||
#define SWAY_XDG_DECORATION_VERSION 2
|
|
||||||
|
|
||||||
bool unsupported_gpu_detected = false;
|
bool unsupported_gpu_detected = false;
|
||||||
|
|
||||||
|
|
@ -229,7 +228,7 @@ static void handle_renderer_lost(struct wl_listener *listener, void *data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_new_foreign_toplevel_capture_request(struct wl_listener *listener, void *data) {
|
static void handle_new_foreign_toplevel_capture_request(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_ext_foreign_toplevel_image_capture_source_manager_v1_request_event *request = data;
|
struct wlr_ext_foreign_toplevel_image_capture_source_manager_v1_request *request = data;
|
||||||
struct sway_view *view = request->toplevel_handle->data;
|
struct sway_view *view = request->toplevel_handle->data;
|
||||||
|
|
||||||
if (view->image_capture_source == NULL) {
|
if (view->image_capture_source == NULL) {
|
||||||
|
|
@ -397,8 +396,7 @@ bool server_init(struct sway_server *server) {
|
||||||
wl_list_init(&server->decorations);
|
wl_list_init(&server->decorations);
|
||||||
|
|
||||||
server->xdg_decoration_manager =
|
server->xdg_decoration_manager =
|
||||||
wlr_xdg_decoration_manager_v1_create(server->wl_display,
|
wlr_xdg_decoration_manager_v1_create(server->wl_display);
|
||||||
SWAY_XDG_DECORATION_VERSION);
|
|
||||||
if (!server->xdg_decoration_manager) {
|
if (!server->xdg_decoration_manager) {
|
||||||
sway_log(SWAY_ERROR, "Failed to create XDG decoration manager");
|
sway_log(SWAY_ERROR, "Failed to create XDG decoration manager");
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -561,7 +559,7 @@ bool server_init(struct sway_server *server) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
server->new_foreign_toplevel_capture_request.notify = handle_new_foreign_toplevel_capture_request;
|
server->new_foreign_toplevel_capture_request.notify = handle_new_foreign_toplevel_capture_request;
|
||||||
wl_signal_add(&server->ext_foreign_toplevel_image_capture_source_manager_v1->events.capture_request,
|
wl_signal_add(&server->ext_foreign_toplevel_image_capture_source_manager_v1->events.new_request,
|
||||||
&server->new_foreign_toplevel_capture_request);
|
&server->new_foreign_toplevel_capture_request);
|
||||||
|
|
||||||
server->tearing_control_v1 =
|
server->tearing_control_v1 =
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ The following commands may only be used in the configuration file.
|
||||||
|
|
||||||
*input* <identifier> drag_lock enabled|disabled|enabled_sticky
|
*input* <identifier> drag_lock enabled|disabled|enabled_sticky
|
||||||
Enables or disables drag lock for specified input device. The default is
|
Enables or disables drag lock for specified input device. The default is
|
||||||
_disabled_.
|
_enabled_sticky_.
|
||||||
|
|
||||||
*input* <identifier> dwt enabled|disabled
|
*input* <identifier> dwt enabled|disabled
|
||||||
Enables or disables disable-while-typing for the specified input device.
|
Enables or disables disable-while-typing for the specified input device.
|
||||||
|
|
|
||||||
|
|
@ -294,10 +294,6 @@ set|plus|minus|toggle <amount>
|
||||||
A no operation command that can be used to override default behaviour. The
|
A no operation command that can be used to override default behaviour. The
|
||||||
optional comment argument is ignored, but logged for debugging purposes.
|
optional comment argument is ignored, but logged for debugging purposes.
|
||||||
|
|
||||||
*opacity* [set|plus|minus] <value>
|
|
||||||
Adjusts the opacity of the window between 0 (completely transparent) and
|
|
||||||
1 (completely opaque). If the operation is omitted, _set_ will be used.
|
|
||||||
|
|
||||||
*reload*
|
*reload*
|
||||||
Reloads the sway config file and applies any changes. The config file is
|
Reloads the sway config file and applies any changes. The config file is
|
||||||
located at path specified by the command line arguments when started,
|
located at path specified by the command line arguments when started,
|
||||||
|
|
@ -877,6 +873,10 @@ The default colors are:
|
||||||
Any mark that starts with an underscore will not be drawn even if
|
Any mark that starts with an underscore will not be drawn even if
|
||||||
*show_marks* is yes. The default is _yes_.
|
*show_marks* is yes. The default is _yes_.
|
||||||
|
|
||||||
|
*opacity* [set|plus|minus] <value>
|
||||||
|
Adjusts the opacity of the window between 0 (completely transparent) and
|
||||||
|
1 (completely opaque). If the operation is omitted, _set_ will be used.
|
||||||
|
|
||||||
*tiling_drag* enable|disable|toggle
|
*tiling_drag* enable|disable|toggle
|
||||||
Sets whether or not tiling containers can be dragged with the mouse. If
|
Sets whether or not tiling containers can be dragged with the mouse. If
|
||||||
_enabled_ (default), the _floating_mod_ can be used to drag tiling, as well
|
_enabled_ (default), the _floating_mod_ can be used to drag tiling, as well
|
||||||
|
|
|
||||||
|
|
@ -920,7 +920,7 @@ void workspace_unwrap_children(struct sway_workspace *ws,
|
||||||
while (wrap->pending.children->length) {
|
while (wrap->pending.children->length) {
|
||||||
struct sway_container *child = wrap->pending.children->items[0];
|
struct sway_container *child = wrap->pending.children->items[0];
|
||||||
container_detach(child);
|
container_detach(child);
|
||||||
workspace_insert_tiling_direct(ws, child, ws->tiling->length);
|
workspace_add_tiling(ws, child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -417,28 +417,6 @@ void ipc_execute_binding(struct swaybar *bar, struct swaybar_binding *bind) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ipc_initialize(struct swaybar *bar) {
|
bool ipc_initialize(struct swaybar *bar) {
|
||||||
if (!bar->id) {
|
|
||||||
uint32_t len = 0;
|
|
||||||
char *res = ipc_single_command(bar->ipc_socketfd,
|
|
||||||
IPC_GET_BAR_CONFIG, "", &len);
|
|
||||||
json_object *bars = json_tokener_parse(res);
|
|
||||||
if (!json_object_is_type(bars, json_type_array)
|
|
||||||
|| json_object_array_length(bars) == 0) {
|
|
||||||
sway_log(SWAY_ERROR, "No bar configuration found, "
|
|
||||||
"please configure a bar block in your sway config file.");
|
|
||||||
json_object_put(bars);
|
|
||||||
free(res);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
json_object *first = json_object_array_get_idx(bars, 0);
|
|
||||||
bar->id = strdup(json_object_get_string(first));
|
|
||||||
json_object_put(bars);
|
|
||||||
free(res);
|
|
||||||
sway_log(SWAY_INFO, "Using first bar config: %s. "
|
|
||||||
"Use --bar_id to manually select a different bar configuration.",
|
|
||||||
bar->id);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t len = strlen(bar->id);
|
uint32_t len = strlen(bar->id);
|
||||||
char *res = ipc_single_command(bar->ipc_socketfd,
|
char *res = ipc_single_command(bar->ipc_socketfd,
|
||||||
IPC_GET_BAR_CONFIG, bar->id, &len);
|
IPC_GET_BAR_CONFIG, bar->id, &len);
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,12 @@ int main(int argc, char **argv) {
|
||||||
sway_log_init(SWAY_INFO, NULL);
|
sway_log_init(SWAY_INFO, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!swaybar.id) {
|
||||||
|
sway_log(SWAY_ERROR, "No bar_id passed. "
|
||||||
|
"Provide --bar_id or let sway start swaybar");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (!socket_path) {
|
if (!socket_path) {
|
||||||
socket_path = get_socketpath();
|
socket_path = get_socketpath();
|
||||||
if (!socket_path) {
|
if (!socket_path) {
|
||||||
|
|
|
||||||
|
|
@ -66,17 +66,17 @@ static int read_pixmap(sd_bus_message *msg, struct swaybar_sni *sni,
|
||||||
}
|
}
|
||||||
|
|
||||||
const void *pixels;
|
const void *pixels;
|
||||||
size_t pixel_data_size; // size in bytes, each pixel is 4 bytes
|
size_t npixels;
|
||||||
ret = sd_bus_message_read_array(msg, 'y', &pixels, &pixel_data_size);
|
ret = sd_bus_message_read_array(msg, 'y', &pixels, &npixels);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
|
sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (height > 0 && width == height && (size_t)width * height <= pixel_data_size / 4) {
|
if (height > 0 && width == height) {
|
||||||
sway_log(SWAY_DEBUG, "%s %s: found icon w:%d h:%d", sni->watcher_id, prop, width, height);
|
sway_log(SWAY_DEBUG, "%s %s: found icon w:%d h:%d", sni->watcher_id, prop, width, height);
|
||||||
struct swaybar_pixmap *pixmap =
|
struct swaybar_pixmap *pixmap =
|
||||||
malloc(sizeof(struct swaybar_pixmap) + pixel_data_size);
|
malloc(sizeof(struct swaybar_pixmap) + npixels);
|
||||||
pixmap->size = height;
|
pixmap->size = height;
|
||||||
|
|
||||||
// convert from network byte order to host byte order
|
// convert from network byte order to host byte order
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue