diff options
-rwxr-xr-x | .ci/build.sh | 16 | ||||
-rw-r--r-- | .travis.yml | 12 | ||||
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | completions/zsh/_swaygrab | 25 | ||||
-rw-r--r-- | sway/CMakeLists.txt | 3 | ||||
-rw-r--r-- | sway/commands.c | 11 | ||||
-rw-r--r-- | sway/handlers.c | 1 | ||||
-rw-r--r-- | sway/main.c | 3 | ||||
-rw-r--r-- | sway/sway-input.5.txt | 31 | ||||
-rw-r--r-- | sway/sway.5.txt | 5 | ||||
-rw-r--r-- | swaybar/main.c | 19 | ||||
-rw-r--r-- | swaylock/main.c | 63 |
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 @@ -#!/bin/bash - -# clone and build wlc -git clone https://github.com/Cloudef/wlc.git -cd wlc -git submodule update --init --recursive # - initialize and fetch submodules -mkdir target && cd target # - create build target directory -cmake -DCMAKE_BUILD_TYPE=Upstream .. # - run CMake -make # - compile -sudo make install # - install - -cd ../.. - -# build sway -cmake . -make diff --git a/.travis.yml b/.travis.yml index dfa48fa4..a8e292ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,22 +11,16 @@ arch: - cmake - xorg-server-xwayland - asciidoc - - pcre - json-c - - pixman - wayland - - libxkbcommon - - libinput - - libx11 - - libxcb - xcb-util-image - - libgl - - mesa - pango - cairo - gdk-pixbuf2 + - wlc-git script: - - "bash .ci/build.sh" + - "cmake ." + - "make" script: - "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) find_package(PAM) find_package(LibInput REQUIRED) -include_directories(${LIBINPUT_INClUDE_DIRS}) find_package(Backtrace) if(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 @@ #----------------- # Description # ----------- -# -# Completion script for swaygrab in the sway wm (http://swaywm.org) +# +# Completion script for swaygrab in sway wm (http://swaywm.org) # # ----------------------------------------------------- # Author @@ -13,16 +13,11 @@ # # ------------------------------------------ -_swaygrab() { - local -a options - options=('--version:shows version' - '--help:shows help message' - '--capture:Captures multiple frames as video as passes into ffmpeg until SIGTERM (ctrl+c) is sent to swaygrab' - '--output:Use the specified output. If no output is defined, the currently focused output in sway is used' - '--socket:Use the specified socket path. Otherwise, swayuses $SWAYSOCK then $I3SOCK' - '--rate:Specify a framerate (in fps). Used in combination with -c. Default is 30 and must be an integer' - '--raw:Instead of ImageMagick or ffmpeg, dump raw rgba data to stdout' - ) - _describe 'values' options - } -_swaygrab "$@" +_arguments -s \ + '(-h --help)'{-h,--help}'[Shows help message]' \ + '(-c --capture)'{-c,--capture}'[Captures multiple frames as video and passes them to ffmpeg]' \ + '(-o --output)'{-o,--output}'[Use the specified output. If not specified then current focused output will be used]' \ + '(-v --version)'{-v,--version}'[Print the version (of swaymsg) and quit]' \ + '(-s --socket)'{-s,--socket}'[Use the specified socket path. Otherwise, sway uses $SWAYSOCK then $I3SOCK]' \ + '(-r --rate)'{-r,--rate}'[Specify a framerate (in fps). Used in combination with -c. Default is 30 and must be an integer]' \ + '(--raw)--raw[Instead of ImageMagick or ffmpeg, dump raw rgba data to stdout]' 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( ${PCRE_INCLUDE_DIRS} ${JSONC_INCLUDE_DIRS} ${XKBCOMMON_INCLUDE_DIRS} - ${LIBINPUT_LIBRARIES} + ${LIBINPUT_INCLUDE_DIRS} ) add_executable(sway @@ -56,3 +56,4 @@ install( add_manpage(sway 1) add_manpage(sway 5) +add_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) { char *criteria = *argv++; - if (strncmp(*argv, "→", 1) == 0) { + if (strncmp(*argv, "→", strlen("→")) == 0) { + if (argc < 3) { + return cmd_results_new(CMD_INVALID, "assign", "Missing workspace"); + } argv++; } char *movecmd = "move container to workspace "; - int arglen = strlen(*argv); - char *cmdlist = calloc(1, sizeof(movecmd) + arglen); + int arglen = strlen(movecmd) + strlen(*argv) + 1; + char *cmdlist = calloc(1, arglen); - sprintf(cmdlist, "%s%s", movecmd, *argv); + snprintf(cmdlist, arglen, "%s%s", movecmd, *argv); struct criteria *crit = malloc(sizeof(struct criteria)); 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) { sway_log(L_DEBUG, "Adding unmanaged window %p to %p", h, output->unmanaged); list_add(output->unmanaged, h); } + wlc_view_set_mask(handle, VISIBLE); return true; } 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) { // handle SIGTERM signals signal(SIGTERM, sig_handler); + // prevent ipc from crashing sway + signal(SIGPIPE, SIG_IGN); + #if defined SWAY_GIT_VERSION && defined SWAY_GIT_BRANCH && defined SWAY_VERSION_DATE sway_log(L_INFO, "Starting sway version %s (%s, branch \"%s\")\n", SWAY_GIT_VERSION, SWAY_VERSION_DATE, SWAY_GIT_BRANCH); #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 @@ ///// vim:set ts=4 sw=4 tw=82 noet: ///// -sway (5) -======== +sway-input (5) +============== Name ---- -sway - input configuration file and commands +sway-input - input configuration file and commands Description ----------- -Sway allows for configuration of libinput dveices. +Sway allows for configuration of libinput devices. Commands -------- -**input** <identifier> click_method <none|button_areas|clickfinger>: +**input** <identifier> click_method <none|button_areas|clickfinger>:: Changes the click method for the specified device. -**input** <identifier> drag_lock <enabled|disabled>: +**input** <identifier> drag_lock <enabled|disabled>:: Enables or disables drag lock for specified input device. -**input** <identifier> dwt <enabled|disabled>: +**input** <identifier> dwt <enabled|disabled>:: Enables or disables disable-while-typing for the specified input device. -**input** <identifier> events <enable|disabled>: +**input** <identifier> events <enable|disabled>:: Enables or disables send_events for specified input device. (Disabling send_events disables the input device) -**input** <identifier> middle_emulation <enabled|disabled>: +**input** <identifier> middle_emulation <enabled|disabled>:: Enables or disables middle click emulation. -**input** <identifier> natural_scroll <enabled|disabled>: +**input** <identifier> natural_scroll <enabled|disabled>:: Enables or disables natural scrolling for the specified input device. -**input** <identifier> pointer_accel <[-1,1]>: +**input** <identifier> pointer_accel <[-1,1]>:: Changes the pointer acceleration for the specified input device. -**input** <identifier> scroll_method <none|two_finger|edge|on_button_down>: +**input** <identifier> scroll_method <none|two_finger|edge|on_button_down>:: Changes the scroll method for the specified input device. -**input** <identifier> tap <enabled|disabled>: +**input** <identifier> tap <enabled|disabled>:: Enables or disables tap for specified input device. + +See Also +-------- + +**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: Compare against the workspace name for this view. Can be a regular expression. If value is _focused_ then all the views on the currently focused workspace matches. + +See Also +-------- + +**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) { bool debug = false; static struct option long_options[] = { + {"help", no_argument, NULL, 'h'}, {"version", no_argument, NULL, 'v'}, {"socket", required_argument, NULL, 's'}, {"bar_id", required_argument, NULL, 'b'}, - {"debug", required_argument, NULL, 'd'}, + {"debug", no_argument, NULL, 'd'}, {0, 0, 0, 0} }; + const char *usage = + "Usage: swaybar [options...] <output>\n" + "\n" + " -h, --help Show help message and quit.\n" + " -v, --version Show the version number and quit.\n" + " -s, --socket <socket> Connect to sway via socket.\n" + " -b, --bar_id <id> Bar ID for which to get the configuration.\n" + " -d, --debug Enable debugging.\n" + "\n" + " PLEASE NOTE that swaybar will be automatically started by sway as\n" + " soon as there is a 'bar' configuration block in your config file.\n" + " You should never need to start it manually.\n"; + int c; while (1) { int option_index = 0; - c = getopt_long(argc, argv, "vs:b:d", long_options, &option_index); + c = getopt_long(argc, argv, "hvs:b:d", long_options, &option_index); if (c == -1) { break; } @@ -1224,6 +1238,7 @@ int main(int argc, char **argv) { debug = true; break; default: + fprintf(stderr, "%s", usage); exit(EXIT_FAILURE); } } 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 @@ #include <string.h> #include <sys/types.h> #include <pwd.h> +#include <getopt.h> #include "client/window.h" #include "client/registry.h" #include "client/cairo.h" @@ -91,7 +92,66 @@ void notify_key(enum wl_keyboard_key_state state, xkb_keysym_t sym, uint32_t cod } int main(int argc, char **argv) { + char *image_path = NULL; + char *scaling_mode_str = "fit"; + init_log(L_INFO); + + static struct option long_options[] = { + {"help", no_argument, NULL, 'h'}, + {"image", required_argument, NULL, 'i'}, + {"scaling", required_argument, NULL, 's'}, + {"tiling", no_argument, NULL, 't'}, + {"version", no_argument, NULL, 'v'}, + {0, 0, 0, 0} + }; + + const char *usage = + "Usage: swaylock [options...]\n" + "\n" + " -h, --help Show help message and quit.\n" + " -s, --scaling Scaling mode: stretch, fill, fit, center, tile.\n" + " -t, --tiling Same as --scaling=tile.\n" + " -v, --version Show the version number and quit.\n" + " -i, --image <path> Display the given image.\n"; + + int c; + while (1) { + int option_index = 0; + c = getopt_long(argc, argv, "hi:s:tv", long_options, &option_index); + if (c == -1) { + break; + } + switch (c) { + case 'i': + image_path = optarg; + break; + case 's': + scaling_mode_str = optarg; + break; + case 't': + scaling_mode_str = "tile"; + break; + case 'v': +#if defined SWAY_GIT_VERSION && defined SWAY_GIT_BRANCH && defined SWAY_VERSION_DATE + fprintf(stdout, "swaylock version %s (%s, branch \"%s\")\n", SWAY_GIT_VERSION, SWAY_VERSION_DATE, SWAY_GIT_BRANCH); +#else + fprintf(stdout, "version not detected\n"); +#endif + exit(EXIT_SUCCESS); + break; + default: + fprintf(stderr, "%s", usage); + exit(EXIT_FAILURE); + } + } + + // TODO: support locking without image + if (!image_path) { + fprintf(stderr, "No image specified!\n"); + exit(EXIT_FAILURE); + } + password = malloc(1024); // TODO: Let this grow password[0] = '\0'; surfaces = create_list(); @@ -115,7 +175,7 @@ int main(int argc, char **argv) { #ifdef WITH_GDK_PIXBUF GError *err = NULL; - GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(argv[1], &err); // TODO: Parse i3lock arguments + GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(image_path, &err); if (!pixbuf) { sway_abort("Failed to load background image."); } @@ -130,7 +190,6 @@ int main(int argc, char **argv) { double width = cairo_image_surface_get_width(image); double height = cairo_image_surface_get_height(image); - const char *scaling_mode_str = argv[2]; enum scaling_mode scaling_mode = SCALING_MODE_STRETCH; if (strcmp(scaling_mode_str, "stretch") == 0) { scaling_mode = SCALING_MODE_STRETCH; |