oder
-exec := exec <path>
+special := [ exec <path> | exit | restart ]
an jeder Stelle kann mit escape abgebrochen werden
# for now, we don’t have an own launcher
bind Mod1+55 exec /usr/bin/dmenu_run
+# Mod1+Shift+e exits i3
+bind Mod1+Shift+26 exit
+
# Mod1+Shift+r restarts i3 inplace
bind Mod1+Shift+27 restart
#define _UTIL_H
#define exit_if_null(pointer, ...) { if (pointer == NULL) die(__VA_ARGS__); }
+#define STARTS_WITH(string, needle) (strncasecmp(string, needle, strlen(needle)) == 0)
#define CIRCLEQ_NEXT_OR_NULL(head, elm, field) (CIRCLEQ_NEXT(elm, field) != CIRCLEQ_END(head) ? \
CIRCLEQ_NEXT(elm, field) : NULL)
#define CIRCLEQ_PREV_OR_NULL(head, elm, field) (CIRCLEQ_PREV(elm, field) != CIRCLEQ_END(head) ? \
Mod1+d::
Enable default layout for the current container.
+Mod1+Shift+r::
+Restarts i3 in place (without losing any windows, but the layout).
+
+Mod1+Shift+e::
+Exits i3.
+
== FILES
=== ~/.i3/config
# Screen locking
bind Mod1+68 exec /usr/bin/i3lock
-# Restart i3 inplace
+# Restart i3 inplace (Mod1+Shift+r)
bind Mod1+Shift+27 restart
+# Exit i3 (Mod1+Shift+e)
+bind Mod1+Shift+26 exit
+
# Brightness
bind Mod1+97 exec sudo sh -c "echo up > /proc/acpi/ibm/brightness"
bind Mod1+103 exec sudo sh -c "echo down > /proc/acpi/ibm/brightness"
if (command[0] == '\0')
return;
- /* Is it an <exec>? */
- if (strncmp(command, "exec ", strlen("exec ")) == 0) {
+ /* Is it an <exec>? Then execute the given command. */
+ if (STARTS_WITH(command, "exec ")) {
LOG("starting \"%s\"\n", command + strlen("exec "));
start_application(command+strlen("exec "));
return;
}
- /* Is it <restart>? */
- if (strncmp(command, "restart", strlen("restart")) == 0) {
+ /* Is it an <exit>? */
+ if (STARTS_WITH(command, "exit"))
+ exit(0);
+
+ /* Is it <restart>? Then restart in place. */
+ if (STARTS_WITH(command, "restart")) {
LOG("restarting \"%s\"...\n", application_path);
execl(application_path, application_path, NULL);
/* not reached */