summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-x.ci/build.sh16
-rw-r--r--.travis.yml12
-rw-r--r--CMakeLists.txt1
-rw-r--r--completions/zsh/_swaygrab25
-rw-r--r--sway/CMakeLists.txt3
-rw-r--r--sway/commands.c11
-rw-r--r--sway/handlers.c1
-rw-r--r--sway/main.c3
-rw-r--r--sway/sway-input.5.txt31
-rw-r--r--sway/sway.5.txt5
-rw-r--r--swaybar/main.c19
-rw-r--r--swaylock/main.c63
12 files changed, 127 insertions, 63 deletions
diff --git a/.ci/build.sh b/.ci/build.sh
deleted file mode 100755
index ece5b2a3..00000000
--- a/.ci/build.sh
+++ /dev/null
@@ -1,16 +0,0 @@
1#!/bin/bash
2
3# clone and build wlc
4git clone https://github.com/Cloudef/wlc.git
5cd wlc
6git submodule update --init --recursive # - initialize and fetch submodules
7mkdir target && cd target # - create build target directory
8cmake -DCMAKE_BUILD_TYPE=Upstream .. # - run CMake
9make # - compile
10sudo make install # - install
11
12cd ../..
13
14# build sway
15cmake .
16make
diff --git a/.travis.yml b/.travis.yml
index dfa48fa4..a8e292ba 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -11,22 +11,16 @@ arch:
11 - cmake 11 - cmake
12 - xorg-server-xwayland 12 - xorg-server-xwayland
13 - asciidoc 13 - asciidoc
14 - pcre
15 - json-c 14 - json-c
16 - pixman
17 - wayland 15 - wayland
18 - libxkbcommon
19 - libinput
20 - libx11
21 - libxcb
22 - xcb-util-image 16 - xcb-util-image
23 - libgl
24 - mesa
25 - pango 17 - pango
26 - cairo 18 - cairo
27 - gdk-pixbuf2 19 - gdk-pixbuf2
20 - wlc-git
28 script: 21 script:
29 - "bash .ci/build.sh" 22 - "cmake ."
23 - "make"
30 24
31script: 25script:
32 - "curl -s https://raw.githubusercontent.com/mikkeloscar/arch-travis/master/arch-travis.sh | bash" 26 - "curl -s https://raw.githubusercontent.com/mikkeloscar/arch-travis/master/arch-travis.sh | bash"
diff --git a/CMakeLists.txt b/CMakeLists.txt
index db019083..d53dcd25 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -59,7 +59,6 @@ find_package(GdkPixbuf)
59find_package(PAM) 59find_package(PAM)
60 60
61find_package(LibInput REQUIRED) 61find_package(LibInput REQUIRED)
62include_directories(${LIBINPUT_INClUDE_DIRS})
63 62
64find_package(Backtrace) 63find_package(Backtrace)
65if(Backtrace_FOUND) 64if(Backtrace_FOUND)
diff --git a/completions/zsh/_swaygrab b/completions/zsh/_swaygrab
index 64d9d2c8..e0d654c3 100644
--- a/completions/zsh/_swaygrab
+++ b/completions/zsh/_swaygrab
@@ -2,8 +2,8 @@
2#----------------- 2#-----------------
3# Description 3# Description
4# ----------- 4# -----------
5# 5#
6# Completion script for swaygrab in the sway wm (http://swaywm.org) 6# Completion script for swaygrab in sway wm (http://swaywm.org)
7# 7#
8# ----------------------------------------------------- 8# -----------------------------------------------------
9# Author 9# Author
@@ -13,16 +13,11 @@
13# 13#
14# ------------------------------------------ 14# ------------------------------------------
15 15
16_swaygrab() { 16_arguments -s \
17 local -a options 17 '(-h --help)'{-h,--help}'[Shows help message]' \
18 options=('--version:shows version' 18 '(-c --capture)'{-c,--capture}'[Captures multiple frames as video and passes them to ffmpeg]' \
19 '--help:shows help message' 19 '(-o --output)'{-o,--output}'[Use the specified output. If not specified then current focused output will be used]' \
20 '--capture:Captures multiple frames as video as passes into ffmpeg until SIGTERM (ctrl+c) is sent to swaygrab' 20 '(-v --version)'{-v,--version}'[Print the version (of swaymsg) and quit]' \
21 '--output:Use the specified output. If no output is defined, the currently focused output in sway is used' 21 '(-s --socket)'{-s,--socket}'[Use the specified socket path. Otherwise, sway uses $SWAYSOCK then $I3SOCK]' \
22 '--socket:Use the specified socket path. Otherwise, swayuses $SWAYSOCK then $I3SOCK' 22 '(-r --rate)'{-r,--rate}'[Specify a framerate (in fps). Used in combination with -c. Default is 30 and must be an integer]' \
23 '--rate:Specify a framerate (in fps). Used in combination with -c. Default is 30 and must be an integer' 23 '(--raw)--raw[Instead of ImageMagick or ffmpeg, dump raw rgba data to stdout]'
24 '--raw:Instead of ImageMagick or ffmpeg, dump raw rgba data to stdout'
25 )
26 _describe 'values' options
27 }
28_swaygrab "$@"
diff --git a/sway/CMakeLists.txt b/sway/CMakeLists.txt
index d23c80b0..e49d1d3d 100644
--- a/sway/CMakeLists.txt
+++ b/sway/CMakeLists.txt
@@ -4,7 +4,7 @@ include_directories(
4 ${PCRE_INCLUDE_DIRS} 4 ${PCRE_INCLUDE_DIRS}
5 ${JSONC_INCLUDE_DIRS} 5 ${JSONC_INCLUDE_DIRS}
6 ${XKBCOMMON_INCLUDE_DIRS} 6 ${XKBCOMMON_INCLUDE_DIRS}
7 ${LIBINPUT_LIBRARIES} 7 ${LIBINPUT_INCLUDE_DIRS}
8) 8)
9 9
10add_executable(sway 10add_executable(sway
@@ -56,3 +56,4 @@ install(
56 56
57add_manpage(sway 1) 57add_manpage(sway 1)
58add_manpage(sway 5) 58add_manpage(sway 5)
59add_manpage(sway-input 5)
diff --git a/sway/commands.c b/sway/commands.c
index f6326038..9f6e5032 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -169,15 +169,18 @@ static struct cmd_results *cmd_assign(int argc, char **argv) {
169 169
170 char *criteria = *argv++; 170 char *criteria = *argv++;
171 171
172 if (strncmp(*argv, "→", 1) == 0) { 172 if (strncmp(*argv, "→", strlen("→")) == 0) {
173 if (argc < 3) {
174 return cmd_results_new(CMD_INVALID, "assign", "Missing workspace");
175 }
173 argv++; 176 argv++;
174 } 177 }
175 178
176 char *movecmd = "move container to workspace "; 179 char *movecmd = "move container to workspace ";
177 int arglen = strlen(*argv); 180 int arglen = strlen(movecmd) + strlen(*argv) + 1;
178 char *cmdlist = calloc(1, sizeof(movecmd) + arglen); 181 char *cmdlist = calloc(1, arglen);
179 182
180 sprintf(cmdlist, "%s%s", movecmd, *argv); 183 snprintf(cmdlist, arglen, "%s%s", movecmd, *argv);
181 184
182 struct criteria *crit = malloc(sizeof(struct criteria)); 185 struct criteria *crit = malloc(sizeof(struct criteria));
183 crit->crit_raw = strdup(criteria); 186 crit->crit_raw = strdup(criteria);
diff --git a/sway/handlers.c b/sway/handlers.c
index b1c0e26a..bad8b59a 100644
--- a/sway/handlers.c
+++ b/sway/handlers.c
@@ -266,6 +266,7 @@ static bool handle_view_created(wlc_handle handle) {
266 sway_log(L_DEBUG, "Adding unmanaged window %p to %p", h, output->unmanaged); 266 sway_log(L_DEBUG, "Adding unmanaged window %p to %p", h, output->unmanaged);
267 list_add(output->unmanaged, h); 267 list_add(output->unmanaged, h);
268 } 268 }
269 wlc_view_set_mask(handle, VISIBLE);
269 return true; 270 return true;
270} 271}
271 272
diff --git a/sway/main.c b/sway/main.c
index bec6a725..db2ed856 100644
--- a/sway/main.c
+++ b/sway/main.c
@@ -187,6 +187,9 @@ int main(int argc, char **argv) {
187 // handle SIGTERM signals 187 // handle SIGTERM signals
188 signal(SIGTERM, sig_handler); 188 signal(SIGTERM, sig_handler);
189 189
190 // prevent ipc from crashing sway
191 signal(SIGPIPE, SIG_IGN);
192
190#if defined SWAY_GIT_VERSION && defined SWAY_GIT_BRANCH && defined SWAY_VERSION_DATE 193#if defined SWAY_GIT_VERSION && defined SWAY_GIT_BRANCH && defined SWAY_VERSION_DATE
191 sway_log(L_INFO, "Starting sway version %s (%s, branch \"%s\")\n", SWAY_GIT_VERSION, SWAY_VERSION_DATE, SWAY_GIT_BRANCH); 194 sway_log(L_INFO, "Starting sway version %s (%s, branch \"%s\")\n", SWAY_GIT_VERSION, SWAY_VERSION_DATE, SWAY_GIT_BRANCH);
192#endif 195#endif
diff --git a/sway/sway-input.5.txt b/sway/sway-input.5.txt
index ec5d1314..1380d1f4 100644
--- a/sway/sway-input.5.txt
+++ b/sway/sway-input.5.txt
@@ -1,46 +1,51 @@
1///// 1/////
2vim:set ts=4 sw=4 tw=82 noet: 2vim:set ts=4 sw=4 tw=82 noet:
3///// 3/////
4sway (5) 4sway-input (5)
5======== 5==============
6 6
7Name 7Name
8---- 8----
9sway - input configuration file and commands 9sway-input - input configuration file and commands
10 10
11Description 11Description
12----------- 12-----------
13 13
14Sway allows for configuration of libinput dveices. 14Sway allows for configuration of libinput devices.
15 15
16 16
17Commands 17Commands
18-------- 18--------
19 19
20**input** <identifier> click_method <none|button_areas|clickfinger>: 20**input** <identifier> click_method <none|button_areas|clickfinger>::
21 Changes the click method for the specified device. 21 Changes the click method for the specified device.
22 22
23**input** <identifier> drag_lock <enabled|disabled>: 23**input** <identifier> drag_lock <enabled|disabled>::
24 Enables or disables drag lock for specified input device. 24 Enables or disables drag lock for specified input device.
25 25
26**input** <identifier> dwt <enabled|disabled>: 26**input** <identifier> dwt <enabled|disabled>::
27 Enables or disables disable-while-typing for the specified input device. 27 Enables or disables disable-while-typing for the specified input device.
28 28
29**input** <identifier> events <enable|disabled>: 29**input** <identifier> events <enable|disabled>::
30 Enables or disables send_events for specified input device. 30 Enables or disables send_events for specified input device.
31 (Disabling send_events disables the input device) 31 (Disabling send_events disables the input device)
32 32
33**input** <identifier> middle_emulation <enabled|disabled>: 33**input** <identifier> middle_emulation <enabled|disabled>::
34 Enables or disables middle click emulation. 34 Enables or disables middle click emulation.
35 35
36**input** <identifier> natural_scroll <enabled|disabled>: 36**input** <identifier> natural_scroll <enabled|disabled>::
37 Enables or disables natural scrolling for the specified input device. 37 Enables or disables natural scrolling for the specified input device.
38 38
39**input** <identifier> pointer_accel <[-1,1]>: 39**input** <identifier> pointer_accel <[-1,1]>::
40 Changes the pointer acceleration for the specified input device. 40 Changes the pointer acceleration for the specified input device.
41 41
42**input** <identifier> scroll_method <none|two_finger|edge|on_button_down>: 42**input** <identifier> scroll_method <none|two_finger|edge|on_button_down>::
43 Changes the scroll method for the specified input device. 43 Changes the scroll method for the specified input device.
44 44
45**input** <identifier> tap <enabled|disabled>: 45**input** <identifier> tap <enabled|disabled>::
46 Enables or disables tap for specified input device. 46 Enables or disables tap for specified input device.
47
48See Also
49--------
50
51**sway**(5)
diff --git a/sway/sway.5.txt b/sway/sway.5.txt
index 9777491e..b54ae8da 100644
--- a/sway/sway.5.txt
+++ b/sway/sway.5.txt
@@ -224,3 +224,8 @@ Currently supported attributes:
224 Compare against the workspace name for this view. Can be a regular expression. 224 Compare against the workspace name for this view. Can be a regular expression.
225 If value is _focused_ then all the views on the currently focused workspace 225 If value is _focused_ then all the views on the currently focused workspace
226 matches. 226 matches.
227
228See Also
229--------
230
231**sway**(1) **sway-input**(5)
diff --git a/swaybar/main.c b/swaybar/main.c
index 98b75aee..a3a3b56a 100644
--- a/swaybar/main.c
+++ b/swaybar/main.c
@@ -1191,17 +1191,31 @@ int main(int argc, char **argv) {
1191 bool debug = false; 1191 bool debug = false;
1192 1192
1193 static struct option long_options[] = { 1193 static struct option long_options[] = {
1194 {"help", no_argument, NULL, 'h'},
1194 {"version", no_argument, NULL, 'v'}, 1195 {"version", no_argument, NULL, 'v'},
1195 {"socket", required_argument, NULL, 's'}, 1196 {"socket", required_argument, NULL, 's'},
1196 {"bar_id", required_argument, NULL, 'b'}, 1197 {"bar_id", required_argument, NULL, 'b'},
1197 {"debug", required_argument, NULL, 'd'}, 1198 {"debug", no_argument, NULL, 'd'},
1198 {0, 0, 0, 0} 1199 {0, 0, 0, 0}
1199 }; 1200 };
1200 1201
1202 const char *usage =
1203 "Usage: swaybar [options...] <output>\n"
1204 "\n"
1205 " -h, --help Show help message and quit.\n"
1206 " -v, --version Show the version number and quit.\n"
1207 " -s, --socket <socket> Connect to sway via socket.\n"
1208 " -b, --bar_id <id> Bar ID for which to get the configuration.\n"
1209 " -d, --debug Enable debugging.\n"
1210 "\n"
1211 " PLEASE NOTE that swaybar will be automatically started by sway as\n"
1212 " soon as there is a 'bar' configuration block in your config file.\n"
1213 " You should never need to start it manually.\n";
1214
1201 int c; 1215 int c;
1202 while (1) { 1216 while (1) {
1203 int option_index = 0; 1217 int option_index = 0;
1204 c = getopt_long(argc, argv, "vs:b:d", long_options, &option_index); 1218 c = getopt_long(argc, argv, "hvs:b:d", long_options, &option_index);
1205 if (c == -1) { 1219 if (c == -1) {
1206 break; 1220 break;
1207 } 1221 }
@@ -1224,6 +1238,7 @@ int main(int argc, char **argv) {
1224 debug = true; 1238 debug = true;
1225 break; 1239 break;
1226 default: 1240 default:
1241 fprintf(stderr, "%s", usage);
1227 exit(EXIT_FAILURE); 1242 exit(EXIT_FAILURE);
1228 } 1243 }
1229 } 1244 }
diff --git a/swaylock/main.c b/swaylock/main.c
index 9de95e7a..c01445e7 100644
--- a/swaylock/main.c
+++ b/swaylock/main.c
@@ -7,6 +7,7 @@
7#include <string.h> 7#include <string.h>
8#include <sys/types.h> 8#include <sys/types.h>
9#include <pwd.h> 9#include <pwd.h>
10#include <getopt.h>
10#include "client/window.h" 11#include "client/window.h"
11#include "client/registry.h" 12#include "client/registry.h"
12#include "client/cairo.h" 13#include "client/cairo.h"
@@ -91,7 +92,66 @@ void notify_key(enum wl_keyboard_key_state state, xkb_keysym_t sym, uint32_t cod
91} 92}
92 93
93int main(int argc, char **argv) { 94int main(int argc, char **argv) {
95 char *image_path = NULL;
96 char *scaling_mode_str = "fit";
97
94 init_log(L_INFO); 98 init_log(L_INFO);
99
100 static struct option long_options[] = {
101 {"help", no_argument, NULL, 'h'},
102 {"image", required_argument, NULL, 'i'},
103 {"scaling", required_argument, NULL, 's'},
104 {"tiling", no_argument, NULL, 't'},
105 {"version", no_argument, NULL, 'v'},
106 {0, 0, 0, 0}
107 };
108
109 const char *usage =
110 "Usage: swaylock [options...]\n"
111 "\n"
112 " -h, --help Show help message and quit.\n"
113 " -s, --scaling Scaling mode: stretch, fill, fit, center, tile.\n"
114 " -t, --tiling Same as --scaling=tile.\n"
115 " -v, --version Show the version number and quit.\n"
116 " -i, --image <path> Display the given image.\n";
117
118 int c;
119 while (1) {
120 int option_index = 0;
121 c = getopt_long(argc, argv, "hi:s:tv", long_options, &option_index);
122 if (c == -1) {
123 break;
124 }
125 switch (c) {
126 case 'i':
127 image_path = optarg;
128 break;
129 case 's':
130 scaling_mode_str = optarg;
131 break;
132 case 't':
133 scaling_mode_str = "tile";
134 break;
135 case 'v':
136#if defined SWAY_GIT_VERSION && defined SWAY_GIT_BRANCH && defined SWAY_VERSION_DATE
137 fprintf(stdout, "swaylock version %s (%s, branch \"%s\")\n", SWAY_GIT_VERSION, SWAY_VERSION_DATE, SWAY_GIT_BRANCH);
138#else
139 fprintf(stdout, "version not detected\n");
140#endif
141 exit(EXIT_SUCCESS);
142 break;
143 default:
144 fprintf(stderr, "%s", usage);
145 exit(EXIT_FAILURE);
146 }
147 }
148
149 // TODO: support locking without image
150 if (!image_path) {
151 fprintf(stderr, "No image specified!\n");
152 exit(EXIT_FAILURE);
153 }
154
95 password = malloc(1024); // TODO: Let this grow 155 password = malloc(1024); // TODO: Let this grow
96 password[0] = '\0'; 156 password[0] = '\0';
97 surfaces = create_list(); 157 surfaces = create_list();
@@ -115,7 +175,7 @@ int main(int argc, char **argv) {
115 175
116#ifdef WITH_GDK_PIXBUF 176#ifdef WITH_GDK_PIXBUF
117 GError *err = NULL; 177 GError *err = NULL;
118 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(argv[1], &err); // TODO: Parse i3lock arguments 178 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(image_path, &err);
119 if (!pixbuf) { 179 if (!pixbuf) {
120 sway_abort("Failed to load background image."); 180 sway_abort("Failed to load background image.");
121 } 181 }
@@ -130,7 +190,6 @@ int main(int argc, char **argv) {
130 double width = cairo_image_surface_get_width(image); 190 double width = cairo_image_surface_get_width(image);
131 double height = cairo_image_surface_get_height(image); 191 double height = cairo_image_surface_get_height(image);
132 192
133 const char *scaling_mode_str = argv[2];
134 enum scaling_mode scaling_mode = SCALING_MODE_STRETCH; 193 enum scaling_mode scaling_mode = SCALING_MODE_STRETCH;
135 if (strcmp(scaling_mode_str, "stretch") == 0) { 194 if (strcmp(scaling_mode_str, "stretch") == 0) {
136 scaling_mode = SCALING_MODE_STRETCH; 195 scaling_mode = SCALING_MODE_STRETCH;