Update clang-format

This commit is contained in:
Utkarsh Verma 2023-04-06 06:18:16 +05:30
parent a9f7763596
commit 2773129533
No known key found for this signature in database
GPG Key ID: 817656CF818EFCCC
10 changed files with 31 additions and 25 deletions

View File

@ -1,3 +1,6 @@
BasedOnStyle: Google BasedOnStyle: Google
IndentWidth: 4 IndentWidth: 4
ColumnLimit: 79 ColumnLimit: 79
AlignArrayOfStructures: Left
AlignConsecutiveMacros: true
AllowShortFunctionsOnASingleLine: None

View File

@ -16,7 +16,7 @@ VPATH := $(SRC_DIR)
OBJS := $(patsubst $(SRC_DIR)/%.c,$(BUILD_DIR)/%.o,$(wildcard $(SRC_DIR)/*.c)) OBJS := $(patsubst $(SRC_DIR)/%.c,$(BUILD_DIR)/%.o,$(wildcard $(SRC_DIR)/*.c))
OBJS += $(patsubst %.c,$(BUILD_DIR)/%.o,$(wildcard *.c)) OBJS += $(patsubst %.c,$(BUILD_DIR)/%.o,$(wildcard *.c))
INSTALL_DIR := $(subst //,/,$(DESTDIR)/$(PREFIX)/bin) INSTALL_DIR := $(DESTDIR)$(PREFIX)/bin
# Prettify output # Prettify output
PRINTF := @printf "%-8s %s\n" PRINTF := @printf "%-8s %s\n"
@ -39,8 +39,8 @@ $(BUILD_DIR):
$Qmkdir -p $@ $Qmkdir -p $@
clean: clean:
$(PRINTF) "RM" $(BUILD_DIR) $(PRINTF) "CLEAN" $(BUILD_DIR)
$Q$(RM) -r $(BUILD_DIR) $Q$(RM) $(BUILD_DIR)/*
install: $(BUILD_DIR)/$(BIN) install: $(BUILD_DIR)/$(BIN)
$(PRINTF) "INSTALL" $(INSTALL_DIR)/$(BIN) $(PRINTF) "INSTALL" $(INSTALL_DIR)/$(BIN)

View File

@ -3,19 +3,17 @@
#include "block.h" #include "block.h"
#include "util.h" #include "util.h"
// clang-format off
Block blocks[] = { Block blocks[] = {
{"sb-mail", 600 , 1 }, {"sb-mail", 600, 1 },
{"sb-music", 0, 2 }, {"sb-music", 0, 2 },
{"sb-disk", 1800, 3 }, {"sb-disk", 1800, 3 },
{"sb-memory", 10, 4 }, {"sb-memory", 10, 4 },
{"sb-loadavg", 5, 5 }, {"sb-loadavg", 5, 5 },
{"sb-mic", 0, 6 }, {"sb-mic", 0, 6 },
{"sb-record", 0, 7 }, {"sb-record", 0, 7 },
{"sb-volume", 0, 8 }, {"sb-volume", 0, 8 },
{"sb-battery", 5, 9 }, {"sb-battery", 5, 9 },
{"sb-date", 1, 10}, {"sb-date", 1, 10},
}; };
// clang-format on
const unsigned short blockCount = LEN(blocks); const unsigned short blockCount = LEN(blocks);

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#define CLICKABLE_BLOCKS 1 // Enable clickability for blocks #define CLICKABLE_BLOCKS 1 // Enable clickability for blocks
#define CMDLENGTH 45 // Number of characters that each block will output #define CMDLENGTH 45 // Trim block output to this length
#define DELIMITER " " // Delimiter string used to separate blocks #define DELIMITER " " // Delimiter string used to separate blocks
#define LEADING_DELIMITER 0 // Whether a leading separator should be used #define LEADING_DELIMITER 0 // Whether a leading separator should be used

View File

@ -1,6 +1,4 @@
#pragma once #pragma once
#define _GNU_SOURCE
#include "config.h" #include "config.h"
typedef struct { typedef struct {

View File

@ -1,7 +1,6 @@
#pragma once #pragma once
#include <unistd.h>
#define LEN(arr) (sizeof(arr) / sizeof(arr[0])) #define LEN(arr) (sizeof(arr) / sizeof(arr[0]))
#define MAX(a, b) (a > b ? a : b) #define MAX(a, b) (a > b ? a : b)
int gcd(int, int); int gcd(int, int);

View File

@ -1,8 +1,10 @@
#include "block.h" #include "block.h"
#define _GNU_SOURCE
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#include "util.h" #include "util.h"

View File

@ -47,7 +47,9 @@ void signalHandler() {
} }
} }
void termHandler() { statusContinue = 0; } void termHandler() {
statusContinue = 0;
}
void setupSignals() { void setupSignals() {
sigset_t handledSignals; sigset_t handledSignals;

View File

@ -1,5 +1,7 @@
#include "util.h" #include "util.h"
#include <unistd.h>
int gcd(int a, int b) { int gcd(int a, int b) {
int temp; int temp;
while (b > 0) { while (b > 0) {

View File

@ -15,7 +15,9 @@ int setupX() {
return 0; return 0;
} }
int closeX() { return XCloseDisplay(display); } int closeX() {
return XCloseDisplay(display);
}
void setXRootName(char *str) { void setXRootName(char *str) {
XStoreName(display, rootWindow, str); XStoreName(display, rootWindow, str);