-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix default PDF reader when open in GNOME #1038
Conversation
home-manager/desktop.nix
Outdated
@@ -17,7 +17,7 @@ | |||
xdg = { | |||
# https://github.com/nix-community/home-manager/blob/release-24.11/modules/misc/xdg-mime-apps.nix - different of https://github.com/NixOS/nixpkgs/blob/nixos-24.11/nixos/modules/config/xdg/mime.nix | |||
mimeApps = { | |||
enable = false; # Avoiding error: bin/xdg-mime: line 1002: hm_mimeapps.list.new: Read-only file system | |||
enable = true; # Required to enable even though it is alerting `bin/xdg-mime: line 1002: hm_mimeapps.list.new: Read-only file system` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
> makers apply 'kachick@nixos-desktop'
[cargo-make] INFO - makers 0.37.23
[cargo-make] INFO -
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: apply
[cargo-make] INFO - Profile: development
[cargo-make] INFO - Execute Command: "nix" "run" ".#home-manager" "--" "switch" "-b" "backup" "--flake" ".#kachick@nixos-desktop" "--show-trace"
Home Managerの有効化を開始しました
checkFilesChanged を有効化しています
checkLinkTargets を有効化しています
writeBoundary を有効化しています
createGpgHomedir を有効化しています
migrateGhAccounts を有効化しています
linkGeneration を有効化しています
/home/kachick から無効なリンクを消去しています
変更されていないので最新の世代 163 のプロファイルを再利用します
ホームファイルのリンクを /home/kachick に作っています
batCache を有効化しています
No themes were found in '/home/kachick/.config/bat/themes', using the default set
No syntaxes were found in '/home/kachick/.config/bat/syntaxes', using the default set.
Writing theme set to /home/kachick/.cache/bat/themes.bin ... okay
Writing syntax set to /home/kachick/.cache/bat/syntaxes.bin ... okay
Writing metadata to folder /home/kachick/.cache/bat ... okay
createXdgUserDirectories を有効化しています
installPackages を有効化しています
replacing old 'home-manager-path'
installing 'home-manager-path'
dconfSettings を有効化しています
ensureLimaSharedTempdir を有効化しています
onFilesChange を有効化しています
refreshZcompdumpCache を有効化しています
registerStartingLima を有効化しています
INFO[0000] The autostart file "/home/kachick/.config/systemd/user/lima-vm@default.service" has been created or updated
reloadSystemd を有効化しています
setDefaultBrowser を有効化しています
/nix/store/9v7x5vabddvggsmy4gyim551gww2hsan-xdg-utils-1.2.1/bin/xdg-mime: line 1002: /nix/store/4zjk2h57wdwpqfmxd6wz5vjwzw3h1w48-hm_mimeapps.list.new: Read-only file system
/nix/store/9v7x5vabddvggsmy4gyim551gww2hsan-xdg-utils-1.2.1/bin/xdg-mime: line 1002: /nix/store/4zjk2h57wdwpqfmxd6wz5vjwzw3h1w48-hm_mimeapps.list.new: Read-only file system
Error while executing command, exit code: 4
Works after this change, but what is this error message... 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Require similar solution like https://github.com/nix-community/home-manager/pull/4815/files?w=1 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L1001-1003
[ -f "$out_file" ] || /nix/store/b1wvkjx96i3s7wblz38ya0zr8i93zbc5-coreutils-9.5/bin/touch "$out_file"
/nix/store/nnin69nrnrrmnv2scbwyfkgh1rf51gh1-gawk-5.3.1/bin/awk -v mimetype="$2" -v application="$1" '
BEGIN {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Full of the awk
/nix/store/nnin69nrnrrmnv2scbwyfkgh1rf51gh1-gawk-5.3.1/bin/awk -v mimetype="$2" -v application="$1" '
BEGIN {
prefix=mimetype "="
indefault=0
added=0
blanks=0
found=0
}
{
suppress=0
if (index($0, "[Default Applications]") == 1) {
indefault=1
found=1
} else if (index($0, "[") == 1) {
if (!added && indefault) {
print prefix application
added=1
}
indefault=0
} else if ($0 == "") {
suppress=1
blanks++
} else if (indefault && !added && index($0, prefix) == 1) {
$0=prefix application
added=1
}
if (!suppress) {
while (blanks > 0) {
print ""
blanks--
}
print $0
}
}
END {
if (!added) {
if (!found) {
print ""
print "[Default Applications]"
}
print prefix application
}
while (blanks > 0) {
print ""
blanks--
}
}
' "$out_file" > "$out_file.new" && /nix/store/b1wvkjx96i3s7wblz38ya0zr8i93zbc5-coreutils-9.5/bin/mv "$out_file.new" "$out_file"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like xdg-mime use in home-manager mismatch.
And the content is much simple.
So dropping this dependency of home-manager module might be good?
> bat /home/kachick/.local/share/applications/mimeapps.list
[Added Associations]
[Default Applications]
application/pdf=google-chrome.desktop;firefox.desktop
[Removed Associations]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be related to nix-community/home-manager#1213?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When pointing the "$out_file.new" to /nix/store/, it would be readonly...
But why? the home-manager module looks not using the xdg-mime https://github.com/nix-community/home-manager/blob/release-24.11/modules/misc/xdg-mime-apps.nix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But why? the home-manager module looks not using the xdg-mime
Oops... This conflict made by my code...
dotfiles/home-manager/desktop.nix
Lines 8 to 15 in c3dbe6b
home = { | |
activation = { | |
# defaultApplications in xdg=* modules do not support except mime types. So required this for hotkey use | |
setDefaultBrowser = lib.hm.dag.entryAfter [ "writeBoundary" ] '' | |
run '${pkgs.xdg-utils}/bin/xdg-settings' set 'default-web-browser' 'google-chrome.desktop' | |
''; | |
}; | |
}; |
Fix PDF default reader with removing conflict implementation which introduced in GH-953