1
Fork 0

Custom firefox apps!

This commit is contained in:
Matei Adriel 2023-01-15 23:04:11 +01:00
parent b7c6650fdd
commit 3f8db6cef4
No known key found for this signature in database
5 changed files with 99 additions and 0 deletions

View file

@ -104,4 +104,11 @@ in
}; };
}; };
}; };
firefox.apps.asana = {
url = "https://app.asana.com/";
icon = ./icons/asana.png;
displayName = "Asana";
id = 1;
};
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 423 B

View file

@ -4,4 +4,5 @@
# example = import ./example.nix; # example = import ./example.nix;
discord = import ./discord.nix; discord = import ./discord.nix;
fonts = import ./fonts.nix; fonts = import ./fonts.nix;
firefox = import ./firefox;
} }

View file

@ -0,0 +1,72 @@
{ lib, pkgs, config, ... }:
let cfg = config.firefox.apps;
in
{
options.firefox.apps = lib.mkOption {
type = lib.types.attrsOf
(lib.types.submodule ({ name, ... }: {
options = {
name = lib.mkOption {
type = lib.types.str;
description = "The name of the app";
default = name;
};
id = lib.mkOption {
type = lib.types.int;
description = "The id of the firefox profile for the app";
example = 3;
};
displayName = lib.mkOption {
type = lib.types.str;
description = "The name of the app in stuff like menus";
default = name;
};
url = lib.mkOption {
type = lib.types.str;
description = "The url the app should point to";
example = "https://example.com";
};
icon = lib.mkOption {
type = lib.types.path;
description = "The icon to use for the app";
};
};
}));
description = "Attr set of firefox web apps to install as desktop apps";
};
config =
let
mkProfile = app: {
settings = {
# Customize css
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
# Set language to english
"general.useragent.locale" = "en-GB";
};
userChrome = builtins.readFile ./theme.css;
isDefault = false;
id = app.id;
};
mkDesktopEntry = app: {
terminal = false;
name = app.displayName;
type = "Application";
exec = "firefox --name=${app.displayName} --no-remote -P \"${app.name}\" \"${app.url}\"";
icon = app.icon;
};
in
{
programs.firefox.profiles = lib.mapAttrs (_: mkProfile) cfg;
xdg.desktopEntries = lib.mapAttrs (_: mkDesktopEntry) cfg;
};
}

View file

@ -0,0 +1,19 @@
/* This file should hide the firefox ui! */
TabsToolbar {
visibility: collapse;
}
:root:not([customizing]) #navigator-toolbox:not(:hover):not(:focus-within) {
max-height: 1px;
min-height: calc(0px);
overflow: hidden;
}
#navigator-toolbox::after {
display: none !important;
}
#main-window[sizemode="maximized"] #content-deck {
padding-top: 8px;
}