Make discord parts of default associations

This commit is contained in:
Natsu Kagami 2025-03-14 11:50:06 +01:00
parent 1804a8e4a9
commit 14fc51fe18
Signed by: nki
GPG key ID: 55A032EB38B49ADB
4 changed files with 25 additions and 38 deletions

View file

@ -25,7 +25,6 @@ in
./modules/monitors.nix
./modules/linux/graphical
./modules/X11/xfce4-notifyd.nix
./modules/programs/discord.nix
kwallet
];
config = (mkIf pkgs.stdenv.isLinux {

View file

@ -3,7 +3,6 @@ with lib;
let
cfg = config.linux.graphical;
thunderbird = pkgs.thunderbird-128;
vscode = with pkgs; if stdenv.isAarch64 then unstable.vscode else unstable.vscode-fhs;
wifi-indicator = pkgs.writeScriptBin "wifi-indicator" ''
@ -52,15 +51,16 @@ in
startup = mkOption {
type = types.listOf types.package;
description = "List of packages to include in ~/.config/autostart";
default = with pkgs; [
default = [
cfg.defaults.webBrowser.package
thunderbird
vesktop
pkgs.thunderbird
cfg.defaults.discord.package
];
};
defaults = {
webBrowser = mkPackageWithDesktopOption { description = "default web browser"; };
terminal = mkPackageWithDesktopOption { description = "default terminal"; default.package = pkgs.kitty; };
discord = mkPackageWithDesktopOption { description = "Discord client"; default.package = pkgs.vesktop; };
};
};
config = mkIf (cfg.type != null) {
@ -106,9 +106,6 @@ in
wifi-indicator
] ++ cfg.startup);
nki.programs.discord.enable = pkgs.stdenv.isx86_64;
nki.programs.discord.package = pkgs.vesktop;
# OBS
programs.obs-studio = {
enable = true;
@ -146,6 +143,14 @@ in
"application/x-extension-rss" = [ "thunderbird.desktop" ];
"x-scheme-handler/tg2" = [ "org.telegram.desktop.desktop" ];
"x-scheme-handler/tonsite2" = [ "org.telegram.desktop.desktop" ];
# Other browser stuff
"application/x-extension-htm" = [ (desktopFileOf cfg.defaults.webBrowser) ];
"application/x-extension-html" = [ (desktopFileOf cfg.defaults.webBrowser) ];
"application/x-extension-shtml" = [ (desktopFileOf cfg.defaults.webBrowser) ];
"application/xhtml+xml" = [ (desktopFileOf cfg.defaults.webBrowser) ];
"application/x-extension-xhtml" = [ (desktopFileOf cfg.defaults.webBrowser) ];
"application/x-extension-xht" = [ (desktopFileOf cfg.defaults.webBrowser) ];
};
xdg.mimeApps.defaultApplications = {
# Email
@ -164,6 +169,7 @@ in
# Default web browser stuff
"text/html" = [ (desktopFileOf cfg.defaults.webBrowser) ];
"x-scheme-handler/chrome" = [ (desktopFileOf cfg.defaults.webBrowser) ];
"x-scheme-handler/about" = [ (desktopFileOf cfg.defaults.webBrowser) ];
"x-scheme-handler/unknown" = [ (desktopFileOf cfg.defaults.webBrowser) ];
"x-scheme-handler/http" = [ (desktopFileOf cfg.defaults.webBrowser) ];
@ -171,6 +177,12 @@ in
"x-scheme-handler/ftp" = [ (desktopFileOf cfg.defaults.webBrowser) ];
"x-scheme-handler/ftps" = [ (desktopFileOf cfg.defaults.webBrowser) ];
"x-scheme-handler/file" = [ (desktopFileOf cfg.defaults.webBrowser) ];
"application/x-extension-htm" = [ (desktopFileOf cfg.defaults.webBrowser) ];
"application/x-extension-html" = [ (desktopFileOf cfg.defaults.webBrowser) ];
"application/x-extension-shtml" = [ (desktopFileOf cfg.defaults.webBrowser) ];
"application/xhtml+xml" = [ (desktopFileOf cfg.defaults.webBrowser) ];
"application/x-extension-xhtml" = [ (desktopFileOf cfg.defaults.webBrowser) ];
"application/x-extension-xht" = [ (desktopFileOf cfg.defaults.webBrowser) ];
# Torrent
"application/x-bittorrent" = [ "deluge.desktop" ];
@ -186,13 +198,16 @@ in
# Telegram
"x-scheme-handler/tg2" = "org.telegram.desktop.desktop";
"x-scheme-handler/tonsite2" = "org.telegram.desktop.desktop";
# Discord
"x-scheme-handler/discord" = [ (desktopFileOf cfg.defaults.discord) ];
};
# Add one for kakoune
xdg.desktopEntries."kakoune" = {
name = "Kakoune";
genericName = "Text Editor";
exec = ''kitty --class kitty-float -o initial_window_width=150c -o initial_window_height=40c ${pkgs.writeShellScript "editor.sh" ''
exec = ''${lib.getExe pkgs.kitty} --class kitty-float -o initial_window_width=150c -o initial_window_height=40c ${pkgs.writeShellScript "editor.sh" ''
$EDITOR "$@"
''} %U'';
# exec = "kakoune %U";

View file

@ -1,27 +0,0 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.nki.programs.discord;
in
{
options.nki.programs.discord = {
enable = mkEnableOption "Enable discord";
basePackage = mkOption {
type = types.package;
default = pkgs.discord;
description = "The base Discord package that will get patched";
};
package = mkOption {
type = types.package;
default = cfg.basePackage.override { nss = pkgs.nss_latest; };
description = "The actual package to use";
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
};
}

View file

@ -1,4 +1,4 @@
{ pkgs, config, lib, ... }:
{ pkgs, options, config, lib, ... }:
let
iio-sway = pkgs.stdenv.mkDerivation {
@ -44,7 +44,7 @@ in
# Graphical set up
linux.graphical.type = "wayland";
linux.graphical.wallpaper = ./images/wallpaper_0.png;
linux.graphical.startup = with pkgs; [ zen-browser-bin thunderbird vesktop slack ];
linux.graphical.startup = options.linux.graphical.startup.default ++ [ pkgs.slack ];
linux.graphical.defaults.webBrowser.package = pkgs.zen-browser-bin;
linux.graphical.defaults.webBrowser.desktopFile = "zen.desktop";
# Enable sway