Coming over from windows again. I’ve got pretty much everything figured out. I even got a VM going with my CAD software so I don’t need to switch between Windows! I was super proud of myself on that one. The last thing I’m having trouble with…

I use pdfxchange for my PDF editor. It works great in wine but they don’t have a specific Linux release. (If there is a good PDF editor that is Linux native let me know, I need good Mark up and dimensioning tools that can scale off of the drawings). I’m trying to set it to open PDFs by default but can’t figure it out. Does someone have a good (easy) way to do it?

7 points
*

TLDR, scroll down to the script. Make a .sh file, allow it to run as a program, set it as your default program to open whatever filetype

Navigate to the appropriate/your favorite folder to store portable applications. Make the below script as a new file called WhateverYouWant.sh
Fellow newbies, the .sh is important.
Then set this .sh file’s permissions to allow executing this file as a Program; may differ by distro.

#!/bin/bash

# Script to set a windows application (that runs through WINE) as the default to open PDF files:

# PURPOSE: To convert Linux-style filename to Windows-style
# to pass as an argument to wine when starting PDF XChange Viewer
Filename="z:"${1//\//\\}

# Assuming you use the default installation folder for PDF
# XChange Viewer in Wine
App='eval wine "C:\Program Files\Filepath\To\Your\PDFXEdit.exe" "'$Filename'"'
$App

# Adapted originally from:
# http://sodeve.net/foxit-reader-on-ubuntu-linux-through-wine/
# Archive.org'd at: \https://web.archive.org/web/20160918205551/http://sodeve.net/2007/12/foxit-reader-on-ubuntu-linux-through-wine/
# Additional credit in 2024:
# https://forums.linuxmint.com/viewtopic.php?t=153092
# https://web.archive.org/web/20150213210206/http://crunchbang.org/forums/viewtopic.php?pid=173574#p173574
# https://web.archive.org/web/20150213210203/http://www.fsavard.com/flow/2009/03/pdf-annotation-under-linux-with-wine-and-pdf-xchange-viewer/

You can also check the appropriate windows-formatted filepath with Winetricks, using its built in windows File Explorer, finding your .exe, and copying the path starting from "C:".
[Edit: the default install folder in the script would normally be C:\Program Files, my bad. I downloaded the portable version and shoved it wherever, so my filepath looks like “C:\users\Froggy\Documents\PDFXchange test01\PDFXEdit.exe”]

Mint Cinnamon 21:

  • right click your shell script file, Properties > Permissions > check on “Allow executing file as program”.
  • Then find a PDF file (or whatever filetype), right click, Open With > ‘Other Application…’ > browse for this .sh file you just made.
  • After selecting this .sh file, be sure to select “Set as default” before clicking OK.

I could not tell you for the life of me why this didn’t work with a .desktop file on Mint 21.

I spent the past few hours down the wrong rabbit holes with .desktop and exec=wine ‘filepaths’ and just about died of asphyxiation from absolutely nothing happening. I’ve been wanting to do the same thing too for a while, but decided that right before bedtime was the perfect time to look it up.
[Edit: I figured out spacing in the script. Also moved the Mint specific instructions down the comment for flow clarity]

permalink
report
reply
3 points

wow thanks, I’ll give this a shot!

permalink
report
parent
reply
7 points

If you click with right button over a PDF, select “open with…” doesn’t it show an option to select default app?

I don’t know cinnamon very well, but I think this is possible

permalink
report
reply
1 point

It’s not in there. I assume because it’s a Windows app I’m running in wine?

permalink
report
parent
reply
4 points

You can create desktop entry files (https://wiki.archlinux.org/title/Desktop_entries) in Linux to define applications running in wine.

permalink
report
parent
reply
3 points

LibreOffice Draw can edit PDFs. For just a pdf reader, I use Zathura, though it may not be for you since it’s very keyboard-based so might be confusing to someone coming from Windows. I think Cinnamon must come with a default pdf reader right?

permalink
report
reply
2 points

Yeah I can read them fine but for work I need to be able to mark them up and modify them. It has to be powerful with Mark up tools and most importantly I need to be able to dimension things to scale.

permalink
report
parent
reply
4 points

Like I said, LibreOffice Draw can edit PDFs. Try it out and see if it’s suitable for your needs

permalink
report
parent
reply
1 point

Thanks, I have tried it but it didn’t fulfill my requirements. Master PDF was the best but it was laggy for some reason. I’m gonna try it again if the solutions listed by other commenters don’t work.

permalink
report
parent
reply
3 points

For PDFEditor, the best option is OnlyOffice, not libreoffice. You can download an appimage on their website to test that out.

Also, for CAD, consider giving QCAD a go (if it’s 2D cad/cam you’re after). If it’s 3D cad, consider the free version of OndSel, a more sane version of Freecad.

permalink
report
reply
3 points

What’s wrong with freecad?

permalink
report
parent
reply
3 points

A lot. The UI blows. Which is why there is a commercial version of freecad that fixes exactly that. If there wasn’t an issue with the UI, they wouldn’t have a case for a commercial product. But they do, and they do rather well. There’s even a youtube video about the two apps, by a professional cad person who tries many new cad apps. When he eventually made a video on freecad, he couldn’t believe that people used it in that condition. In the comments, he was directed on Ondsel, and he tried it a few weeks later. He found it way more usable, even if it’s just freecad underneath. And I agree with his assessment.

permalink
report
parent
reply
1 point

I use it and find it works just fine.

permalink
report
parent
reply
1 point

Thanks! I’ll check out only office. For CAD I’ve tried most options in Linux and they simply aren’t as polished, powerful, professional as Windows options. Luckily my VM is working good on that front!

permalink
report
parent
reply
1 point

Is there any way too edit file associations in settings? I know you can in plasma but idk about mint.

permalink
report
reply
3 points

It looks like I can create a custom command but can’t figure out what that would be. I’m Linux terminal illiterate for the most part.

permalink
report
parent
reply

Linux

!linux@lemmy.ml

Create post

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

  • Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
  • No misinformation
  • No NSFW content
  • No hate speech, bigotry, etc

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

Community stats

  • 9.6K

    Monthly active users

  • 3.1K

    Posts

  • 35K

    Comments