summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Aaron Ouellette <aouellette2016@gmail.com>2016-03-18 17:09:11 -0400
committerLibravatar Aaron Ouellette <aouellette2016@gmail.com>2016-03-18 17:09:11 -0400
commit8af6a419ec6f4cfc596aabd5c820e7033cc760c4 (patch)
treed958fae88ea43df2e707830e5f6ca9bf6975a491
parentadd a manpage for swaylock (diff)
parentMerge pull request #519 from mikkeloscar/maintain-exec-quotes (diff)
downloadsway-8af6a419ec6f4cfc596aabd5c820e7033cc760c4.tar.gz
sway-8af6a419ec6f4cfc596aabd5c820e7033cc760c4.tar.zst
sway-8af6a419ec6f4cfc596aabd5c820e7033cc760c4.zip
Merge branch 'master' of git://github.com/SirCmpwn/sway into swaylock
-rw-r--r--LICENSE2
-rw-r--r--config4
-rw-r--r--include/extensions.h1
-rw-r--r--include/workspace.h2
-rw-r--r--sway/CMakeLists.txt1
-rw-r--r--sway/commands.c12
-rw-r--r--sway/container.c2
-rw-r--r--sway/extensions.c14
-rw-r--r--sway/focus.c5
-rw-r--r--sway/handlers.c4
-rw-r--r--sway/layout.c2
-rw-r--r--sway/sway-bar.5.txt112
-rw-r--r--sway/sway-input.5.txt2
-rw-r--r--sway/sway.5.txt2
-rw-r--r--sway/workspace.c26
15 files changed, 168 insertions, 23 deletions
diff --git a/LICENSE b/LICENSE
index 932e1dff..a4db75f7 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
1Copyright (c) 2015 Drew DeVault 1Copyright (c) 2016 Drew DeVault
2 2
3Permission is hereby granted, free of charge, to any person obtaining a copy of 3Permission is hereby granted, free of charge, to any person obtaining a copy of
4this software and associated documentation files (the "Software"), to deal in 4this software and associated documentation files (the "Software"), to deal in
diff --git a/config b/config
index f7e9e751..17160d5e 100644
--- a/config
+++ b/config
@@ -106,9 +106,9 @@ output * bg /usr/share/sway/wallpaper.jpg fill
106# Layout stuff: 106# Layout stuff:
107# 107#
108 # You can "split" the current object of your focus with 108 # You can "split" the current object of your focus with
109 # $mod+h or $mod+v, for horizontal and vertical splits 109 # $mod+s or $mod+v, for horizontal and vertical splits
110 # respectively. 110 # respectively.
111 bindsym $mod+h splith 111 bindsym $mod+s splith
112 bindsym $mod+v splitv 112 bindsym $mod+v splitv
113 113
114 # Switch the current container between different layout styles 114 # Switch the current container between different layout styles
diff --git a/include/extensions.h b/include/extensions.h
index 164688ee..158a40a2 100644
--- a/include/extensions.h
+++ b/include/extensions.h
@@ -28,7 +28,6 @@ struct desktop_shell_state {
28 list_t *panels; 28 list_t *panels;
29 list_t *lock_surfaces; 29 list_t *lock_surfaces;
30 bool is_locked; 30 bool is_locked;
31 struct wlc_size panel_size;
32}; 31};
33 32
34struct swaylock_state { 33struct swaylock_state {
diff --git a/include/workspace.h b/include/workspace.h
index c69ccdbb..6911e3d4 100644
--- a/include/workspace.h
+++ b/include/workspace.h
@@ -7,7 +7,7 @@
7 7
8extern char *prev_workspace_name; 8extern char *prev_workspace_name;
9 9
10char *workspace_next_name(void); 10char *workspace_next_name(const char *output_name);
11swayc_t *workspace_create(const char*); 11swayc_t *workspace_create(const char*);
12swayc_t *workspace_by_name(const char*); 12swayc_t *workspace_by_name(const char*);
13swayc_t *workspace_by_number(const char*); 13swayc_t *workspace_by_number(const char*);
diff --git a/sway/CMakeLists.txt b/sway/CMakeLists.txt
index e49d1d3d..5b6104f3 100644
--- a/sway/CMakeLists.txt
+++ b/sway/CMakeLists.txt
@@ -57,3 +57,4 @@ install(
57add_manpage(sway 1) 57add_manpage(sway 1)
58add_manpage(sway 5) 58add_manpage(sway 5)
59add_manpage(sway-input 5) 59add_manpage(sway-input 5)
60add_manpage(sway-bar 5)
diff --git a/sway/commands.c b/sway/commands.c
index 3b8556ca..ebb63691 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -362,10 +362,8 @@ static struct cmd_results *cmd_exec_always(int argc, char **argv) {
362 return error; 362 return error;
363 } 363 }
364 364
365 add_quotes(argv + 1, argc - 1);
366 tmp = join_args(argv + 1, argc - 1); 365 tmp = join_args(argv + 1, argc - 1);
367 } else { 366 } else {
368 add_quotes(argv, argc);
369 tmp = join_args(argv, argc); 367 tmp = join_args(argv, argc);
370 } 368 }
371 369
@@ -2869,10 +2867,12 @@ struct cmd_results *handle_command(char *_exec) {
2869 //TODO better handling of argv 2867 //TODO better handling of argv
2870 int argc; 2868 int argc;
2871 char **argv = split_args(cmd, &argc); 2869 char **argv = split_args(cmd, &argc);
2872 int i; 2870 if (strcmp(argv[0], "exec") != 0) {
2873 for (i = 1; i < argc; ++i) { 2871 int i;
2874 if (*argv[i] == '\"' || *argv[i] == '\'') { 2872 for (i = 1; i < argc; ++i) {
2875 strip_quotes(argv[i]); 2873 if (*argv[i] == '\"' || *argv[i] == '\'') {
2874 strip_quotes(argv[i]);
2875 }
2876 } 2876 }
2877 } 2877 }
2878 struct cmd_handler *handler = find_handler(argv[0], CMD_BLOCK_END); 2878 struct cmd_handler *handler = find_handler(argv[0], CMD_BLOCK_END);
diff --git a/sway/container.c b/sway/container.c
index 2db7b218..e4c20bc9 100644
--- a/sway/container.c
+++ b/sway/container.c
@@ -143,7 +143,7 @@ swayc_t *new_output(wlc_handle handle) {
143 } 143 }
144 } 144 }
145 if (!ws_name) { 145 if (!ws_name) {
146 ws_name = workspace_next_name(); 146 ws_name = workspace_next_name(output->name);
147 } 147 }
148 148
149 // create and initilize default workspace 149 // create and initilize default workspace
diff --git a/sway/extensions.c b/sway/extensions.c
index bd279276..c646ac91 100644
--- a/sway/extensions.c
+++ b/sway/extensions.c
@@ -1,10 +1,12 @@
1#include <stdlib.h> 1#include <stdlib.h>
2#include <wlc/wlc.h> 2#include <wlc/wlc.h>
3#include <wlc/wlc-wayland.h> 3#include <wlc/wlc-wayland.h>
4#include <wlc/wlc-render.h>
4#include "wayland-desktop-shell-server-protocol.h" 5#include "wayland-desktop-shell-server-protocol.h"
5#include "wayland-swaylock-server-protocol.h" 6#include "wayland-swaylock-server-protocol.h"
6#include "layout.h" 7#include "layout.h"
7#include "log.h" 8#include "log.h"
9#include "input_state.h"
8#include "extensions.h" 10#include "extensions.h"
9 11
10struct desktop_shell_state desktop_shell; 12struct desktop_shell_state desktop_shell;
@@ -76,6 +78,7 @@ static void set_background(struct wl_client *client, struct wl_resource *resourc
76 config->wl_surface_res = surface; 78 config->wl_surface_res = surface;
77 list_add(desktop_shell.backgrounds, config); 79 list_add(desktop_shell.backgrounds, config);
78 wl_resource_set_destructor(surface, background_surface_destructor); 80 wl_resource_set_destructor(surface, background_surface_destructor);
81 wlc_output_schedule_render(config->output);
79} 82}
80 83
81static void set_panel(struct wl_client *client, struct wl_resource *resource, 84static void set_panel(struct wl_client *client, struct wl_resource *resource,
@@ -90,8 +93,8 @@ static void set_panel(struct wl_client *client, struct wl_resource *resource,
90 config->surface = wlc_resource_from_wl_surface_resource(surface); 93 config->surface = wlc_resource_from_wl_surface_resource(surface);
91 config->wl_surface_res = surface; 94 config->wl_surface_res = surface;
92 wl_resource_set_destructor(surface, panel_surface_destructor); 95 wl_resource_set_destructor(surface, panel_surface_destructor);
93 desktop_shell.panel_size = *wlc_surface_get_size(config->surface);
94 arrange_windows(&root_container, -1, -1); 96 arrange_windows(&root_container, -1, -1);
97 wlc_output_schedule_render(config->output);
95} 98}
96 99
97static void desktop_set_lock_surface(struct wl_client *client, struct wl_resource *resource, struct wl_resource *surface) { 100static void desktop_set_lock_surface(struct wl_client *client, struct wl_resource *resource, struct wl_resource *surface) {
@@ -123,7 +126,14 @@ static void set_lock_surface(struct wl_client *client, struct wl_resource *resou
123 wlc_view_set_state(view->handle, WLC_BIT_FULLSCREEN, true); 126 wlc_view_set_state(view->handle, WLC_BIT_FULLSCREEN, true);
124 workspace->fullscreen = view; 127 workspace->fullscreen = view;
125 desktop_shell.is_locked = true; 128 desktop_shell.is_locked = true;
126 set_focused_container(view); 129 // reset input state
130 input_init();
131 // set focus if the lockscreen is spawned on the currently
132 // active output
133 swayc_t *focus_output = swayc_active_output();
134 if (focus_output == output) {
135 set_focused_container(view);
136 }
127 arrange_windows(workspace, -1, -1); 137 arrange_windows(workspace, -1, -1);
128 list_add(desktop_shell.lock_surfaces, surface); 138 list_add(desktop_shell.lock_surfaces, surface);
129 wl_resource_set_destructor(surface, lock_surface_destructor); 139 wl_resource_set_destructor(surface, lock_surface_destructor);
diff --git a/sway/focus.c b/sway/focus.c
index c2ded212..7f96eda7 100644
--- a/sway/focus.c
+++ b/sway/focus.c
@@ -139,6 +139,11 @@ bool set_focused_container(swayc_t *c) {
139 wlc_view_focus(p->handle); 139 wlc_view_focus(p->handle);
140 } 140 }
141 } 141 }
142 } else if (p->type == C_WORKSPACE) {
143 // remove previous focus if view_focus is unlocked
144 if (!locked_view_focus) {
145 wlc_view_focus(0);
146 }
142 } 147 }
143 148
144 if (active_ws != workspace) { 149 if (active_ws != workspace) {
diff --git a/sway/handlers.c b/sway/handlers.c
index 69f325eb..d992a7b6 100644
--- a/sway/handlers.c
+++ b/sway/handlers.c
@@ -141,10 +141,6 @@ static void handle_output_pre_render(wlc_handle output) {
141 break; 141 break;
142 } 142 }
143 wlc_surface_render(config->surface, &geo); 143 wlc_surface_render(config->surface, &geo);
144 if (size.w != desktop_shell.panel_size.w || size.h != desktop_shell.panel_size.h) {
145 desktop_shell.panel_size = size;
146 arrange_windows(&root_container, -1, -1);
147 }
148 break; 144 break;
149 } 145 }
150 } 146 }
diff --git a/sway/layout.c b/sway/layout.c
index dca4e47f..e9998bc8 100644
--- a/sway/layout.c
+++ b/sway/layout.c
@@ -364,7 +364,7 @@ void move_workspace_to(swayc_t* workspace, swayc_t* destination) {
364 364
365 // make sure source output has a workspace 365 // make sure source output has a workspace
366 if (src_op->children->length == 0) { 366 if (src_op->children->length == 0) {
367 char *ws_name = workspace_next_name(); 367 char *ws_name = workspace_next_name(src_op->name);
368 swayc_t *ws = new_workspace(src_op, ws_name); 368 swayc_t *ws = new_workspace(src_op, ws_name);
369 ws->is_focused = true; 369 ws->is_focused = true;
370 free(ws_name); 370 free(ws_name);
diff --git a/sway/sway-bar.5.txt b/sway/sway-bar.5.txt
new file mode 100644
index 00000000..c23519a4
--- /dev/null
+++ b/sway/sway-bar.5.txt
@@ -0,0 +1,112 @@
1/////
2vim:set ts=4 sw=4 tw=82 noet:
3/////
4sway-bar (5)
5============
6
7Name
8----
9sway-bar - bar configuration file and commands
10
11Description
12-----------
13
14Sway allows for configuration of swaybar within the sway configuation file.
15Swaybar commands must be used inside a _bar { }_ block in the config.
16
17
18Commands
19--------
20
21**status_command** <status command>::
22 Executes the bar _status command_ with _sh -c_.
23
24**id** <bar_id>::
25 Sets the ID of the bar.
26
27**position** <top|bottom|left|right>::
28 Sets position of the bar. Default is _bottom_.
29
30**output** <output>::
31 Restrict the bar to a certain output, can be specified multiple times. If the
32 output command is omitted, the bar will be displayed on all outputs.
33
34**swaybar_command** <command>::
35 Executes custom bar command, default is _swaybar_.
36
37**font** <font>::
38 Specifies the font to be used in the bar.
39
40**separator_symbol** <symbol>::
41 Specifies the separator symbol to separate blocks on the bar.
42
43**workspace_buttons** <yes|no>::
44 Enables or disables workspace buttons on the bar. Default is to enable
45 buttons.
46
47**strip_workspace_numbers** <yes|no>::
48 If set to _yes_, then workspace numbers will be omitted from the workspace
49 button and only the custom name will be shown.
50
51**binding_mode_indicator** <yes|no>::
52 Enable or disable binding mode indicator. It's enabled by default.
53
54**height** <height>::
55 Sets the height of the bar. Default height will match the font size.
56
57Colors
58------
59
60Colors are defined within a _colors { }_ block inside a _bar { }_ block. Colors
61must be defined in hex. E.g. _#fff000_ or _#fff000ff_ when including the alpha
62channel.
63
64**background** <color>::
65 Background color of the bar.
66
67**statusline** <color>::
68 Text color to be used for the statusline.
69
70**separator** <color>::
71 Text color to be used for the separator.
72
73**focused_background** <color>::
74 Background color of the bar on the currently focused monitor output. If not
75 used, the color will be taken from _background_.
76
77**focused_statusline** <color>::
78 Text color to be used for the statusline on the currently focused monitor
79 output. If not used, the color will be taken from _statusline_.
80
81**focused_separator** <color>::
82 Text color to be used for the separator on the currently focused monitor
83 output. If not used, the color will be taken from _separator_.
84
85**focused_workspace** <border> <background> <text>::
86 Border, background and text color for a workspace button when the workspace
87 has focus.
88
89**active_workspace** <border> <background> <text>::
90 Border, background and text color for a workspace button when the workspace is
91 active (visible) on some output, but the focus is on another one. You can only
92 tell this apart from the focused workspace when you are using multiple
93 monitors.
94
95**inactive_workspace** <border> <background> <text>::
96 Border, background and text color for a workspace button when the workspace
97 does not have focus and is not active (visible) on any output. This will be
98 the case for most workspaces.
99
100**urgent_workspace** <border> <background> <text>::
101 Border, background and text color for a workspace button when the workspace
102 contains a window with the urgency hint set.
103
104**binding_mode** <border> <background> <text>::
105 Border, background and text color for the binding mode indicator. If not used,
106 the colors will be taken from _urgent_workspace_.
107
108
109See Also
110--------
111
112**sway**(5) **sway-input**(5)
diff --git a/sway/sway-input.5.txt b/sway/sway-input.5.txt
index 1380d1f4..1ef1dbf8 100644
--- a/sway/sway-input.5.txt
+++ b/sway/sway-input.5.txt
@@ -48,4 +48,4 @@ Commands
48See Also 48See Also
49-------- 49--------
50 50
51**sway**(5) 51**sway**(5) **sway-bar**(5)
diff --git a/sway/sway.5.txt b/sway/sway.5.txt
index 5c1cf44d..4e73cd45 100644
--- a/sway/sway.5.txt
+++ b/sway/sway.5.txt
@@ -242,4 +242,4 @@ Currently supported attributes:
242See Also 242See Also
243-------- 243--------
244 244
245**sway**(1) **sway-input**(5) 245**sway**(1) **sway-input**(5) **sway-bar**(5)
diff --git a/sway/workspace.c b/sway/workspace.c
index ad989de9..90edc6e9 100644
--- a/sway/workspace.c
+++ b/sway/workspace.c
@@ -25,8 +25,22 @@ struct workspace_by_number_data {
25 const char *name; 25 const char *name;
26}; 26};
27 27
28char *workspace_next_name(void) { 28static bool workspace_valid_on_output(const char *output_name, const char *ws_name) {
29 sway_log(L_DEBUG, "Workspace: Generating new name"); 29 int i;
30 for (i = 0; i < config->workspace_outputs->length; ++i) {
31 struct workspace_output *wso = config->workspace_outputs->items[i];
32 if (strcasecmp(wso->workspace, ws_name) == 0) {
33 if (strcasecmp(wso->output, output_name) != 0) {
34 return false;
35 }
36 }
37 }
38
39 return true;
40}
41
42char *workspace_next_name(const char *output_name) {
43 sway_log(L_DEBUG, "Workspace: Generating new workspace name for output %s", output_name);
30 int i; 44 int i;
31 int l = 1; 45 int l = 1;
32 // Scan all workspace bindings to find the next available workspace name, 46 // Scan all workspace bindings to find the next available workspace name,
@@ -73,6 +87,14 @@ char *workspace_next_name(void) {
73 free(_target); 87 free(_target);
74 continue; 88 continue;
75 } 89 }
90
91 // make sure that the workspace can appear on the given
92 // output
93 if (!workspace_valid_on_output(output_name, _target)) {
94 free(_target);
95 continue;
96 }
97
76 if (binding->order < order) { 98 if (binding->order < order) {
77 order = binding->order; 99 order = binding->order;
78 target = _target; 100 target = _target;