Compare commits

...

16 commits

Author SHA1 Message Date
cfbdc77e6d NOTE ABOUT XDG-TERMINAL
All checks were successful
ci/woodpecker/push/check Pipeline was successful
2025-08-11 10:41:08 +00:00
a31a0ca400 REMOVE THIS ONE 2025-08-11 10:41:08 +00:00
341dc9b9c5 home: discord: add MIME associations 2025-08-11 10:41:08 +00:00
b27d71af2d hosts: homes: bazin: set MIME browser 2025-08-11 10:41:08 +00:00
f6d0eade59 home: terminal: termite: add MIME associations 2025-08-11 10:41:08 +00:00
cf000abe11 home: terminal: alacritty: add MIME associations 2025-08-11 10:41:08 +00:00
f4c185eacf home: zathura: add MIME associations 2025-08-11 10:41:08 +00:00
d99047fad2 home: nvim: add MIME associations 2025-08-11 10:41:08 +00:00
5158420e28 home: mpv: add MIME associations 2025-08-11 10:41:08 +00:00
337cf76b9f home: himalaya: add MIME associations 2025-08-11 10:41:08 +00:00
6bfec7558b home: firefox: add MIME associations 2025-08-11 10:41:08 +00:00
1c565d6377 home: feh: add MIME association 2025-08-11 10:41:08 +00:00
ae65119eea home: xdg: add 'mime-apps' 2025-08-11 10:41:08 +00:00
5f073875e6 home: tmux: use consistent commenting style
All checks were successful
ci/woodpecker/push/check Pipeline was successful
2025-08-11 10:18:35 +00:00
8c506ea03c home: xdg: enable 'preferXdgDirectories'
At the moment this only makes a difference for `dircolors`.
2025-08-11 10:05:19 +00:00
8688206ff5 flake: bump inputs 2025-08-11 10:05:19 +00:00
14 changed files with 361 additions and 24 deletions

36
flake.lock generated
View file

@ -14,11 +14,11 @@
]
},
"locked": {
"lastModified": 1754337839,
"narHash": "sha256-fEc2/4YsJwtnLU7HCFMRckb0u9UNnDZmwGhXT5U5NTw=",
"lastModified": 1754433428,
"narHash": "sha256-NA/FT2hVhKDftbHSwVnoRTFhes62+7dxZbxj5Gxvghs=",
"owner": "ryantm",
"repo": "agenix",
"rev": "856df6f6922845abd4fd958ce21febc07ca2fa45",
"rev": "9edb1787864c4f59ae5074ad498b6272b3ec308d",
"type": "github"
},
"original": {
@ -53,11 +53,11 @@
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"lastModified": 1747046372,
"narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",
"type": "github"
},
"original": {
@ -73,11 +73,11 @@
]
},
"locked": {
"lastModified": 1754091436,
"narHash": "sha256-XKqDMN1/Qj1DKivQvscI4vmHfDfvYR2pfuFOJiCeewM=",
"lastModified": 1754487366,
"narHash": "sha256-pHYj8gUBapuUzKV/kN/tR3Zvqc7o6gdFB9XKXIp1SQ8=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "67df8c627c2c39c41dbec76a1f201929929ab0bd",
"rev": "af66ad14b28a127c5c0f3bbb298218fc63528a18",
"type": "github"
},
"original": {
@ -117,11 +117,11 @@
]
},
"locked": {
"lastModified": 1750779888,
"narHash": "sha256-wibppH3g/E2lxU43ZQHC5yA/7kIKLGxVEnsnVK1BtRg=",
"lastModified": 1754416808,
"narHash": "sha256-c6yg0EQ9xVESx6HGDOCMcyRSjaTpNJP10ef+6fRcofA=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "16ec914f6fb6f599ce988427d9d94efddf25fe6d",
"rev": "9c52372878df6911f9afc1e2a1391f55e4dfc864",
"type": "github"
},
"original": {
@ -159,11 +159,11 @@
]
},
"locked": {
"lastModified": 1754365350,
"narHash": "sha256-NLWIkn1qM0wxtZu/2NXRaujWJ4Y1PSZlc7h0y6pOzOQ=",
"lastModified": 1754886238,
"narHash": "sha256-LTQomWOwG70lZR+78ZYSZ9sYELWNq3HJ7/tdHzfif/s=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "c5d7e957397ecb7d48b99c928611c6e780db1b56",
"rev": "0d492b89d1993579e63b9dbdaed17fd7824834da",
"type": "github"
},
"original": {
@ -175,11 +175,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1754372978,
"narHash": "sha256-ByII9p9ek0k9UADC/hT+i9ueM2mw0Zxiz+bOlydU6Oo=",
"lastModified": 1754725699,
"narHash": "sha256-iAcj9T/Y+3DBy2J0N+yF9XQQQ8IEb5swLFzs23CdP88=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9ebe222ec7ef9de52478f76cba3f0324c1d1119f",
"rev": "85dbfc7aaf52ecb755f87e577ddbe6dbbdbc1054",
"type": "github"
},
"original": {

View file

@ -38,6 +38,14 @@
};
};
xdg = {
mime-apps = {
applications = {
browser = "garcon_host_browser.desktop";
};
};
};
zsh = {
notify = {
enable = true;

View file

@ -21,5 +21,9 @@ in
# Do not keep me from using the app just to force an update
SKIP_HOST_UPDATE = true;
};
xdg.mimeApps.defaultApplications = {
"x-scheme-handler/discord" = "discord.desktop";
};
};
}

