mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-06-27 12:08:49 +02:00
systemd: move XDG MIME defaults to a script
This commit is contained in:
parent
4e9c69d5b1
commit
3ffca01c5a
2 changed files with 26 additions and 10 deletions
25
bin/xdg-defaults
Executable file
25
bin/xdg-defaults
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Set default MIME type for XDG. Linux desktop is a bit painful around
|
||||
# that. Random applications register for any MIME type and the default
|
||||
# is always surprising.
|
||||
|
||||
set -e
|
||||
|
||||
while read desktop mimetypes; do
|
||||
for dir in ~/.local/share/applications /usr/local/share/applications /usr/share/applications notfound; do
|
||||
[ -f "$dir"/"$desktop" ] || continue
|
||||
echo "Set default for $mimetypes to $desktop"
|
||||
xdg-mime default $desktop $mimetypes
|
||||
break
|
||||
done
|
||||
[ "$dir" != "notfound" ] || echo "Application $desktop not found"
|
||||
done <<EOF
|
||||
firefox.desktop x-scheme-handler/http x-scheme-handler/https x-scheme-handler/about
|
||||
firefox.desktop text/html
|
||||
emacsmail.desktop x-scheme-handler/mailto
|
||||
org.pwmt.zathura-ps.desktop application/postscript
|
||||
org.pwmt.zathura-pdf-poppler.desktop application/pdf
|
||||
org.pwmt.zathura-djvu.desktop image/vnd.djvu image/vnd.djvu+multipage
|
||||
org.kde.krita.desktop image/png image/jpeg image/jpg image/gif image/webp
|
||||
EOF
|
|
@ -5,15 +5,6 @@ PartOf=graphical-session@%i.target
|
|||
[Service]
|
||||
Environment=DISPLAY=%I
|
||||
ExecStart=/usr/bin/xset -b
|
||||
ExecStart=/usr/bin/xdg-mime default firefox.desktop \
|
||||
x-scheme-handler/http \
|
||||
x-scheme-handler/https \
|
||||
x-scheme-handler/about \
|
||||
text/html
|
||||
ExecStart=/usr/bin/xdg-mime default emacsmail.desktop x-scheme-handler/mailto
|
||||
ExecStart=/usr/bin/xdg-mime default org.pwmt.zathura-ps.desktop application/postscript
|
||||
ExecStart=/usr/bin/xdg-mime default org.pwmt.zathura-pdf-poppler.desktop application/pdf
|
||||
ExecStart=/usr/bin/xdg-mime default org.pwmt.zathura-djvu.desktop image/vnd.djvu image/vnd.djvu+multipage
|
||||
ExecStart=/usr/bin/xdg-mime default gpicview.desktop image/png image/jpeg image/jpg image/gif image/webp
|
||||
ExecStart=%h/.config/awesome/bin/xdg-defaults
|
||||
Type=oneshot
|
||||
RemainAfterExit=false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue