diff options
author | Yaroslav <contact@yaroslavps.com> | 2020-09-05 18:30:19 +0300 |
---|---|---|
committer | Yaroslav <contact@yaroslavps.com> | 2020-09-05 18:30:19 +0300 |
commit | f848575160ca441ee7129969c45c39f7f78ccbfc (patch) | |
tree | 8f24cd43279a933acee1ac33c588e3a8d1a390b1 /dotfiles | |
parent | 0afbb41cc3bad6c6943d1ef1826b3b5464e9d7c2 (diff) | |
download | swayrice-f848575160ca441ee7129969c45c39f7f78ccbfc.tar.gz swayrice-f848575160ca441ee7129969c45c39f7f78ccbfc.zip |
manage default applications with xdg-open/mimeo in ranger/vifm/etc.
Diffstat (limited to 'dotfiles')
-rw-r--r-- | dotfiles/.config/imv/config | 9 | ||||
-rw-r--r-- | dotfiles/.config/mimeapps.list | 1 | ||||
-rw-r--r-- | dotfiles/.config/ranger/rifle.conf | 179 | ||||
-rw-r--r-- | dotfiles/.config/vifm/vifmrc | 136 | ||||
-rwxr-xr-x | dotfiles/.local/bin/imv-rifle | 5 | ||||
-rw-r--r-- | dotfiles/.local/share/applications/imv.desktop | 14 |
6 files changed, 33 insertions, 311 deletions
diff --git a/dotfiles/.config/imv/config b/dotfiles/.config/imv/config new file mode 100644 index 0000000..bf3453e --- /dev/null +++ b/dotfiles/.config/imv/config @@ -0,0 +1,9 @@ +[binds] + +<Ctrl+a> = exec setbg "$imv_current_file" +<Ctrl+1> = exec setbg "$imv_current_file" +<Ctrl+2> = exec setbg "$imv_current_file" "2" +<Ctrl+s> = exec setbglblur "$imv_current_file" +<Ctrl+d> = exec setbglsimple "$imv_current_file" +<Ctrl+c> = exec wl-copy < "$imv_current_file" +<Ctrl+Shift+c> = exec wl-copy "$imv_current_file" diff --git a/dotfiles/.config/mimeapps.list b/dotfiles/.config/mimeapps.list index 4fc1b50..f15c469 100644 --- a/dotfiles/.config/mimeapps.list +++ b/dotfiles/.config/mimeapps.list @@ -9,6 +9,7 @@ image/jpeg=imv.desktop; image/png=imv.desktop; text/html=org.qutebrowser.qutebrowser.desktop; text/xml=nvim.desktop; +text/plain=nvim.desktop; x-scheme-handler/discord-589393213723246592=discord-589393213723246592.desktop; x-scheme-handler/http=org.qutebrowser.qutebrowser.desktop; x-scheme-handler/https=org.qutebrowser.qutebrowser.desktop; diff --git a/dotfiles/.config/ranger/rifle.conf b/dotfiles/.config/ranger/rifle.conf index 4ebbf6b..ce2c241 100644 --- a/dotfiles/.config/ranger/rifle.conf +++ b/dotfiles/.config/ranger/rifle.conf @@ -55,179 +55,6 @@ # install a rare browser, you probably use it. Firefox/konqueror/w3m on the # other hand are often only installed as fallback browsers. -ext x?html?, has qutebrowser, X, flag f = qutebrowser -- "$@" -ext x?html?, has firefox, X, flag f = firefox -- "$@" -ext x?html?, has waterfox, X, flag f = waterfox -- "$@" -ext x?html?, has surf, X, flag f = surf -- file://"$1" -ext x?html?, has vimprobable, X, flag f = vimprobable -- "$@" -ext x?html?, has vimprobable2, X, flag f = vimprobable2 -- "$@" -ext x?html?, has dwb, X, flag f = dwb -- "$@" -ext x?html?, has jumanji, X, flag f = jumanji -- "$@" -ext x?html?, has luakit, X, flag f = luakit -- "$@" -ext x?html?, has uzbl, X, flag f = uzbl -- "$@" -ext x?html?, has uzbl-tabbed, X, flag f = uzbl-tabbed -- "$@" -ext x?html?, has uzbl-browser, X, flag f = uzbl-browser -- "$@" -ext x?html?, has uzbl-core, X, flag f = uzbl-core -- "$@" -ext x?html?, has midori, X, flag f = midori -- "$@" -ext x?html?, has chromium, X, flag f = chromium -- "$@" -ext x?html?, has opera, X, flag f = opera -- "$@" -ext x?html?, has dillo, X, flag f = dillo -- "$@" -ext x?html?, has seamonkey, X, flag f = seamonkey -- "$@" -ext x?html?, has iceweasel, X, flag f = iceweasel -- "$@" -ext x?html?, has epiphany, X, flag f = epiphany -- "$@" -ext x?html?, has konqueror, X, flag f = konqueror -- "$@" -ext x?html?, has elinks, terminal = elinks "$@" -ext x?html?, has links2, terminal = links2 "$@" -ext x?html?, has links, terminal = links "$@" -ext x?html?, has lynx, terminal = lynx -- "$@" -ext x?html?, has w3m, terminal = w3m "$@" - - -#Spreadsheets for scim -ext sc|csv|sxc|xlt|xlw|gnm|gnumeric, = sc-im -- "$@" - -#------------------------------------------- -# Misc -#------------------------------------------- -# Define the "editor" for text files as first action -mime ^text, label editor = $EDITOR -- "$@" -mime ^text, label pager = "$PAGER" -- "$@" -!mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|js|sh|php = $EDITOR -- "$@" -!mime ^text, label pager, ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@" - -ext 1 = man "$1" -ext s[wmf]c, has zsnes, X = zsnes "$1" -ext s[wmf]c, has snes9x-gtk,X = snes9x-gtk "$1" -ext nes, has fceux, X = fceux "$1" -ext exe = wine "$1" -name ^[mM]akefile$ = make - -#-------------------------------------------- -# Code -#------------------------------------------- -ext py = python -- "$1" -ext pl = perl -- "$1" -ext rb = ruby -- "$1" -ext js = node -- "$1" -ext sh = sh -- "$1" -ext php = php -- "$1" - -#-------------------------------------------- -# Video/Audio with a GUI -#------------------------------------------- -mime ^video, has mpv, X, flag f = mpv -- "$@" -mime ^video, has mpv, X, flag f = mpv --fs -- "$@" -mime ^video, has mpv, X, flag f = mpv --loop -- "$@" -mime ^video|audio, has gmplayer, X, flag f = gmplayer -- "$@" -mime ^video|audio, has smplayer, X, flag f = smplayer "$@" -mime ^video, has mplayer2, X, flag f = mplayer2 -- "$@" -mime ^video, has mplayer2, X, flag f = mplayer2 -fs -- "$@" -mime ^video, has mplayer, X, flag f = mplayer -- "$@" -mime ^video, has mplayer, X, flag f = mplayer -fs -- "$@" -# mime ^video|audio, has vlc, X, flag f = vlc -- "$@" -mime ^video|audio, has totem, X, flag f = totem -- "$@" -mime ^video|audio, has totem, X, flag f = totem --fullscreen -- "$@" -#-------------------------------------------- -# Audio without X -#------------------------------------------- -mime ^audio|ogg$, terminal, has mpv = mpv --no-audio-display -- "$@" -mime ^audio|ogg$, terminal, has mplayer = mplayer -- "$@" -mime ^audio|ogg$, terminal, has mplayer2 = mplayer2 -- "$@" -# mime ^audio|ogg$, terminal, has mpc = mpc clear && mpc add "$@" && mpc play -mime ^audio|ogg$, terminal, has mpv = mpv -- "$@" -ext midi?, terminal, has wildmidi = wildmidi -- "$@" - - -#-------------------------------------------- -# Video without X: -#------------------------------------------- -mime ^video, terminal, !X, has mpv = mpv -- "$@" -mime ^video, terminal, !X, has mplayer2 = mplayer2 -- "$@" -mime ^video, terminal, !X, has mplayer = mplayer -- "$@" - -#------------------------------------------- -# Documents -#------------------------------------------- -ext pdf, has llpp, X, flag f = llpp "$@" -ext pdf, has zathura, X, flag f = zathura -- "$@" -ext pdf, has mupdf, X, flag f = mupdf "$@" -ext pdf, has mupdf, X, flag f = mupdf -I "$@" -ext pdf, has mupdf-x11,X, flag f = mupdf-x11 "$@" -ext pdf, has apvlv, X, flag f = apvlv -- "$@" -ext pdf, has xpdf, X, flag f = xpdf -- "$@" -ext pdf, has evince, X, flag f = evince -- "$@" -ext pdf, has atril, X, flag f = atril -- "$@" -ext pdf, has okular, X, flag f = okular -- "$@" -ext pdf, has epdfview, X, flag f = epdfview -- "$@" -ext pdf, has qpdfview, X, flag f = qpdfview "$@" - -ext epub, has zathura, X, flag f = zathura -- "$@" -ext epub, has mupdf, X, flag f = mupdf "$@" - - -ext docx, has abiword, X, flag f = abiword "$@" - -ext docx?, has catdoc, terminal = catdoc -- "$@" | "$PAGER" - -ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has libreoffice, X, flag f = libreoffice "$@" -ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has gnumeric, X, flag f = gnumeric -- "$@" -ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has kspread, X, flag f = kspread -- "$@" -ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has soffice, X, flag f = soffice "$@" -ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has ooffice, X, flag f = ooffice "$@" - -ext djvu, has zathura,X, flag f = zathura -- "$@" -ext djvu, has evince, X, flag f = evince -- "$@" -ext djvu, has atril, X, flag f = atril -- "$@" - -#------------------------------------------- -# Image Viewing: -#------------------------------------------- -mime ^image/svg, has inkscape, X, flag f = inkscape -- "$@" -mime ^image/svg, has display, X, flag f = display -- "$@" -#mime ^image/gif, has mpv, X, flag f = mpv --loop -- "$@" -#mime ^image/gif, has viewnior, X, flag f = viewnior -- "$@" -#mime ^image/gif, has qutebrowser, X, flag f = qutebrowser -- "$@" - -ext xcf, X, flag f = gimp -- "$@" -mime ^image, has sxiv, X, flag f = sxiv-rifle -- "$@" -#mime ^image, has geeqie, X, flag f = geeqie -t -- "$@" -#mime ^image, has sxiv, X, flag f = sxiv -- "$@" -mime ^image, has feh, X, flag f = feh --scale-down --auto-zoom --image-bg black -- "$@" -mime ^image, has mirage, X, flag f = mirage -- "$@" -mime ^image, has ristretto, X, flag f = ristretto "$@" -mime ^image, has eog, X, flag f = eog -- "$@" -mime ^image, has eom, X, flag f = eom -- "$@" -mime ^image, has gimp, X, flag f = gimp -- "$@" -mime ^image, has pinta, X, flag f = pinta -- "$@" -mime ^image, has mypaint, X, flag f = mypaint -- "$@" -mime ^image, has kolourpaint, X, flag f = kolourpaint -- "$@" - -#------------------------------------------- -# Archives -#------------------------------------------- -# This requires atool -ext jar = java -jar "$@" - -ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has als = als -- "$@" | "$PAGER" -ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has als = als -- "$@" | "$PAGER" -ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has aunpack = aunpack -- "$@" -ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has aunpack = aunpack -- "$@" - -# Fallback: -ext tar|gz, has tar = tar vvtf "$@" | "$PAGER" -ext tar|gz, has tar = tar vvxf "$@" - -#------------------------------------------- -# Misc -#------------------------------------------- -label wallpaper, number 11, mime ^image, has feh, X = feh --bg-scale "$1" -label wallpaper, number 12, mime ^image, has feh, X = feh --bg-tile "$1" -label wallpaper, number 13, mime ^image, has feh, X = feh --bg-center "$1" -label wallpaper, number 14, mime ^image, has feh, X = feh --bg-fill "$1" - -# Define the editor for non-text files + pager as last action - !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = ask -label editor, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = $EDITOR -- "$@" -label pager, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@" - -ext blend, has blender, X, flag f = blender -- "$@" +else = setsid xdg-open "$1" > /dev/null 2>&1 & +label editor = "$EDITOR" -- "$@" +label pager = "$PAGER" -- "$@" diff --git a/dotfiles/.config/vifm/vifmrc b/dotfiles/.config/vifm/vifmrc index 7ef1696..c9d81fc 100644 --- a/dotfiles/.config/vifm/vifmrc +++ b/dotfiles/.config/vifm/vifmrc @@ -91,48 +91,17 @@ noremap K :tabp<CR> " program. " Pdf -filextype *.pdf zathura %c %i &, apvlv %c, xpdf %c fileviewer *.pdf "\ vifmimg pdfpreview %px %py %pw %ph %c "\ %pc "\ vifmimg clear \ pdftotext -nopgbrk %c - -" PostScript -filextype *.ps,*.eps,*.ps.gz - \ {View in zathura} - \ zathura %f&, - \ {View in gv} - \ gv %c %i &, - -" Djvu -filextype *.djvu - \ {View in zathura} - \ zathura %f&, - \ {View in apvlv} - \ apvlv %f&, - " Audio -filetype *.wav,*.mp3,*.flac,*.m4a,*.wma,*.ape,*.ac3,*.og[agx],*.spx,*.opus - "\ {Play using ffplay} - "\ ffplay -nodisp -autoexit %c, - \ {Play using MPlayer} - \ mplayer %f, fileviewer *.mp3 mp3info fileviewer *.flac soxi " Video -filextype *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob, - \*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx, - \*.as[fx] - \ {View using mpv} - \ mpv --gpu-context=wayland %f, - \ {View using ffplay} - \ ffplay -fs -autoexit %f, - \ {View using Dragon} - \ dragon %f:p, - \ {View using mplayer} - \ mplayer %f, fileviewer *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob, \*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx, \*.as[fx] @@ -141,33 +110,10 @@ fileviewer *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob, "\ vifmimg clear \ ffprobe -pretty %c 2>&1 -" Web -filextype *.html,*.htm - \ {Open with dwb} - \ dwb %f %i &, - \ {Open with firefox} - \ firefox %f &, - \ {Open with uzbl} - \ uzbl-browser %f %i &, -filetype *.html,*.htm links, lynx - -" Object -filetype *.o nm %f | less - " Man page -filetype *.[1-8] man ./%c fileviewer *.[1-8] man ./%c | col -b " Images -filextype *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm - \ {View in sxiv} - \ sxiv -ia %c %d &, - \ {View in imv} - \ imv -d %d -n %f &, - \ {View in feh} - \ feh %d &, - \ {View in cacaview} - \ cacaview %c &, fileviewer *.bmp,*.jpg,*.jpeg,*.png,*.xpm \ vifmimg draw %px %py %pw %ph %c \ %pc @@ -181,107 +127,27 @@ fileviewer *.gif \ %pc \ vifmimg clear -" OpenRaster -filextype *.ora - \ {Edit in MyPaint} - \ mypaint %f, - -" Mindmap -filextype *.vym - \ {Open with VYM} - \ vym %f &, - -" MD5 -filetype *.md5 - \ {Check MD5 hash sum} - \ md5sum -c %f %S, - -" SHA1 -filetype *.sha1 - \ {Check SHA1 hash sum} - \ sha1sum -c %f %S, - -" SHA256 -filetype *.sha256 - \ {Check SHA256 hash sum} - \ sha256sum -c %f %S, - -" SHA512 -filetype *.sha512 - \ {Check SHA512 hash sum} - \ sha512sum -c %f %S, - -" GPG signature -filetype *.asc - \ {Check signature} - \ !!gpg --verify %c, - -" Torrent -filetype *.torrent ktorrent %f & fileviewer *.torrent dumptorrent -v %c " FuseZipMount -filetype *.zip,*.jar,*.war,*.ear,*.oxt,*.apkg - \ {Mount with fuse-zip} - \ FUSE_MOUNT|fuse-zip %SOURCE_FILE %DESTINATION_DIR, - \ {View contents} - \ zip -sf %c | less, - \ {Extract here} - \ tar -xf %c, fileviewer *.zip,*.jar,*.war,*.ear,*.oxt zip -sf %c " ArchiveMount -filetype *.tar,*.tar.bz2,*.tbz2,*.tgz,*.tar.gz,*.tar.xz,*.txz - \ {Mount with archivemount} - \ FUSE_MOUNT|archivemount %SOURCE_FILE %DESTINATION_DIR, fileviewer *.tgz,*.tar.gz tar -tzf %c fileviewer *.tar.bz2,*.tbz2 tar -tjf %c fileviewer *.tar.txz,*.txz xz --list %c fileviewer *.tar tar -tf %c " Rar2FsMount and rar archives -filetype *.rar - \ {Mount with rar2fs} - \ FUSE_MOUNT|rar2fs %SOURCE_FILE %DESTINATION_DIR, fileviewer *.rar unrar v %c -" IsoMount -filetype *.iso - \ {Mount with fuseiso} - \ FUSE_MOUNT|fuseiso %SOURCE_FILE %DESTINATION_DIR, - -" SshMount -filetype *.ssh - \ {Mount with sshfs} - \ FUSE_MOUNT2|sshfs %PARAM %DESTINATION_DIR %FOREGROUND, - -" FtpMount -filetype *.ftp - \ {Mount with curlftpfs} - \ FUSE_MOUNT2|curlftpfs -o ftp_port=-,,disable_eprt %PARAM %DESTINATION_DIR %FOREGROUND, - " Fuse7z and 7z archives -filetype *.7z - \ {Mount with fuse-7z} - \ FUSE_MOUNT|fuse-7z %SOURCE_FILE %DESTINATION_DIR, fileviewer *.7z 7z l %c " Office files -filextype *.odt,*.doc,*.docx,*.xls,*.xlsx,*.odp,*.pptx libreoffice %f & fileviewer *.doc catdoc %c fileviewer *.docx docx2txt.pl %f - -" TuDu files -filetype *.tudu tudu -f %c - -" Qt projects -filextype *.pro qtcreator %f & - -" Directories -filextype */ - \ {View in thunar} - \ Thunar %f &, - " Syntax highlighting in preview " " Explicitly set highlight type for some extensions @@ -307,7 +173,7 @@ filextype */ " uncommenting one of lines below will result in ignoring 'vi[x]cmd' option " for unknown file types. " For *nix: -" filetype * xdg-open +filetype * xdg-open " For OS X: " filetype * open " For Windows: diff --git a/dotfiles/.local/bin/imv-rifle b/dotfiles/.local/bin/imv-rifle new file mode 100755 index 0000000..26d1673 --- /dev/null +++ b/dotfiles/.local/bin/imv-rifle @@ -0,0 +1,5 @@ +#!/bin/sh + +dir=$(dirname "$1") + +imv "$dir" -n "$1" diff --git a/dotfiles/.local/share/applications/imv.desktop b/dotfiles/.local/share/applications/imv.desktop new file mode 100644 index 0000000..d558282 --- /dev/null +++ b/dotfiles/.local/share/applications/imv.desktop @@ -0,0 +1,14 @@ +[Desktop Entry] +Name=imv +GenericName=Image viewer +GenericName[en_US]=Image viewer +Comment=Fast freeimage-based Image Viewer +Exec=imv-rifle %f +NoDisplay=true +Terminal=false +Type=Application +Categories=Graphics;2DGraphics;Viewer; +MimeType=image/bmp;image/gif;image/jpeg;image/jpg;image/pjpeg;image/png;image/tiff;image/x-bmp;image/x-pcx;image/x-png;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-tga;image/x-xbitmap; +Name[en_US]=imv +Icon=multimedia-photo-viewer +Keywords=photo;picture; |