View file

@ -10,4 +10,11 @@ in
config.programs.feh = lib.mkIf cfg.enable {
enable = true;
};
config.my.home.xdg.mime-apps = lib.mkIf cfg.enable {
applications.media.image = {
bitmap = "feh.desktop";
vector = "feh.desktop";
};
};
}

View file

@ -79,4 +79,8 @@ in
};
};
};
config.my.home.xdg.mime-apps = lib.mkIf cfg.enable {
applications.browser = "firefox.desktop";
};
}

View file

@ -20,4 +20,8 @@ in
'';
};
};
config.my.home.xdg.mime-apps = lib.mkIf cfg.enable {
applications.editor = "himalaya.desktop";
};
}

View file

@ -17,5 +17,12 @@ in
pkgs.mpvScripts.uosc # Nicer UI
];
};
my.home.xdg.mime-apps = {
applications.media = {
audio = "mpv.desktop";
video = "mpv.desktop";
};
};
};
}

View file

@ -48,5 +48,9 @@ in
};
};
};
my.home.xdg.mime-apps = {
applications.terminal = "Alacritty.desktop";
};
};
}

View file

@ -49,5 +49,9 @@ in
color15 = ${whiteBold}
'';
};
my.home.xdg.mime-apps = {
applications.terminal = "termite.desktop";
};
};
}

View file

@ -61,8 +61,8 @@ in
pain-control
# Better session management
sessionist
# X clipboard integration
{
# X clipboard integration
plugin = yank;
extraConfig = ''
# Use 'clipboard' because of misbehaving apps (e.g: firefox)
@ -71,8 +71,8 @@ in
set -g @yank_action 'copy-pipe'
'';
}
# Show when prefix has been pressed
{
# Show when prefix has been pressed
plugin = prefix-highlight;
extraConfig = ''
# Also show when I'm in copy or sync mode

View file

@ -104,4 +104,8 @@ in
};
config.xdg.configFile = lib.mkIf cfg.enable configFiles;
config.my.home.xdg.mime-apps = lib.mkIf cfg.enable {
applications.editor = "nvim.desktop";
};
}

View file

@ -3,6 +3,10 @@ let
cfg = config.my.home.xdg;
in
{
imports = [
./mime-apps.nix
];
options.my.home.xdg = with lib; {
enable = my.mkDisableOption "XDG configuration";
};
@ -11,10 +15,6 @@ in
enable = true;
# File types
mime.enable = true;
# File associations
mimeApps = {
enable = true;
};
# User directories
userDirs = {
enable = true;
@ -56,4 +56,7 @@ in
XCOMPOSECACHE = "${dataHome}/X11/xcompose";
_JAVA_OPTIONS = "-Djava.util.prefs.userRoot=${configHome}/java";
};
# Some modules *optionally* use `XDG_*_HOME` when told to
config.home.preferXdgDirectories = lib.mkIf cfg.enable true;
}

View file

