Implement exit command, document it in manpage, add it to defaultconfig (Mod1+Shift+e)
This commit is contained in:
parent
21e62ae9b7
commit
cc0b060628
2
CMDMODE
2
CMDMODE
|
@ -17,7 +17,7 @@ with := <w> { [ <times> ] <where> }+ <space> <cmd>
|
||||||
|
|
||||||
oder
|
oder
|
||||||
|
|
||||||
exec := exec <path>
|
special := [ exec <path> | exit | restart ]
|
||||||
|
|
||||||
an jeder Stelle kann mit escape abgebrochen werden
|
an jeder Stelle kann mit escape abgebrochen werden
|
||||||
|
|
||||||
|
|
|
@ -76,5 +76,8 @@ bind Mod1+36 exec /usr/bin/urxvt
|
||||||
# for now, we don’t have an own launcher
|
# for now, we don’t have an own launcher
|
||||||
bind Mod1+55 exec /usr/bin/dmenu_run
|
bind Mod1+55 exec /usr/bin/dmenu_run
|
||||||
|
|
||||||
|
# Mod1+Shift+e exits i3
|
||||||
|
bind Mod1+Shift+26 exit
|
||||||
|
|
||||||
# Mod1+Shift+r restarts i3 inplace
|
# Mod1+Shift+r restarts i3 inplace
|
||||||
bind Mod1+Shift+27 restart
|
bind Mod1+Shift+27 restart
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#define _UTIL_H
|
#define _UTIL_H
|
||||||
|
|
||||||
#define exit_if_null(pointer, ...) { if (pointer == NULL) die(__VA_ARGS__); }
|
#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) ? \
|
#define CIRCLEQ_NEXT_OR_NULL(head, elm, field) (CIRCLEQ_NEXT(elm, field) != CIRCLEQ_END(head) ? \
|
||||||
CIRCLEQ_NEXT(elm, field) : NULL)
|
CIRCLEQ_NEXT(elm, field) : NULL)
|
||||||
#define CIRCLEQ_PREV_OR_NULL(head, elm, field) (CIRCLEQ_PREV(elm, field) != CIRCLEQ_END(head) ? \
|
#define CIRCLEQ_PREV_OR_NULL(head, elm, field) (CIRCLEQ_PREV(elm, field) != CIRCLEQ_END(head) ? \
|
||||||
|
|
11
man/i3.man
11
man/i3.man
|
@ -108,6 +108,12 @@ Enable stacking layout for the current container.
|
||||||
Mod1+d::
|
Mod1+d::
|
||||||
Enable default layout for the current container.
|
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
|
== FILES
|
||||||
|
|
||||||
=== ~/.i3/config
|
=== ~/.i3/config
|
||||||
|
@ -136,9 +142,12 @@ bind Mod1+73 exec /home/michael/toggle_beamer.sh
|
||||||
# Screen locking
|
# Screen locking
|
||||||
bind Mod1+68 exec /usr/bin/i3lock
|
bind Mod1+68 exec /usr/bin/i3lock
|
||||||
|
|
||||||
# Restart i3 inplace
|
# Restart i3 inplace (Mod1+Shift+r)
|
||||||
bind Mod1+Shift+27 restart
|
bind Mod1+Shift+27 restart
|
||||||
|
|
||||||
|
# Exit i3 (Mod1+Shift+e)
|
||||||
|
bind Mod1+Shift+26 exit
|
||||||
|
|
||||||
# Brightness
|
# Brightness
|
||||||
bind Mod1+97 exec sudo sh -c "echo up > /proc/acpi/ibm/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"
|
bind Mod1+103 exec sudo sh -c "echo down > /proc/acpi/ibm/brightness"
|
||||||
|
|
|
@ -552,15 +552,19 @@ void parse_command(xcb_connection_t *conn, const char *command) {
|
||||||
if (command[0] == '\0')
|
if (command[0] == '\0')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Is it an <exec>? */
|
/* Is it an <exec>? Then execute the given command. */
|
||||||
if (strncmp(command, "exec ", strlen("exec ")) == 0) {
|
if (STARTS_WITH(command, "exec ")) {
|
||||||
LOG("starting \"%s\"\n", command + strlen("exec "));
|
LOG("starting \"%s\"\n", command + strlen("exec "));
|
||||||
start_application(command+strlen("exec "));
|
start_application(command+strlen("exec "));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Is it <restart>? */
|
/* Is it an <exit>? */
|
||||||
if (strncmp(command, "restart", strlen("restart")) == 0) {
|
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);
|
LOG("restarting \"%s\"...\n", application_path);
|
||||||
execl(application_path, application_path, NULL);
|
execl(application_path, application_path, NULL);
|
||||||
/* not reached */
|
/* not reached */
|
||||||
|
|
Loading…
Reference in New Issue