diff --git a/data/icons/input-powerbar-symbolic.svg b/data/icons/input-powerbar-symbolic.svg
new file mode 100644
index 000000000..9e1b42b5f
--- /dev/null
+++ b/data/icons/input-powerbar-symbolic.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/data/sm.puri.phosh.gschema.xml b/data/sm.puri.phosh.gschema.xml
index 848ed5fe5..2947c0f40 100644
--- a/data/sm.puri.phosh.gschema.xml
+++ b/data/sm.puri.phosh.gschema.xml
@@ -77,6 +77,17 @@
UI elements in order to not overlap with notches and cutouts.
+
+
+ 1.0
+ OSK unfold long press delay factor
+
+ Delay factor for long press on the home bar to unfold the keyboard.
+ Valid values are [0.5,2.0]. Values less than 1.0 make the unfold trigger
+ sooner, greater than 1.0 make the unfold trigger later.
+
+
+
Whether to scramble the keypad
Setting this to true shuffle the digits on the PIN keypad to
- make eaveysdropping harder.
+ make eavesdropping harder.
diff --git a/debian/control b/debian/control
index 049cbb46f..60ff41a76 100644
--- a/debian/control
+++ b/debian/control
@@ -8,6 +8,7 @@ Build-Depends:
libadwaita-1-dev,
libcallaudio-dev,
libevince-dev,
+ libgirepository1.0-dev,
libjson-glib-dev,
libsecret-1-dev,
libsystemd-dev,
diff --git a/src/background-manager.c b/src/background-manager.c
index e4cdd0079..f5818328d 100644
--- a/src/background-manager.c
+++ b/src/background-manager.c
@@ -38,17 +38,17 @@ static PhoshBackground *
create_background_for_monitor (PhoshBackgroundManager *self, PhoshMonitor *monitor)
{
PhoshWayland *wl = phosh_wayland_get_default();
- PhoshBackground *background;
+ GtkWidget *background;
- background = g_object_ref_sink(PHOSH_BACKGROUND (phosh_background_new (
- phosh_wayland_get_zwlr_layer_shell_v1(wl),
- monitor->wl_output,
- MAX(1.0, phosh_monitor_get_fractional_scale (monitor)),
- monitor == self->primary_monitor)));
+ background = phosh_background_new (phosh_wayland_get_zwlr_layer_shell_v1 (wl),
+ monitor->wl_output,
+ MAX(1.0, phosh_monitor_get_fractional_scale (monitor)),
+ monitor == self->primary_monitor,
+ ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND);
g_hash_table_insert (self->backgrounds,
g_object_ref (monitor),
background);
- return background;
+ return PHOSH_BACKGROUND (background);
}
diff --git a/src/background.c b/src/background.c
index f77bb0260..1702189d4 100644
--- a/src/background.c
+++ b/src/background.c
@@ -266,9 +266,11 @@ background_update (PhoshBackground *self, GdkPixbuf *pixbuf, GDesktopBackgroundS
g_clear_object (&self->pixbuf);
+#if 0
if (self->primary)
phosh_shell_get_usable_area (phosh_shell_get_default (), NULL, NULL, &width, &height);
else
+#endif
g_object_get (self, "configured-width", &width, "configured-height", &height, NULL);
g_debug ("Scaling %p to %dx%d, scale %f", self, width, height, self->scale);
@@ -466,8 +468,10 @@ background_draw_cb (PhoshBackground *self,
g_return_val_if_fail (GDK_IS_PIXBUF (self->pixbuf), TRUE);
+#if 0
if (self->primary)
phosh_shell_get_usable_area (phosh_shell_get_default (), &x, &y, NULL, NULL);
+#endif
cairo_save(cr);
cairo_scale(cr, 1.0 / self->scale, 1.0 / self->scale);
@@ -626,7 +630,8 @@ GtkWidget *
phosh_background_new (gpointer layer_shell,
gpointer wl_output,
float scale,
- gboolean primary)
+ gboolean primary,
+ guint layer)
{
return g_object_new (PHOSH_TYPE_BACKGROUND,
"layer-shell", layer_shell,
@@ -635,7 +640,7 @@ phosh_background_new (gpointer layer_shell,
ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM |
ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT |
ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT),
- "layer", ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND,
+ "layer", layer,
"kbd-interactivity", FALSE,
"exclusive-zone", -1,
"namespace", "phosh background",
diff --git a/src/background.h b/src/background.h
index 8b921edf1..d6599a5bc 100644
--- a/src/background.h
+++ b/src/background.h
@@ -19,6 +19,7 @@ G_DECLARE_FINAL_TYPE (PhoshBackground, phosh_background, PHOSH, BACKGROUND, Phos
GtkWidget *phosh_background_new (gpointer layer_shell,
gpointer wl_output,
float scale,
- gboolean primary);
+ gboolean primary,
+ guint layer);
void phosh_background_set_primary (PhoshBackground *self, gboolean primary);
void phosh_background_set_scale (PhoshBackground *self, float scale);
diff --git a/src/home.c b/src/home.c
index aaaf46528..2c7e58851 100644
--- a/src/home.c
+++ b/src/home.c
@@ -14,7 +14,8 @@
#include "home.h"
#include "shell.h"
#include "phosh-enums.h"
-#include "osk-button.h"
+#include "osk-manager.h"
+#include "feedback-manager.h"
#include "util.h"
#include
@@ -23,8 +24,14 @@
#define KEYBINDING_KEY_TOGGLE_OVERVIEW "toggle-overview"
#define KEYBINDING_KEY_TOGGLE_APPLICATION_VIEW "toggle-application-view"
+#define PHOSH_SETTINGS "sm.puri.phosh"
+
#define PHOSH_HOME_DRAG_THRESHOLD 0.3
+#define POWERBAR_ACTIVE_CLASS "p-active"
+#define POWERBAR_FAILED_CLASS "p-failed"
+#define HOMEBAR_OPAQUE_CLASS "opaque"
+
/**
* PhoshHome:
*
@@ -56,8 +63,12 @@ struct _PhoshHome
PhoshDragSurface parent;
GtkWidget *arrow_home;
- GtkWidget *revealer_osk;
GtkWidget *overview;
+ GtkWidget *powerbar;
+ PhoshOskManager *osk;
+ GtkWidget *stack;
+ GtkGesture *swipe_gesture;
+
guint debounce_handle;
gboolean focus_app_search;
@@ -71,21 +82,28 @@ struct _PhoshHome
gboolean osk_enabled;
GtkGesture *click_gesture; /* needed so that the gesture isn't destroyed immediately */
+ GtkGesture *osk_toggle_long_press; /* to toggle osk from the home bar itself */
+ GSettings *phosh_settings;
+
};
G_DEFINE_TYPE(PhoshHome, phosh_home, PHOSH_TYPE_DRAG_SURFACE);
static void
-phosh_home_update_osk_button (PhoshHome *self)
+phosh_home_update_home_bar (PhoshHome *self)
{
- gboolean visible = FALSE;
+ gboolean home_bar_transparent = FALSE;
+
+ const char *visible_child = "home-bar-unfolded";
PhoshDragSurfaceState drag_state = phosh_drag_surface_get_drag_state (PHOSH_DRAG_SURFACE (self));
- if (self->osk_enabled && self->state == PHOSH_HOME_STATE_FOLDED &&
- drag_state != PHOSH_DRAG_SURFACE_STATE_DRAGGED)
- visible = TRUE;
+ if (self->state == PHOSH_HOME_STATE_FOLDED && drag_state != PHOSH_DRAG_SURFACE_STATE_DRAGGED) {
+ visible_child = "home-bar-folded";
+ home_bar_transparent = TRUE;
+ }
- gtk_revealer_set_reveal_child (GTK_REVEALER (self->revealer_osk), visible);
+ gtk_stack_set_visible_child_name (GTK_STACK (self->stack), visible_child);
+ phosh_util_toggle_style_class (self->stack, HOMEBAR_OPAQUE_CLASS , home_bar_transparent);
}
@@ -104,7 +122,6 @@ phosh_home_set_property (GObject *object,
break;
case PROP_OSK_ENABLED:
self->osk_enabled = g_value_get_boolean (value);
- phosh_home_update_osk_button (self);
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_OSK_ENABLED]);
break;
default:
@@ -146,6 +163,14 @@ update_drag_handle (PhoshHome *self, gboolean commit)
PhoshDragSurfaceDragMode drag_mode = PHOSH_DRAG_SURFACE_DRAG_MODE_HANDLE;
PhoshDragSurfaceState drag_state = phosh_drag_surface_get_drag_state (PHOSH_DRAG_SURFACE (self));
+ /* hide osk only when unfolded */
+ if (self->state == PHOSH_HOME_STATE_FOLDED && drag_state == PHOSH_DRAG_SURFACE_STATE_DRAGGED)
+ phosh_osk_manager_set_visible (self->osk, FALSE);
+
+ /* reset powerbar gestures when unfolding */
+ gtk_event_controller_reset (GTK_EVENT_CONTROLLER (self->osk_toggle_long_press));
+ gtk_event_controller_reset(GTK_EVENT_CONTROLLER(self->swipe_gesture));
+
/* Update the handle's arrow and dragability */
if (phosh_overview_has_running_activities (PHOSH_OVERVIEW (self->overview)) == FALSE &&
self->state == PHOSH_HOME_STATE_UNFOLDED && drag_state != PHOSH_DRAG_SURFACE_STATE_DRAGGED) {
@@ -215,11 +240,111 @@ on_home_released (GtkButton *button, int n_press, double x, double y, GtkGesture
static void
-osk_clicked_cb (PhoshHome *self, GtkButton *btn)
+on_powerbar_action_started (PhoshHome *self)
+{
+ g_debug ("powerbar action started");
+ phosh_util_toggle_style_class (self->stack, POWERBAR_FAILED_CLASS, FALSE);
+ phosh_util_toggle_style_class (self->stack, POWERBAR_ACTIVE_CLASS, TRUE);
+}
+
+
+static void
+on_powerbar_action_ended (PhoshHome *self)
+{
+ g_debug ("powerbar action ended");
+ phosh_util_toggle_style_class (self->stack, POWERBAR_ACTIVE_CLASS, FALSE);
+ phosh_util_toggle_style_class (self->stack, POWERBAR_FAILED_CLASS, FALSE);
+}
+
+
+static void
+on_powerbar_action_failed (PhoshHome *self)
+{
+ g_debug ("powerbar action failed");
+ phosh_util_toggle_style_class (self->stack, POWERBAR_ACTIVE_CLASS, FALSE);
+ phosh_util_toggle_style_class (self->stack, POWERBAR_FAILED_CLASS, TRUE);
+}
+
+
+static void
+on_powerbar_pressed (PhoshHome *self)
+{
+ PhoshOskManager *osk;
+ gboolean osk_is_available, osk_current_state, osk_new_state;
+
+ g_return_if_fail (PHOSH_IS_HOME (self));
+ osk = phosh_shell_get_osk_manager (phosh_shell_get_default ());
+
+ osk_is_available = phosh_osk_manager_get_available (osk);
+ osk_current_state = phosh_osk_manager_get_visible (osk);
+ osk_new_state = osk_current_state;
+
+ gtk_gesture_set_state ((self->click_gesture), GTK_EVENT_SEQUENCE_DENIED);
+
+ if (osk_is_available) {
+ osk_new_state = !osk_current_state;
+ on_powerbar_action_ended (self);
+ } else {
+ on_powerbar_action_failed (self);
+ return;
+ }
+
+ if (osk_new_state)
+ g_signal_emit (self, signals[OSK_ACTIVATED], 0);
+
+ g_debug ("OSK toggled with pressed signal");
+ phosh_osk_manager_set_visible (osk, osk_new_state);
+
+ phosh_trigger_feedback ("button-pressed");
+}
+
+static void
+on_powerbar_swiped (GtkGestureSwipe *gesture, double velocity_x, double velocity_y, gpointer user_data)
{
+ PhoshHome *self;
+ PhoshToplevelManager *toplevel_manager;
+
+ gint toplevel_n;
+ gint toplevel_active;
+ gint toplevel_next;
+
+ self = g_object_get_data (G_OBJECT (gesture), "phosh-home");
g_return_if_fail (PHOSH_IS_HOME (self));
- g_return_if_fail (GTK_IS_BUTTON (btn));
- g_signal_emit(self, signals[OSK_ACTIVATED], 0);
+
+ /* only allow swiping when folded; it doesn't make sense while in the overview */
+ if (phosh_drag_surface_get_drag_state(PHOSH_DRAG_SURFACE (self)) != PHOSH_DRAG_SURFACE_STATE_FOLDED)
+ return;
+
+ g_debug("detected swipe on home: velocity_x: %f; velocity_y: %f", velocity_x, velocity_y);
+
+ toplevel_manager = phosh_shell_get_toplevel_manager (phosh_shell_get_default ());
+
+ toplevel_n = phosh_toplevel_manager_get_num_toplevels(toplevel_manager);
+ if (toplevel_n < 2) /* no swipe possible if there is only one activity */
+ return;
+
+ for (toplevel_active = 0; toplevel_active < toplevel_n; toplevel_active++) {
+ if (phosh_toplevel_is_activated (phosh_toplevel_manager_get_toplevel (toplevel_manager, toplevel_active)))
+ break;
+ if (toplevel_active == toplevel_n -1) // no toplevel active?
+ return;
+ }
+
+ if (velocity_x < -300)
+ toplevel_next = toplevel_active + 1;
+ else if (velocity_x > 300)
+ toplevel_next = toplevel_active - 1;
+ else
+ return;
+
+ if (toplevel_next < 0 || toplevel_next >= toplevel_n) {
+ g_debug ("next toplevel is out of bounds - id: %d", toplevel_next);
+ return;
+ }
+
+ phosh_toplevel_activate (
+ phosh_toplevel_manager_get_toplevel (toplevel_manager, toplevel_next),
+ phosh_wayland_get_wl_seat (phosh_wayland_get_default ()));
}
@@ -383,9 +508,15 @@ phosh_home_dragged (PhoshDragSurface *self, int margin)
{
PhoshHome *home = PHOSH_HOME (self);
int width, height;
+ double progress;
+
gtk_window_get_size (GTK_WINDOW (self), &width, &height);
- phosh_arrow_set_progress (PHOSH_ARROW (home->arrow_home), 1.0 - (-margin / (double)(height - PHOSH_HOME_BUTTON_HEIGHT)));
- g_debug ("Margin: %d", margin);
+
+ progress = 1.0 - (-margin / (double)(height - PHOSH_HOME_BUTTON_HEIGHT));
+
+ g_debug ("Margin: %d, %f", margin, progress);
+ phosh_arrow_set_progress (PHOSH_ARROW (home->arrow_home), progress);
+ phosh_shell_set_bg_alpha (phosh_shell_get_default (), hdy_ease_out_cubic (progress));
}
@@ -407,10 +538,12 @@ on_drag_state_changed (PhoshHome *self)
phosh_overview_focus_app_search (PHOSH_OVERVIEW (self->overview));
self->focus_app_search = FALSE;
}
+ phosh_shell_set_bg_alpha (phosh_shell_get_default (), 1.0);
break;
case PHOSH_DRAG_SURFACE_STATE_FOLDED:
state = PHOSH_HOME_STATE_FOLDED;
phosh_arrow_set_progress (PHOSH_ARROW (self->arrow_home), 0.0);
+ phosh_shell_set_bg_alpha (phosh_shell_get_default (), 0.0);
break;
case PHOSH_DRAG_SURFACE_STATE_DRAGGED:
if (self->state == PHOSH_HOME_STATE_FOLDED)
@@ -426,7 +559,7 @@ on_drag_state_changed (PhoshHome *self)
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_HOME_STATE]);
}
- phosh_home_update_osk_button (self);
+ phosh_home_update_home_bar (self);
phosh_layer_surface_set_kbd_interactivity (PHOSH_LAYER_SURFACE (self), kbd_interactivity);
update_drag_handle (self, FALSE);
@@ -458,6 +591,8 @@ phosh_home_constructed (GObject *object)
g_signal_connect (self, "notify::drag-state", G_CALLBACK (on_drag_state_changed), NULL);
g_object_set_data (G_OBJECT (self->click_gesture), "phosh-home", self);
+ g_object_set_data (G_OBJECT (self->osk_toggle_long_press), "phosh-home", self);
+ g_object_set_data (G_OBJECT (self->swipe_gesture), "phosh-home", self);
}
@@ -516,19 +651,25 @@ phosh_home_class_init (PhoshHomeClass *klass)
g_object_class_install_properties (object_class, PROP_LAST_PROP, props);
g_type_ensure (PHOSH_TYPE_ARROW);
- g_type_ensure (PHOSH_TYPE_OSK_BUTTON);
g_type_ensure (PHOSH_TYPE_OVERVIEW);
gtk_widget_class_set_template_from_resource (widget_class,
"/sm/puri/phosh/ui/home.ui");
gtk_widget_class_bind_template_child (widget_class, PhoshHome, arrow_home);
- gtk_widget_class_bind_template_child (widget_class, PhoshHome, revealer_osk);
+ gtk_widget_class_bind_template_child (widget_class, PhoshHome, powerbar);
+ gtk_widget_class_bind_template_child (widget_class, PhoshHome, stack);
gtk_widget_class_bind_template_child (widget_class, PhoshHome, click_gesture);
+ gtk_widget_class_bind_template_child (widget_class, PhoshHome, osk_toggle_long_press);
+ gtk_widget_class_bind_template_child (widget_class, PhoshHome, swipe_gesture);
gtk_widget_class_bind_template_child (widget_class, PhoshHome, overview);
gtk_widget_class_bind_template_callback (widget_class, fold_cb);
gtk_widget_class_bind_template_callback (widget_class, on_home_released);
+ gtk_widget_class_bind_template_callback (widget_class, on_powerbar_swiped);
gtk_widget_class_bind_template_callback (widget_class, on_has_activities_changed);
- gtk_widget_class_bind_template_callback (widget_class, osk_clicked_cb);
+ gtk_widget_class_bind_template_callback (widget_class, on_powerbar_pressed);
+ gtk_widget_class_bind_template_callback (widget_class, on_powerbar_action_started);
+ gtk_widget_class_bind_template_callback (widget_class, on_powerbar_action_ended);
+ gtk_widget_class_bind_template_callback (widget_class, on_powerbar_action_failed);
gtk_widget_class_bind_template_callback (widget_class, window_key_press_event_cb);
gtk_widget_class_set_css_name (widget_class, "phosh-home");
@@ -538,15 +679,21 @@ phosh_home_class_init (PhoshHomeClass *klass)
static void
phosh_home_init (PhoshHome *self)
{
- self->state = PHOSH_HOME_STATE_FOLDED;
- self->settings = g_settings_new (KEYBINDINGS_SCHEMA_ID);
+ g_autoptr (GSettings) settings = NULL;
gtk_widget_init_template (GTK_WIDGET (self));
- phosh_home_update_osk_button (self);
+ self->state = PHOSH_HOME_STATE_FOLDED;
+ self->settings = g_settings_new (KEYBINDINGS_SCHEMA_ID);
+ phosh_home_update_home_bar (self);
/* Adjust margins and folded state on size changes */
g_signal_connect (self, "configure-event", G_CALLBACK (on_configure_event), NULL);
+
+ settings = g_settings_new (PHOSH_SETTINGS);
+ g_settings_bind (settings, "osk-unfold-delay",
+ self->osk_toggle_long_press, "delay-factor",
+ G_SETTINGS_BIND_GET);
}
diff --git a/src/home.h b/src/home.h
index a34b71550..86c5cfe4f 100644
--- a/src/home.h
+++ b/src/home.h
@@ -12,7 +12,7 @@
#define PHOSH_TYPE_HOME (phosh_home_get_type())
-#define PHOSH_HOME_BUTTON_HEIGHT 40
+#define PHOSH_HOME_BUTTON_HEIGHT 15
/**
* PhoshHomeState:
diff --git a/src/layersurface.c b/src/layersurface.c
index 479c87d00..f86e849a3 100644
--- a/src/layersurface.c
+++ b/src/layersurface.c
@@ -9,6 +9,7 @@
#define G_LOG_DOMAIN "phosh-layer-surface"
#include "phosh-config.h"
+#include "phosh-wayland.h"
#include "layersurface.h"
#include "phosh-wayland.h"
#include "phoc-layer-shell-effects-unstable-v1-client-protocol.h"
@@ -879,3 +880,19 @@ phosh_layer_surface_has_alpha (PhoshLayerSurface *self)
return !!priv->alpha_surface;
}
+
+
+void
+phosh_layer_surface_set_empty_input_region (PhoshLayerSurface *self)
+{
+ PhoshLayerSurfacePrivate *priv;
+ struct wl_region *empty;
+
+ g_return_if_fail (PHOSH_IS_LAYER_SURFACE (self));
+ priv = phosh_layer_surface_get_instance_private (self);
+
+ empty = wl_compositor_create_region (phosh_wayland_get_compositor (phosh_wayland_get_default()));
+ wl_surface_set_input_region (priv->wl_surface, empty);
+ wl_surface_commit (priv->wl_surface);
+ wl_region_destroy (empty);
+}
diff --git a/src/layersurface.h b/src/layersurface.h
index 488eb00a4..d260a1785 100644
--- a/src/layersurface.h
+++ b/src/layersurface.h
@@ -59,5 +59,6 @@ int phosh_layer_surface_get_configured_height (Pho
void phosh_layer_surface_set_alpha (PhoshLayerSurface *self,
double alpha);
gboolean phosh_layer_surface_has_alpha (PhoshLayerSurface *self);
+void phosh_layer_surface_set_empty_input_region (PhoshLayerSurface *self);
G_END_DECLS
diff --git a/src/lockscreen.c b/src/lockscreen.c
index 5d93a3f69..94d05a579 100644
--- a/src/lockscreen.c
+++ b/src/lockscreen.c
@@ -1082,4 +1082,4 @@ phosh_lockscreen_set_page (PhoshLockscreen *self, PhoshLockscreenPage page)
scroll_to = (page == PHOSH_LOCKSCREEN_PAGE_UNLOCK) ? priv->box_unlock : priv->box_info;
hdy_carousel_scroll_to (HDY_CAROUSEL (priv->carousel), scroll_to);
-}
+}
\ No newline at end of file
diff --git a/src/phosh-wayland.c b/src/phosh-wayland.c
index f5edf8ade..3365f35d0 100644
--- a/src/phosh-wayland.c
+++ b/src/phosh-wayland.c
@@ -59,6 +59,7 @@ struct _PhoshWayland {
struct zphoc_layer_shell_effects_v1 *zphoc_layer_shell_effects_v1;
struct zphoc_device_state_v1 *zphoc_device_state_v1;
struct wl_shm *wl_shm;
+ struct wl_compositor *wl_compositor;
GHashTable *wl_outputs;
PhoshWaylandSeatCapabilities seat_capabilities;
};
@@ -123,6 +124,8 @@ registry_handle_global (void *data,
self->wl_shm = wl_registry_bind(
registry, name, &wl_shm_interface,
1);
+ } else if (!strcmp(interface, "wl_compositor")) {
+ self->wl_compositor = wl_registry_bind(registry, name, &wl_compositor_interface, 3);
} else if (!strcmp(interface, zwlr_input_inhibit_manager_v1_interface.name)) {
self->input_inhibit_manager = wl_registry_bind(
registry,
@@ -310,7 +313,7 @@ phosh_wayland_constructed (GObject *object)
"inhibit: %p, xdg_wm: %p, "
"xdg_output: %p, wlr_output_manager: %p, "
"wlr_foreign_toplevel_manager: %p, "
- "zwlr_output_power_manager_v1: %p, "
+"zwlr_output_power_manager_v1: %p, "
"zphoc_layer_shell_effects_v1: %p"
"\n",
num_outputs, self->layer_shell, self->idle_manager,
@@ -620,3 +623,12 @@ phosh_wayland_get_zphoc_device_state_v1 (PhoshWayland *self)
return self->zphoc_device_state_v1;
}
+
+
+struct wl_compositor *
+phosh_wayland_get_compositor (PhoshWayland *self)
+{
+ g_return_val_if_fail (PHOSH_IS_WAYLAND (self), NULL);
+
+ return self->wl_compositor;
+}
\ No newline at end of file
diff --git a/src/phosh-wayland.h b/src/phosh-wayland.h
index 407bfa67c..9c076e9f5 100644
--- a/src/phosh-wayland.h
+++ b/src/phosh-wayland.h
@@ -21,7 +21,7 @@
#include "wlr-screencopy-unstable-v1-client-protocol.h"
#include "xdg-output-unstable-v1-client-protocol.h"
#include "xdg-shell-client-protocol.h"
-
+#include "phoc-layer-shell-effects-unstable-v1-client-protocol.h"
/* This goes past the other wl protocols since it might need their structs */
#include "phosh-private-client-protocol.h"
@@ -42,12 +42,12 @@ G_BEGIN_DECLS
* These match wl_seat_capabilities
*/
typedef enum {
- /* From wl_seat */
+/* From wl_seat */
PHOSH_WAYLAND_SEAT_CAPABILITY_NONE = 0,
PHOSH_WAYLAND_SEAT_CAPABILITY_POINTER = (1 << 0),
PHOSH_WAYLAND_SEAT_CAPABILITY_KEYBOARD = (1 << 1),
PHOSH_WAYLAND_SEAT_CAPABILITY_TOUCH = (1 << 2),
- /* From device_state */
+/* From device_state */
PHOSH_WAYLAND_SEAT_CAPABILITY_TABLET_MODE_SWITCH = (1 << 8),
PHOSH_WAYLAND_SEAT_CAPABILITY_LID_SWITCH = (1 << 9),
} PhoshWaylandSeatCapabilities;
@@ -79,4 +79,5 @@ void phosh_wayland_roundtrip (PhoshWayland *sel
PhoshWaylandSeatCapabilities phosh_wayland_get_seat_capabilities (PhoshWayland *self);
struct zphoc_layer_shell_effects_v1 *phosh_wayland_get_zphoc_layer_shell_effects_v1 (PhoshWayland *self);
struct zphoc_device_state_v1 *phosh_wayland_get_zphoc_device_state_v1 (PhoshWayland *self);
+struct wl_compositor *phosh_wayland_get_compositor (PhoshWayland *self);
G_END_DECLS
diff --git a/src/phosh.gresources.xml b/src/phosh.gresources.xml
index e4c65c600..101ea5307 100644
--- a/src/phosh.gresources.xml
+++ b/src/phosh.gresources.xml
@@ -52,6 +52,7 @@
../data/icons/eye-not-looking-symbolic.svg
../data/icons/eye-open-negative-filled-symbolic.svg
../data/icons/feedback-quiet-symbolic.svg
+ ../data/icons/input-powerbar-symbolic.svg
../data/icons/microphone-hardware-disabled-symbolic.svg
../data/icons/moon-filled-symbolic.svg
../data/icons/network-cellular-disabled-symbolic.svg
diff --git a/src/shell.c b/src/shell.c
index a8fe675b3..386d477a4 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -23,6 +23,7 @@
#include "phosh-config.h"
#include "ambient.h"
+#include "background.h"
#include "drag-surface.h"
#include "shell.h"
#include "app-tracker.h"
@@ -123,6 +124,7 @@ static PhoshShellDebugFlags debug_flags;
typedef struct
{
+ PhoshBackground *top_bg;
PhoshDragSurface *top_panel;
PhoshDragSurface *home;
GPtrArray *faders; /* for final fade out */
@@ -286,6 +288,10 @@ on_home_state_changed (PhoshShell *self, GParamSpec *pspec, PhoshHome *home)
g_object_get (priv->home, "state", &state, NULL);
phosh_shell_set_state (self, PHOSH_STATE_OVERVIEW, state == PHOSH_HOME_STATE_UNFOLDED);
+
+ if (state == PHOSH_HOME_STATE_FOLDED) {
+ phosh_layer_surface_set_empty_input_region (PHOSH_LAYER_SURFACE (priv->top_bg));
+ }
}
@@ -349,6 +355,16 @@ panels_create (PhoshShell *self)
monitor = phosh_shell_get_primary_monitor (self);
g_return_if_fail (monitor);
+ /* TODO: just handle the background as part of PhoshHome */
+ /* Add a "background layer in the top layer */
+ priv->top_bg = PHOSH_BACKGROUND (phosh_background_new (
+ phosh_wayland_get_zwlr_layer_shell_v1(wl),
+ monitor->wl_output,
+ MAX(1.0, phosh_monitor_get_fractional_scale (monitor)),
+ TRUE,
+ ZWLR_LAYER_SHELL_V1_LAYER_TOP));;
+ gtk_widget_show (GTK_WIDGET (priv->top_bg));
+
top_layer = priv->locked ? ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY : ZWLR_LAYER_SHELL_V1_LAYER_TOP;
priv->top_panel = PHOSH_DRAG_SURFACE (phosh_top_panel_new (
phosh_wayland_get_zwlr_layer_shell_v1 (wl),
@@ -777,7 +793,7 @@ setup_idle_cb (PhoshShell *self)
priv->suspend_manager = phosh_suspend_manager_new ();
priv->emergency_calls_manager = phosh_emergency_calls_manager_new ();
priv->power_menu_manager = phosh_power_menu_manager_new ();
-
+
setup_primary_monitor_signal_handlers (self);
/* Delay signaling the compositor a bit so that idle handlers get a
@@ -2163,7 +2179,6 @@ phosh_shell_get_blanked (PhoshShell *self)
return phosh_shell_get_state (self) & PHOSH_STATE_BLANKED;
}
-
/**
* phosh_shell_activate_action:
* @self: The #PhoshShell singleton
@@ -2203,5 +2218,16 @@ phosh_shell_get_debug_flags (void)
return debug_flags;
}
-/* }}} */
+void
+phosh_shell_set_bg_alpha (PhoshShell *self, double alpha)
+{
+ PhoshShellPrivate *priv;
+
+ g_return_if_fail (PHOSH_IS_SHELL (self));
+ priv = phosh_shell_get_instance_private (self);
+
+ phosh_layer_surface_set_alpha (PHOSH_LAYER_SURFACE (priv->top_bg), alpha);
+}
+
+/* }}} */
diff --git a/src/shell.h b/src/shell.h
index 7eab4e935..caa7cf871 100644
--- a/src/shell.h
+++ b/src/shell.h
@@ -144,4 +144,6 @@ gboolean phosh_shell_activate_action (PhoshShell *self,
const char *action,
GVariant *parameter);
+void phosh_shell_set_bg_alpha (PhoshShell *self, double alpha);
+
G_END_DECLS
diff --git a/src/stylesheet/common.css b/src/stylesheet/common.css
index 442263345..91892789a 100644
--- a/src/stylesheet/common.css
+++ b/src/stylesheet/common.css
@@ -1,7 +1,8 @@
/*
* Top panel and bar
*/
-phosh-top-panel {
+ phosh-top-panel {
+ color: @phosh_fg_color;
font: 15px Cantarell;
}
@@ -53,12 +54,20 @@ phosh-top-panel .phosh-topbar-date {
min-width: 0;
min-height: 0;
padding: 6px;
+ background: none;
}
/*
* Settings menu
*/
+widget.phosh-settings-menu > scrolledwindow {
+ background-color: @phosh_bg_color;
+ border-radius: 24px;
+ margin-left: 6px;
+ margin-right: 6px;
+}
+
.phosh-settings-menu {
background-color: @phosh_bg_color;
border-bottom-right-radius: 12px;
@@ -70,7 +79,7 @@ phosh-top-panel .phosh-topbar-date {
}
.phosh-settings-menu scrolledwindow > viewport {
- padding: 0 16px;
+ padding: 0 12px;
}
#phosh_quick_settings flowboxchild > button {
@@ -175,6 +184,42 @@ phosh-audio-device-row image {
font-size: 90%;
}
+/* phosh-home */
+
+.opaque {
+ background-color: @window_bg_color;
+}
+
+#powerbar {
+ background: -gtk-recolor(url('resource:///sm/puri/phosh/icons/scalable/status/input-powerbar-symbolic.svg'));
+ background-position: center;
+ background-size: 150px 15px;
+ background-repeat: no-repeat;
+ transition: 400ms ease;
+}
+
+.p-active #powerbar {
+ opacity: 0.5;
+}
+
+.p-failed #powerbar {
+ background-size: 150px 15px;
+ transition: 300ms ease;
+ animation: error-shake 1.5s ease;
+ animation-iteration-count: 1;
+}
+
+@keyframes error-shake {
+ 0% {background-position: center; opacity: .5;}
+ 10% {background-position: center; opacity: .7;}
+ 15% {background-position: left; opacity: 1;}
+ 30% {background-position: right;}
+ 45% {background-position: left;}
+ 60% {background-position: right;}
+ 80% {background-position: center;}
+ 100% {background-position: center;}
+}
+
/*
* Overview (app grid with favories and, activities)
*/
@@ -210,8 +255,8 @@ phosh-activity.phosh-empty {
background-size: cover;
}
-phosh-home, phosh-top-panel {
- background: @phosh_bg_color;
+phosh-home {
+ background: none;
color: @phosh_fg_color;
}
@@ -224,7 +269,7 @@ phosh-home, phosh-top-panel {
}
.phosh-overview {
- background: @phosh_bg_color;
+ background: none;
color: @phosh_fg_color;
}
@@ -266,7 +311,7 @@ phosh-home, phosh-top-panel {
}
phosh-app-grid {
- background: @phosh_bg_color;
+ background: none;
color: @phosh_fg_color;
}
@@ -299,7 +344,11 @@ phosh-app-grid-button button {
* Lock screen
*/
-phosh-lockscreen,
+phosh-lockscreen {
+ background-color: @phosh_bg_color;
+ color: @phosh_fg_color;
+}
+
.phosh-lockshield {
background-color: @phosh_bg_color;
color: @phosh_fg_color;
diff --git a/src/ui/home.ui b/src/ui/home.ui
index ba9ead2c5..5c9482aed 100644
--- a/src/ui/home.ui
+++ b/src/ui/home.ui
@@ -12,57 +12,63 @@
True
vertical
-
-
-
True
@@ -83,4 +89,19 @@
evbox_home
+
+
+ powerbar
+
+
+
+
+
+
+
+ powerbar
+
+
+
+
diff --git a/src/util.c b/src/util.c
index a672b43a3..6ab42eb97 100644
--- a/src/util.c
+++ b/src/util.c
@@ -616,3 +616,36 @@ phosh_clear_fd (int *fd, GError **err)
return success;
}
+
+/**
+ * phosh_is_high_contrast:
+ * @widget:(nullable): a widget or %NULL.
+ *
+ * Check if a high contrast theme is in use. If no widget is passed
+ * the default GTK settings object is used.
+ *
+ * Returns: %TRUE if phosh currently using a high contrast theme
+ */
+gboolean
+phosh_is_high_contrast (GtkWidget *widget)
+{
+ GtkSettings *settings = NULL;
+ g_autofree char *theme_name = NULL;
+
+ g_return_val_if_fail (widget == NULL || GTK_IS_WIDGET (widget), FALSE);
+
+ if (widget)
+ settings = gtk_widget_get_settings (widget);
+ else
+ settings = gtk_settings_get_default ();
+
+ g_return_val_if_fail (GTK_IS_SETTINGS (settings), FALSE);
+
+ g_object_get (settings, "gtk-theme-name", &theme_name, NULL);
+ if (g_strcmp0 (theme_name, "HighContrast") &&
+ g_strcmp0 (theme_name, "HighContrastInverse")) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
diff --git a/src/util.h b/src/util.h
index 567fc93f1..3a0acb267 100644
--- a/src/util.h
+++ b/src/util.h
@@ -39,3 +39,4 @@ gboolean phosh_util_have_gnome_software (gboolean scan);
void phosh_util_toggle_style_class (GtkWidget *widget, const char *style_class, gboolean toggle);
const char *phosh_util_get_stylesheet (const char *theme_name);
gboolean phosh_clear_fd (int *fd, GError **err);
+gboolean phosh_is_high_contrast (GtkWidget *widget);
diff --git a/src/wwan/phosh-wwan-mm.c b/src/wwan/phosh-wwan-mm.c
index 70f452cc8..692d34029 100644
--- a/src/wwan/phosh-wwan-mm.c
+++ b/src/wwan/phosh-wwan-mm.c
@@ -42,6 +42,7 @@ typedef enum { /* From ModemManager-enums.h */
MM_MODEM_ACCESS_TECHNOLOGY_EVDOA = 1 << 12,
MM_MODEM_ACCESS_TECHNOLOGY_EVDOB = 1 << 13,
MM_MODEM_ACCESS_TECHNOLOGY_LTE = 1 << 14,
+ MM_MODEM_ACCESS_TECHNOLOGY_5GNR = 1 << 15,
} PhoshWWanMMAccessTechnology;
typedef enum { /* From ModemManager-enums.h */
@@ -145,6 +146,8 @@ phosh_wwan_mm_user_friendly_access_tec (guint access_tec)
return "3.75G";
case MM_MODEM_ACCESS_TECHNOLOGY_LTE:
return "4G";
+ case MM_MODEM_ACCESS_TECHNOLOGY_5GNR:
+ return "5G";
case MM_MODEM_ACCESS_TECHNOLOGY_1XRTT:
case MM_MODEM_ACCESS_TECHNOLOGY_EVDO0:
case MM_MODEM_ACCESS_TECHNOLOGY_EVDOA:
diff --git a/src/wwan/phosh-wwan-ofono.c b/src/wwan/phosh-wwan-ofono.c
index 94532cb7e..e3e89e4b6 100644
--- a/src/wwan/phosh-wwan-ofono.c
+++ b/src/wwan/phosh-wwan-ofono.c
@@ -90,6 +90,8 @@ phosh_wwan_ofono_user_friendly_access_tec (const char *access_tec)
return "3.5G";
if (g_strcmp0 (access_tec, "lte") == 0)
return "4G";
+ if (g_strcmp0 (access_tec, "nr") == 0)
+ return "5G";
return NULL;
}
diff --git a/tests/test-background.c b/tests/test-background.c
index 394fe6635..66027ba2c 100644
--- a/tests/test-background.c
+++ b/tests/test-background.c
@@ -55,7 +55,8 @@ test_background_new (Fixture *fixture, gconstpointer unused)
fixture->base.state->wl),
fixture->base.state->output,
1,
- TRUE);
+ TRUE
+ ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND);
g_assert_true (PHOSH_IS_BACKGROUND (background));
g_object_get (background, "primary", &primary, NULL);
g_assert_true (primary);