xdgutils

Java Runtime exec() not working

拜拜、爱过 提交于 2020-01-04 09:04:18
问题 I try to execute a shell command via java like this if (Program.isPlatformLinux()) { exec = "/bin/bash -c xdg-open \"" + file.getAbsolutePath() + "\""; exec2 = "xdg-open \"" + file.getAbsolutePath() + "\""; System.out.println(exec); } else { //other code } Runtime.getRuntime().exec(exec); Runtime.getRuntime().exec(exec2); but nothing happens at all. When I execute this code it prints /bin/bash -c xdg-open "/home/user/Desktop/file.txt" in the console, but does not open the file. I have also

Towards understanding availability of xdg-open

北城余情 提交于 2019-12-24 04:45:08
问题 I want to open an image, and in Windows I do: #include <windows.h> .. ShellExecute(NULL, "open", "https://gsamaras.files.wordpress.com/2018/11/chronosgod.png", NULL, NULL, SW_SHOWNORMAL); I would like to use a Linux approach, where it's so much easier to run something on the fly. Example: char s[100]; snprintf(s, sizeof s, "%s %s", "xdg-open", "https://gsamaras.files.wordpress.com/2018/11/chronosgod.png"); system(s); In my Ubuntu, it works. However, when running that in Wandbox ( Live Demo ),

Using XDG directory specification on Java application

↘锁芯ラ 提交于 2019-12-13 00:09:48
问题 I'm trying to follow XDG directory specification on my Java application. I have already used it for application data: protected String getDefaultDataDir() { String rootPath = System.getenv("XDG_DATA_HOME"); if(rootPath == null) { rootPath = System.getProperty("user.home")+S+".local"+S+"share"; } return rootPath+S+Pinocchio.PLATFORMNAME; } ( S is a constant containing System.getProperty("file.separator") ) I want now to store documents on the user documents' folder. But I don't have an

How to open the user's preferred mail application on Linux?

六月ゝ 毕业季﹏ 提交于 2019-12-12 10:42:33
问题 I wrote a simple native GUI script with python-gtk. Now I want to give the user a button to send an email with an attachment. The script runs on Linux desktops. Is there a way to open the user's preferred mail application and attach a file? 回答1: The linux command to call would be xdg-email, part of the xdg-utils package, which is on most linux desktops (at least by default on arch, debian, ubuntu). xdg-email is a "command line tool for sending mail using the user's preferred e-mail composer".

xdg-settings not setting default-web-browser in gentoo

陌路散爱 提交于 2019-12-11 03:06:02
问题 I'm trying to get xdg-open to using chromium to open urls instead of firefox. I noticed that xdg-settings get default-web-browser returns chromium.desktop when it should be chromium-browser-chromium.desktop . Following the instructions here I tried xdg-settings set default-web-browser chromium-browser-chromium.desktop , which runs with no errors. However when I run xdg-settings get default-web-browser it stills shows chromium.desktop , and xdg-open "http://www.example.com" still uses firefox.

error: XDG_RUNTIME_DIR not set in the environment. Gtk-WARNING **: cannot open display:

纵然是瞬间 提交于 2019-12-10 10:07:24
问题 I used to open text files with sublime, and for Read-only files, I used to do : sudo sublime . But now just suddenly the sudo sublime command gives the following error : (sublime:3931): Gtk-WARNING **: cannot open display: while sublime command is working fine. I tried the same with gedit , and the same thing happened, with the error with gedit being shown : error: XDG_RUNTIME_DIR not set in the environment. (gedit:3933): Gtk-WARNING **: cannot open display: I installed gtk , and tried gksudo

Adding several attachments to thunderbird (from command line)

瘦欲@ 提交于 2019-12-07 05:33:18
问题 I try to create a new message with several attachments via command line, but this does not work: thunderbird -compose "attachment='/etc/mtab',attachment='/etc/fstab'" Only the first file gets attached. The second is missing. What is wrong with the above command line? PS: I tried xdg-email first, but this fails. See How to open the user's preferred mail application on Linux? 回答1: the command must be specified as thunderbird -compose "attachment='/etc/mtab,/etc/fstab'" I have tried under

error: XDG_RUNTIME_DIR not set in the environment. Gtk-WARNING **: cannot open display:

我怕爱的太早我们不能终老 提交于 2019-12-06 01:27:51
I used to open text files with sublime, and for Read-only files, I used to do : sudo sublime . But now just suddenly the sudo sublime command gives the following error : (sublime:3931): Gtk-WARNING **: cannot open display: while sublime command is working fine. I tried the same with gedit , and the same thing happened, with the error with gedit being shown : error: XDG_RUNTIME_DIR not set in the environment. (gedit:3933): Gtk-WARNING **: cannot open display: I installed gtk , and tried gksudo , still got the same error! I searched the web and found these ways : xhost +localhost : https:/

Adding several attachments to thunderbird (from command line)

痞子三分冷 提交于 2019-12-05 10:17:32
I try to create a new message with several attachments via command line, but this does not work: thunderbird -compose "attachment='/etc/mtab',attachment='/etc/fstab'" Only the first file gets attached. The second is missing. What is wrong with the above command line? PS: I tried xdg-email first, but this fails. See How to open the user's preferred mail application on Linux? RoddeChime the command must be specified as thunderbird -compose "attachment='/etc/mtab,/etc/fstab'" I have tried under windows. Roman Another way to attach several files: thunderbird.exe -compose to="info@gmail.com"