fix: reuse betterbird profile
This commit is contained in:
parent
8e225f5d82
commit
7da82701df
3 changed files with 74 additions and 4 deletions
|
|
@ -1,4 +1,4 @@
|
|||
{ ... }:
|
||||
{ homeLib, ... }:
|
||||
|
||||
{
|
||||
dconf.settings = {
|
||||
|
|
@ -40,6 +40,29 @@
|
|||
noDisplay = true;
|
||||
};
|
||||
|
||||
xdg.desktopEntries.betterbird = {
|
||||
name = "Betterbird";
|
||||
comment = "Mail, RSS and newsgroups client";
|
||||
exec = "${homeLib.betterbirdLauncher}/bin/betterbird-profile %u";
|
||||
icon = "betterbird";
|
||||
terminal = false;
|
||||
type = "Application";
|
||||
categories = [
|
||||
"Network"
|
||||
"Email"
|
||||
];
|
||||
mimeType = [
|
||||
"x-scheme-handler/mailto"
|
||||
"message/rfc822"
|
||||
"x-scheme-handler/webcal"
|
||||
"x-scheme-handler/webcals"
|
||||
];
|
||||
settings = {
|
||||
StartupNotify = "false";
|
||||
StartupWMClass = "eu.betterbird.Betterbird";
|
||||
};
|
||||
};
|
||||
|
||||
xdg.mimeApps = {
|
||||
enable = true;
|
||||
defaultApplications = {
|
||||
|
|
|
|||
|
|
@ -128,6 +128,52 @@ let
|
|||
platforms = [ "x86_64-linux" ];
|
||||
};
|
||||
};
|
||||
betterbirdLauncher = pkgs.writeShellApplication {
|
||||
name = "betterbird-profile";
|
||||
runtimeInputs = [
|
||||
pkgs.coreutils
|
||||
pkgs.gawk
|
||||
];
|
||||
text = ''
|
||||
set -euo pipefail
|
||||
|
||||
profile_root="''${HOME:-${config.home.homeDirectory}}/.thunderbird"
|
||||
profile_link="$profile_root/betterbird-current"
|
||||
profile=""
|
||||
|
||||
if [ -d "$profile_root" ]; then
|
||||
for lock in "$profile_root"/*/.parentlock; do
|
||||
if [ -e "$lock" ]; then
|
||||
profile="''${lock%/.parentlock}"
|
||||
ln -sfn "$profile" "$profile_link"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$profile" ] && [ -e "$profile_link" ]; then
|
||||
profile="$(readlink -f "$profile_link")"
|
||||
fi
|
||||
|
||||
if [ -z "$profile" ] && [ -f "$profile_root/profiles.ini" ]; then
|
||||
install_default="$(awk '
|
||||
/^\[Install/ { in_install = 1; next }
|
||||
/^\[/ { in_install = 0 }
|
||||
in_install && /^Default=/ { sub(/^Default=/, ""); print; exit }
|
||||
' "$profile_root/profiles.ini")"
|
||||
if [ -n "$install_default" ] && [ -d "$profile_root/$install_default" ]; then
|
||||
profile="$profile_root/$install_default"
|
||||
ln -sfn "$profile" "$profile_link"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$profile" ] && [ -d "$profile" ]; then
|
||||
exec ${betterbird}/bin/betterbird --profile "$profile" "$@"
|
||||
fi
|
||||
|
||||
exec ${betterbird}/bin/betterbird "$@"
|
||||
'';
|
||||
};
|
||||
nasaApodWallpaper = pkgs.writeShellApplication {
|
||||
name = "nasa-apod-wallpaper";
|
||||
runtimeInputs = [
|
||||
|
|
@ -385,7 +431,7 @@ let
|
|||
name = "betterbird-startup";
|
||||
desktopName = "Betterbird Startup";
|
||||
comment = "Launch Betterbird in fullscreen";
|
||||
exec = "${betterbird}/bin/betterbird";
|
||||
exec = "${betterbirdLauncher}/bin/betterbird-profile";
|
||||
terminal = false;
|
||||
noDisplay = true;
|
||||
categories = [ "Network" ];
|
||||
|
|
@ -405,6 +451,7 @@ in
|
|||
inherit
|
||||
betterbirdStartup
|
||||
betterbird
|
||||
betterbirdLauncher
|
||||
email
|
||||
ghosttyZellijStartup
|
||||
greptileSkills
|
||||
|
|
|
|||
|
|
@ -50,13 +50,13 @@ let
|
|||
"${config.programs.zen-browser.package}/bin/zen-beta"
|
||||
"${pkgs.ghostty}/bin/ghostty --fullscreen=true -e ${homeLib.zellijPersistentSession}/bin/zellij-persistent-session"
|
||||
"${pkgs.slack}/bin/slack"
|
||||
"${homeLib.betterbird}/bin/betterbird"
|
||||
"${homeLib.betterbirdLauncher}/bin/betterbird-profile"
|
||||
];
|
||||
personalStartup = [
|
||||
"${config.programs.zen-browser.package}/bin/zen-beta"
|
||||
"${pkgs.ghostty}/bin/ghostty --fullscreen=true -e ${homeLib.zellijPersistentSession}/bin/zellij-persistent-session"
|
||||
"${pkgs.vesktop}/bin/vesktop --start-fullscreen"
|
||||
"${homeLib.betterbird}/bin/betterbird"
|
||||
"${homeLib.betterbirdLauncher}/bin/betterbird-profile"
|
||||
"${pkgs.signal-desktop}/bin/signal-desktop --start-fullscreen"
|
||||
"${pkgs.zulip}/bin/zulip --start-fullscreen"
|
||||
];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue