Skip to content

Commit

Permalink
common: Create options for applications, other fixes
Browse files Browse the repository at this point in the history
This creates a new option `ghaf.programs.<name>`, which allows us to
configure applications across targets and whether they run inside a VM
or not.

This also fixes Chromium border glitch, and Element border colour
(SP-4645 & SP-4644).

Signed-off-by: Humaid Alqasimi <humaid.alqassimi@tii.ae>
  • Loading branch information
humaidq-tii authored and brianmcgillion committed Jun 6, 2024
1 parent a4ba18d commit 710cd4b
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 17 deletions.
2 changes: 0 additions & 2 deletions lib/launcher.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ _: {
then old.postInstall
else "";
in {
desktopItems = null;
desktopItem = null;
postInstall = pInst + "rm -rf \"$out/share/applications\"";
}))
pkgs;
Expand Down
1 change: 1 addition & 0 deletions modules/common/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
./virtualization/docker.nix
./systemd
./services
./programs
];
}
23 changes: 23 additions & 0 deletions modules/common/programs/chromium.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2024 TII (SSRC) and the Ghaf contributors
# SPDX-License-Identifier: Apache-2.0
{
config,
lib,
...
}: let
cfg = config.ghaf.programs.chromium;
in {
options.ghaf.programs.chromium = {
enable = lib.mkEnableOption "Enable Chromium program settings";
useZathuraVM = lib.mkEnableOption "Open PDFs in Zathura VM";
};
config = lib.mkIf cfg.enable {
programs.chromium.enable = true;

# Fix border glitch when going maximised->minimised.
programs.chromium.initialPrefs.browser.custom_chrome_frame = false;

# Don't use pdf.js, open externally.
programs.chromium.extraOpts."AlwaysOpenPdfExternally" = true;
};
}
8 changes: 8 additions & 0 deletions modules/common/programs/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright 2024 TII (SSRC) and the Ghaf contributors
# SPDX-License-Identifier: Apache-2.0
{
imports = [
./zathura.nix
./chromium.nix
];
}
19 changes: 19 additions & 0 deletions modules/common/programs/zathura.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2024 TII (SSRC) and the Ghaf contributors
# SPDX-License-Identifier: Apache-2.0
{
config,
lib,
...
}: let
cfg = config.ghaf.programs.zathura;
in {
options.ghaf.programs.zathura = {
enable = lib.mkEnableOption "Enable Zathura program settings";
};
config = lib.mkIf cfg.enable {
# Use regular clipboard instead of primary clipboard.
environment.etc."zathurarc".text = ''
set selection-clipboard clipboard
'';
};
}
7 changes: 0 additions & 7 deletions modules/desktop/graphics/demo-apps.nix
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,5 @@ in {
path = "${pkgs.appflowy}/bin/appflowy";
icon = "${pkgs.appflowy}/opt/data/flutter_assets/assets/images/flowy_logo.svg";
};
environment.systemPackages =
lib.optional cfg.chromium pkgs.chromium
++ lib.optional cfg.element-desktop pkgs.element-desktop
++ lib.optional cfg.firefox pkgs.firefox
++ lib.optional cfg.gala-app pkgs.gala-app
++ lib.optional cfg.zathura pkgs.zathura
++ lib.optional (cfg.appflowy && pkgs.stdenv.isx86_64) pkgs.appflowy;
};
}
4 changes: 4 additions & 0 deletions modules/desktop/graphics/labwc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ in {
identifier = "org.pwmt.zathura";
colour = "#122263";
}
{
identifier = "Element";
colour = "#337aff";
}
];
description = "List of applications and their frame colours";
};
Expand Down
5 changes: 2 additions & 3 deletions targets/lenovo-x1/appvms/chromium.nix
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,8 @@ in {
];
microvm.devices = [];

# Disable chromium built-in PDF viewer to make it execute xdg-open
programs.chromium.enable = true;
programs.chromium.extraOpts."AlwaysOpenPdfExternally" = true;
ghaf.programs.chromium.enable = true;

# Set default PDF XDG handler
xdg.mime.defaultApplications."application/pdf" = "ghaf-pdf.desktop";
}
Expand Down
6 changes: 1 addition & 5 deletions targets/lenovo-x1/appvms/zathura.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@
extraModules = [
{
time.timeZone = "Asia/Dubai";

# Use regular clipboard instead of primary clipboard.
environment.etc."zathurarc".text = ''
set selection-clipboard clipboard
'';
ghaf.programs.zathura.enable = true;
}
];
borderColor = "#122263";
Expand Down

0 comments on commit 710cd4b

Please sign in to comment.