mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
Revert "linux: add dbus and systemd activation services (#7433)"
Reverts two commits: 977cd530c7bb9551de93900170bdaec4601b1b5b 820b7e432b57cd08c49d2e76cce4cb78016f0418 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.
This commit is contained in:
7
dist/linux/app.desktop
vendored
7
dist/linux/app.desktop
vendored
@ -1,10 +1,8 @@
|
|||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Version=1.0
|
|
||||||
Name=Ghostty
|
Name=Ghostty
|
||||||
Type=Application
|
Type=Application
|
||||||
Comment=A terminal emulator
|
Comment=A terminal emulator
|
||||||
TryExec=ghostty
|
Exec=ghostty
|
||||||
Exec=ghostty --launched-from=desktop
|
|
||||||
Icon=com.mitchellh.ghostty
|
Icon=com.mitchellh.ghostty
|
||||||
Categories=System;TerminalEmulator;
|
Categories=System;TerminalEmulator;
|
||||||
Keywords=terminal;tty;pty;
|
Keywords=terminal;tty;pty;
|
||||||
@ -18,8 +16,7 @@ X-TerminalArgTitle=--title=
|
|||||||
X-TerminalArgAppId=--class=
|
X-TerminalArgAppId=--class=
|
||||||
X-TerminalArgDir=--working-directory=
|
X-TerminalArgDir=--working-directory=
|
||||||
X-TerminalArgHold=--wait-after-command
|
X-TerminalArgHold=--wait-after-command
|
||||||
DBusActivatable=true
|
|
||||||
|
|
||||||
[Desktop Action new-window]
|
[Desktop Action new-window]
|
||||||
Name=New Window
|
Name=New Window
|
||||||
Exec=ghostty --launched-from=desktop
|
Exec=ghostty
|
||||||
|
4
dist/linux/dbus.service
vendored
4
dist/linux/dbus.service
vendored
@ -1,4 +0,0 @@
|
|||||||
[D-BUS Service]
|
|
||||||
Name=com.mitchellh.ghostty
|
|
||||||
SystemdService=com.mitchellh.ghostty.service
|
|
||||||
Exec=ghostty --launched-from=dbus
|
|
7
dist/linux/systemd.service
vendored
7
dist/linux/systemd.service
vendored
@ -1,7 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Ghostty
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=dbus
|
|
||||||
BusName=com.mitchellh.ghostty
|
|
||||||
ExecStart=ghostty --launched-from=systemd
|
|
@ -52,13 +52,6 @@ modules:
|
|||||||
--prefix /app
|
--prefix /app
|
||||||
--search-prefix /app
|
--search-prefix /app
|
||||||
--system $PWD/vendor/p
|
--system $PWD/vendor/p
|
||||||
|
|
||||||
# Rename to match service and drop systemd references
|
|
||||||
- sed -e 's/^Name=.*/\0-debug/'
|
|
||||||
-e '/^SystemdService=/d'
|
|
||||||
/app/share/dbus-1/services/com.mitchellh.ghostty.service
|
|
||||||
> /app/share/dbus-1/services/com.mitchellh.ghostty-debug.service
|
|
||||||
- rm /app/share/dbus-1/services/com.mitchellh.ghostty.service
|
|
||||||
sources:
|
sources:
|
||||||
- type: dir
|
- type: dir
|
||||||
path: ..
|
path: ..
|
||||||
|
@ -47,10 +47,6 @@ modules:
|
|||||||
--prefix /app
|
--prefix /app
|
||||||
--search-prefix /app
|
--search-prefix /app
|
||||||
--system $PWD/vendor/p
|
--system $PWD/vendor/p
|
||||||
|
|
||||||
# Remove references to the user service. Flatpak does not export those.
|
|
||||||
- sed -i '/^SystemdService=/d'
|
|
||||||
/app/share/dbus-1/services/com.mitchellh.ghostty.service
|
|
||||||
sources:
|
sources:
|
||||||
- type: dir
|
- type: dir
|
||||||
path: ..
|
path: ..
|
||||||
|
@ -117,11 +117,6 @@ in
|
|||||||
|
|
||||||
mkdir -p "$out/nix-support"
|
mkdir -p "$out/nix-support"
|
||||||
|
|
||||||
sed -i -e "s@^Exec=.*ghostty@Exec=$out/bin/ghostty@" $out/share/applications/com.mitchellh.ghostty.desktop
|
|
||||||
sed -i -e "s@^TryExec=.*ghostty@TryExec=$out/bin/ghostty@" $out/share/applications/com.mitchellh.ghostty.desktop
|
|
||||||
sed -i -e "s@^Exec=.*ghostty@Exec=$out/bin/ghostty@" $out/share/dbus-1/services/com.mitchellh.ghostty.service
|
|
||||||
sed -i -e "s@^ExecStart=.*ghostty@ExecStart=$out/bin/ghostty@" $out/lib/systemd/user/com.mitchellh.ghostty.service
|
|
||||||
|
|
||||||
mkdir -p "$terminfo/share"
|
mkdir -p "$terminfo/share"
|
||||||
mv "$terminfo_src" "$terminfo/share/terminfo"
|
mv "$terminfo_src" "$terminfo/share/terminfo"
|
||||||
ln -sf "$terminfo/share/terminfo" "$terminfo_src"
|
ln -sf "$terminfo/share/terminfo" "$terminfo_src"
|
||||||
|
@ -405,15 +405,11 @@ pub fn init(core_app: *CoreApp, opts: Options) !App {
|
|||||||
// This just calls the `activate` signal but its part of the normal startup
|
// This just calls the `activate` signal but its part of the normal startup
|
||||||
// routine so we just call it, but only if the config allows it (this allows
|
// routine so we just call it, but only if the config allows it (this allows
|
||||||
// for launching Ghostty in the "background" without immediately opening
|
// for launching Ghostty in the "background" without immediately opening
|
||||||
// a window). An initial window will not be immediately created if we were
|
// a window)
|
||||||
// launched by D-Bus activation or systemd. D-Bus activation will send it's
|
|
||||||
// own `activate` or `new-window` signal later.
|
|
||||||
//
|
//
|
||||||
// https://gitlab.gnome.org/GNOME/glib/-/blob/bd2ccc2f69ecfd78ca3f34ab59e42e2b462bad65/gio/gapplication.c#L2302
|
// https://gitlab.gnome.org/GNOME/glib/-/blob/bd2ccc2f69ecfd78ca3f34ab59e42e2b462bad65/gio/gapplication.c#L2302
|
||||||
if (config.@"initial-window") switch (config.@"launched-from".?) {
|
if (config.@"initial-window")
|
||||||
.desktop, .cli => gio_app.activate(),
|
gio_app.activate();
|
||||||
.dbus, .systemd => {},
|
|
||||||
};
|
|
||||||
|
|
||||||
// Internally, GTK ensures that only one instance of this provider exists in the provider list
|
// Internally, GTK ensures that only one instance of this provider exists in the provider list
|
||||||
// for the display.
|
// for the display.
|
||||||
@ -1687,17 +1683,6 @@ fn gtkActionShowGTKInspector(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
fn gtkActionNewWindow(
|
|
||||||
_: *gio.SimpleAction,
|
|
||||||
_: ?*glib.Variant,
|
|
||||||
self: *App,
|
|
||||||
) callconv(.c) void {
|
|
||||||
log.info("received new window action", .{});
|
|
||||||
_ = self.core_app.mailbox.push(.{
|
|
||||||
.new_window = .{},
|
|
||||||
}, .{ .forever = {} });
|
|
||||||
}
|
|
||||||
|
|
||||||
/// This is called to setup the action map that this application supports.
|
/// This is called to setup the action map that this application supports.
|
||||||
/// This should be called only once on startup.
|
/// This should be called only once on startup.
|
||||||
fn initActions(self: *App) void {
|
fn initActions(self: *App) void {
|
||||||
@ -1717,9 +1702,7 @@ fn initActions(self: *App) void {
|
|||||||
.{ "reload-config", gtkActionReloadConfig, null },
|
.{ "reload-config", gtkActionReloadConfig, null },
|
||||||
.{ "present-surface", gtkActionPresentSurface, t },
|
.{ "present-surface", gtkActionPresentSurface, t },
|
||||||
.{ "show-gtk-inspector", gtkActionShowGTKInspector, null },
|
.{ "show-gtk-inspector", gtkActionShowGTKInspector, null },
|
||||||
.{ "new-window", gtkActionNewWindow, null },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline for (actions) |entry| {
|
inline for (actions) |entry| {
|
||||||
const action = gio.SimpleAction.new(entry[0], entry[2]);
|
const action = gio.SimpleAction.new(entry[0], entry[2]);
|
||||||
defer action.unref();
|
defer action.unref();
|
||||||
|
@ -2325,15 +2325,6 @@ pub fn defaultTermioEnv(self: *Surface) !std.process.EnvMap {
|
|||||||
env.remove("GDK_DISABLE");
|
env.remove("GDK_DISABLE");
|
||||||
env.remove("GSK_RENDERER");
|
env.remove("GSK_RENDERER");
|
||||||
|
|
||||||
// Remove some environment variables that are set when Ghostty is launched
|
|
||||||
// from a `.desktop` file, by D-Bus activation, or systemd.
|
|
||||||
env.remove("GIO_LAUNCHED_DESKTOP_FILE");
|
|
||||||
env.remove("GIO_LAUNCHED_DESKTOP_FILE_PID");
|
|
||||||
env.remove("DBUS_STARTER_ADDRESS");
|
|
||||||
env.remove("DBUS_STARTER_BUS_TYPE");
|
|
||||||
env.remove("INVOCATION_ID");
|
|
||||||
env.remove("JOURNAL_STREAM");
|
|
||||||
|
|
||||||
// Unset environment varies set by snaps if we're running in a snap.
|
// Unset environment varies set by snaps if we're running in a snap.
|
||||||
// This allows Ghostty to further launch additional snaps.
|
// This allows Ghostty to further launch additional snaps.
|
||||||
if (env.get("SNAP")) |_| {
|
if (env.get("SNAP")) |_| {
|
||||||
|
@ -228,16 +228,6 @@ pub fn init(b: *std.Build, cfg: *const Config) !GhosttyResources {
|
|||||||
b.path("dist/linux/app.desktop"),
|
b.path("dist/linux/app.desktop"),
|
||||||
"share/applications/com.mitchellh.ghostty.desktop",
|
"share/applications/com.mitchellh.ghostty.desktop",
|
||||||
).step);
|
).step);
|
||||||
// DBus service for DBus activation
|
|
||||||
try steps.append(&b.addInstallFile(
|
|
||||||
b.path("dist/linux/dbus.service"),
|
|
||||||
"share/dbus-1/services/com.mitchellh.ghostty.service",
|
|
||||||
).step);
|
|
||||||
// systemd user service
|
|
||||||
try steps.append(&b.addInstallFile(
|
|
||||||
b.path("dist/linux/systemd.service"),
|
|
||||||
"lib/systemd/user/com.mitchellh.ghostty.service",
|
|
||||||
).step);
|
|
||||||
|
|
||||||
// AppStream metainfo so that application has rich metadata within app stores
|
// AppStream metainfo so that application has rich metadata within app stores
|
||||||
try steps.append(&b.addInstallFile(
|
try steps.append(&b.addInstallFile(
|
||||||
|
@ -942,17 +942,12 @@ title: ?[:0]const u8 = null,
|
|||||||
/// The setting that will change the application class value.
|
/// The setting that will change the application class value.
|
||||||
///
|
///
|
||||||
/// This controls the class field of the `WM_CLASS` X11 property (when running
|
/// This controls the class field of the `WM_CLASS` X11 property (when running
|
||||||
/// under X11), the Wayland application ID (when running under Wayland), and the
|
/// under X11), and the Wayland application ID (when running under Wayland).
|
||||||
/// bus name that Ghostty uses to connect to DBus.
|
|
||||||
///
|
///
|
||||||
/// Note that changing this value between invocations will create new, separate
|
/// Note that changing this value between invocations will create new, separate
|
||||||
/// instances, of Ghostty when running with `gtk-single-instance=true`. See that
|
/// instances, of Ghostty when running with `gtk-single-instance=true`. See that
|
||||||
/// option for more details.
|
/// option for more details.
|
||||||
///
|
///
|
||||||
/// Changing this value may break launching Ghostty from `.desktop` files, via
|
|
||||||
/// DBus activation, or systemd user services as the system is expecting Ghostty
|
|
||||||
/// to connect to DBus using the default `class` when it is launched.
|
|
||||||
///
|
|
||||||
/// The class name must follow the requirements defined [in the GTK
|
/// The class name must follow the requirements defined [in the GTK
|
||||||
/// documentation](https://docs.gtk.org/gio/type_func.Application.id_is_valid.html).
|
/// documentation](https://docs.gtk.org/gio/type_func.Application.id_is_valid.html).
|
||||||
///
|
///
|
||||||
|
Reference in New Issue
Block a user