]> git.sur5r.net Git - i3/i3/commitdiff
Rename workspaces in startup sequences. 1539/head
authorMichael Hofmann <mh21@mh21.de>
Fri, 6 Mar 2015 23:13:54 +0000 (00:13 +0100)
committerMichael Hofmann <mh21@mh21.de>
Fri, 13 Mar 2015 09:35:20 +0000 (10:35 +0100)
When renaming workspaces, any workspace names in pending startup
sequences also need to be renamed.

include/startup.h
src/commands.c
src/startup.c

index 2f28baa772f9000918c9a6e341579d0f6a94c056..cb784913b303efc859a6894750673b4a596288ee 100644 (file)
@@ -44,6 +44,12 @@ void startup_sequence_delete(struct Startup_Sequence *sequence);
  */
 void startup_monitor_event(SnMonitorEvent *event, void *userdata);
 
+/**
+ * Renames workspaces that are mentioned in the startup sequences.
+ *
+ */
+void startup_sequence_rename_workspace(char *old_name, char *new_name);
+
 /**
  * Gets the stored startup sequence for the _NET_STARTUP_ID of a given window.
  *
index 92203e3925ba7ab730d510537238abc84941df4e..d3e2a6e3da59630c4b971b80eba04ef8cf082754 100644 (file)
@@ -2044,6 +2044,8 @@ void cmd_rename_workspace(I3_CMD, char *old_name, char *new_name) {
     ewmh_update_desktop_names();
     ewmh_update_desktop_viewport();
     ewmh_update_current_desktop();
+
+    startup_sequence_rename_workspace(old_name, new_name);
 }
 
 /*
index ebe8c1d9439601a426bee70aa512d95c70a7a44f..aa347bd75fe86096096b7bc0b6148f7859fe8a91 100644 (file)
@@ -257,6 +257,22 @@ void startup_monitor_event(SnMonitorEvent *event, void *userdata) {
     }
 }
 
+/**
+ * Renames workspaces that are mentioned in the startup sequences.
+ *
+ */
+void startup_sequence_rename_workspace(char *old_name, char *new_name) {
+    struct Startup_Sequence *current;
+    TAILQ_FOREACH(current, &startup_sequences, sequences) {
+        if (strcmp(current->workspace, old_name) != 0)
+            continue;
+        DLOG("Renaming workspace \"%s\" to \"%s\" in startup sequence %s.\n",
+             old_name, new_name, current->id);
+        free(current->workspace);
+        current->workspace = sstrdup(new_name);
+    }
+}
+
 /**
  * Gets the stored startup sequence for the _NET_STARTUP_ID of a given window.
  *