Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
feat(activity_drawer): rename from user_drawer and restrict running w…
Browse files Browse the repository at this point in the history
…indows height
  • Loading branch information
RossComputerGuy committed May 11, 2024
1 parent 27229e6 commit c3b74d1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
27 changes: 16 additions & 11 deletions lib/widgets/user_drawer.dart → lib/widgets/activity_drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import '../logic/wm.dart';

import 'toplevel.dart';

class UserDrawer extends StatelessWidget {
const UserDrawer({
class ActivityDrawer extends StatelessWidget {
const ActivityDrawer({
super.key,
required this.onClose,
this.hasDisplayServer = false,
Expand All @@ -28,7 +28,7 @@ class UserDrawer extends StatelessWidget {
ListView(
children: [
hasDisplayServer
? SingleChildScrollView(
? Container(height: MediaQuery.of(context).size.height / 3, child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: context.watch<DisplayServer>().toplevels.map(
Expand Down Expand Up @@ -77,11 +77,14 @@ class UserDrawer extends StatelessWidget {
)
).toList(),
),
) : null,
)) : null,
Padding(
padding: const EdgeInsets.all(8),
child: GridView.count(
crossAxisCount: 5,
child: GridView(
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 84,
mainAxisExtent: 84,
),
shrinkWrap: true,
children: (Provider.of<ApplicationsManager>(context).applications.toList()..where((app) => !app.isHidden))
.map(
Expand All @@ -93,24 +96,26 @@ class UserDrawer extends StatelessWidget {
},
child: Column(
children: [
const Spacer(),
app.icon != null
? (path.extension(app.icon!) == '.svg'
? SvgPicture.file(
File(app.icon!),
width: 40,
height: 40,
width: 64,
height: 64,
) : Image.file(
File(app.icon!),
width: 40,
height: 40,
)) : Icon(Icons.tablet, size: 40),
width: 64,
height: 64,
)) : Icon(Icons.tablet, size: 58),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 4.0),
child: Text(
app.displayName ?? app.name ?? '',
overflow: TextOverflow.ellipsis,
),
),
const Spacer(),
],
),
)
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/system_layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import 'package:flutter_adaptive_scaffold/flutter_adaptive_scaffold.dart';
import 'package:libtokyo_flutter/libtokyo.dart' hide ColorScheme;
import 'package:libtokyo/libtokyo.dart' hide TokyoApp, Scaffold;

import 'activity_drawer.dart';
import 'account_profile.dart';
import 'output_layout.dart';
import 'system_bar.dart';
import 'system_drawer.dart';
import 'user_drawer.dart';

class SystemLayout extends StatelessWidget {
const SystemLayout({
Expand Down Expand Up @@ -117,7 +117,7 @@ class SystemLayout extends StatelessWidget {
),
child: Builder(
builder: (context) =>
UserDrawer(
ActivityDrawer(
hasDisplayServer: hasDisplayServer,
onClose: () {
material.Scaffold.of(context).closeDrawer();
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/system_navbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/material.dart' as material;
import 'package:libtokyo_flutter/libtokyo.dart' hide ColorScheme;
import 'package:libtokyo/libtokyo.dart' hide TokyoApp, Scaffold;

import 'user_drawer.dart';
import 'activity_drawer.dart';

class SystemNavbar extends StatefulWidget {
const SystemNavbar({ super.key });
Expand Down Expand Up @@ -33,7 +33,7 @@ class _SystemNavbarState extends State<SystemNavbar> {
_controller = null;
} else {
_controller = material.Scaffold.of(context).showBottomSheet((context) =>
UserDrawer(
ActivityDrawer(
onClose: () {
_controller!.close();
},
Expand Down
1 change: 1 addition & 0 deletions nix/module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
program = "${lib.getExe pkgs.expidus.genesis-shell} --display-manager";
};
accounts-daemon.enable = true;
upower.enable = true;
};

users.users.${config.services.cage.user} = {
Expand Down

0 comments on commit c3b74d1

Please sign in to comment.