Skip to content

Commit 0fe3db4

Browse files
committed
Separator: honors FQDN settings in Title module
1 parent e80bb48 commit 0fe3db4

File tree

4 files changed

+4
-3
lines changed

4 files changed

+4
-3
lines changed

src/common/init.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ static void initState(FFstate* state)
2525
state->logoHeight = 0;
2626
state->keysHeight = 0;
2727
state->terminalLightTheme = false;
28+
state->titleFqdn = false;
2829

2930
ffPlatformInit(&state->platform);
3031
state->configDoc = NULL;

src/fastfetch.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ typedef struct FFstate
4949
uint32_t logoHeight;
5050
uint32_t keysHeight;
5151
bool terminalLightTheme;
52+
bool titleFqdn;
5253

5354
FFPlatform platform;
5455
yyjson_doc* configDoc;

src/modules/separator/separator.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,14 @@ void ffPrintSeparator(FFSeparatorOptions* options)
5656
{
5757
setlocale(LC_CTYPE, "");
5858
mbstate_t state = {};
59-
bool fqdn = true; // TODO: Make this configurable
6059
const FFPlatform* platform = &instance.state.platform;
6160

6261
FF_AUTO_FREE wchar_t* wstr = malloc((max(
6362
platform->userName.length, options->string.length) + 1) * sizeof(*wstr));
6463

6564
uint32_t titleLength = 1 // @
6665
+ getWcsWidth(&platform->userName, wstr, &state) // user name
67-
+ (fqdn ? platform->hostName.length : ffStrbufFirstIndexC(&platform->hostName, '.')); // host name
66+
+ (instance.state.titleFqdn ? platform->hostName.length : ffStrbufFirstIndexC(&platform->hostName, '.')); // host name
6867

6968
if(__builtin_expect(options->string.length == 1, 1))
7069
{

src/modules/title/title.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include "common/jsonconfig.h"
33
#include "modules/title/title.h"
44
#include "util/textModifier.h"
5-
#include "util/stringUtils.h"
65

76
static void appendText(FFstrbuf* output, const FFstrbuf* text, const FFstrbuf* color)
87
{
@@ -30,6 +29,7 @@ void ffPrintTitle(FFTitleOptions* options)
3029
FF_STRBUF_AUTO_DESTROY hostName = ffStrbufCreateCopy(&instance.state.platform.hostName);
3130
if (!options->fqdn)
3231
ffStrbufSubstrBeforeFirstC(&hostName, '.');
32+
instance.state.titleFqdn = options->fqdn;
3333

3434
FF_STRBUF_AUTO_DESTROY hostNameColored = ffStrbufCreate();
3535
appendText(&hostNameColored, &hostName, &options->colorHost);

0 commit comments

Comments
 (0)