Skip to content

Commit

Permalink
fix: title
Browse files Browse the repository at this point in the history
  • Loading branch information
FlafyDev committed Oct 10, 2022
1 parent cc27a6d commit 8725334
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
12 changes: 12 additions & 0 deletions lib/info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ final logoColorsProvider = FutureProvider<PaletteGenerator>(
},
);

final infoTitleProvider = Provider<String>((ref) {
final osID = ref.watch(infoOSIDProvider);
final user = ref.watch(infoUserProvider);


return osID.whenOrNull(data: (osID) => "$user@$osID") ?? user ?? "";
});

final infoFieldsProvider = Provider<List<InfoField>>(
(ref) {
final fields = <InfoField>[];
Expand Down Expand Up @@ -177,6 +185,10 @@ final infoTerminalProvider = Provider((ref) {
return Platform.environment["TERM"];
});

final infoUserProvider = Provider((ref) {
return Platform.environment["USER"];
});

final infoWaylandCompositorProvider = Provider((ref) {
if ((Platform.environment["WAYLAND_DISPLAY"]?.length ?? 0) == 0) {
return null;
Expand Down
3 changes: 2 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class MyHomePage extends HookConsumerWidget {
final scrollController = useScrollController();
final scrollProgress = useValueNotifier<double>(0);
final infoFields = ref.watch(infoFieldsProvider);
final infoTitle = ref.watch(infoTitleProvider);
final config = ref.watch(configProvider);

void _onScroll() {
Expand Down Expand Up @@ -161,7 +162,7 @@ class MyHomePage extends HookConsumerWidget {
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text("flafydev@nixos"),
Text(infoTitle),
if (logo != null)
Opacity(
opacity: scrollProgress.value,
Expand Down

0 comments on commit 8725334

Please sign in to comment.