Compare commits
No commits in common. "d0013946f4191e51fec8ee7b990a9ef4871e86e1" and "d50d35717333f089b5febf6a456f9042b6655687" have entirely different histories.
d0013946f4
...
d50d357173
225
.clang-format
225
.clang-format
@ -1,225 +0,0 @@
|
|||||||
---
|
|
||||||
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
|
|
||||||
...
|
|
||||||
|
|
75
Makefile
75
Makefile
@ -1,61 +1,38 @@
|
|||||||
HEADERS = $(wildcard src/*.h)
|
|
||||||
CSRCS = $(wildcard src/*.c)
|
|
||||||
|
|
||||||
PO_SRCS = $(wildcard locale/*/*/*.po)
|
|
||||||
PO_OUTS = $(patsubst locale/%.po,locale/%.mo,$(PO_SRCS))
|
|
||||||
PO_DIRS = $(wildcard locale/*/*)
|
|
||||||
|
|
||||||
CFLAGS = -fstack-protector-strong -fcf-protection=full -fstack-clash-protection
|
|
||||||
LIBS = -lncurses -lmenu -lm
|
|
||||||
|
|
||||||
prefix = /usr
|
prefix = /usr
|
||||||
CC = gcc
|
SRCS = $(wildcard src/*.c)
|
||||||
|
HEADERS = $(wildcard src/*.h)
|
||||||
|
PO_DIRS = $(wildcard locale/*/*)
|
||||||
|
PO_FILES = $(wildcard locale/*/*/*.po)
|
||||||
|
|
||||||
VERSION = 24.08
|
dist/xcfg: $(SRCS) $(HEADERS) $(PO_FILES)
|
||||||
|
|
||||||
all: dist/xcfg $(PO_OUTS)
|
|
||||||
|
|
||||||
dist/xcfg: $(CSRCS) $(HEADERS)
|
|
||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
$(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" $(CSRCS) -o $@ $(LIBS)
|
gcc $(CFLAGS) $(SRCS) -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: $@" ; \
|
|
||||||
install -m644 $@.old $@ ; \
|
|
||||||
fi; \
|
|
||||||
|
|
||||||
locale/xcfg.pot: $(CSRCS)
|
|
||||||
mkdir -p locale
|
mkdir -p locale
|
||||||
xgettext -k_ -c $^ -o $@
|
xgettext -k_ -c $(SRCS) -o locale/xcfg.pot
|
||||||
|
@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 -pv $(DESTDIR)/$(prefix)/bin
|
mkdir -p $(DESTDIR)$(prefix)/bin
|
||||||
install -v -m755 dist/xcfg $(DESTDIR)/$(prefix)/bin/xcfg
|
install -m755 dist/xcfg $(DESTDIR)$(prefix)/bin/xcfg
|
||||||
@for po in $(PO_DIRS) ; do \
|
@for po in $(PO_DIRS) ; do \
|
||||||
echo "installing locale: $$po/xcfg.mo" ; \
|
echo "installing locale: $$po/xcfg.mo" ; \
|
||||||
install -v -Ddm755 $(DESTDIR)/usr/share/$$po ; \
|
mkdir -pv $(DESTDIR)/usr/share/$$po ; \
|
||||||
install -m644 $$po/xcfg.mo $(DESTDIR)/usr/share/$$po ; \
|
cp $$po/xcfg.mo $(DESTDIR)/usr/share/$$po ; \
|
||||||
done
|
done
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -v $(DESTDIR)/$(prefix)/bin/xcfg
|
rm $(DESTDIR)$(prefix)/bin/xcfg
|
||||||
|
|
||||||
clean:
|
.PHONY: install uninstall
|
||||||
rm -v dist/xcfg
|
|
||||||
rm -v locale/xcfg.pot
|
|
||||||
@for po in $(PO_DIRS) ; do \
|
|
||||||
rm $$po/xcfg.mo ; \
|
|
||||||
done
|
|
||||||
|
|
||||||
format:
|
|
||||||
clang-format -i -style=file $(HEADERS) $(CSRCS)
|
|
||||||
|
|
||||||
.PHONY: install 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-08-15 04:33+0300\n"
|
"POT-Creation-Date: 2024-02-22 20:30+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,97 +17,67 @@ 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:189
|
#: src/main.c:101 src/main.c:243
|
||||||
#, 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"
|
||||||
|
|
||||||
#: src/main.c:55
|
#: src/main.c:107
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Failed to open %s for reading"
|
msgid "Failed to open %s for reading"
|
||||||
msgstr "%s dosyasını okumak için açmak başarısız oldu"
|
msgstr "%s dosyasını okumak için açmak başarısız oldu"
|
||||||
|
|
||||||
#: src/main.c:94
|
#: src/main.c:146
|
||||||
#, c-format
|
#, c-format
|
||||||
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:195
|
#: src/main.c:152 src/main.c:249
|
||||||
#, 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"
|
||||||
|
|
||||||
#: src/main.c:116
|
#: src/main.c:164
|
||||||
msgid "You should use this script as a regular user, not as root!"
|
msgid "You should use this script as a regular user, not as root!"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Bu betiği normal bir kullanıcı olarak kullanmalısınız, kök kullanıcı olarak "
|
"Bu betiği normal bir kullanıcı olarak kullanmalısınız, kök kullanıcı olarak "
|
||||||
"değil!"
|
"değil!"
|
||||||
|
|
||||||
#: src/main.c:121
|
#: src/main.c:189
|
||||||
#, c-format
|
|
||||||
msgid "Simple xorg configuration tool %s"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/main.c:122
|
|
||||||
msgid ""
|
|
||||||
"Licensed under GPLv3, see https://www.gnu.org/licenses/ for more information"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/main.c:129
|
|
||||||
msgid "Lightweight desktop environment for UNIX-like operating systems"
|
|
||||||
msgstr "UNIX-gibi işletim sistemleri için hafif bir masaütü"
|
|
||||||
|
|
||||||
#: src/main.c:136
|
|
||||||
msgid "Free desktop environment with comparatively low resource requirements"
|
|
||||||
msgstr "Nispeten düşük sistem gereksinimleri olan özgür bir masaüstü ortamı"
|
|
||||||
|
|
||||||
#: src/main.c:142
|
|
||||||
msgid "Tiling window manager based on binary space partitioning"
|
|
||||||
msgstr "İkili alan bölme tabanlı döşeme pencere yöneticisi"
|
|
||||||
|
|
||||||
#: src/main.c:145
|
|
||||||
msgid "Improved tiling window manager"
|
|
||||||
msgstr "Geliştirilmiş döşeme pencere yöneticisi"
|
|
||||||
|
|
||||||
#: src/main.c:150
|
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
msgid "matt is not installed!"
|
msgid "mp is not installed!"
|
||||||
msgstr "mp kurulu değil"
|
msgstr "mp kurulu değil"
|
||||||
|
|
||||||
#: src/main.c:159
|
#: src/main.c:198
|
||||||
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:174
|
#: src/main.c:216
|
||||||
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:180
|
#: src/main.c:222
|
||||||
|
msgid "Yes"
|
||||||
|
msgstr "Evet"
|
||||||
|
|
||||||
|
#: src/main.c:222
|
||||||
|
msgid "No"
|
||||||
|
msgstr "Hayır"
|
||||||
|
|
||||||
|
#: src/main.c:229
|
||||||
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:201
|
#: src/main.c:255
|
||||||
msgid "Configuration has been saved!"
|
msgid "Configuration has been saved!"
|
||||||
msgstr "Konfigürasyon kaydedildi!"
|
msgstr "Konfigürasyon kaydedildi!"
|
||||||
|
|
||||||
#: src/main.c:203
|
#: src/main.c:257
|
||||||
#, fuzzy, c-format
|
#, fuzzy, c-format
|
||||||
msgid "Installing %s"
|
msgid "Installing %s"
|
||||||
msgstr "%s kuruluyor"
|
msgstr "%s kuruluyor"
|
||||||
|
|
||||||
#: src/main.c:207
|
#: src/main.c:263
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
msgid "Installation failed"
|
msgid "Installation failed"
|
||||||
msgstr "Kurulum başarısız oldu"
|
msgstr "Kurulum başarısız oldu"
|
||||||
|
|
||||||
#: src/term.c:82
|
|
||||||
msgid "Yes"
|
|
||||||
msgstr "Evet"
|
|
||||||
|
|
||||||
#: src/term.c:82
|
|
||||||
msgid "No"
|
|
||||||
msgstr "Hayır"
|
|
||||||
|
|
||||||
#, fuzzy
|
|
||||||
#~ msgid "Feiled to get the home directory"
|
|
||||||
#~ msgstr "Ev dizini bulmak başarısız oldu"
|
|
||||||
|
16
src/log.c
16
src/log.c
@ -1,14 +1,14 @@
|
|||||||
#include "log.h"
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
void info(const char* msg, ...){
|
void info(const char* msg, ...){
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, msg);
|
va_start(args, msg);
|
||||||
|
|
||||||
printf(C_BOLD C_BLUE ">>> " C_RESET C_BOLD);
|
printf(LOG_BOLD LOG_BLUE">>> "LOG_RESET LOG_BOLD);
|
||||||
vprintf(msg, args);
|
vprintf(msg, args);
|
||||||
printf(C_RESET "\n");
|
printf(LOG_RESET"\n");
|
||||||
|
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
@ -17,9 +17,9 @@ void error(const char *msg, ...) {
|
|||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, msg);
|
va_start(args, msg);
|
||||||
|
|
||||||
printf(C_BOLD C_RED ">>> " C_RESET C_BOLD);
|
printf(LOG_BOLD LOG_RED">>> "LOG_RESET LOG_BOLD);
|
||||||
vprintf(msg, args);
|
vprintf(msg, args);
|
||||||
printf(C_RESET "\n");
|
printf(LOG_RESET"\n");
|
||||||
|
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
@ -28,9 +28,9 @@ void success(const char *msg, ...) {
|
|||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, msg);
|
va_start(args, msg);
|
||||||
|
|
||||||
printf(C_BOLD C_GREEN ">>> " C_RESET C_BOLD);
|
printf(LOG_BOLD LOG_GREEN">>> "LOG_RESET LOG_BOLD);
|
||||||
vprintf(msg, args);
|
vprintf(msg, args);
|
||||||
printf(C_RESET "\n");
|
printf(LOG_RESET"\n");
|
||||||
|
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
12
src/log.h
12
src/log.h
@ -1,10 +1,8 @@
|
|||||||
#pragma once
|
#define LOG_RED "\x1b[31m"
|
||||||
|
#define LOG_BOLD "\x1b[1m"
|
||||||
#define C_RED "\x1b[31m"
|
#define LOG_BLUE "\x1b[34m"
|
||||||
#define C_BOLD "\x1b[1m"
|
#define LOG_GREEN "\x1b[32m"
|
||||||
#define C_BLUE "\x1b[34m"
|
#define LOG_RESET "\x1b[0m"
|
||||||
#define C_GREEN "\x1b[32m"
|
|
||||||
#define C_RESET "\x1b[0m"
|
|
||||||
|
|
||||||
void info(const char* msg, ...);
|
void info(const char* msg, ...);
|
||||||
void error(const char* msg, ...);
|
void error(const char* msg, ...);
|
||||||
|
146
src/main.c
146
src/main.c
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
* xcfg | simple xorg configuration tool
|
* xcfg | simple xorg configuration tool
|
||||||
* MatterLinux 2023-2024 (https://matterlinux.xyz)
|
* MatterLinux 2024 (https://matterlinux.xyz)
|
||||||
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -18,24 +18,76 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <curses.h>
|
#include <sys/wait.h>
|
||||||
#include <libintl.h>
|
|
||||||
#include <limits.h>
|
|
||||||
#include <locale.h>
|
|
||||||
#include <menu.h>
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <libintl.h>
|
||||||
|
#include <locale.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <curses.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/wait.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include "log.h"
|
#include <menu.h>
|
||||||
#include "term.h"
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
#define _(x) gettext(x)
|
#define _(x) gettext(x)
|
||||||
|
|
||||||
|
int ask(char* text, ITEM** items, int sz) {
|
||||||
|
attron(COLOR_PAIR(1) | A_BOLD);
|
||||||
|
|
||||||
|
mvprintw(1, 1, "%s", text);
|
||||||
|
char line[strlen(text)+5];
|
||||||
|
int i = 0;
|
||||||
|
for (; i < strlen(text); i++){
|
||||||
|
line[i] = '#';
|
||||||
|
}
|
||||||
|
line[i] = '\0';
|
||||||
|
mvprintw(2, 1, "%s", line);
|
||||||
|
|
||||||
|
attroff(COLOR_PAIR(1) | A_BOLD);
|
||||||
|
refresh();
|
||||||
|
|
||||||
|
WINDOW* swin = newwin(LINES-3, COLS-1, 3, 1);
|
||||||
|
keypad(swin, TRUE);
|
||||||
|
MENU* menu = new_menu((ITEM **)items);
|
||||||
|
set_menu_win(menu, swin);
|
||||||
|
set_menu_sub(menu, swin);
|
||||||
|
set_menu_mark(menu, ">");
|
||||||
|
|
||||||
|
post_menu(menu);
|
||||||
|
wrefresh(swin);
|
||||||
|
|
||||||
|
bool done = false;
|
||||||
|
int indx = 0, c = 0;
|
||||||
|
|
||||||
|
while((c = wgetch(swin))){
|
||||||
|
switch(c){
|
||||||
|
case KEY_DOWN:
|
||||||
|
if (indx != (sz+1))
|
||||||
|
indx++;
|
||||||
|
menu_driver(menu, REQ_DOWN_ITEM);
|
||||||
|
break;
|
||||||
|
case KEY_UP:
|
||||||
|
if (indx != 0)
|
||||||
|
indx--;
|
||||||
|
menu_driver(menu, REQ_UP_ITEM);
|
||||||
|
break;
|
||||||
|
case '\n':
|
||||||
|
done = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
wrefresh(swin);
|
||||||
|
if(done)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
free_menu(menu);
|
||||||
|
return indx;
|
||||||
|
}
|
||||||
|
|
||||||
bool add_startx(){
|
bool add_startx(){
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
|
||||||
@ -108,46 +160,33 @@ END:
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv, char** envp){
|
int main(int argc, char** argv, char** envp){
|
||||||
signal(SIGINT, SIG_IGN);
|
|
||||||
setlocale(LC_ALL, "");
|
|
||||||
textdomain("xcfg");
|
|
||||||
|
|
||||||
if(getuid()==0){
|
if(getuid()==0){
|
||||||
error(_("You should use this script as a regular user, not as root!"));
|
error(_("You should use this script as a regular user, not as root!"));
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc >= 2 && strcmp(argv[1], "--version") == 0) {
|
signal(SIGINT, SIG_IGN);
|
||||||
success(_("Simple xorg configuration tool %s"), VERSION);
|
setlocale(LC_ALL, "");
|
||||||
info(_("Licensed under GPLv3, see https://www.gnu.org/licenses/ for more information"));
|
textdomain("mp");
|
||||||
return EXIT_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
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="bspwm",
|
||||||
.desc = _("Free desktop environment with comparatively low resource "
|
.desc="Tiling window manager based on binary space partitioning",
|
||||||
"requirements"),
|
|
||||||
.pkg = "lxde",
|
|
||||||
.cmd = "startlxde\n",
|
|
||||||
},
|
|
||||||
{.name = "bspwm",
|
|
||||||
.desc = _("Tiling window manager based on binary space partitioning"),
|
|
||||||
.pkg="bspwm",
|
.pkg="bspwm",
|
||||||
.cmd = "bspwm\n"},
|
.cmd="bspwm\n"
|
||||||
{.name = "i3", .desc = _("Improved tiling window manager"), .pkg = "i3", .cmd = "i3\n"}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
char *mpi_path = check_path("matt");
|
char* mpi_path = check_path("mp-install");
|
||||||
if(NULL==mpi_path){
|
if(NULL==mpi_path){
|
||||||
error(_("matt is not installed!"));
|
error(_("mp is not installed!"));
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
free(mpi_path);
|
free(mpi_path);
|
||||||
@ -162,52 +201,69 @@ int main(int argc, char **argv, char **envp) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
term_init();
|
initscr();
|
||||||
|
cbreak();
|
||||||
|
noecho();
|
||||||
|
keypad(stdscr, TRUE);
|
||||||
|
init_pair(1, COLOR_BLUE, COLOR_BLUE);
|
||||||
|
|
||||||
int sz = sizeof(desktops)/sizeof(struct Desktop);
|
int sz = sizeof(desktops)/sizeof(struct Desktop);
|
||||||
ITEM **items = malloc(sizeof(ITEM *) * (sz + 1));
|
ITEM** items = (ITEM **)malloc(sizeof(ITEM *)*(sz+1));
|
||||||
|
|
||||||
for(int i = 0; i < sz; i++)
|
for(int i = 0; i < sz; i++)
|
||||||
items[i] = new_item(desktops[i].name, desktops[i].desc);
|
items[i] = new_item(desktops[i].name, desktops[i].desc);
|
||||||
items[sz] = NULL;
|
|
||||||
|
|
||||||
int indx = term_ask(_("Choose a desktop enviroment"), items, sz + 1);
|
int indx = ask(_("Choose a desktop enviroment"), items, sz);
|
||||||
for (int i = 0; i < sz; i++)
|
for (int i = 0; i < sz; i++)
|
||||||
free_item(items[i]);
|
free_item(items[i]);
|
||||||
free(items);
|
free(items);
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
bool autox = term_yn(_("Add auto-startx to shell configuration?"));
|
char* yn[] = {_("Yes"), _("No")};
|
||||||
|
sz = sizeof(yn)/sizeof(char*);
|
||||||
|
items = (ITEM **)malloc(sizeof(ITEM *)*(sz+1));
|
||||||
|
|
||||||
term_finish();
|
for(int i = 0; i < sz; i++)
|
||||||
|
items[i] = new_item(yn[i], "");
|
||||||
|
|
||||||
|
bool autox = ask(_("Add auto-startx to shell configuration?"), items, sz) == 0;
|
||||||
|
for (int i = 0; i < sz; i++)
|
||||||
|
free_item(items[i]);
|
||||||
|
free(items);
|
||||||
|
clear();
|
||||||
|
|
||||||
|
clear();
|
||||||
|
endwin();
|
||||||
|
|
||||||
if(autox && !add_startx())
|
if(autox && !add_startx())
|
||||||
goto fail;
|
goto FAIL;
|
||||||
|
|
||||||
char xinitrc[PATH_MAX];
|
char xinitrc[PATH_MAX];
|
||||||
if(!joinhome(xinitrc, ".xinitrc")){
|
if(!joinhome(xinitrc, ".xinitrc")){
|
||||||
error(_("Failed to get the home directory"));
|
error(_("Failed to get the home directory"));
|
||||||
goto fail;
|
goto FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE* xf = fopen(xinitrc, "w");
|
FILE* xf = fopen(xinitrc, "w");
|
||||||
if(fwrite(desktops[indx].cmd, 1, strlen(desktops[indx].cmd), xf)<0){
|
if(fwrite(desktops[indx].cmd, 1, strlen(desktops[indx].cmd), xf)<0){
|
||||||
error(_("Failed to write to %s"), xinitrc);
|
error(_("Failed to write to %s"), xinitrc);
|
||||||
fclose(xf);
|
fclose(xf);
|
||||||
goto fail;
|
goto FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(xf);
|
fclose(xf);
|
||||||
success(_("Configuration has been saved!"));
|
success(_("Configuration has been saved!"));
|
||||||
|
|
||||||
info(_("Installing %s"), desktops[indx].name, mpi_path);
|
info(_("Installing %s"), desktops[indx].name, mpi_path);
|
||||||
char *args[] = {doas_path, "matt", "install", "--skip", desktops[indx].pkg, NULL};
|
char* args[] = {
|
||||||
|
doas_path, "mp-install", desktops[indx].pkg, NULL
|
||||||
|
};
|
||||||
|
|
||||||
if(execvp(doas_path, args) != 0) {
|
if(execvp(doas_path, args) != 0) {
|
||||||
error(_("Installation failed"));
|
error(_("Installation failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
fail:
|
FAIL:
|
||||||
free(doas_path);
|
free(doas_path);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
100
src/term.c
100
src/term.c
@ -1,100 +0,0 @@
|
|||||||
#include <libintl.h>
|
|
||||||
#include <menu.h>
|
|
||||||
#include <ncurses.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#define _(x) gettext(x)
|
|
||||||
|
|
||||||
void term_init() {
|
|
||||||
initscr();
|
|
||||||
if (has_colors()) {
|
|
||||||
use_default_colors();
|
|
||||||
start_color();
|
|
||||||
}
|
|
||||||
|
|
||||||
cbreak();
|
|
||||||
noecho();
|
|
||||||
keypad(stdscr, TRUE);
|
|
||||||
|
|
||||||
init_pair(1, COLOR_GREEN, -1);
|
|
||||||
init_pair(2, COLOR_BLUE, -1);
|
|
||||||
start_color();
|
|
||||||
}
|
|
||||||
|
|
||||||
int term_ask(char *text, ITEM **items, int sz) {
|
|
||||||
attron(COLOR_PAIR(1) | A_BOLD);
|
|
||||||
|
|
||||||
mvprintw(1, 1, "%s", text);
|
|
||||||
char line[strlen(text) + 5];
|
|
||||||
for (int i = 0; i < strlen(text); i++) {
|
|
||||||
line[i] = '=';
|
|
||||||
line[i + 1] = '\0';
|
|
||||||
}
|
|
||||||
mvprintw(2, 1, "%s", line);
|
|
||||||
|
|
||||||
attroff(COLOR_PAIR(1) | A_BOLD);
|
|
||||||
refresh();
|
|
||||||
|
|
||||||
WINDOW *swin = newwin(LINES - 3, COLS - 1, 3, 1);
|
|
||||||
keypad(swin, TRUE);
|
|
||||||
|
|
||||||
MENU *menu = new_menu(items);
|
|
||||||
set_menu_win(menu, swin);
|
|
||||||
set_menu_sub(menu, swin);
|
|
||||||
set_menu_mark(menu, ">>> ");
|
|
||||||
set_menu_fore(menu, COLOR_PAIR(2));
|
|
||||||
|
|
||||||
post_menu(menu);
|
|
||||||
curs_set(0);
|
|
||||||
wrefresh(swin);
|
|
||||||
|
|
||||||
bool done = false;
|
|
||||||
int indx = 0, c = 0;
|
|
||||||
|
|
||||||
while ((c = wgetch(swin))) {
|
|
||||||
switch (c) {
|
|
||||||
case KEY_DOWN:
|
|
||||||
if (indx != (sz + 1))
|
|
||||||
indx++;
|
|
||||||
menu_driver(menu, REQ_DOWN_ITEM);
|
|
||||||
break;
|
|
||||||
case KEY_UP:
|
|
||||||
if (indx != 0)
|
|
||||||
indx--;
|
|
||||||
menu_driver(menu, REQ_UP_ITEM);
|
|
||||||
break;
|
|
||||||
case '\n':
|
|
||||||
done = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
wrefresh(swin);
|
|
||||||
if (done)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
curs_set(1);
|
|
||||||
free_menu(menu);
|
|
||||||
return indx;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool term_yn(char *text) {
|
|
||||||
char *yn[] = {_("Yes"), _("No"), NULL};
|
|
||||||
int sz = sizeof(yn) / sizeof(char *);
|
|
||||||
ITEM *items[sz + 1];
|
|
||||||
|
|
||||||
for (int i = 0; i < sz; i++)
|
|
||||||
items[i] = new_item(yn[i], "");
|
|
||||||
|
|
||||||
bool res = term_ask(_(text), items, sz) == 0;
|
|
||||||
for (int i = 0; i < sz; i++)
|
|
||||||
free_item(items[i]);
|
|
||||||
clear();
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
void term_finish() {
|
|
||||||
clear();
|
|
||||||
endwin();
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include <menu.h>
|
|
||||||
|
|
||||||
void term_init();
|
|
||||||
int term_ask(char *, ITEM **, int);
|
|
||||||
bool term_yn(char *);
|
|
||||||
void term_finish();
|
|
@ -1,11 +1,11 @@
|
|||||||
#include "util.h"
|
|
||||||
#include <dirent.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <dirent.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
bool joinhome(char* res, char* path){
|
bool joinhome(char* res, char* path){
|
||||||
char* homedir = getenv("HOME");
|
char* homedir = getenv("HOME");
|
||||||
|
11
src/util.h
11
src/util.h
@ -1,16 +1,11 @@
|
|||||||
#pragma once
|
#define AUTOSTARTX "\n#auto-startx \nif [[ \"$(tty)\" == \"/dev/tty1\" ]] && [ -z \"$DISPLAY\" ]; then\nexec startx\nfi\n"
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#define AUTOSTARTX \
|
struct Desktop {
|
||||||
"\n#auto-startx \nif [[ \"$(tty)\" == \"/dev/tty1\" ]] && [ -z " \
|
|
||||||
"\"$DISPLAY\" ]; then\nexec startx\nfi\n"
|
|
||||||
|
|
||||||
typedef struct Desktop {
|
|
||||||
char* name;
|
char* name;
|
||||||
char* desc;
|
char* desc;
|
||||||
char* pkg;
|
char* pkg;
|
||||||
char* cmd;
|
char* cmd;
|
||||||
} desktop_t;
|
};
|
||||||
|
|
||||||
bool exists(char*);
|
bool exists(char*);
|
||||||
char* check_path(char*);
|
char* check_path(char*);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user