1

I created a custom action in Thunar for extracting RAR archives with unar:

unar %N

It works, but it doesn’t inform me when it’s done.

Is it possible to show some kind of indicator (e.g., a progress bar) while it’s extracting? Or a notification as soon as it’s finished?

unor
  • 1,300
  • xfce-terminal -e unrar %N – sourcejedi Jan 20 '17 at 19:39
  • @sourcejedi: Thanks. I guess I have to use xfce4-terminal (instead of xfce-terminal), and it’s unar (instead of unrar), but I doesn’t seem to work: nothing happens. When I omit the %N (so I have: xfce4-terminal -e unar), the terminal window at least gets opened, but automatically closed immediately after. – unor Jan 20 '17 at 19:49
  • Sorry! Testing fail. It works with xterm, but not gnome-terminal. gnome-terminal -e "sleep 1" works, and fortunately gnome-terminal -e "sleep 1;command-injected-by-evil-filename" shows an error. I would recommend running these tests xfce4-terminal before using it :). – sourcejedi Jan 20 '17 at 19:55
  • Except it won't work for files with spaces in them, dammit. It might almost be safe with a command like unar -- %N, but I still hate it. – sourcejedi Jan 20 '17 at 19:58
  • 1
    How do you feel about installing the original xterm :). Don't squint, it's bad for your eyes. – sourcejedi Jan 20 '17 at 20:00
  • @sourcejedi: I already had xterm installed (Debian 8 + Xfce seems to install it by default). Using xterm -e unar %N seems to work fine for my test file. Do you want to create an answer? – unor Jan 20 '17 at 20:05
  • 1
    As an alternative, you could use zenity for a more GUI type approach. Good starting point would be How to pass data outside process for zenity progress? and How to make progress dialog for Bash in XFCE?. – Chindraba Jan 20 '17 at 20:37

1 Answers1

2

You could always run the command in a terminal.

Your notification is when the terminal closes itself :). It will also show whatever progress / activity indicator is provided by the unar command.

  1. gnome-terminal -x unar -- %N

    I have not tested whether xfce4-terminal accepts the -x option.

  2. xterm -e unar -- %N

    uxrvt should also accept the -e option.

    Apologies in advance for any eyestrain due to running xterm with its default font size.

gnome-terminal also has a -e option. With gnome-terminal, the option takes a single command argument, and splits in based on spaces. E.g. gnome-terminal -e "sleep 1". We can't use this because filenames could also contain spaces. With xterm, -e can actually behave either way, depending on how many arguments you pass. So the behaviour of gnome-terminal is less magic and probably nicer, provided you don't mind that gnome-terminal --help fails to document either option.

sourcejedi
  • 50,249
  • Why do you keep whining about default xterm fonts? Just set the defaults once and for all in your ~/.Xresources, and then all xterms will use them, happily ever after. – Satō Katsura Jan 20 '17 at 20:29
  • @SatoKatsura I whine because I should have to configure at most one terminal emulator (and it should have sensible defaults anyway). My DE's terminal emulator failed to document that it supported the necessary option in its --help. Whereas I was able to find documentation on xterm. So at this point I had no evidence that gnome-terminal supported this use case. The whine is that there should have been no reason for me to install and run an extra app for this purpose; the font size is a concrete example of why it was a bad idea. I have not tested the terminal emulator for OP's DE either. – sourcejedi Jan 21 '17 at 12:01
  • Well, consistency is expensive. You can't really expect consistency from projects whose philosophical model is a bazaar. CDE, NeXT, and OpenWindows were consistent. Gnome and KDE, not so much. shrug – Satō Katsura Jan 21 '17 at 12:22
  • Hmm? My DE's terminal emulator failed to document that it supported the necessary option... there should have been no reason for me to install and run [xterm]. gnome-terminal is consistent with gnome. Fedora Workstation did not install xterm for me. I don't think any of the ancient terminal emulators (with ancient defaults) even show up in gnome-software. Also google web search only knew to tell me about xterm. I've seen SE answers fix that sort of thing before. – sourcejedi Jan 21 '17 at 12:57
  • I whine because I should have to configure at most one terminal emulator (and it should have sensible defaults anyway). - This is the kind of consistency I'm talking about. – Satō Katsura Jan 21 '17 at 13:12