aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt6
-rw-r--r--config21
-rw-r--r--include/container.h5
-rw-r--r--sway/commands.c8
-rw-r--r--sway/container.c10
-rw-r--r--sway/handlers.c6
-rw-r--r--sway/main.c8
-rw-r--r--wallpaper.jpgbin0 -> 2458443 bytes
8 files changed, 56 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(
119 COMPONENT data 119 COMPONENT data
120) 120)
121 121
122install(
123 FILES ${CMAKE_CURRENT_SOURCE_DIR}/wallpaper.jpg
124 DESTINATION share/sway
125 COMPONENT data
126)
127
122feature_summary(WHAT ALL) 128feature_summary(WHAT ALL)
diff --git a/config b/config
index 2bb37f4f..f7e9e751 100644
--- a/config
+++ b/config
@@ -16,6 +16,15 @@ set $term urxvt
16# Your preferred application launcher 16# Your preferred application launcher
17set $menu dmenu_run 17set $menu dmenu_run
18 18
19### Output configuration
20#
21# Default wallpaper - CC-BY-NC from Netzlemming http://netzlemming.deviantart.com/art/Field-of-Barley-05240017-307176737
22output * bg /usr/share/sway/wallpaper.jpg fill
23#
24# Example output configuration:
25#
26# output HDMI-A-1 resolution 1920x1080 position 1920,0
27
19### Key bindings 28### Key bindings
20# 29#
21# Basics: 30# Basics:
@@ -130,3 +139,15 @@ set $menu dmenu_run
130 # Show the next scratchpad window or hide the focused scratchpad window. 139 # Show the next scratchpad window or hide the focused scratchpad window.
131 # If there are multiple scratchpad windows, this command cycles through them. 140 # If there are multiple scratchpad windows, this command cycles through them.
132 bindsym $mod+minus scratchpad show 141 bindsym $mod+minus scratchpad show
142
143#
144# Status Bar:
145#
146bar {
147 position top
148 colors {
149 statusline #ffffff
150 background #323232
151 inactive_workspace #32323200 #32323200 #5c5c5c
152 }
153}
diff --git a/include/container.h b/include/container.h
index d76160de..d5126e74 100644
--- a/include/container.h
+++ b/include/container.h
@@ -260,4 +260,9 @@ void add_gaps(swayc_t *view, void *amount);
260 */ 260 */
261void update_visibility(swayc_t *container); 261void update_visibility(swayc_t *container);
262 262
263/**
264 * Close all child views of container
265 */
266void close_views(swayc_t *container);
267
263#endif 268#endif
diff --git a/sway/commands.c b/sway/commands.c
index 0955db38..fe341cd5 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -318,12 +318,6 @@ static struct cmd_results *cmd_exec(int argc, char **argv) {
318 return cmd_exec_always(argc, argv); 318 return cmd_exec_always(argc, argv);
319} 319}
320 320
321static void kill_views(swayc_t *container, void *data) {
322 if (container->type == C_VIEW) {
323 wlc_view_close(container->handle);
324 }
325}
326
327static struct cmd_results *cmd_exit(int argc, char **argv) { 321static struct cmd_results *cmd_exit(int argc, char **argv) {
328 struct cmd_results *error = NULL; 322 struct cmd_results *error = NULL;
329 if (config->reading) return cmd_results_new(CMD_FAILURE, "exit", "Can't be used in config file."); 323 if (config->reading) return cmd_results_new(CMD_FAILURE, "exit", "Can't be used in config file.");
@@ -331,7 +325,7 @@ static struct cmd_results *cmd_exit(int argc, char **argv) {
331 return error; 325 return error;
332 } 326 }
333 // Close all views 327 // Close all views
334 container_map(&root_container, kill_views, NULL); 328 close_views(&root_container);
335 sway_terminate(); 329 sway_terminate();
336 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 330 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
337} 331}
diff --git a/sway/container.c b/sway/container.c
index e6fa4f37..dcf4dcc8 100644
--- a/sway/container.c
+++ b/sway/container.c
@@ -796,3 +796,13 @@ void add_gaps(swayc_t *view, void *_data) {
796 } 796 }
797 } 797 }
798} 798}
799
800static void close_view(swayc_t *container, void *data) {
801 if (container->type == C_VIEW) {
802 wlc_view_close(container->handle);
803 }
804}
805
806void close_views(swayc_t *container) {
807 container_map(container, close_view, NULL);
808}
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) {
252 } 252 }
253 253
254 if (view) { 254 if (view) {
255 swayc_t *parent = destroy_view(view); 255 bool fullscreen = swayc_is_fullscreen(view);
256 remove_view_from_scratchpad(view); 256 remove_view_from_scratchpad(view);
257 swayc_t *parent = destroy_view(view);
258 if (fullscreen) {
259 parent->fullscreen = NULL;
260 }
257 arrange_windows(parent, -1, -1); 261 arrange_windows(parent, -1, -1);
258 } else { 262 } else {
259 // Is it unmanaged? 263 // Is it unmanaged?
diff --git a/sway/main.c b/sway/main.c
index 382e7ca2..37681f2d 100644
--- a/sway/main.c
+++ b/sway/main.c
@@ -26,6 +26,11 @@ void sway_terminate(void) {
26 wlc_terminate(); 26 wlc_terminate();
27} 27}
28 28
29void sig_handler(int signal) {
30 close_views(&root_container);
31 sway_terminate();
32}
33
29static void wlc_log_handler(enum wlc_log_type type, const char *str) { 34static void wlc_log_handler(enum wlc_log_type type, const char *str) {
30 if (type == WLC_LOG_ERROR) { 35 if (type == WLC_LOG_ERROR) {
31 sway_log(L_ERROR, "[wlc] %s", str); 36 sway_log(L_ERROR, "[wlc] %s", str);
@@ -176,6 +181,9 @@ int main(int argc, char **argv) {
176 } 181 }
177 register_extensions(); 182 register_extensions();
178 183
184 // handle SIGTERM signals
185 signal(SIGTERM, sig_handler);
186
179#if defined SWAY_GIT_VERSION && defined SWAY_GIT_BRANCH && defined SWAY_VERSION_DATE 187#if defined SWAY_GIT_VERSION && defined SWAY_GIT_BRANCH && defined SWAY_VERSION_DATE
180 sway_log(L_INFO, "Starting sway version %s (%s, branch \"%s\")\n", SWAY_GIT_VERSION, SWAY_VERSION_DATE, SWAY_GIT_BRANCH); 188 sway_log(L_INFO, "Starting sway version %s (%s, branch \"%s\")\n", SWAY_GIT_VERSION, SWAY_VERSION_DATE, SWAY_GIT_BRANCH);
181#endif 189#endif
diff --git a/wallpaper.jpg b/wallpaper.jpg
new file mode 100644
index 00000000..65a167f0
--- /dev/null
+++ b/wallpaper.jpg
Binary files differ