Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
99add19
Do not animate check items in the right-click menu
donadigo May 11, 2019
1ef4fd7
Merge branch 'master' of https://github.com/elementary/gala
donadigo May 16, 2019
e43223c
Add transition_from_snapshot DBus API
donadigo May 18, 2019
fe520bd
Revert unintented changes
donadigo May 18, 2019
d5c41aa
Revert more unintented changes
donadigo May 18, 2019
b67350f
Separate public API for apps from the global API for system components
donadigo May 19, 2019
0c35686
Indent with tabs
donadigo May 19, 2019
40cf1b5
Fix comment
donadigo May 19, 2019
1327c81
Merge branch 'master' into fade-style
cassidyjames Jul 1, 2019
c119db8
Merge branch 'master' into fade-style
donadigo Sep 4, 2019
cacc4eb
Port to Cogl2 and update to master
donadigo Nov 19, 2020
ba45369
Add missing file
donadigo Nov 19, 2020
82b8f53
* Add an arbitrary timeout to allow Gtk change the styling of all ele…
donadigo Nov 21, 2020
f7b11db
Use Source.REMOVE
donadigo Nov 21, 2020
7b7df07
Change animation duration
donadigo Nov 21, 2020
a94a9e4
Change Gtk styling after calling gala
donadigo Nov 21, 2020
f78c27f
Merge branch 'master' into fade-style
donadigo Nov 24, 2020
3e13226
Merge branch 'master' into fade-style
cassidyjames Jul 20, 2021
d7bc84e
Fix lint errors; bump copyright
cassidyjames Jul 20, 2021
d707cda
Correct .gitignore rules
cassidyjames Jul 20, 2021
dd41901
Delete Main.vala~
cassidyjames Jul 20, 2021
ccb1c0e
Bump copyright
cassidyjames Jul 20, 2021
2815a6f
Correct punctuation in copyright header
cassidyjames Jul 20, 2021
ec203c3
DBus: increase STYLE_CHANGE_COMPLETION_DURATION to mask GTK and WebKi…
cassidyjames Jul 20, 2021
b893541
Merge branch 'master' into fade-style
kgrubb Apr 7, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
*~
ABOUT-NLS
aclocal.m4
autom4te.cache
/build-aux/*
ChangeLog
config.h
config.h.in
config.h.in~
config.log
config.status
configure
Expand Down
72 changes: 55 additions & 17 deletions daemon/Main.vala
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
//
// Copyright (c) 2018 elementary LLC. (https://elementary.io)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
/*
* Copyright 2018–2021 elementary, Inc. (https://elementary.io)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

namespace Gala {
const string DBUS_NAME = "org.pantheon.gala";
const string DBUS_OBJECT_PATH = "/org/pantheon/gala";

[DBus (name = "org.pantheon.gala")]
public interface WMDBus : GLib.Object {
public abstract void perform_action (Gala.ActionType type) throws DBusError, IOError;
public abstract void global_transition_from_snapshot () throws DBusError, IOError;
}

[DBus (name = "org.gnome.SessionManager")]
public interface SessionManager : Object {
public abstract async ObjectPath register_client (
Expand All @@ -35,6 +44,7 @@ namespace Gala {
}

public class Daemon {
public WMDBus? wm_proxy { get; private set; }
SessionClient? sclient = null;

public Daemon () {
Expand All @@ -45,16 +55,26 @@ namespace Gala {
}
});

Bus.watch_name (BusType.SESSION, DBUS_NAME, BusNameWatcherFlags.NONE, gala_appeared, lost_gala);

var granite_settings = Granite.Settings.get_default ();
var gtk_settings = Gtk.Settings.get_default ();

gtk_settings.gtk_application_prefer_dark_theme = granite_settings.prefers_color_scheme == Granite.Settings.ColorScheme.DARK;

granite_settings.notify["prefers-color-scheme"].connect (() => {
if (wm_proxy != null) {
try {
wm_proxy.global_transition_from_snapshot ();
} catch (Error e) {
warning ("Failed to create a global transition: %s", e.message);
}
}

gtk_settings.gtk_application_prefer_dark_theme = granite_settings.prefers_color_scheme == Granite.Settings.ColorScheme.DARK;
});

var menu_daemon = new MenuDaemon ();
var menu_daemon = new MenuDaemon (this);
menu_daemon.setup_dbus ();
}

Expand Down Expand Up @@ -131,6 +151,24 @@ namespace Gala {
warning ("Unable to respond to session manager: %s", e.message);
}
}

void on_gala_get (GLib.Object? o, GLib.AsyncResult? res) {
try {
wm_proxy = Bus.get_proxy.end (res);
} catch (Error e) {
warning ("Failed to get Gala proxy: %s", e.message);
}
}

void lost_gala () {
wm_proxy = null;
}

void gala_appeared () {
if (wm_proxy == null) {
Bus.get_proxy.begin<WMDBus> (BusType.SESSION, DBUS_NAME, DBUS_OBJECT_PATH, 0, null, on_gala_get);
}
}
}

public static int main (string[] args) {
Expand Down
67 changes: 21 additions & 46 deletions daemon/MenuDaemon.vala
Original file line number Diff line number Diff line change
@@ -1,32 +1,24 @@
//
// Copyright 2018-2020 elementary, Inc. (https://elementary.io)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
/*
* Copyright 2018–2021 elementary, Inc. (https://elementary.io)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

namespace Gala {
const string DBUS_NAME = "org.pantheon.gala";
const string DBUS_OBJECT_PATH = "/org/pantheon/gala";

const string DAEMON_DBUS_NAME = "org.pantheon.gala.daemon";
const string DAEMON_DBUS_OBJECT_PATH = "/org/pantheon/gala/daemon";

[DBus (name = "org.pantheon.gala")]
public interface WMDBus : GLib.Object {
public abstract void perform_action (Gala.ActionType type) throws DBusError, IOError;
}

[DBus (name = "org.pantheon.gala.daemon")]
public class MenuDaemon : Object {
// Window Menu
Expand All @@ -39,6 +31,7 @@ namespace Gala {
private Granite.AccelLabel on_visible_workspace_accellabel;
private Granite.AccelLabel resize_accellabel;
private Granite.AccelLabel screenshot_accellabel;
unowned Daemon daemon;
Gtk.Menu? window_menu = null;
Gtk.MenuItem hide;
Gtk.MenuItem maximize;
Expand All @@ -54,8 +47,6 @@ namespace Gala {
// Desktop Menu
Gtk.Menu? desktop_menu = null;

WMDBus? wm_proxy = null;

ulong always_on_top_sid = 0U;
ulong on_visible_workspace_sid = 0U;

Expand All @@ -71,26 +62,10 @@ namespace Gala {
public void setup_dbus () {
var flags = BusNameOwnerFlags.ALLOW_REPLACEMENT | BusNameOwnerFlags.REPLACE;
Bus.own_name (BusType.SESSION, DAEMON_DBUS_NAME, flags, on_bus_acquired, () => {}, null);

Bus.watch_name (BusType.SESSION, DBUS_NAME, BusNameWatcherFlags.NONE, gala_appeared, lost_gala);
}

void on_gala_get (GLib.Object? o, GLib.AsyncResult? res) {
try {
wm_proxy = Bus.get_proxy.end (res);
} catch (Error e) {
warning ("Failed to get Gala proxy: %s", e.message);
}
}

void lost_gala () {
wm_proxy = null;
}

void gala_appeared () {
if (wm_proxy == null) {
Bus.get_proxy.begin<WMDBus> (BusType.SESSION, DBUS_NAME, DBUS_OBJECT_PATH, 0, null, on_gala_get);
}
public MenuDaemon (Daemon daemon) {
this.daemon = daemon;
}

void on_bus_acquired (DBusConnection conn) {
Expand All @@ -102,9 +77,9 @@ namespace Gala {
}

void perform_action (Gala.ActionType type) {
if (wm_proxy != null) {
if (daemon.wm_proxy != null) {
try {
wm_proxy.perform_action (type);
daemon.wm_proxy.perform_action (type);
} catch (Error e) {
warning ("Failed to perform Gala action over DBus: %s", e.message);
}
Expand Down
34 changes: 18 additions & 16 deletions lib/Constants.vala
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
//
// Copyright 2019 elementary, Inc. (https://elementary.io)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
/*
* Copyright 2019–2021 elementary, Inc. (https://elementary.io)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

namespace Gala {
[CCode (has_type_id = false)]
Expand All @@ -33,5 +33,7 @@ namespace Gala {
WORKSPACE_SWITCH = 400,
// Duration of the nudge animation when trying to switch to at the end of the workspace list
NUDGE = 360,
// Dark/light style switch animation
STYLE_SWITCH = 200
}
}
Loading