Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d88be92
Update deps
danirabbit Apr 23, 2025
98707be
Hdy → Adw
danirabbit Apr 23, 2025
d1385f9
Update protocol stuff
danirabbit Apr 23, 2025
3918bb3
Minor syntax changes
danirabbit Apr 23, 2025
f03c122
Remove commented vapidir
danirabbit Apr 23, 2025
a50e218
copy/paste error
danirabbit Apr 23, 2025
19dc149
other small changes
danirabbit Apr 23, 2025
e5a62d3
Merge main
danirabbit Apr 28, 2025
213ca01
More little fixes
danirabbit Apr 28, 2025
df726aa
EndSessionDialog: cast as widget to realize connect
danirabbit Apr 28, 2025
ac1afdd
Connect to close request
danirabbit Apr 28, 2025
1f6753b
Merge branch 'main' into danirabbit/gtk4
danirabbit Apr 28, 2025
f2b9575
Merge branch 'main' into danirabbit/gtk4
danirabbit Apr 28, 2025
5a493ae
Merge branch 'main' into danirabbit/gtk4
danirabbit Apr 28, 2025
9c43e14
merge main
danirabbit Apr 28, 2025
497f783
Merge branch 'main' into danirabbit/gtk4
danirabbit May 7, 2025
1effd85
Merge branch 'main' into danirabbit/gtk4
zeebok Jun 5, 2025
4a93e24
Final compilation stuff
danirabbit Jun 6, 2025
8eb0ed1
try to bump deps
danirabbit Jun 6, 2025
d28a2c9
bump wingpanel version
danirabbit Jun 6, 2025
53b842f
Bump README
danirabbit Jun 6, 2025
602ad60
Fix an oops
danirabbit Jun 6, 2025
a44fe8b
Fix missing toggle icons
danirabbit Jun 6, 2025
381d3f0
center align text scale buttons
danirabbit Jun 6, 2025
a7a498f
Merge branch 'main' into danirabbit/gtk4
zeebok Jun 15, 2025
1ac61ba
Merge main
danirabbit Jun 17, 2025
dfd575e
Fix rotation lock style
danirabbit Jun 17, 2025
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 .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Install Dependencies
run: |
apt update
apt install -y libglib2.0-dev libgtk-3-dev libpackagekit-glib2-dev libportal-dev libwingpanel-dev libaccountsservice-dev meson valac
apt install -y libadwaita-1-dev libglib2.0-dev libgtk-4-dev libpackagekit-glib2-dev libportal-dev libwingpanel-8-dev libaccountsservice-dev meson valac
- name: Build
env:
DESTDIR: out
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

You'll need the following dependencies:

* libgranite-dev
* libhandy-1-dev
* libwingpanel-dev
* libgranite-7-dev
* libadwaita-1-dev
* libwingpanel-8-dev
* meson
* valac

Expand Down
11 changes: 5 additions & 6 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@ datadir = prefix / get_option('datadir')

add_global_arguments('-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()), language:'c')
add_project_arguments('-DG_LOG_DOMAIN="@0@"'.format(meson.project_name()), language:'c')
add_project_arguments('--vapidir=' + join_paths(meson.project_source_root(), 'vapi'), language: 'vala')

gdk_wl_dep = dependency('gdk-wayland-3.0')
glib_dep = dependency('glib-2.0')
gobject_dep = dependency('gobject-2.0')
granite_dep = dependency('granite', version: '>=6.0.0')
gtk_dep = dependency('gtk+-3.0')
handy_dep = dependency('libhandy-1', version: '>=1.0')
granite_dep = dependency('granite-7', version: '>=7.0.0')
gtk_dep = dependency('gtk4')
gtk_wayland_dep = dependency('gtk4-wayland')
handy_dep = dependency('libadwaita-1', version: '>=1.0')
packagekit_dep = dependency('packagekit-glib2')
wingpanel_dep = dependency('wingpanel')
wingpanel_dep = dependency('wingpanel-8')
wingpanel_indicatorsdir = wingpanel_dep.get_pkgconfig_variable('indicatorsdir', define_variable: ['libdir', libdir])
wl_client_dep = dependency('wayland-client')
portal_dep = dependency('libportal')
Expand Down
6 changes: 3 additions & 3 deletions src/Indicator.vala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class QuickSettings.Indicator : Wingpanel.Indicator {

// Prevent a race that skips automatic resource loading
// https://github.com/elementary/wingpanel-indicator-bluetooth/issues/203
Gtk.IconTheme.get_default ().add_resource_path ("/org/elementary/wingpanel/icons");
Gtk.IconTheme.get_for_display (Gdk.Display.get_default ()).add_resource_path ("/org/elementary/wingpanel/icons");
}

public override Gtk.Widget get_display_widget () {
Expand All @@ -39,8 +39,8 @@ public class QuickSettings.Indicator : Wingpanel.Indicator {
var provider = new Gtk.CssProvider ();
provider.load_from_resource ("io/elementary/quick-settings/Indicator.css");

Gtk.StyleContext.add_provider_for_screen (
Gdk.Screen.get_default (),
Gtk.StyleContext.add_provider_for_display (
Gdk.Display.get_default (),
provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
);
Expand Down
50 changes: 24 additions & 26 deletions src/PopoverWidget.vala
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public class QuickSettings.PopoverWidget : Gtk.Box {
row_spacing = 12,
selection_mode = NONE
};
toggle_box.get_style_context ().add_class ("togglebox");
toggle_box.add (prevent_sleep_toggle);
toggle_box.add_css_class ("togglebox");
toggle_box.append (prevent_sleep_toggle);

var text_scale = new TextScale ();

Expand All @@ -59,9 +59,9 @@ public class QuickSettings.PopoverWidget : Gtk.Box {
current_user_button = new Gtk.Button () {
child = current_user
};
current_user_button.get_style_context ().add_class ("circular");
current_user_button.get_style_context ().add_class ("flat");
current_user_button.get_style_context ().add_class ("no-padding");
current_user_button.add_css_class ("circular");
current_user_button.add_css_class ("flat");
current_user_button.add_css_class ("no-padding");

var session_box = new SessionBox (server_type) {
halign = END,
Expand All @@ -70,15 +70,15 @@ public class QuickSettings.PopoverWidget : Gtk.Box {
};

var bottom_box = new Gtk.Box (HORIZONTAL, 0);
bottom_box.add (current_user_button);
bottom_box.add (session_box);
bottom_box.get_style_context ().add_class ("togglebox");
bottom_box.append (current_user_button);
bottom_box.append (session_box);
bottom_box.add_css_class ("togglebox");

main_box = new Gtk.Box (VERTICAL, 0);
main_box.add (toggle_box);
main_box.add (scale_box);
main_box.add (new Gtk.Separator (HORIZONTAL));
main_box.add (bottom_box);
main_box.append (toggle_box);
main_box.append (scale_box);
main_box.append (new Gtk.Separator (HORIZONTAL));
main_box.append (bottom_box);

accounts_view = new UserList ();

Expand All @@ -88,27 +88,25 @@ public class QuickSettings.PopoverWidget : Gtk.Box {
transition_type = SLIDE_LEFT_RIGHT
};

stack.add (main_box);
stack.add (accounts_view);
stack.add_child (main_box);
stack.add_child (accounts_view);

add (stack);
append (stack);

if (server_type == GREETER) {
bottom_box.remove (current_user_button);
}

if (server_type != GREETER) {
var darkmode_button = new DarkModeToggle ();
toggle_box.add (darkmode_button);
show_all ();
toggle_box.append (darkmode_button);
}

setup_sensor_proxy.begin ((obj, res) => {
var sensor_proxy = setup_sensor_proxy.end (res);
if (sensor_proxy.has_accelerometer) {
var rotation_toggle = new RotationToggle ();
toggle_box.add (rotation_toggle);
show_all ();
toggle_box.append (rotation_toggle);
};
});

Expand All @@ -122,18 +120,18 @@ public class QuickSettings.PopoverWidget : Gtk.Box {
var glib_settings = new Settings ("io.elementary.desktop.quick-settings");

if (server_type == GREETER || glib_settings.get_boolean ("show-a11y")) {
toggle_box.add (screen_reader);
toggle_box.add (onscreen_keyboard);
toggle_box.append (screen_reader);
toggle_box.append (onscreen_keyboard);

scale_box.add (text_scale);
scale_box.append (text_scale);
}

glib_settings.changed["show-a11y"].connect (() => {
if (glib_settings.get_boolean ("show-a11y") && screen_reader.parent == null) {
toggle_box.add (screen_reader);
toggle_box.add (onscreen_keyboard);
toggle_box.append (screen_reader);
toggle_box.append (onscreen_keyboard);

scale_box.add (text_scale);
scale_box.append (text_scale);
} else {
toggle_box.remove (screen_reader);
toggle_box.remove (onscreen_keyboard);
Expand Down Expand Up @@ -162,7 +160,7 @@ public class QuickSettings.PopoverWidget : Gtk.Box {
new ThemedIcon ("onboard")
) {
badge_icon = new ThemedIcon ("system-log-out"),
transient_for = (Gtk.Window) get_toplevel ()
transient_for = (Gtk.Window) get_root ()
};
message_dialog.response.connect (message_dialog.destroy);
message_dialog.present ();
Expand Down
32 changes: 15 additions & 17 deletions src/Widgets/CurrentUser.vala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
public bool minimal { get; construct; }
public Act.User? user { get; set; default = null; }

private Hdy.Avatar avatar;
private Adw.Avatar avatar;
private Gtk.Label fullname_label;
private Gtk.Label status_label;
private Gtk.Button logout_button;
Expand All @@ -29,7 +29,7 @@
}

construct {
avatar = new Hdy.Avatar (minimal ? 32 : 48, null, true);
avatar = new Adw.Avatar (minimal ? 32 : 48, null, true);

// We want to use the user's accent, not a random color
unowned Gtk.StyleContext avatar_context = avatar.get_style_context ();
Expand All @@ -52,25 +52,25 @@
valign = Gtk.Align.END,
halign = Gtk.Align.START
};
fullname_label.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL);
fullname_label.add_css_class (Granite.STYLE_CLASS_H3_LABEL);

status_label = new Gtk.Label (null) {
valign = Gtk.Align.START,
halign = Gtk.Align.START
};
status_label.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL);
status_label.get_style_context ().add_class (Granite.STYLE_CLASS_SMALL_LABEL);
status_label.add_css_class (Granite.STYLE_CLASS_DIM_LABEL);
status_label.add_css_class (Granite.STYLE_CLASS_SMALL_LABEL);

logout_button = new Gtk.Button.from_icon_name ("system-log-out-symbolic") {
tooltip_text = _("Log Out…"),
hexpand = true,
halign = END,
valign = CENTER
};
logout_button.get_style_context ().add_class ("circular");
logout_button.add_css_class ("circular");

if (minimal) {
add (avatar);
append (avatar);
} else {
var grid = new Gtk.Grid () {
column_spacing = 12
Expand All @@ -79,11 +79,10 @@
grid.attach (fullname_label, 1, 0, 1, 1);
grid.attach (status_label, 1, 1, 1, 1);
grid.attach (logout_button, 2, 0, 2, 2);
grid.show_all ();

get_style_context ().add_class ("menuitem");
add_css_class ("menuitem");

add (grid);
append (grid);
}

if (UserManager.get_usermanager ().is_loaded) {
Expand Down Expand Up @@ -132,13 +131,12 @@
}
}

private GLib.LoadableIcon? get_avatar_icon () {
var file = File.new_for_path (user.get_icon_file ());
if (file.query_exists ()) {
return new FileIcon (file);
private Gdk.Texture? get_avatar_icon () {
try {
return Gdk.Texture.from_filename (user.get_icon_file ());
} catch {
return null;
}

return null;
}

public async void update_state () {
Expand Down Expand Up @@ -166,6 +164,6 @@

fullname_label.label = user.real_name;
avatar.text = user.real_name;
avatar.set_loadable_icon (get_avatar_icon ());
avatar.custom_image = get_avatar_icon ();
}
}
2 changes: 1 addition & 1 deletion src/Widgets/DarkModeToggle.vala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class QuickSettings.DarkModeToggle: SettingsToggle {
construct {
icon_name = "dark-mode-symbolic";
settings_uri = "settings://desktop/appearance";
get_style_context ().add_class ("color-scheme");
add_css_class ("color-scheme");

var settings = new GLib.Settings ("io.elementary.settings-daemon.prefers-color-scheme");

Expand Down
23 changes: 10 additions & 13 deletions src/Widgets/EndSessionDialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public class QuickSettings.EndSessionDialog : Granite.MessageDialog {
public EndSessionDialogType dialog_type { get; construct; }

private Gtk.CheckButton? updates_check_button;
private Gtk.EventControllerKey key_controller;

public EndSessionDialog (QuickSettings.EndSessionDialogType type) {
Object (dialog_type: type);
Expand All @@ -50,10 +49,6 @@ public class QuickSettings.EndSessionDialog : Granite.MessageDialog {
break;
}

var image = new Gtk.Image.from_icon_name (icon_name, Gtk.IconSize.DIALOG) {
valign = Gtk.Align.START
};

/*
* the indicator does not have a separate item for restart, that's
* why we show both shutdown and restart for the restart action
Expand All @@ -71,7 +66,7 @@ public class QuickSettings.EndSessionDialog : Granite.MessageDialog {
var cancel = (Gtk.Button) add_button (_("Cancel"), Gtk.ResponseType.CANCEL);

var confirm = (Gtk.Button) add_button (button_text, Gtk.ResponseType.ACCEPT);
confirm.get_style_context ().add_class (Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION);
confirm.add_css_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION);

if (dialog_type != LOGOUT) {
bool has_prepared_updates = false;
Expand All @@ -86,9 +81,8 @@ public class QuickSettings.EndSessionDialog : Granite.MessageDialog {
active = true,
label = _("Install pending system updates"),
};
updates_check_button.show ();

custom_bin.add (updates_check_button);
custom_bin.append (updates_check_button);
}
}

Expand All @@ -104,13 +98,15 @@ public class QuickSettings.EndSessionDialog : Granite.MessageDialog {
cancel_action.activate (null);
});

key_controller = new Gtk.EventControllerKey (this);
var key_controller = new Gtk.EventControllerKey ();
key_controller.key_released.connect ((keyval, keycode, state) => {
if (keyval == Gdk.Key.Escape) {
cancel_action.activate (null);
}
});

((Gtk.Widget) this).add_controller (key_controller);

confirm.clicked.connect (() => {
if (dialog_type == EndSessionDialogType.RESTART || dialog_type == EndSessionDialogType.SHUTDOWN) {
if (set_offline_trigger (POWER_OFF)) {
Expand All @@ -125,7 +121,7 @@ public class QuickSettings.EndSessionDialog : Granite.MessageDialog {
destroy ();
});

realize.connect (() => Idle.add_once (() => init_wl ()));
((Gtk.Widget) this).realize.connect (() => Idle.add_once (() => init_wl ()));
}

private bool set_offline_trigger (Pk.OfflineAction action) {
Expand Down Expand Up @@ -156,9 +152,10 @@ public class QuickSettings.EndSessionDialog : Granite.MessageDialog {
public void registry_handle_global (Wl.Registry wl_registry, uint32 name, string @interface, uint32 version) {
if (@interface == "io_elementary_pantheon_shell_v1") {
var desktop_shell = wl_registry.bind<Pantheon.Desktop.Shell> (name, ref Pantheon.Desktop.Shell.iface, uint32.min (version, 1));
unowned var window = get_window ();
if (window is Gdk.Wayland.Window) {
unowned var wl_surface = ((Gdk.Wayland.Window) window).get_wl_surface ();
unowned var surface = get_surface ();
if (surface is Gdk.Wayland.Surface) {
unowned var wl_surface = ((Gdk.Wayland.Surface) surface).get_wl_surface ();

var extended_behavior = desktop_shell.get_extended_behavior (wl_surface);
extended_behavior.set_keep_above ();
extended_behavior.make_centered ();
Expand Down
4 changes: 2 additions & 2 deletions src/Widgets/PreventSleepToggle.vala
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ public class QuickSettings.PreventSleepToggle: SettingsToggle {

if (_prevent_sleep_toggle.active && suspend_cookie == 0 && idle_cookie == 0) {
suspend_cookie = application.inhibit (
(Gtk.Window) get_toplevel (),
(Gtk.Window) get_root (),
Gtk.ApplicationInhibitFlags.SUSPEND,
"Prevent session from suspending"
);
idle_cookie = application.inhibit (
(Gtk.Window) get_toplevel (),
(Gtk.Window) get_root (),
Gtk.ApplicationInhibitFlags.IDLE,
"Prevent session from idle"
);
Expand Down
11 changes: 5 additions & 6 deletions src/Widgets/RotationToggle.vala
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,20 @@ public class QuickSettings.RotationToggle: SettingsToggle {

construct {
var lock_image = new Gtk.Image ();
lock_image.get_style_context ().add_class ("lock");
lock_image.add_css_class ("lock");

var arrow_image = new Gtk.Image.from_icon_name ("quick-settings-rotation-arrow-symbolic", BUTTON);
arrow_image.get_style_context ().add_class ("arrow");
var arrow_image = new Gtk.Image.from_icon_name ("quick-settings-rotation-arrow-symbolic");
arrow_image.add_css_class ("arrow");

var overlay = new Gtk.Overlay () {
can_target = false,
child = lock_image
};
overlay.add_overlay (arrow_image);
overlay.set_overlay_pass_through (arrow_image, true);
overlay.set_overlay_pass_through (lock_image, true);

button_child = overlay;

get_style_context ().add_class ("rotation");
add_css_class ("rotation");
settings_uri = "settings://display";

var touchscreen_settings = new Settings ("org.gnome.settings-daemon.peripherals.touchscreen");
Expand Down
Loading
Loading