update: Clean up the Makefile
This commit is contained in:
parent
fd6489f13f
commit
004f5fbdcf
225
.clang-format
Normal file
225
.clang-format
Normal file
@ -0,0 +1,225 @@
|
|||||||
|
---
|
||||||
|
Language: Cpp
|
||||||
|
# BasedOnStyle: LLVM
|
||||||
|
AccessModifierOffset: -2
|
||||||
|
AlignAfterOpenBracket: DontAlign
|
||||||
|
AlignArrayOfStructures: Left
|
||||||
|
AlignConsecutiveAssignments:
|
||||||
|
Enabled: true
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignCompound: false
|
||||||
|
PadOperators: true
|
||||||
|
AlignConsecutiveBitFields:
|
||||||
|
Enabled: true
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignCompound: false
|
||||||
|
PadOperators: false
|
||||||
|
AlignConsecutiveDeclarations:
|
||||||
|
Enabled: true
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignCompound: false
|
||||||
|
PadOperators: false
|
||||||
|
AlignConsecutiveMacros:
|
||||||
|
Enabled: true
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignCompound: false
|
||||||
|
PadOperators: false
|
||||||
|
AlignEscapedNewlines: Right
|
||||||
|
AlignOperands: Align
|
||||||
|
AlignTrailingComments:
|
||||||
|
Kind: Always
|
||||||
|
OverEmptyLines: 0
|
||||||
|
AllowAllArgumentsOnNextLine: true
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: true
|
||||||
|
AllowShortBlocksOnASingleLine: Never
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: true
|
||||||
|
AllowShortFunctionsOnASingleLine: None
|
||||||
|
AllowShortIfStatementsOnASingleLine: Never
|
||||||
|
AllowShortLambdasOnASingleLine: All
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
AlwaysBreakAfterDefinitionReturnType: None
|
||||||
|
AlwaysBreakAfterReturnType: None
|
||||||
|
AlwaysBreakBeforeMultilineStrings: false
|
||||||
|
AlwaysBreakTemplateDeclarations: MultiLine
|
||||||
|
AttributeMacros:
|
||||||
|
- __capability
|
||||||
|
BinPackArguments: false
|
||||||
|
BinPackParameters: true
|
||||||
|
BitFieldColonSpacing: Both
|
||||||
|
BraceWrapping:
|
||||||
|
AfterCaseLabel: false
|
||||||
|
AfterClass: false
|
||||||
|
AfterControlStatement: Never
|
||||||
|
AfterEnum: false
|
||||||
|
AfterExternBlock: false
|
||||||
|
AfterFunction: false
|
||||||
|
AfterNamespace: false
|
||||||
|
AfterObjCDeclaration: false
|
||||||
|
AfterStruct: false
|
||||||
|
AfterUnion: false
|
||||||
|
BeforeCatch: false
|
||||||
|
BeforeElse: false
|
||||||
|
BeforeLambdaBody: false
|
||||||
|
BeforeWhile: false
|
||||||
|
IndentBraces: false
|
||||||
|
SplitEmptyFunction: true
|
||||||
|
SplitEmptyRecord: true
|
||||||
|
SplitEmptyNamespace: true
|
||||||
|
BreakAfterAttributes: Never
|
||||||
|
BreakAfterJavaFieldAnnotations: false
|
||||||
|
BreakArrays: true
|
||||||
|
BreakBeforeBinaryOperators: None
|
||||||
|
BreakBeforeConceptDeclarations: Always
|
||||||
|
BreakBeforeBraces: Attach
|
||||||
|
BreakBeforeInlineASMColon: OnlyMultiline
|
||||||
|
BreakBeforeTernaryOperators: true
|
||||||
|
BreakConstructorInitializers: BeforeColon
|
||||||
|
BreakInheritanceList: BeforeColon
|
||||||
|
BreakStringLiterals: true
|
||||||
|
ColumnLimit: 120
|
||||||
|
CommentPragmas: '^ IWYU pragma:'
|
||||||
|
CompactNamespaces: false
|
||||||
|
ConstructorInitializerIndentWidth: 4
|
||||||
|
ContinuationIndentWidth: 4
|
||||||
|
Cpp11BracedListStyle: true
|
||||||
|
DerivePointerAlignment: false
|
||||||
|
DisableFormat: false
|
||||||
|
EmptyLineAfterAccessModifier: Never
|
||||||
|
EmptyLineBeforeAccessModifier: LogicalBlock
|
||||||
|
ExperimentalAutoDetectBinPacking: false
|
||||||
|
FixNamespaceComments: true
|
||||||
|
ForEachMacros:
|
||||||
|
- foreach
|
||||||
|
- Q_FOREACH
|
||||||
|
- BOOST_FOREACH
|
||||||
|
IfMacros:
|
||||||
|
- KJ_IF_MAYBE
|
||||||
|
IncludeBlocks: Preserve
|
||||||
|
IncludeCategories:
|
||||||
|
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||||
|
Priority: 2
|
||||||
|
SortPriority: 0
|
||||||
|
CaseSensitive: false
|
||||||
|
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||||
|
Priority: 3
|
||||||
|
SortPriority: 0
|
||||||
|
CaseSensitive: false
|
||||||
|
- Regex: '.*'
|
||||||
|
Priority: 1
|
||||||
|
SortPriority: 0
|
||||||
|
CaseSensitive: false
|
||||||
|
IncludeIsMainRegex: '(Test)?$'
|
||||||
|
IncludeIsMainSourceRegex: ''
|
||||||
|
IndentAccessModifiers: false
|
||||||
|
IndentCaseBlocks: false
|
||||||
|
IndentCaseLabels: false
|
||||||
|
IndentExternBlock: AfterExternBlock
|
||||||
|
IndentGotoLabels: true
|
||||||
|
IndentPPDirectives: None
|
||||||
|
IndentRequiresClause: true
|
||||||
|
IndentWidth: 2
|
||||||
|
IndentWrappedFunctionNames: false
|
||||||
|
InsertBraces: false
|
||||||
|
InsertNewlineAtEOF: false
|
||||||
|
InsertTrailingCommas: None
|
||||||
|
IntegerLiteralSeparator:
|
||||||
|
Binary: 0
|
||||||
|
BinaryMinDigits: 0
|
||||||
|
Decimal: 0
|
||||||
|
DecimalMinDigits: 0
|
||||||
|
Hex: 0
|
||||||
|
HexMinDigits: 0
|
||||||
|
JavaScriptQuotes: Leave
|
||||||
|
JavaScriptWrapImports: true
|
||||||
|
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||||
|
LambdaBodyIndentation: Signature
|
||||||
|
LineEnding: DeriveLF
|
||||||
|
MacroBlockBegin: ''
|
||||||
|
MacroBlockEnd: ''
|
||||||
|
MaxEmptyLinesToKeep: 1
|
||||||
|
NamespaceIndentation: None
|
||||||
|
ObjCBinPackProtocolList: Auto
|
||||||
|
ObjCBlockIndentWidth: 2
|
||||||
|
ObjCBreakBeforeNestedBlockParam: true
|
||||||
|
ObjCSpaceAfterProperty: false
|
||||||
|
ObjCSpaceBeforeProtocolList: true
|
||||||
|
PackConstructorInitializers: BinPack
|
||||||
|
PenaltyBreakAssignment: 2
|
||||||
|
PenaltyBreakBeforeFirstCallParameter: 19
|
||||||
|
PenaltyBreakComment: 300
|
||||||
|
PenaltyBreakFirstLessLess: 120
|
||||||
|
PenaltyBreakOpenParenthesis: 0
|
||||||
|
PenaltyBreakString: 1000
|
||||||
|
PenaltyBreakTemplateDeclaration: 10
|
||||||
|
PenaltyExcessCharacter: 1000000
|
||||||
|
PenaltyIndentedWhitespace: 0
|
||||||
|
PenaltyReturnTypeOnItsOwnLine: 60
|
||||||
|
PointerAlignment: Right
|
||||||
|
PPIndentWidth: -1
|
||||||
|
QualifierAlignment: Leave
|
||||||
|
ReferenceAlignment: Pointer
|
||||||
|
ReflowComments: true
|
||||||
|
RemoveBracesLLVM: false
|
||||||
|
RemoveSemicolon: false
|
||||||
|
RequiresClausePosition: OwnLine
|
||||||
|
RequiresExpressionIndentation: OuterScope
|
||||||
|
SeparateDefinitionBlocks: Leave
|
||||||
|
ShortNamespaceLines: 1
|
||||||
|
SortIncludes: CaseSensitive
|
||||||
|
SortJavaStaticImport: Before
|
||||||
|
SortUsingDeclarations: LexicographicNumeric
|
||||||
|
SpaceAfterCStyleCast: false
|
||||||
|
SpaceAfterLogicalNot: false
|
||||||
|
SpaceAfterTemplateKeyword: true
|
||||||
|
SpaceAroundPointerQualifiers: Default
|
||||||
|
SpaceBeforeAssignmentOperators: true
|
||||||
|
SpaceBeforeCaseColon: false
|
||||||
|
SpaceBeforeCpp11BracedList: false
|
||||||
|
SpaceBeforeCtorInitializerColon: true
|
||||||
|
SpaceBeforeInheritanceColon: true
|
||||||
|
SpaceBeforeParens: ControlStatements
|
||||||
|
SpaceBeforeParensOptions:
|
||||||
|
AfterControlStatements: true
|
||||||
|
AfterForeachMacros: true
|
||||||
|
AfterFunctionDefinitionName: false
|
||||||
|
AfterFunctionDeclarationName: false
|
||||||
|
AfterIfMacros: true
|
||||||
|
AfterOverloadedOperator: false
|
||||||
|
AfterRequiresInClause: false
|
||||||
|
AfterRequiresInExpression: false
|
||||||
|
BeforeNonEmptyParentheses: false
|
||||||
|
SpaceBeforeRangeBasedForLoopColon: true
|
||||||
|
SpaceBeforeSquareBrackets: false
|
||||||
|
SpaceInEmptyBlock: false
|
||||||
|
SpaceInEmptyParentheses: false
|
||||||
|
SpacesBeforeTrailingComments: 1
|
||||||
|
SpacesInAngles: Never
|
||||||
|
SpacesInConditionalStatement: false
|
||||||
|
SpacesInContainerLiterals: true
|
||||||
|
SpacesInCStyleCastParentheses: false
|
||||||
|
SpacesInLineCommentPrefix:
|
||||||
|
Minimum: 1
|
||||||
|
Maximum: -1
|
||||||
|
SpacesInParentheses: false
|
||||||
|
SpacesInSquareBrackets: false
|
||||||
|
Standard: Latest
|
||||||
|
StatementAttributeLikeMacros:
|
||||||
|
- Q_EMIT
|
||||||
|
StatementMacros:
|
||||||
|
- Q_UNUSED
|
||||||
|
- QT_REQUIRE_VERSION
|
||||||
|
TabWidth: 8
|
||||||
|
UseTab: Never
|
||||||
|
WhitespaceSensitiveMacros:
|
||||||
|
- BOOST_PP_STRINGIZE
|
||||||
|
- CF_SWIFT_NAME
|
||||||
|
- NS_SWIFT_NAME
|
||||||
|
- PP_STRINGIZE
|
||||||
|
- STRINGIZE
|
||||||
|
...
|
||||||
|
|
74
Makefile
74
Makefile
@ -1,43 +1,67 @@
|
|||||||
SRCS = $(wildcard src/*.c)
|
|
||||||
HEADERS = $(wildcard src/*.h)
|
HEADERS = $(wildcard src/*.h)
|
||||||
|
CSRCS = $(wildcard src/*.c)
|
||||||
|
|
||||||
PO_DIRS = $(wildcard locale/*/*)
|
PO_SRCS = $(wildcard locale/*/*/*.po)
|
||||||
PO_FILES = $(wildcard locale/*/*/*.po)
|
PO_OUTS = $(patsubst locale/%.po,locale/%.mo,$(PO_SRCS))
|
||||||
|
PO_DIRS = $(wildcard locale/*/*)
|
||||||
|
|
||||||
prefix = /usr
|
prefix = /usr
|
||||||
|
CC = gcc
|
||||||
|
|
||||||
dist/xcfg: $(SRCS) $(HEADERS) $(PO_FILES)
|
all: dist/xcfg $(PO_OUTS)
|
||||||
|
|
||||||
|
dist/xcfg: $(CSRCS) $(HEADERS)
|
||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
gcc $(CFLAGS) $(SRCS) -o $@ -lncurses -lmenu -lm
|
$(CC) $(CFLAGS) $(CSRCS) -o $@ -lncurses -lmenu -lm
|
||||||
|
|
||||||
|
locale/%.mo: locale/%.po
|
||||||
|
msgfmt $^ -o $@
|
||||||
|
|
||||||
|
locale/%.po: locale/xcfg.pot
|
||||||
|
cp $@ $@.old
|
||||||
|
if msgmerge $@ $^ -o $@ ; then \
|
||||||
|
rm $@.old ; \
|
||||||
|
echo "merge success: $@" ; \
|
||||||
|
else \
|
||||||
|
echo "merge failed: $@" ; \
|
||||||
|
mv $@.old $@ ; \
|
||||||
|
fi; \
|
||||||
|
|
||||||
|
locale/xcfg.pot: $(CSRCS)
|
||||||
mkdir -p locale
|
mkdir -p locale
|
||||||
xgettext -k_ -c $(SRCS) -o locale/xcfg.pot
|
xgettext -k_ -c $^ -o $@
|
||||||
@for po in $(PO_DIRS) ; do \
|
|
||||||
mv $$po/xcfg.po $$po/mp.old.po ; \
|
|
||||||
if msgmerge $$po/mp.old.po locale/xcfg.pot -o $$po/xcfg.po ; then \
|
|
||||||
rm $$po/mp.old.po ; \
|
|
||||||
echo "merge success: $$po/xcfg.po" ; \
|
|
||||||
else \
|
|
||||||
echo "merge failed: $$po/xcfg.po" ; \
|
|
||||||
mv $$po/mp.old.po $$po/xcfg.po ; \
|
|
||||||
fi; \
|
|
||||||
done
|
|
||||||
@for po in $(PO_DIRS) ; do \
|
|
||||||
msgfmt $$po/xcfg.po -o $$po/xcfg.mo ; \
|
|
||||||
done
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
mkdir -p $(DESTDIR)$(prefix)/bin
|
mkdir -pv $(DESTDIR)/etc/xcfg
|
||||||
install -m755 dist/xcfg $(DESTDIR)$(prefix)/bin/xcfg
|
mkdir -pv $(DESTDIR)/var/lib/xcfg
|
||||||
|
mkdir -pv $(DESTDIR)$(prefix)/bin
|
||||||
|
install -v -m755 dist/xcfg $(DESTDIR)$(prefix)/bin/xcfg
|
||||||
|
@for cmd in $(CMDS) ; do \
|
||||||
|
ln -sfv xcfg $(DESTDIR)$(prefix)/bin/$$cmd ; \
|
||||||
|
done
|
||||||
@for po in $(PO_DIRS) ; do \
|
@for po in $(PO_DIRS) ; do \
|
||||||
echo "installing locale: $$po/xcfg.mo" ; \
|
echo "installing locale: $$po/xcfg.mo" ; \
|
||||||
mkdir -pv $(DESTDIR)/usr/share/$$po ; \
|
mkdir -pv $(DESTDIR)/usr/share/$$po ; \
|
||||||
cp $$po/xcfg.mo $(DESTDIR)/usr/share/$$po ; \
|
cp $$po/xcfg.mo $(DESTDIR)/usr/share/$$po ; \
|
||||||
done
|
done
|
||||||
|
|
||||||
|
defcfg:
|
||||||
|
cp -v install/cfg.default $(DESTDIR)/etc/xcfg/cfg
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm $(DESTDIR)$(prefix)/bin/xcfg
|
rm -v $(DESTDIR)$(prefix)/bin/xcfg
|
||||||
|
@for cmd in $(CMDS) ; do \
|
||||||
|
unlink $(DESTDIR)$(prefix)/bin/$$cmd ; \
|
||||||
|
done
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm dist/xcfg
|
||||||
|
rm locale/xcfg.pot
|
||||||
|
@for po in $(PO_DIRS) ; do \
|
||||||
|
rm $$po/xcfg.mo ; \
|
||||||
|
done
|
||||||
|
|
||||||
format:
|
format:
|
||||||
clang-format -i -style=file src/*.c src/*.h
|
clang-format -i -style=file $(HEADERS) $(CSRCS)
|
||||||
|
|
||||||
.PHONY: install uninstall format
|
.PHONY: install defcfg uninstall clean
|
||||||
|
@ -7,7 +7,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2024-04-23 02:27+0300\n"
|
"POT-Creation-Date: 2024-05-01 13:06+0300\n"
|
||||||
"PO-Revision-Date: 2024-02-20 20:36+0300\n"
|
"PO-Revision-Date: 2024-02-20 20:36+0300\n"
|
||||||
"Last-Translator: <ngn@ngn.tf>\n"
|
"Last-Translator: <ngn@ngn.tf>\n"
|
||||||
"Language-Team: Turkish <gnome-turk@gnome.org>\n"
|
"Language-Team: Turkish <gnome-turk@gnome.org>\n"
|
||||||
@ -17,7 +17,7 @@ msgstr ""
|
|||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
|
|
||||||
#: src/main.c:49 src/main.c:185
|
#: src/main.c:49 src/main.c:183
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
msgid "Failed to get the home directory"
|
msgid "Failed to get the home directory"
|
||||||
msgstr "Ev dizini bulmak başarısız oldu"
|
msgstr "Ev dizini bulmak başarısız oldu"
|
||||||
@ -32,7 +32,7 @@ msgstr "%s dosyasını okumak için açmak başarısız oldu"
|
|||||||
msgid "Failed to open %s for writing"
|
msgid "Failed to open %s for writing"
|
||||||
msgstr "%s dosyasını yazmak için açmak başarısız oldu"
|
msgstr "%s dosyasını yazmak için açmak başarısız oldu"
|
||||||
|
|
||||||
#: src/main.c:100 src/main.c:191
|
#: src/main.c:100 src/main.c:189
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Failed to write to %s"
|
msgid "Failed to write to %s"
|
||||||
msgstr "%s dosyasına yazmak başarısız oldu"
|
msgstr "%s dosyasına yazmak başarısız oldu"
|
||||||
@ -55,37 +55,37 @@ msgstr "Nispeten düşük sistem gereksinimleri olan özgür bir masaüstü orta
|
|||||||
msgid "Tiling window manager based on binary space partitioning"
|
msgid "Tiling window manager based on binary space partitioning"
|
||||||
msgstr "İkili alan bölme tabanlı döşeme pencere yöneticisi"
|
msgstr "İkili alan bölme tabanlı döşeme pencere yöneticisi"
|
||||||
|
|
||||||
#: src/main.c:140
|
#: src/main.c:139
|
||||||
msgid "Improved tiling window manager"
|
msgid "Improved tiling window manager"
|
||||||
msgstr "Geliştirilmiş döşeme pencere yöneticisi"
|
msgstr "Geliştirilmiş döşeme pencere yöneticisi"
|
||||||
|
|
||||||
#: src/main.c:146
|
#: src/main.c:144
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
msgid "mp is not installed!"
|
msgid "mp is not installed!"
|
||||||
msgstr "mp kurulu değil"
|
msgstr "mp kurulu değil"
|
||||||
|
|
||||||
#: src/main.c:155
|
#: src/main.c:153
|
||||||
msgid "Install doas or sudo to use this script"
|
msgid "Install doas or sudo to use this script"
|
||||||
msgstr "Bu betiği kullanmak için doas ya da sudo kurun"
|
msgstr "Bu betiği kullanmak için doas ya da sudo kurun"
|
||||||
|
|
||||||
#: src/main.c:170
|
#: src/main.c:168
|
||||||
msgid "Choose a desktop enviroment"
|
msgid "Choose a desktop enviroment"
|
||||||
msgstr "Bir masaüstü ortamı seçin"
|
msgstr "Bir masaüstü ortamı seçin"
|
||||||
|
|
||||||
#: src/main.c:176
|
#: src/main.c:174
|
||||||
msgid "Add auto-startx to shell configuration?"
|
msgid "Add auto-startx to shell configuration?"
|
||||||
msgstr "Otomatik-startx kabuk konfigürasyonu ekle?"
|
msgstr "Otomatik-startx kabuk konfigürasyonu ekle?"
|
||||||
|
|
||||||
#: src/main.c:197
|
#: src/main.c:195
|
||||||
msgid "Configuration has been saved!"
|
msgid "Configuration has been saved!"
|
||||||
msgstr "Konfigürasyon kaydedildi!"
|
msgstr "Konfigürasyon kaydedildi!"
|
||||||
|
|
||||||
#: src/main.c:199
|
#: src/main.c:197
|
||||||
#, fuzzy, c-format
|
#, fuzzy, c-format
|
||||||
msgid "Installing %s"
|
msgid "Installing %s"
|
||||||
msgstr "%s kuruluyor"
|
msgstr "%s kuruluyor"
|
||||||
|
|
||||||
#: src/main.c:203
|
#: src/main.c:201
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
msgid "Installation failed"
|
msgid "Installation failed"
|
||||||
msgstr "Kurulum başarısız oldu"
|
msgstr "Kurulum başarısız oldu"
|
||||||
@ -97,3 +97,7 @@ msgstr "Evet"
|
|||||||
#: src/term.c:82
|
#: src/term.c:82
|
||||||
msgid "No"
|
msgid "No"
|
||||||
msgstr "Hayır"
|
msgstr "Hayır"
|
||||||
|
|
||||||
|
#, fuzzy
|
||||||
|
#~ msgid "Feiled to get the home directory"
|
||||||
|
#~ msgstr "Ev dizini bulmak başarısız oldu"
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define C_RED "\x1b[31m"
|
#define C_RED "\x1b[31m"
|
||||||
#define C_BOLD "\x1b[1m"
|
#define C_BOLD "\x1b[1m"
|
||||||
#define C_BLUE "\x1b[34m"
|
#define C_BLUE "\x1b[34m"
|
||||||
#define C_GREEN "\x1b[32m"
|
#define C_GREEN "\x1b[32m"
|
||||||
#define C_RESET "\x1b[0m"
|
#define C_RESET "\x1b[0m"
|
||||||
|
|
||||||
|
42
src/main.c
42
src/main.c
@ -39,7 +39,7 @@
|
|||||||
bool add_startx() {
|
bool add_startx() {
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
|
||||||
char *profile = ".bash_profile";
|
char *profile = ".bash_profile";
|
||||||
char *shellenv = getenv("SHELL");
|
char *shellenv = getenv("SHELL");
|
||||||
if (NULL != shellenv && endswith(shellenv, "zsh"))
|
if (NULL != shellenv && endswith(shellenv, "zsh"))
|
||||||
profile = ".zshrc";
|
profile = ".zshrc";
|
||||||
@ -56,8 +56,8 @@ bool add_startx() {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *line = NULL, *all = NULL;
|
char *line = NULL, *all = NULL;
|
||||||
int indx = 0;
|
int indx = 0;
|
||||||
size_t sz, len;
|
size_t sz, len;
|
||||||
|
|
||||||
while ((sz = getline(&line, &len, pf)) != -1) {
|
while ((sz = getline(&line, &len, pf)) != -1) {
|
||||||
@ -82,7 +82,7 @@ bool add_startx() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *startx = AUTOSTARTX;
|
char *startx = AUTOSTARTX;
|
||||||
all = realloc(all, indx + strlen(startx) + 10);
|
all = realloc(all, indx + strlen(startx) + 10);
|
||||||
for (int i = 0; i < strlen(startx); i++) {
|
for (int i = 0; i < strlen(startx); i++) {
|
||||||
all[indx] = startx[i];
|
all[indx] = startx[i];
|
||||||
indx++;
|
indx++;
|
||||||
@ -119,27 +119,25 @@ int main(int argc, char **argv, char **envp) {
|
|||||||
|
|
||||||
struct Desktop desktops[] = {
|
struct Desktop desktops[] = {
|
||||||
{
|
{
|
||||||
.name = "XFCE4",
|
.name = "XFCE4",
|
||||||
.desc = _("Lightweight desktop environment for UNIX-like operating "
|
.desc = _("Lightweight desktop environment for UNIX-like operating "
|
||||||
"systems"),
|
"systems"),
|
||||||
.pkg = "xfce4",
|
.pkg = "xfce4",
|
||||||
.cmd = "startxfce4\n",
|
.cmd = "startxfce4\n",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "LXDE",
|
.name = "LXDE",
|
||||||
.desc = _("Free desktop environment with comparatively low resource "
|
.desc = _("Free desktop environment with comparatively low resource "
|
||||||
"requirements"),
|
"requirements"),
|
||||||
.pkg = "lxde",
|
.pkg = "lxde",
|
||||||
.cmd = "startlxde\n",
|
.cmd = "startlxde\n",
|
||||||
},
|
},
|
||||||
{.name = "bspwm",
|
{.name = "bspwm",
|
||||||
.desc = _("Tiling window manager based on binary space partitioning"),
|
.desc = _("Tiling window manager based on binary space partitioning"),
|
||||||
.pkg = "bspwm",
|
.pkg = "bspwm",
|
||||||
.cmd = "bspwm\n"},
|
.cmd = "bspwm\n"},
|
||||||
{.name = "i3",
|
{.name = "i3", .desc = _("Improved tiling window manager"), .pkg = "i3", .cmd = "i3\n"}
|
||||||
.desc = _("Improved tiling window manager"),
|
};
|
||||||
.pkg = "i3",
|
|
||||||
.cmd = "i3\n"}};
|
|
||||||
|
|
||||||
char *mpi_path = check_path("mp-install");
|
char *mpi_path = check_path("mp-install");
|
||||||
if (NULL == mpi_path) {
|
if (NULL == mpi_path) {
|
||||||
@ -160,7 +158,7 @@ int main(int argc, char **argv, char **envp) {
|
|||||||
|
|
||||||
term_init();
|
term_init();
|
||||||
|
|
||||||
int sz = sizeof(desktops) / sizeof(struct Desktop);
|
int sz = sizeof(desktops) / sizeof(struct Desktop);
|
||||||
ITEM **items = malloc(sizeof(ITEM *) * (sz + 1));
|
ITEM **items = malloc(sizeof(ITEM *) * (sz + 1));
|
||||||
|
|
||||||
for (int i = 0; i < sz; i++)
|
for (int i = 0; i < sz; i++)
|
||||||
|
@ -27,7 +27,7 @@ int term_ask(char *text, ITEM **items, int sz) {
|
|||||||
mvprintw(1, 1, "%s", text);
|
mvprintw(1, 1, "%s", text);
|
||||||
char line[strlen(text) + 5];
|
char line[strlen(text) + 5];
|
||||||
for (int i = 0; i < strlen(text); i++) {
|
for (int i = 0; i < strlen(text); i++) {
|
||||||
line[i] = '=';
|
line[i] = '=';
|
||||||
line[i + 1] = '\0';
|
line[i + 1] = '\0';
|
||||||
}
|
}
|
||||||
mvprintw(2, 1, "%s", line);
|
mvprintw(2, 1, "%s", line);
|
||||||
@ -49,7 +49,7 @@ int term_ask(char *text, ITEM **items, int sz) {
|
|||||||
wrefresh(swin);
|
wrefresh(swin);
|
||||||
|
|
||||||
bool done = false;
|
bool done = false;
|
||||||
int indx = 0, c = 0;
|
int indx = 0, c = 0;
|
||||||
|
|
||||||
while ((c = wgetch(swin))) {
|
while ((c = wgetch(swin))) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
@ -80,7 +80,7 @@ int term_ask(char *text, ITEM **items, int sz) {
|
|||||||
|
|
||||||
bool term_yn(char *text) {
|
bool term_yn(char *text) {
|
||||||
char *yn[] = {_("Yes"), _("No"), NULL};
|
char *yn[] = {_("Yes"), _("No"), NULL};
|
||||||
int sz = sizeof(yn) / sizeof(char *);
|
int sz = sizeof(yn) / sizeof(char *);
|
||||||
ITEM *items[sz + 1];
|
ITEM *items[sz + 1];
|
||||||
|
|
||||||
for (int i = 0; i < sz; i++)
|
for (int i = 0; i < sz; i++)
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
#include <menu.h>
|
#include <menu.h>
|
||||||
|
|
||||||
void term_init();
|
void term_init();
|
||||||
int term_ask(char *, ITEM **, int);
|
int term_ask(char *, ITEM **, int);
|
||||||
bool term_yn(char *);
|
bool term_yn(char *);
|
||||||
void term_finish();
|
void term_finish();
|
||||||
|
@ -17,7 +17,9 @@ bool joinhome(char *res, char *path) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool exists(char *path) { return access(path, F_OK) == 0; }
|
bool exists(char *path) {
|
||||||
|
return access(path, F_OK) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool endswith(const char *str, const char *suf) {
|
bool endswith(const char *str, const char *suf) {
|
||||||
int strl = strlen(str);
|
int strl = strlen(str);
|
||||||
@ -31,7 +33,7 @@ bool endswith(const char *str, const char *suf) {
|
|||||||
|
|
||||||
char *check_path(char *bin) {
|
char *check_path(char *bin) {
|
||||||
char *path = getenv("PATH");
|
char *path = getenv("PATH");
|
||||||
char *res = NULL;
|
char *res = NULL;
|
||||||
|
|
||||||
if (NULL == path)
|
if (NULL == path)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
10
src/util.h
10
src/util.h
@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#define AUTOSTARTX \
|
#define AUTOSTARTX \
|
||||||
"\n#auto-startx \nif [[ \"$(tty)\" == \"/dev/tty1\" ]] && [ -z " \
|
"\n#auto-startx \nif [[ \"$(tty)\" == \"/dev/tty1\" ]] && [ -z " \
|
||||||
"\"$DISPLAY\" ]; then\nexec startx\nfi\n"
|
"\"$DISPLAY\" ]; then\nexec startx\nfi\n"
|
||||||
|
|
||||||
typedef struct Desktop {
|
typedef struct Desktop {
|
||||||
@ -12,7 +12,7 @@ typedef struct Desktop {
|
|||||||
char *cmd;
|
char *cmd;
|
||||||
} desktop_t;
|
} desktop_t;
|
||||||
|
|
||||||
bool exists(char *);
|
bool exists(char *);
|
||||||
char *check_path(char *);
|
char *check_path(char *);
|
||||||
bool joinhome(char *, char *);
|
bool joinhome(char *, char *);
|
||||||
bool endswith(const char *, const char *);
|
bool endswith(const char *, const char *);
|
||||||
|
Loading…
Reference in New Issue
Block a user