diff --git a/Makefile b/Makefile index eac610d3..27890e83 100644 --- a/Makefile +++ b/Makefile @@ -11,16 +11,16 @@ MAN_DIR?=$(PREFIX)/share/man/man1 MAN_PAGE=$(PROGRAM).1 -BUILD_DIR=build SOURCE_DIR=source +CONFIG_DIR=config DOC_DIR=doc +BUILD_DIR=build -SOURCES=$(wildcard $(SOURCE_DIR)/*.c) -OBJECTS=$(SOURCES:$(SOURCE_DIR)/%.c=$(BUILD_DIR)/%.o) +SOURCES=$(wildcard $(SOURCE_DIR)/*.c $(CONFIG_DIR)/*.c ) +OBJECTS=$(SOURCES:%.c=$(BUILD_DIR)/%.o) HEADERS=$(wildcard include/*.h) OTHERS=Makefile LICENSE README.md - INSTALL_MANPAGE_PATH=$(MAN_DIR)/$(MAN_PAGE).gz INSTALL_PROGRAM=$(BIN_DIR)/$(PROGRAM) @@ -69,9 +69,11 @@ all: $(BUILD_DIR)/$(PROGRAM) $(BUILD_DIR): $(info Creating build dir) $(QUIET)mkdir -p $@ + $(QUIET)mkdir -p $@/$(SOURCE_DIR) + $(QUIET)mkdir -p $@/$(CONFIG_DIR) # Objects depend on header files and makefile too. -$(BUILD_DIR)/%.o: $(SOURCE_DIR)/%.c | Makefile $(HEADERS) $(BUILD_DIR) +$(BUILD_DIR)/%.o: %.c | Makefile $(HEADERS) $(BUILD_DIR) $(info Compiling $^ -> $@) $(QUIET) $(CC) $(CFLAGS) -c -o $@ $^ diff --git a/config/config.c b/config/config.c new file mode 100644 index 00000000..bafad3e8 --- /dev/null +++ b/config/config.c @@ -0,0 +1,54 @@ +/** + * simpleswitcher + * + * MIT/X11 License + * Modified 2013-2014 Qball Cow + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ +#include "simpleswitcher.h" + +Settings config = { + // Window settings + .window_opacity = 100, + // Menu settings + .menu_bw = 1, + .menu_width = 50, + .menu_lines = 15, + .menu_font = "mono-12", + .menu_fg = "#222222", + .menu_bg = "#f2f1f0", + .menu_bgalt = "#e9e8e7", + .menu_hlfg = "#ffffff", + .menu_hlbg = "#005577", + .menu_bc = "black", + // Behavior + .zeltak_mode = 0, + .terminal_emulator = "x-terminal-emulator", + .i3_mode = 0, + // Key binding + .window_key = "F12", + .run_key = "mod1+F2", + .ssh_key = "mod1+F3", + .location = CENTER, + .wmode = VERTICAL, + .inner_margin = 5 +}; diff --git a/include/simpleswitcher.h b/include/simpleswitcher.h index 70c1adc8..a04dac7b 100644 --- a/include/simpleswitcher.h +++ b/include/simpleswitcher.h @@ -1,7 +1,7 @@ #ifndef __SIMPLESWITCHER_H__ #define __SIMPLESWITCHER_H__ -#include +#include #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MIN(a, b) ((a) < (b) ? (a) : (b)) diff --git a/source/simpleswitcher.c b/source/simpleswitcher.c index a7f800b3..fa9e20d5 100644 --- a/source/simpleswitcher.c +++ b/source/simpleswitcher.c @@ -59,6 +59,8 @@ #include #endif +#include + #include "simpleswitcher.h" #include "run-dialog.h" #include "ssh-dialog.h" @@ -73,33 +75,6 @@ xdgHandle xdg_handle; const char *cache_dir = NULL; -Settings config = { - // Window settings - .window_opacity = 100, - // Menu settings - .menu_bw = 1, - .menu_width = 50, - .menu_lines = 15, - .menu_font = "mono-12", - .menu_fg = "#222222", - .menu_bg = "#f2f1f0", - .menu_bgalt = "#e9e8e7", - .menu_hlfg = "#ffffff", - .menu_hlbg = "#005577", - .menu_bc = "black", - // Behavior - .zeltak_mode = 0, - .terminal_emulator = "x-terminal-emulator", - .i3_mode = 0, - // Key binding - .window_key = "F12", - .run_key = "mod1+F2", - .ssh_key = "mod1+F3", - .location = CENTER, - .wmode = VERTICAL, - .inner_margin = 5 -}; - void* allocate( unsigned long bytes ) {