diff options
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | config | 21 | ||||
-rw-r--r-- | sway/handlers.c | 6 | ||||
-rw-r--r-- | swaybar/main.c | 36 | ||||
-rw-r--r-- | wallpaper.jpg | bin | 0 -> 2458443 bytes |
5 files changed, 61 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 94f2ab29..109b233a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,4 +119,10 @@ install( COMPONENT data ) +install( + FILES ${CMAKE_CURRENT_SOURCE_DIR}/wallpaper.jpg + DESTINATION share/sway + COMPONENT data +) + feature_summary(WHAT ALL) @@ -16,6 +16,15 @@ set $term urxvt # Your preferred application launcher set $menu dmenu_run +### Output configuration +# +# Default wallpaper - CC-BY-NC from Netzlemming http://netzlemming.deviantart.com/art/Field-of-Barley-05240017-307176737 +output * bg /usr/share/sway/wallpaper.jpg fill +# +# Example output configuration: +# +# output HDMI-A-1 resolution 1920x1080 position 1920,0 + ### Key bindings # # Basics: @@ -130,3 +139,15 @@ set $menu dmenu_run # Show the next scratchpad window or hide the focused scratchpad window. # If there are multiple scratchpad windows, this command cycles through them. bindsym $mod+minus scratchpad show + +# +# Status Bar: +# +bar { + position top + colors { + statusline #ffffff + background #323232 + inactive_workspace #32323200 #32323200 #5c5c5c + } +} diff --git a/sway/handlers.c b/sway/handlers.c index b8bd9eff..6c6d0e60 100644 --- a/sway/handlers.c +++ b/sway/handlers.c @@ -252,8 +252,12 @@ static void handle_view_destroyed(wlc_handle handle) { } if (view) { - swayc_t *parent = destroy_view(view); + bool fullscreen = swayc_is_fullscreen(view); remove_view_from_scratchpad(view); + swayc_t *parent = destroy_view(view); + if (fullscreen) { + parent->fullscreen = NULL; + } arrange_windows(parent, -1, -1); } else { // Is it unmanaged? diff --git a/swaybar/main.c b/swaybar/main.c index 49aa08cd..05c1fd75 100644 --- a/swaybar/main.c +++ b/swaybar/main.c @@ -75,6 +75,7 @@ char *output, *status_command; struct registry *registry; struct window *window; bool dirty = true; +char *separator_symbol = NULL; typedef enum {UNDEF, TEXT, I3BAR} command_protocol; command_protocol protocol = UNDEF; @@ -289,7 +290,7 @@ void bar_ipc_init(int outputi, const char *bar_id) { json_object *bar_config = json_tokener_parse(res); json_object *tray_output, *mode, *hidden_state, *position, *_status_command; json_object *font, *bar_height, *workspace_buttons, *strip_workspace_numbers; - json_object *binding_mode_indicator, *verbose, *_colors; + json_object *binding_mode_indicator, *verbose, *_colors, *sep_symbol; json_object_object_get_ex(bar_config, "tray_output", &tray_output); json_object_object_get_ex(bar_config, "mode", &mode); json_object_object_get_ex(bar_config, "hidden_state", &hidden_state); @@ -301,6 +302,7 @@ void bar_ipc_init(int outputi, const char *bar_id) { json_object_object_get_ex(bar_config, "strip_workspace_numbers", &strip_workspace_numbers); json_object_object_get_ex(bar_config, "binding_mode_indicator", &binding_mode_indicator); json_object_object_get_ex(bar_config, "verbose", &verbose); + json_object_object_get_ex(bar_config, "separator_symbol", &sep_symbol); json_object_object_get_ex(bar_config, "colors", &_colors); // TODO: More of these options @@ -317,6 +319,10 @@ void bar_ipc_init(int outputi, const char *bar_id) { window->font = parse_font(json_object_get_string(font)); } + if (sep_symbol) { + separator_symbol = strdup(json_object_get_string(sep_symbol)); + } + if (bar_height) { int width, height; get_text_size(window, &width, &height, "Test string for measuring purposes"); @@ -438,7 +444,7 @@ void render_sharp_line(cairo_t *cairo, uint32_t color, double x, double y, doubl } void render_block(struct status_block *block, double *x, bool edge) { - int width, height; + int width, height, sep_width; get_text_size(window, &width, &height, "%s", block->full_text); int textwidth = width; @@ -462,6 +468,13 @@ void render_block(struct status_block *block, double *x, bool edge) { // Add separator if (!edge) { + if (separator_symbol) { + get_text_size(window, &sep_width, &height, "%s", separator_symbol); + if (sep_width > block->separator_block_width) { + block->separator_block_width = sep_width + margin * 2; + } + } + *x -= block->separator_block_width; } else { *x -= margin; @@ -535,14 +548,23 @@ void render_block(struct status_block *block, double *x, bool edge) { pos += block->border_right; } + sway_log(L_DEBUG, "%s", separator_symbol); + // render separator - // TODO: Handle custom separator if (!edge && block->separator) { cairo_set_source_u32(window->cairo, colors.separator); - cairo_set_line_width(window->cairo, 1); - cairo_move_to(window->cairo, pos + block->separator_block_width/2, margin); - cairo_line_to(window->cairo, pos + block->separator_block_width/2, window->height - margin); - cairo_stroke(window->cairo); + if (separator_symbol) { + offset = pos + (block->separator_block_width - sep_width) / 2; + cairo_move_to(window->cairo, offset, margin); + pango_printf(window, "%s", separator_symbol); + } else { + cairo_set_line_width(window->cairo, 1); + cairo_move_to(window->cairo, pos + block->separator_block_width/2, + margin); + cairo_line_to(window->cairo, pos + block->separator_block_width/2, + window->height - margin); + cairo_stroke(window->cairo); + } } } diff --git a/wallpaper.jpg b/wallpaper.jpg Binary files differnew file mode 100644 index 00000000..65a167f0 --- /dev/null +++ b/wallpaper.jpg |