Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can no longer select editor in GTimeLog 0.11 #113

Open
riccardomurri opened this issue May 18, 2018 · 5 comments · May be fixed by #246
Open

Can no longer select editor in GTimeLog 0.11 #113

riccardomurri opened this issue May 18, 2018 · 5 comments · May be fixed by #246

Comments

@riccardomurri
Copy link
Contributor

I am a happy user of GTimeLog since years.

However, having recently upgraded my laptop to Lubuntu 18.04, I found that in GTimeLog 0.11 the Ctrl+E shortcut always opens timelog.txt in Lubuntu's leafpad editor, instead of using emacsclient, completely ignoring the EDITOR environment variable.

Would it be possible to just honor the EDITOR setting, or make the text editor a preference that one can set?

@mgedmin
Copy link
Member

mgedmin commented May 18, 2018

GTimeLog honors your system preference. The problem is that there are multiple competing standards of specifying system preferences:

  • $EDITOR/$VISUAL environment variables, usually meant for console applications
  • /etc/alternatives/sensible-editor symlink on Debian systems, also meant for console applications, managed via sudo update-alternatives
  • the Freedesktop MIME Applications Associations, usually meant for GUI applications

Since gtimelog is a GUI application, it uses the mime-apps-spec, by virtue of using GTK+'s gtk_show_uri("file:///..../timelog.txt").

You can change your preferred editor in one of several ways:

  • right-clicking any *.txt file in Nautilus, selecting Properties, switching to the Open With tab and selecting your preferred editor
  • running xdg-mime default emacs25.desktop text/plain
  • editing ~/.config/mimeapps.list and making sure it has something like the following
[Default Applications]
text/plain=emacs25.desktop

@mgedmin mgedmin closed this as completed May 18, 2018
@mgedmin
Copy link
Member

mgedmin commented Jun 6, 2018

People keep asking me whether it's possible to change the editor just for gtimelog, independent from system-wide MIME associations, so I guess I'll reopen this as a wishlist.

I would like a gsetting org.gtimelog.editor or something, where you could put a value like gvim %s or xterm -e ed %s. When blank (default) it would do what it currently does, i.e. call Gtk.show_uri().

@onitake
Copy link

onitake commented Nov 8, 2021

This might be a Gtk bug, but it looks like the xdg default application is not always honored by gtk_show_uri.

When using the KDE desktop, default applications seem to be different between Gnome and other applications. I'm quite sure Gtk is at fault here, because xdg-mime query default text/plain shows the correct default application. A minimal show_uri test program opens something else, at least on my system.

P.S. You might want to use Gtk.show_uri_on_window instead of Gtk.show_uri. The latter is deprecated in Gtk 3.22.

@icemac
Copy link
Contributor

icemac commented Nov 29, 2023

Running gtimelog on MacOS this is rather tricky and I did not find a way when gtimelog is not started via command line but like a normal application. So I'd highly appreciate a way to customise how the application for editing is opened.

mgedmin added a commit that referenced this issue Nov 29, 2023
Note that people who run gtimelog straight from Git will need to
manually run ``make`` to recompile the gsettings schema, or gtimelog
will segfault when you press Ctrl+E.

Also note that using `gsettings` is a pain when the schema is not
installed globally, but you can use

    dconf write /org/gtimelog/editor '"gvim %s"'

and then tweak it with dconf-editor.

Error handling is missing: if you set editor to gvim and gvim is not
installed, you'll see a Python traceback on the console.

Application.prepare_args() is a separate static method so I could write
unit tests for it, but I haven't done so.

Closes #113.
@mgedmin mgedmin linked a pull request Nov 29, 2023 that will close this issue
@mgedmin
Copy link
Member

mgedmin commented Nov 29, 2023

Would you like to test a PR for this? See #246.

mgedmin added a commit that referenced this issue Jan 30, 2024
Note that people who run gtimelog straight from Git will need to
manually run ``make`` to recompile the gsettings schema, or gtimelog
will segfault when you press Ctrl+E.

Also note that using `gsettings` is a pain when the schema is not
installed globally, but you can use

    dconf write /org/gtimelog/editor '"gvim %s"'

and then tweak it with dconf-editor.

Error handling is missing: if you set editor to gvim and gvim is not
installed, you'll see a Python traceback on the console.

Application.prepare_args() is a separate static method so I could write
unit tests for it, but I haven't done so.

Closes #113.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants