Commit Graph

39 Commits (f86a3a9b50c269a6af647cadb7e6e5b1df0321d1)

Author SHA1 Message Date
Mitchell Hashimoto 587f47a587
apprt/gtk-ng: clean up our single instance, new window interactions
This removes `launched-from` entirely and moves our `gtk-single-instance`
detection logic to assume true unless we detect CLI instead of assume
false unless we detect desktop/dbus/systemd.

The "assume true" scenario for single instance is desirable because
detecting a CLI instance is much more reliable.

Removing `launched-from` fixes an issue where we had a
difficult-to-understand relationship between `launched-from`,
`gtk-single-instance`, and `initial-window`. Now, only
`gtk-single-instance` has some hueristic logic. And `initial-window`
ALWAYS sends a GTK activation signal regardless of single instance or
not.

As a result, we need to be explicit in our systemd, dbus, desktop files
about what we want Ghostty to do, but everything works as you'd mostly
expect.

Now, if you put plain old `ghostty` in your terminal, you get a new
Ghostty instance. If you put it anywhere else, you get a GTK single
instance activation call (either creates a first instance or opens a new
window in the existing instance). Works for launchers and so on.
2025-09-05 10:17:17 -05:00
Jeffrey C. Ollie 2435cee11b
linux/systemd: add an app- prefix to the systemd unit
The XDG Freedesktop Portal has a _major_ undocumented requirement for
programs that are launched/controlled by `systemd` to interact with the
Portal. The unit _must_ be named `app-<appid>.service`. The Portal uses
the systemd unit name figure out what the program's application ID is
and it will only look at unit names that begin with `app-`. I can find
no place that this is documented other than by inspecting the code or the
issue and PR that introduced this feature. See the following code:

7d4d48cf07/src/xdp-utils.c (L152-L220)

This may fix many people's issues with getting global shortcuts
to work.

Note that this is a breaking change if you have been using Ghostty
compiled from source since #7433 was merged. You will need to ensure
that any Ghosty systemd unit files _not_ prefixed with `app-` are
deleted.

Original discussion/PR in the XDG Desktop Portal repository:

https://github.com/flatpak/xdg-desktop-portal/issues/579
https://github.com/flatpak/xdg-desktop-portal/pull/719

Originally discussed on Discord:

https://discord.com/channels/1005603569187160125/1394845362186879026

Co-authored-by: ambareeshbalaji@gmail.com
2025-07-16 10:26:30 -05:00
Jeffrey C. Ollie c9d0bbefc2
linux: switch systemd user service to type=notify-reload
This allows `systemctl` to send SIGUSR2 to Ghostty to trigger a reload,
which is more convenient than scripting `ps` and `kill` to find the
Ghostty main PID.
2025-07-09 13:11:01 -05:00
Jeffrey C. Ollie 871f90e448
linux/kde: add KDE shortcut to desktop file
Fixes #7673

This adds `Ctrl+Alt+T` as a KDE shortcut to the desktop file. If Konsole
is installed (or any other prorgam that has the same shortcut) the user
will need to go into the KDE system settings and manually reassign the
`Ctrl+Alt+T` shortcut to Ghostty.

If Ghostty is the only terminal installed that claims that shortcut KDE
_should_ automatically enable the shortcut (but YMMV).

Non-KDE systems will ignore this setting and if the user desires a
global shortcut to open a Ghostty window it will need to be accomplished
in other ways.
2025-07-06 13:05:00 -05:00
Jeffrey C. Ollie 190c744a6f
linux: add install target to systemd user service
This will allow users to enable Ghostty startup on login. Users will
need to explicitly enable startup on login via this command:

```sh
systemctl enable --user com.mitchellh.ghostty.service
```
2025-07-01 16:51:23 -05:00
Mitchell Hashimoto 6d6dcf863a
Correct AppStream metainfo XML, broken trailing tags 2025-06-26 13:37:20 -07:00
Mitchell Hashimoto b4e81949ee
wrong service name for dbus systemd service 2025-06-26 13:12:05 -07:00
Mitchell Hashimoto 739b691a6d
use cmake formatting to template, avoids the custom binary 2025-06-26 10:28:46 -07:00
Jeffrey C. Ollie 8a95212197 fix up the name in the metainfo when templating 2025-06-26 10:28:46 -07:00
Jeffrey C. Ollie eb5a488b57 clean up duplicated code in installation of desktop services 2025-06-26 10:28:46 -07:00
Jeffrey C. Ollie cf561fcc55 rename templated files with .in suffix 2025-06-26 10:28:46 -07:00
Jeffrey C. Ollie b68f9f2321 make sure that the desktop file uses the absolute path everywhere 2025-06-26 10:28:46 -07:00
Jeffrey C. Ollie ddada2fb3f flatpak: remove references to systemd unit
Replaces #7676

When building as a flatpak, don't install the systemd user services
since flatpaks can't use them. Remove references to the systemd service
from the DBus service.

Also, customize the app metadata depending on the debug mode.

Co-authored-by: Leorize <leorize+oss@disroot.org>
2025-06-26 10:28:46 -07:00
Jeffrey C. Ollie 81403f59ce dbus and systemd activation - take 2
This replaces #7433. The improvements are:

1) Install the systemd user service in the proper directory depending
on if it's a 'user' install or a 'system' install. This is controlled
either by using the `--system` build flag (as most packages will) or by
the `-Dsystem-package` flag.

2) Add the absolute path to the `ghostty` binary in the application
file, the DBus service, and the systemd user service. This is done so
that they do not depend on `ghostty` being in the `PATH` of whatever
is launching Ghostty. That `PATH` is not necessarily the same as the
`PATH` in a user shell (especially for DBus activation and systemd user
services).

3) Adjust the DBus bus name that is expected by the system depending on
the optimization level that Ghostty is compiled with.
2025-06-26 10:28:46 -07:00
Mitchell Hashimoto f941a2185e
Revert "linux: add dbus and systemd activation services (#7433)"
Reverts two commits:

977cd530c7
820b7e432b

These break build from source on Linux for two reasons:

1.) The systemd user service needs to be installed in the `share`
prefix, not the `lib` prefix. This lets it get picked up in `~/.local`
but is also correct for just standard FHS paths.

2.) The `ghostty` path in the systemd user service needs to be absolute.
We should interpolate in the build install prefix to form an absolute
path.
2025-06-24 22:07:09 -04:00
Jeffrey C. Ollie e5c737a423
linux: use launched-from for new window action 2025-06-13 10:22:16 -05:00
Jeffrey C. Ollie 57392dfcb5
linux: use explicit launched-from config in service files 2025-06-13 10:22:16 -05:00
Jeffrey C. Ollie 8824d11e1c
linux: add dbus and systemd activation services 2025-06-13 10:22:12 -05:00
Leorize 0473b0c3f4 metainfo: update with extra data
* Added URLs to more resources
* Fixed developer ID
* Added device compatibility information
2025-04-22 10:56:09 -07:00
Leorize ebc169dbaf Fix flatpak packaging to a working state
This should make testing Flatpak builds a lot easier.

To build, enter `flatpak/` directory and run:

    flatpak-builder --repo=repo builddir com.mitchellh.ghostty.yml

alternatively, using org.flatpak.Builder flatpak:

    flatpak run -p org.flatpak.Builder \
      --repo=repo \
      builddir \
      com.mitchellh.ghostty.yml

The resulting flatpak can be installed using

    flatpak install ./repo com.mitchellh.ghostty

Credit of AppStream metadata goes to @yorickpeterse.
2025-04-22 10:56:09 -07:00
Andrej Daskalov 8c1db16c79 added exec permission back to dolphin action 2025-01-20 20:19:12 +01:00
Samuel 941915b862
declare `StartupWMClass` in .desktop 2025-01-10 22:26:48 -04:00
Gabriele Musco c972051611 linux: add "Open in Ghostty" shortcut for nautilus 2025-01-08 13:49:32 +01:00
Misaki Kasumi 5c2fb580d0 misc: add desktop entry fields to support xdg-terminal-exec 2024-12-29 13:58:12 +08:00
Anthony 5180cc6c0e Remove executable permission from readonly config file 2024-12-12 15:26:26 +11:00
Andrej Daskalov 3048d71537 added gtk-single-instance argument 2024-12-01 13:16:56 +01:00
Andrej Daskalov 46afa9c4e1 use cli argument instead of cd 2024-11-29 11:51:10 +01:00
Andrej Daskalov 074312c5ef updated permissions and build process
Removed check for plasma in build.zig, it installs it anyways now
Added executable permissions for ghostty_dolphin.desktop since Plasma
requires them for context menu items
2024-11-29 11:14:17 +01:00
Andrej Daskalov 62fe3eb652 added right click action for plasma 2024-11-28 23:41:55 +01:00
Mitchell Hashimoto 9b81d57cb9
remove new-window action from desktop file
Fixes #1006
2023-12-07 20:46:05 -08:00
Tim Culverhouse caf2252144 gtk: implement desktop notifications 2023-11-17 12:59:23 -06:00
Nathan Fisher 865b43cd4d Add Categories entry to .desktop file so Linux desktops have a better
chance of placing the menu entry into an appropriate category
2023-09-29 18:24:48 -04:00
Mitchell Hashimoto cbbafc70e2
gtk: set Name for new-window action 2023-09-15 22:10:06 -07:00
Tim Culverhouse 6484c34bec linux: don't presume install location in desktop file
The app.desktop file shipped with the default build presumes the install
location of the binary. Let the OS determine the executable through it's
normal PATH variables.
2023-09-15 03:22:48 -05:00
Mitchell Hashimoto d94cf2f124
remove flatpak
Flatpak support has been a HUGE pain to keep working, the builds take
forever and cost me real money, and there are very few users. Ideally,
we want to just use native system packagers for each distro. I thought
Flatpak would make it easy to support many distros but that ended up
being false.
2023-09-13 11:41:16 -07:00
Thorsten Ball d275256e32 gtk: add new-window action to .desktop files
Inspired by #413.

This modifies the .desktop files so that it's possible to right-click on
the Ghostty icon in a dock and get the "New window" action.

Apparently this is how you implement that in GTK applications. In order
for us to also get "New tab", we'd have to implement a CLI flag, I
think.
2023-09-09 07:04:22 +02:00
Mitchell Hashimoto 5db9854e63
build: install the proper linux desktop file depending on flatpak or not 2023-02-27 15:20:31 -08:00
Mitchell Hashimoto ec956debb7
Command/Pty work better with Flatpak but not 100% yet 2023-02-25 21:19:57 -08:00
Mitchell Hashimoto 1ca0ea361b
dist/linux: add freedesktop desktop spec file 2023-02-25 15:23:51 -08:00