@ -0,0 +1,280 @@
{ config, lib, ... }:
let
cfg = config.my.home.xdg.mime-apps;
app = cfg.applications;
mkMimeAppOption = kind: lib.mkOption {
description = "Application to associate as ${kind}";
default = null;
type = with lib.types; nullOr str;
};
in
{
options.my.home.xdg.mime-apps = with lib; {
enable = mkEnableOption "XDG MIME Applications configuration" // {
default = config.my.home.xdg.enable;
};
applications = lib.mapAttrsRecursive (_: mkMimeAppOption) {
archive = "archive manager";
browser = "internet browser";
calendar = "calendar";
editor = "text editor";
fileManager = "file manager";
mail = "mail client";
media = {
audio = "audio player";
document = {
comic = "comic book reader";
ebook = "ebook reader";
pdf = "PDF reader";
};
image = {
bitmap = "bitmap image viewer";
vector = "vector image viewer";
editor = "image editor";
};
video = "video player";
};
office = {
database = "database management program";
formula = "formula editor";
graphics = "graphics editor";
presentation = "presentation editor";
spreadsheet = "spreadsheet editor";
text = "word processor";
};
terminal = "terminal"; # FIXME: should it also set `xdg.terminal-exec.settings.default`?
torrent = "bittorrent client";
};
};
config = lib.mkIf cfg.enable {
xdg = {
mimeApps = {
enable = true;
defaultApplications = lib.filterAttrs (_: apps: apps != null) {
"application/epub+zip" = app.media.document.ebook;
"application/gzip" = app.archive;
"application/json" = app.editor;
"application/ld+json" = app.editor;
"application/mxf " = app.media.video;
"application/ogg" = app.media.audio;
"application/pdf" = app.media.document.pdf;
"application/rss+xml" = app.editor;
"application/smil+xml " = app.media.video;
"application/vnd.amazon.ebook" = app.media.document.ebook;
"application/vnd.apple.mpegurl " = app.media.video;
"application/vnd.comicbook+zip" = app.media.document.comic;
"application/vnd.comicbook-rar" = app.media.document.comic;
"application/vnd.mozilla.xul+xml" = app.browser;
"application/vnd.ms-excel" = app.office.spreadsheet;
"application/vnd.ms-powerpoint" = app.office.presentation;
"application/vnd.ms-word" = app.office.text;
"application/vnd.oasis.opendocument.database" = app.office.database;
"application/vnd.oasis.opendocument.formula" = app.office.formula;
"application/vnd.oasis.opendocument.graphics" = app.office.graphics;
"application/vnd.oasis.opendocument.graphics-template" = app.office.graphics;
"application/vnd.oasis.opendocument.presentation" = app.office.presentation;
"application/vnd.oasis.opendocument.presentation-template" = app.office.presentation;
"application/vnd.oasis.opendocument.spreadsheet" = app.office.spreadsheet;
"application/vnd.oasis.opendocument.spreadsheet-template" = app.office.spreadsheet;
"application/vnd.oasis.opendocument.text" = app.office.text;
"application/vnd.oasis.opendocument.text-master" = app.office.text;
"application/vnd.oasis.opendocument.text-template" = app.office.text;
"application/vnd.oasis.opendocument.text-web" = app.office.text;
"application/vnd.openxmlformats-officedocument.presentationml.presentation" = app.office.presentation;
"application/vnd.openxmlformats-officedocument.presentationml.template" = app.office.presentation;
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" = app.office.spreadsheet;
"application/vnd.openxmlformats-officedocument.spreadsheetml.template" = app.office.spreadsheet;
"application/vnd.openxmlformats-officedocument.wordprocessingml.document" = app.office.text;
"application/vnd.openxmlformats-officedocument.wordprocessingml.template" = app.office.text;
"application/vnd.rar" = app.archive;
"application/vnd.stardivision.calc" = app.office.spreadsheet;
"application/vnd.stardivision.draw" = app.office.graphics;
"application/vnd.stardivision.impress" = app.office.presentation;
"application/vnd.stardivision.math" = app.office.formula;
"application/vnd.stardivision.writer" = app.office.text;
"application/vnd.sun.xml.base" = app.office.database;
"application/vnd.sun.xml.calc" = app.office.spreadsheet;
"application/vnd.sun.xml.calc.template" = app.office.spreadsheet;
"application/vnd.sun.xml.draw" = app.office.graphics;
"application/vnd.sun.xml.draw.template" = app.office.graphics;
"application/vnd.sun.xml.impress" = app.office.presentation;
"application/vnd.sun.xml.impress.template" = app.office.presentation;
"application/vnd.sun.xml.math" = app.office.formula;
"application/vnd.sun.xml.writer" = app.office.text;
"application/vnd.sun.xml.writer.global" = app.office.text;
"application/vnd.sun.xml.writer.template" = app.office.text;
"application/vnd.wordperfect" = app.office.text;
"application/x-7z-compressed" = app.archive;
"application/x-arj" = app.archive;
"application/x-bittorrent" = app.torrent;
"application/x-bzip" = app.archive;
"application/x-bzip-compressed-tar" = app.archive;
"application/x-bzip2" = app.archive;
"application/x-cb7" = app.media.document.comic;
"application/x-cbr" = app.media.document.comic;
"application/x-cbt" = app.media.document.comic;
"application/x-cbz" = app.media.document.comic;
"application/x-compress" = app.archive;
"application/x-compressed-tar" = app.archive;
"application/x-csh" = app.editor;
"application/x-cue" = app.media.audio;
"application/x-directory" = app.fileManager;
"application/x-extension-htm" = app.browser;
"application/x-extension-html" = app.browser;
"application/x-extension-ics" = app.calendar;
"application/x-extension-m4a" = app.media.audio;
"application/x-extension-mp4" = app.media.video;
"application/x-extension-shtml" = app.browser;
"application/x-extension-xht" = app.browser;
"application/x-extension-xhtml" = app.browser;
"application/x-fictionbook" = app.media.document.ebook;
"application/x-fictionbook+xml" = app.media.document.ebook;
"application/x-flac" = app.media.audio;
"application/x-gzip" = app.archive;
"application/x-lha" = app.archive;
"application/x-lhz" = app.archive;
"application/x-lzop" = app.archive;
"application/x-matroska" = app.media.video;
"application/x-netshow-channel" = app.media.video;
"application/x-quicktime-media-link" = app.media.video;
"application/x-quicktimeplayer" = app.media.video;
"application/x-rar" = app.archive;
"application/x-sh" = app.editor;
"application/x-shellscript" = app.editor;
"application/x-shorten " = app.media.audio;
"application/x-smil" = app.media.video;
"application/x-tar" = app.archive;
"application/x-tarz" = app.archive;
"application/x-wine-extension-ini" = app.editor;
"application/x-zip-compressed" = app.archive;
"application/x-zoo" = app.archive;
"application/xhtml+xml" = app.browser;
"application/xml" = app.editor;
"application/zip" = app.archive;
"audio/*" = app.media.video;
"image/*" = app.media.image.bitmap;
"image/svg+xml" = app.media.image.vector;
"image/x-compressed-xcf" = app.media.image.editor;
"image/x-fits" = app.media.image.editor;
"image/x-psd" = app.media.image.editor;
"image/x-xcf" = app.media.image.editor;
"inode/directory" = app.fileManager;
"message/rfc822" = app.mail;
"text/*" = app.editor;
"text/calendar" = app.calendar;
"text/html" = app.browser;
"text/plain" = app.editor;
"video/*" = app.media.video;
"x-scheme-handler/about" = app.browser;
"x-scheme-handler/chrome" = app.browser;
"x-scheme-handler/file" = app.fileManager;
"x-scheme-handler/ftp" = app.browser;
"x-scheme-handler/http" = app.browser;
"x-scheme-handler/https" = app.browser;
"x-scheme-handler/mailto" = app.mail;
"x-scheme-handler/mid" = app.mail;
"x-scheme-handler/terminal" = app.terminal;
"x-scheme-handler/unknown" = app.browser;
"x-scheme-handler/webcal" = app.calendar;
"x-scheme-handler/webcals" = app.calendar;
"x-www-browser" = app.browser;
# FIXME: relevant? https://bbs.archlinux.org/viewtopic.php?id=243125
# FIXME: shouldn't be necessary then
# "audio/AMR" = app.media.audio;
# "audio/aac" = app.media.audio;
# "audio/ac3" = app.media.audio;
# "audio/flac" = app.media.audio;
# "audio/mp2" = app.media.audio;
# "audio/mp4" = app.media.audio;
# "audio/mpeg" = app.media.audio;
# "audio/ogg" = app.media.audio;
# "audio/vnd.dts" = app.media.audio;
# "audio/vnd.dts.hd" = app.media.audio;
# "audio/vnd.rn-realaudio" = app.media.audio;
# "audio/webm" = app.media.audio;
# "audio/x-adpcm" = app.media.audio;
# "audio/x-aiff" = app.media.audio;
# "audio/x-ape" = app.media.audio;
# "audio/x-matroska" = app.media.audio;
# "audio/x-mpegurl" = app.media.audio;
# "audio/x-ms-asx" = app.media.audio;
# "audio/x-ms-wma" = app.media.audio;
# "audio/x-musepack" = app.media.audio;
# "audio/x-scpls" = app.media.audio;
# "audio/x-tta" = app.media.audio;
# "audio/x-vorbis+ogg" = app.media.audio;
# "audio/x-wav" = app.media.audio;
# "audio/x-wavpack" = app.media.audio;
# "image/bmp" = app.media.image.bitmap;
# "image/gif" = app.media.image.bitmap;
# "image/heif" = app.media.image.bitmap;
# "image/jpeg" = app.media.image.bitmap;
# "image/jpg" = app.media.image.bitmap;
# "image/pjpeg" = app.media.image.bitmap;
# "image/png" = app.media.image.bitmap;
# "image/tiff" = app.media.image.bitmap;
# "image/vnd.zbrush.pcx" = app.media.image.bitmap;
# "image/webp" = app.media.image.bitmap;
# "image/x-icb" = app.media.image.bitmap;
# "image/x-ico" = app.media.image.bitmap;
# "image/x-pcx" = app.media.image.bitmap;
# "image/x-portable-anymap" = app.media.image.bitmap;
# "image/x-portable-bitmap" = app.media.image.bitmap;
# "image/x-portable-graymap" = app.media.image.bitmap;
# "image/x-portable-pixmap" = app.media.image.bitmap;
# "image/x-tga" = app.media.image.bitmap;
# "image/x-xbitmap" = app.media.image.bitmap;
# "image/x-xpixmap" = app.media.image.bitmap;
# "image/x-xwindowdump" = app.media.image.bitmap;
# "text/tcl" = app.editor;
# "text/x-c++hdr" = app.editor;
# "text/x-c++src" = app.editor;
# "text/x-chdr" = app.editor;
# "text/x-csrc" = app.editor;
# "text/x-java" = app.editor;
# "text/x-makefile" = app.editor;
# "text/x-moc" = app.editor;
# "text/x-pascal" = app.editor;
# "text/x-tex" = app.editor;
# "video/3gpp" = app.media.video;
# "video/3gpp2" = app.media.video;
# "video/dv" = app.media.video;
# "video/mp2t" = app.media.video;
# "video/mp4" = app.media.video;
# "video/mpeg" = app.media.video;
# "video/ogg" = app.media.video;
# "video/quicktime" = app.media.video;
# "video/vnd.mpegurl" = app.media.video;
# "video/vnd.rn-realvideo" = app.media.video;
# "video/webm" = app.media.video;
# "video/x-flic" = app.media.video;
# "video/x-flv" = app.media.video;
# "video/x-matroska" = app.media.video;
# "video/x-ms-wmv" = app.media.video;
# "video/x-msvideo" = app.media.video;
# "video/x-ogm+ogg" = app.media.video;
# "video/x-theora+ogg" = app.media.video;
# FIXME: kind of weird formats, not quite adapted to attribute name
# "application/eps" = app.media.document.pdf
# "application/oxps" = app.media.document.pdf
# "application/postscript" = app.media.document.pdf
# "application/x-eps" = app.media.document.pdf
# "image/eps" = app.media.document.pdf
# "image/vnd.djvu" = app.media.document.pdf
# "image/vnd.djvu+multipage" = app.media.document.pdf
# "image/x-eps" = app.media.document.pdf
# FIXME: additionally interesting, but not necessary
# "x-scheme-handler/msteams" = [ "teams.desktop" ];
# "x-scheme-handler/slack" = [ "slack.desktop" ];
};
};
};
};
}

View file

@ -17,4 +17,12 @@ in
"statusbar-home-tilde" = true;
};
};
config.my.home.xdg.mime-apps = lib.mkIf cfg.enable {
applications.media.document = {
comic = "org.pwmt.zathura.desktop";
ebook = "org.pwmt.zathura.desktop";
pdf = "org.pwmt.zathura.desktop";
};
};
}