diff options
| -rw-r--r-- | .chezmoiignore | 2 | ||||
| -rw-r--r-- | docs/canonical-laptop.md | 8 | ||||
| -rw-r--r-- | dot_config/mimeapps.list.tmpl | 7 | ||||
| -rw-r--r-- | dot_local/share/applications/dotfiles-nvim.desktop.tmpl | 8 | ||||
| -rw-r--r-- | dot_local/share/applications/dotfiles-yazi.desktop.tmpl | 8 | ||||
| -rw-r--r-- | tests/test_canonical_defaults.py | 60 |
6 files changed, 93 insertions, 0 deletions
diff --git a/.chezmoiignore b/.chezmoiignore index b91ca15..724d0d0 100644 --- a/.chezmoiignore +++ b/.chezmoiignore @@ -85,6 +85,7 @@ dot_config/nvim/nvim-pack-lock.json !.local/share/applications .local/share/applications/* !.local/share/applications/org.pwmt.zathura.desktop +!.local/share/applications/dotfiles-*.desktop !.local/share/gnome-shell .local/share/gnome-shell/* !.local/share/gnome-shell/extensions @@ -102,6 +103,7 @@ canonical-nvim-lock.sh .config/nix/nix.conf .config/autostart/dotfiles-*.desktop .config/autostart/keybase.desktop +.local/share/applications/dotfiles-*.desktop .config/systemd/user/gpg-agent.service.d/canonical.conf .local/lib/dotfiles/ .local/share/gnome-shell/extensions/corporate-panel@dotfiles/ diff --git a/docs/canonical-laptop.md b/docs/canonical-laptop.md index 3e93a56..892a17f 100644 --- a/docs/canonical-laptop.md +++ b/docs/canonical-laptop.md @@ -312,6 +312,14 @@ chooser if an old portal choice overrides the default. ## Desktop Checks +Folders open in Yazi and text files open in Neovim, each in Ghostty. Images +open in imv. Firefox, Thunderbird, and Zathura keep their existing defaults. +The GNOME file selection dialog stays unchanged. These settings do not replace +the file manager's D-Bus interface or a saved application choice in a portal. + +After deployment, check `xdg-open "$HOME"`, `xdg-open` on a text file, and +`xdg-open` on an image. The terminal launchers use absolute Nix profile paths. + Mattermost, Thunderbird, and one Nheko `work` profile autostart through GNOME. In Nheko, enable its tray and start-in-tray options for that profile. Disable duplicate application-owned autostart entries. Test notifications with diff --git a/dot_config/mimeapps.list.tmpl b/dot_config/mimeapps.list.tmpl index f5b6d20..da7c28a 100644 --- a/dot_config/mimeapps.list.tmpl +++ b/dot_config/mimeapps.list.tmpl @@ -1,5 +1,12 @@ {{ if eq (default "host" (index . "machineRole")) "canonical" }} [Default Applications] +inode/directory=dotfiles-yazi.desktop +{{ range list "text/plain" "text/markdown" "text/x-python" "text/x-chdr" "text/x-tex" "application/x-shellscript" "application/json" "application/yaml" }} +{{ . }}=dotfiles-nvim.desktop +{{ end }} +{{ range list "image/jpeg" "image/png" "image/gif" "image/webp" "image/bmp" "image/tiff" "image/x-nikon-nef" }} +{{ . }}=imv.desktop +{{ end }} application/pdf=org.pwmt.zathura.desktop x-scheme-handler/http=firefox_firefox.desktop x-scheme-handler/https=firefox_firefox.desktop diff --git a/dot_local/share/applications/dotfiles-nvim.desktop.tmpl b/dot_local/share/applications/dotfiles-nvim.desktop.tmpl new file mode 100644 index 0000000..e57d983 --- /dev/null +++ b/dot_local/share/applications/dotfiles-nvim.desktop.tmpl @@ -0,0 +1,8 @@ +[Desktop Entry] +Type=Application +Name=Neovim +Exec=/snap/bin/ghostty -e {{ printf "%s/.nix-profile/bin/nvim" .chezmoi.homeDir | quote }} -- %F +Icon=nvim +Terminal=false +Categories=Utility;TextEditor; +MimeType=text/plain;text/markdown;text/x-python;text/x-chdr;text/x-tex;application/x-shellscript;application/json;application/yaml; diff --git a/dot_local/share/applications/dotfiles-yazi.desktop.tmpl b/dot_local/share/applications/dotfiles-yazi.desktop.tmpl new file mode 100644 index 0000000..913f480 --- /dev/null +++ b/dot_local/share/applications/dotfiles-yazi.desktop.tmpl @@ -0,0 +1,8 @@ +[Desktop Entry] +Type=Application +Name=Yazi +Exec=/snap/bin/ghostty -e {{ printf "%s/.nix-profile/bin/yazi" .chezmoi.homeDir | quote }} %f +Icon=system-file-manager +Terminal=false +Categories=System;FileTools;FileManager; +MimeType=inode/directory; diff --git a/tests/test_canonical_defaults.py b/tests/test_canonical_defaults.py new file mode 100644 index 0000000..6ddb767 --- /dev/null +++ b/tests/test_canonical_defaults.py @@ -0,0 +1,60 @@ +import json +import subprocess +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] + + +def chezmoi(role, *args): + return subprocess.check_output( + [ + "chezmoi", + "--config", + "/dev/null", + "--config-format", + "toml", + "--override-data", + json.dumps({"machineRole": role}), + "-S", + str(ROOT), + *args, + ], + text=True, + ) + + +class DefaultTests(unittest.TestCase): + def test_corporate_defaults_use_managed_launchers(self): + rendered = chezmoi( + "canonical", + "execute-template", + "--file", + str(ROOT / "dot_config/mimeapps.list.tmpl"), + ) + for value in ( + "inode/directory=dotfiles-yazi.desktop", + "text/plain=dotfiles-nvim.desktop", + "image/png=imv.desktop", + "application/pdf=org.pwmt.zathura.desktop", + ): + self.assertIn(value, rendered) + + def test_launchers_are_corporate_only_and_use_ghostty(self): + for role in ("host", "vm", "canonical"): + files = chezmoi(role, "managed", "--include=files").splitlines() + for app in ("yazi", "nvim"): + target = f".local/share/applications/dotfiles-{app}.desktop" + self.assertEqual(target in files, role == "canonical") + entry = chezmoi( + role, + "execute-template", + "--file", + str( + ROOT + / f"dot_local/share/applications/dotfiles-{app}.desktop.tmpl" + ), + ) + self.assertIn("Exec=/snap/bin/ghostty -e ", entry) + self.assertIn(f'/.nix-profile/bin/{app}"', entry) + self.assertIn("Terminal=false", entry) |
