Implement exit command, document it in manpage, add it to defaultconfig (Mod1+Shift+e)

This commit is contained in:
Michael Stapelberg 2009-03-14 21:31:22 +01:00
parent 21e62ae9b7
commit cc0b060628
5 changed files with 23 additions and 6 deletions

View File

@ -17,7 +17,7 @@ with := <w> { [ <times> ] <where> }+ <space> <cmd>
oder
exec := exec <path>
special := [ exec <path> | exit | restart ]
an jeder Stelle kann mit escape abgebrochen werden

View File

@ -76,5 +76,8 @@ bind Mod1+36 exec /usr/bin/urxvt
# for now, we dont 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

View File

@ -16,6 +16,7 @@
#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) ? \

View File

@ -108,6 +108,12 @@ Enable stacking layout for the current container.
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
@ -136,9 +142,12 @@ bind Mod1+73 exec /home/michael/toggle_beamer.sh
# 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"

View File

@ -552,15 +552,19 @@ void parse_command(xcb_connection_t *conn, const char *command) {
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 */