Compare commits
No commits in common. "bd0f0b2720d8b6a43e9fd37653c895d04f20ce40" and "45191559c73a9915bdb1bfca8086734514d6b6b3" have entirely different histories.
bd0f0b2720
...
45191559c7
|
@ -162,7 +162,7 @@
|
||||||
config = {
|
config = {
|
||||||
osc = "no";
|
osc = "no";
|
||||||
hwdec = "vaapi";
|
hwdec = "vaapi";
|
||||||
vo = "gpu,dmabuf-wayland,wlshm,vdpau,xv,x11,sdl,drm,";
|
vo = "gpu-next,gpu,dmabuf-wayland,wlshm,vdpau,xv,x11,sdl,drm,";
|
||||||
alang = "jpn,en,ru";
|
alang = "jpn,en,ru";
|
||||||
slang = "jpn,en,ru";
|
slang = "jpn,en,ru";
|
||||||
vlang = "jpn,en,ru";
|
vlang = "jpn,en,ru";
|
||||||
|
|
|
@ -34,7 +34,6 @@ audioPrev = pkgs.writeShellScript "playerctl-prev" ''
|
||||||
${pkgs.playerctl}/bin/playerctl play
|
${pkgs.playerctl}/bin/playerctl play
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
# TODO: only unidle mako when unlocked
|
|
||||||
swaylock =
|
swaylock =
|
||||||
if config.phone.enable
|
if config.phone.enable
|
||||||
then "${pkgs.schlock}/bin/schlock -fp /secrets/schlock.pin"
|
then "${pkgs.schlock}/bin/schlock -fp /secrets/schlock.pin"
|
||||||
|
@ -45,12 +44,10 @@ swaylock-start = pkgs.writeShellScript "swaylock-start" ''
|
||||||
dpms-off = pkgs.writeShellScript "sway-dpms-off" ''
|
dpms-off = pkgs.writeShellScript "sway-dpms-off" ''
|
||||||
${config.wayland.windowManager.sway.package}/bin/swaymsg output "*" power off
|
${config.wayland.windowManager.sway.package}/bin/swaymsg output "*" power off
|
||||||
${config.wayland.windowManager.sway.package}/bin/swaymsg input type:touch events disabled
|
${config.wayland.windowManager.sway.package}/bin/swaymsg input type:touch events disabled
|
||||||
${config.services.mako.package}/bin/makoctl mode -a idle
|
|
||||||
'';
|
'';
|
||||||
dpms-on = pkgs.writeShellScript "sway-dpms-on" ''
|
dpms-on = pkgs.writeShellScript "sway-dpms-on" ''
|
||||||
${config.wayland.windowManager.sway.package}/bin/swaymsg output "*" power on
|
${config.wayland.windowManager.sway.package}/bin/swaymsg output "*" power on
|
||||||
${config.wayland.windowManager.sway.package}/bin/swaymsg input type:touch events enabled
|
${config.wayland.windowManager.sway.package}/bin/swaymsg input type:touch events enabled
|
||||||
${config.services.mako.package}/bin/makoctl mode -r idle
|
|
||||||
'';
|
'';
|
||||||
lock-script = pkgs.writeShellScript "lock-start" ''
|
lock-script = pkgs.writeShellScript "lock-start" ''
|
||||||
${swaylock-start}
|
${swaylock-start}
|
||||||
|
@ -232,17 +229,9 @@ in
|
||||||
};
|
};
|
||||||
services.mako = {
|
services.mako = {
|
||||||
enable = lib.mkDefault config.wayland.windowManager.sway.enable;
|
enable = lib.mkDefault config.wayland.windowManager.sway.enable;
|
||||||
package = pkgs.mako.overrideAttrs (old: {
|
# ms
|
||||||
patches = old.patches or []
|
defaultTimeout = 7500;
|
||||||
++ (lib.mapAttrsToList (k: v: ../../pkgs/mako/${k}) (builtins.readDir ../../pkgs/mako));
|
|
||||||
});
|
|
||||||
defaultTimeout = 10000;
|
|
||||||
font = "Noto Sans Mono 12";
|
font = "Noto Sans Mono 12";
|
||||||
extraConfig = ''
|
|
||||||
max-history=50
|
|
||||||
[mode=idle]
|
|
||||||
freeze=1
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
xsession.windowManager.i3 = {
|
xsession.windowManager.i3 = {
|
||||||
config = let i3Config = {
|
config = let i3Config = {
|
||||||
|
@ -290,9 +279,9 @@ in
|
||||||
sha256 = "sha256-XgkysduhHbmprE334yeL65txpK0HNXeCmgCZMxpwsgU=";
|
sha256 = "sha256-XgkysduhHbmprE334yeL65txpK0HNXeCmgCZMxpwsgU=";
|
||||||
})*/
|
})*/
|
||||||
] ++ lib.optionals config.phone.enable
|
] ++ lib.optionals config.phone.enable
|
||||||
(lib.mapAttrsToList
|
(map
|
||||||
(k: v: ../../pkgs/sway/${k})
|
(x: ../../pkgs/sway/${x})
|
||||||
(lib.filterAttrs (k: v: lib.hasInfix "-mobile-" k) (builtins.readDir ../../pkgs/sway)));
|
(builtins.filter (lib.hasInfix "-mobile-") (builtins.attrNames (builtins.readDir ../../pkgs/sway))));
|
||||||
});
|
});
|
||||||
inherit (cfg) extraSessionCommands extraOptions;
|
inherit (cfg) extraSessionCommands extraOptions;
|
||||||
withBaseWrapper = cfg.wrapperFeatures.base;
|
withBaseWrapper = cfg.wrapperFeatures.base;
|
||||||
|
@ -522,12 +511,7 @@ in
|
||||||
programs.rofi = {
|
programs.rofi = {
|
||||||
enable = true;
|
enable = true;
|
||||||
font = "Noto Sans Mono 16";
|
font = "Noto Sans Mono 16";
|
||||||
package = lib.mkIf config.wayland.windowManager.sway.enable (pkgs.rofi-wayland.override {
|
package = lib.mkIf config.wayland.windowManager.sway.enable pkgs.rofi-wayland;
|
||||||
rofi-unwrapped = pkgs.rofi-wayland-unwrapped.overrideAttrs (old: {
|
|
||||||
patches = old.patches or []
|
|
||||||
++ (lib.mapAttrsToList (k: v: ../../pkgs/rofi-wayland/${k}) (builtins.readDir ../../pkgs/rofi-wayland));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
plugins = with pkgs; [
|
plugins = with pkgs; [
|
||||||
rofi-calc
|
rofi-calc
|
||||||
];
|
];
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
, xorg
|
, xorg
|
||||||
, xvfb-run
|
, xvfb-run
|
||||||
, dbus
|
, dbus
|
||||||
, adwaita-icon-theme
|
, gnome
|
||||||
, alsa-lib
|
, alsa-lib
|
||||||
, glib
|
, glib
|
||||||
, glib-networking
|
, glib-networking
|
||||||
|
@ -89,7 +89,7 @@ in gimp.overrideAttrs (old: rec {
|
||||||
json-glib
|
json-glib
|
||||||
python
|
python
|
||||||
xorg.libXmu
|
xorg.libXmu
|
||||||
adwaita-icon-theme
|
gnome.adwaita-icon-theme
|
||||||
(luajit.withPackages (ps: [ ps.lgi ]))
|
(luajit.withPackages (ps: [ ps.lgi ]))
|
||||||
alsa-lib
|
alsa-lib
|
||||||
gjs
|
gjs
|
||||||
|
@ -130,7 +130,7 @@ in gimp.overrideAttrs (old: rec {
|
||||||
preFixup = ''
|
preFixup = ''
|
||||||
gappsWrapperArgs+=(\
|
gappsWrapperArgs+=(\
|
||||||
--prefix PATH : "${lib.makeBinPath [ graphviz ]}:$out/bin" \
|
--prefix PATH : "${lib.makeBinPath [ graphviz ]}:$out/bin" \
|
||||||
--suffix XDG_DATA_DIRS : "${adwaita-icon-theme}/share" \
|
--suffix XDG_DATA_DIRS : "${gnome.adwaita-icon-theme}/share" \
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
postFixup = ''
|
postFixup = ''
|
||||||
|
|
|
@ -1,210 +0,0 @@
|
||||||
From 85bbcf7e18136f788cf76bb6f345ade84a5e536e Mon Sep 17 00:00:00 2001
|
|
||||||
From: chayleaf <chayleaf-git@pavluk.org>
|
|
||||||
Date: Sat, 24 Aug 2024 10:49:21 +0700
|
|
||||||
Subject: [PATCH 1/5] add on-long-touch option
|
|
||||||
|
|
||||||
---
|
|
||||||
config.c | 21 +++++++++++++++++++++
|
|
||||||
doc/mako.5.scd | 15 ++++++++++++++-
|
|
||||||
include/config.h | 7 ++++---
|
|
||||||
include/notification.h | 2 +-
|
|
||||||
include/wayland.h | 1 +
|
|
||||||
notification.c | 8 ++++++--
|
|
||||||
wayland.c | 3 ++-
|
|
||||||
7 files changed, 49 insertions(+), 8 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/config.c b/config.c
|
|
||||||
index 70be717..87db932 100644
|
|
||||||
--- a/config.c
|
|
||||||
+++ b/config.c
|
|
||||||
@@ -129,6 +129,9 @@ void init_default_style(struct mako_style *style) {
|
|
||||||
style->button_bindings.right.action = MAKO_BINDING_DISMISS;
|
|
||||||
style->button_bindings.middle.action = MAKO_BINDING_NONE;
|
|
||||||
style->touch_binding.action = MAKO_BINDING_DISMISS;
|
|
||||||
+ style->long_touch_binding.action = MAKO_BINDING_INVOKE_ACTION;
|
|
||||||
+ style->long_touch_binding.action_name = strdup(DEFAULT_ACTION_KEY);
|
|
||||||
+ style->long_press_duration = 500;
|
|
||||||
|
|
||||||
// Everything in the default config is explicitly specified.
|
|
||||||
memset(&style->spec, true, sizeof(struct mako_style_spec));
|
|
||||||
@@ -148,6 +151,7 @@ void finish_style(struct mako_style *style) {
|
|
||||||
finish_binding(&style->button_bindings.middle);
|
|
||||||
finish_binding(&style->button_bindings.right);
|
|
||||||
finish_binding(&style->touch_binding);
|
|
||||||
+ finish_binding(&style->long_touch_binding);
|
|
||||||
finish_binding(&style->notify_binding);
|
|
||||||
free(style->icon_path);
|
|
||||||
free(style->font);
|
|
||||||
@@ -385,6 +389,16 @@ bool apply_style(struct mako_style *target, const struct mako_style *style) {
|
|
||||||
target->spec.touch_binding = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ if (style->spec.long_touch_binding) {
|
|
||||||
+ copy_binding(&target->long_touch_binding, &style->long_touch_binding);
|
|
||||||
+ target->spec.long_touch_binding = true;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (style->spec.long_press_duration) {
|
|
||||||
+ target->long_press_duration = style->long_press_duration;
|
|
||||||
+ target->spec.long_press_duration = true;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (style->spec.notify_binding) {
|
|
||||||
copy_binding(&target->notify_binding, &style->notify_binding);
|
|
||||||
target->spec.notify_binding = true;
|
|
||||||
@@ -660,6 +674,8 @@ static bool apply_style_option(struct mako_style *style, const char *name,
|
|
||||||
return true;
|
|
||||||
} else if (strcmp(name, "anchor") == 0) {
|
|
||||||
return spec->anchor = parse_anchor(value, &style->anchor);
|
|
||||||
+ } else if (strcmp(name, "long-press-duration") == 0) {
|
|
||||||
+ return spec->long_press_duration = parse_int_ge(value, &style->long_press_duration, 0);
|
|
||||||
} else if (has_prefix(name, "on-")) {
|
|
||||||
struct mako_binding binding = {0};
|
|
||||||
if (strcmp(value, "none") == 0) {
|
|
||||||
@@ -697,6 +713,9 @@ static bool apply_style_option(struct mako_style *style, const char *name,
|
|
||||||
} else if (strcmp(name, "on-touch") == 0) {
|
|
||||||
copy_binding(&style->touch_binding, &binding);
|
|
||||||
style->spec.touch_binding = true;
|
|
||||||
+ } else if (strcmp(name, "on-long-touch") == 0) {
|
|
||||||
+ copy_binding(&style->long_touch_binding, &binding);
|
|
||||||
+ style->spec.long_touch_binding = true;
|
|
||||||
} else if (strcmp(name, "on-notify") == 0) {
|
|
||||||
copy_binding(&style->notify_binding, &binding);
|
|
||||||
style->spec.notify_binding = true;
|
|
||||||
@@ -886,6 +905,8 @@ int parse_config_arguments(struct mako_config *config, int argc, char **argv) {
|
|
||||||
{"on-button-right", required_argument, 0, 0},
|
|
||||||
{"on-button-middle", required_argument, 0, 0},
|
|
||||||
{"on-touch", required_argument, 0, 0},
|
|
||||||
+ {"on-long-touch", required_argument, 0, 0},
|
|
||||||
+ {"long-press-duration", required_argument, 0, 0},
|
|
||||||
{0},
|
|
||||||
};
|
|
||||||
|
|
||||||
diff --git a/doc/mako.5.scd b/doc/mako.5.scd
|
|
||||||
index 91378ba..fff19ed 100644
|
|
||||||
--- a/doc/mako.5.scd
|
|
||||||
+++ b/doc/mako.5.scd
|
|
||||||
@@ -57,10 +57,23 @@ Supported options:
|
|
||||||
Default: dismiss
|
|
||||||
|
|
||||||
*on-touch*=_action_
|
|
||||||
- Performs the action when tapped via a touch device.
|
|
||||||
+ Performs the action when tapped via a touch device if the tap
|
|
||||||
+ duration is less than *long-press-duration*.
|
|
||||||
|
|
||||||
Default: dismiss
|
|
||||||
|
|
||||||
+*on-long-touch*=_action_
|
|
||||||
+ Performs the action when tapped via a touch device if the press
|
|
||||||
+ duration is greater or equal to *long-press-duration*.
|
|
||||||
+
|
|
||||||
+ Default: invoke-default-action
|
|
||||||
+
|
|
||||||
+*long-press-duration*=_time_
|
|
||||||
+ Specifies the cutoff time (in milliseconds) for a press to be
|
|
||||||
+ considered a long press.
|
|
||||||
+
|
|
||||||
+ Default: 500
|
|
||||||
+
|
|
||||||
*on-notify*=_action_
|
|
||||||
Performs the action when the notification is opened.
|
|
||||||
|
|
||||||
diff --git a/include/config.h b/include/config.h
|
|
||||||
index 013923a..5ff541c 100644
|
|
||||||
--- a/include/config.h
|
|
||||||
+++ b/include/config.h
|
|
||||||
@@ -42,14 +42,14 @@ struct mako_style_spec {
|
|
||||||
bool width, height, outer_margin, margin, padding, border_size, border_radius, font,
|
|
||||||
markup, format, text_alignment, actions, default_timeout, ignore_timeout,
|
|
||||||
icons, max_icon_size, icon_path, group_criteria_spec, invisible, history,
|
|
||||||
- icon_location, max_visible, layer, output, anchor;
|
|
||||||
+ icon_location, max_visible, layer, output, anchor, long_press_duration;
|
|
||||||
struct {
|
|
||||||
bool background, text, border, progress;
|
|
||||||
} colors;
|
|
||||||
struct {
|
|
||||||
bool left, right, middle;
|
|
||||||
} button_bindings;
|
|
||||||
- bool touch_binding, notify_binding;
|
|
||||||
+ bool touch_binding, long_touch_binding, notify_binding;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
@@ -98,7 +98,8 @@ struct mako_style {
|
|
||||||
struct {
|
|
||||||
struct mako_binding left, right, middle;
|
|
||||||
} button_bindings;
|
|
||||||
- struct mako_binding touch_binding, notify_binding;
|
|
||||||
+ struct mako_binding touch_binding, long_touch_binding, notify_binding;
|
|
||||||
+ int32_t long_press_duration;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct mako_config {
|
|
||||||
diff --git a/include/notification.h b/include/notification.h
|
|
||||||
index 9a395ba..a02d855 100644
|
|
||||||
--- a/include/notification.h
|
|
||||||
+++ b/include/notification.h
|
|
||||||
@@ -101,7 +101,7 @@ size_t format_notification(struct mako_notification *notif, const char *format,
|
|
||||||
void notification_handle_button(struct mako_notification *notif, uint32_t button,
|
|
||||||
enum wl_pointer_button_state state, const struct mako_binding_context *ctx);
|
|
||||||
void notification_handle_touch(struct mako_notification *notif,
|
|
||||||
- const struct mako_binding_context *ctx);
|
|
||||||
+ const struct mako_binding_context *ctx, int32_t duration_ms);
|
|
||||||
void notification_execute_binding(struct mako_notification *notif,
|
|
||||||
const struct mako_binding *binding, const struct mako_binding_context *ctx);
|
|
||||||
void insert_notification(struct mako_state *state, struct mako_notification *notif);
|
|
||||||
diff --git a/include/wayland.h b/include/wayland.h
|
|
||||||
index cc00500..c8767be 100644
|
|
||||||
--- a/include/wayland.h
|
|
||||||
+++ b/include/wayland.h
|
|
||||||
@@ -35,6 +35,7 @@ struct mako_seat {
|
|
||||||
struct wl_touch *wl_touch;
|
|
||||||
struct {
|
|
||||||
int32_t x, y;
|
|
||||||
+ uint32_t time;
|
|
||||||
struct mako_surface *surface;
|
|
||||||
} pts[MAX_TOUCHPOINTS];
|
|
||||||
} touch;
|
|
||||||
diff --git a/notification.c b/notification.c
|
|
||||||
index 8c0c8a7..7d3db2f 100644
|
|
||||||
--- a/notification.c
|
|
||||||
+++ b/notification.c
|
|
||||||
@@ -446,8 +446,12 @@ void notification_handle_button(struct mako_notification *notif, uint32_t button
|
|
||||||
}
|
|
||||||
|
|
||||||
void notification_handle_touch(struct mako_notification *notif,
|
|
||||||
- const struct mako_binding_context *ctx) {
|
|
||||||
- notification_execute_binding(notif, ¬if->style.touch_binding, ctx);
|
|
||||||
+ const struct mako_binding_context *ctx, int32_t duration_ms) {
|
|
||||||
+ if (duration_ms >= notif->style.long_press_duration) {
|
|
||||||
+ notification_execute_binding(notif, ¬if->style.long_touch_binding, ctx);
|
|
||||||
+ } else {
|
|
||||||
+ notification_execute_binding(notif, ¬if->style.touch_binding, ctx);
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
diff --git a/wayland.c b/wayland.c
|
|
||||||
index eeefb30..d247779 100644
|
|
||||||
--- a/wayland.c
|
|
||||||
+++ b/wayland.c
|
|
||||||
@@ -122,6 +122,7 @@ static void touch_handle_down(void *data, struct wl_touch *wl_touch,
|
|
||||||
}
|
|
||||||
seat->touch.pts[id].x = wl_fixed_to_int(surface_x);
|
|
||||||
seat->touch.pts[id].y = wl_fixed_to_int(surface_y);
|
|
||||||
+ seat->touch.pts[id].time = time;
|
|
||||||
seat->touch.pts[id].surface = get_surface(seat->state, wl_surface);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -144,7 +145,7 @@ static void touch_handle_up(void *data, struct wl_touch *wl_touch,
|
|
||||||
wl_list_for_each(notif, &state->notifications, link) {
|
|
||||||
if (hotspot_at(¬if->hotspot, seat->touch.pts[id].x, seat->touch.pts[id].y)) {
|
|
||||||
struct mako_surface *surface = notif->surface;
|
|
||||||
- notification_handle_touch(notif, &ctx);
|
|
||||||
+ notification_handle_touch(notif, &ctx, time - seat->touch.pts[id].time);
|
|
||||||
set_dirty(surface);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.45.2
|
|
||||||
|
|
|
@ -1,151 +0,0 @@
|
||||||
From 7365261e130016e884371d2e288b83e16a9dcb48 Mon Sep 17 00:00:00 2001
|
|
||||||
From: chayleaf <chayleaf-git@pavluk.org>
|
|
||||||
Date: Sat, 24 Aug 2024 13:50:38 +0700
|
|
||||||
Subject: [PATCH 2/5] consider long press done even before release
|
|
||||||
|
|
||||||
---
|
|
||||||
include/notification.h | 16 ++++++++++------
|
|
||||||
include/wayland.h | 1 +
|
|
||||||
notification.c | 22 ++++++++++++++++++++++
|
|
||||||
wayland.c | 15 ++++++++++++++-
|
|
||||||
4 files changed, 47 insertions(+), 7 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/include/notification.h b/include/notification.h
|
|
||||||
index a02d855..b1482ec 100644
|
|
||||||
--- a/include/notification.h
|
|
||||||
+++ b/include/notification.h
|
|
||||||
@@ -19,6 +19,12 @@ struct mako_hotspot {
|
|
||||||
int32_t width, height;
|
|
||||||
};
|
|
||||||
|
|
||||||
+struct mako_binding_context {
|
|
||||||
+ struct mako_surface *surface;
|
|
||||||
+ struct mako_seat *seat;
|
|
||||||
+ uint32_t serial;
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
struct mako_notification {
|
|
||||||
struct mako_state *state;
|
|
||||||
struct mako_surface *surface;
|
|
||||||
@@ -38,6 +44,8 @@ struct mako_notification {
|
|
||||||
char *body;
|
|
||||||
int32_t requested_timeout;
|
|
||||||
struct wl_list actions; // mako_action::link
|
|
||||||
+ struct mako_timer *long_press_timer;
|
|
||||||
+ struct mako_binding_context long_press_ctx;
|
|
||||||
|
|
||||||
enum mako_notification_urgency urgency;
|
|
||||||
char *category;
|
|
||||||
@@ -70,12 +78,6 @@ struct mako_hidden_format_data {
|
|
||||||
size_t count;
|
|
||||||
};
|
|
||||||
|
|
||||||
-struct mako_binding_context {
|
|
||||||
- struct mako_surface *surface;
|
|
||||||
- struct mako_seat *seat;
|
|
||||||
- uint32_t serial;
|
|
||||||
-};
|
|
||||||
-
|
|
||||||
typedef char *(*mako_format_func_t)(char variable, bool *markup, void *data);
|
|
||||||
|
|
||||||
bool hotspot_at(struct mako_hotspot *hotspot, int32_t x, int32_t y);
|
|
||||||
@@ -100,6 +102,8 @@ size_t format_notification(struct mako_notification *notif, const char *format,
|
|
||||||
char *buf);
|
|
||||||
void notification_handle_button(struct mako_notification *notif, uint32_t button,
|
|
||||||
enum wl_pointer_button_state state, const struct mako_binding_context *ctx);
|
|
||||||
+void notification_handle_touch_start(struct mako_notification *notif,
|
|
||||||
+ const struct mako_binding_context *ctx);
|
|
||||||
void notification_handle_touch(struct mako_notification *notif,
|
|
||||||
const struct mako_binding_context *ctx, int32_t duration_ms);
|
|
||||||
void notification_execute_binding(struct mako_notification *notif,
|
|
||||||
diff --git a/include/wayland.h b/include/wayland.h
|
|
||||||
index c8767be..d4d39c4 100644
|
|
||||||
--- a/include/wayland.h
|
|
||||||
+++ b/include/wayland.h
|
|
||||||
@@ -3,6 +3,7 @@
|
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <wayland-client-protocol.h>
|
|
||||||
+#include "mako.h"
|
|
||||||
|
|
||||||
#define MAX_TOUCHPOINTS 10
|
|
||||||
|
|
||||||
diff --git a/notification.c b/notification.c
|
|
||||||
index 7d3db2f..32e7f7b 100644
|
|
||||||
--- a/notification.c
|
|
||||||
+++ b/notification.c
|
|
||||||
@@ -41,6 +41,8 @@ void reset_notification(struct mako_notification *notif) {
|
|
||||||
|
|
||||||
destroy_timer(notif->timer);
|
|
||||||
notif->timer = NULL;
|
|
||||||
+ destroy_timer(notif->long_press_timer);
|
|
||||||
+ notif->long_press_timer = NULL;
|
|
||||||
|
|
||||||
free(notif->app_name);
|
|
||||||
free(notif->app_icon);
|
|
||||||
@@ -447,6 +449,8 @@ void notification_handle_button(struct mako_notification *notif, uint32_t button
|
|
||||||
|
|
||||||
void notification_handle_touch(struct mako_notification *notif,
|
|
||||||
const struct mako_binding_context *ctx, int32_t duration_ms) {
|
|
||||||
+ destroy_timer(notif->long_press_timer);
|
|
||||||
+ notif->long_press_timer = NULL;
|
|
||||||
if (duration_ms >= notif->style.long_press_duration) {
|
|
||||||
notification_execute_binding(notif, ¬if->style.long_touch_binding, ctx);
|
|
||||||
} else {
|
|
||||||
@@ -454,6 +458,24 @@ void notification_handle_touch(struct mako_notification *notif,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+void handle_notification_touch_timer(void *data) {
|
|
||||||
+ struct mako_notification *notif = data;
|
|
||||||
+ notif->long_press_timer = NULL;
|
|
||||||
+ struct mako_binding_context ctx = notif->long_press_ctx;
|
|
||||||
+ notification_execute_binding(notif, ¬if->style.long_touch_binding, &ctx);
|
|
||||||
+ set_dirty(ctx.surface);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void notification_handle_touch_start(struct mako_notification *notif,
|
|
||||||
+ const struct mako_binding_context *ctx) {
|
|
||||||
+ if (notif->long_press_timer) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ notif->long_press_ctx = *ctx;
|
|
||||||
+ notif->long_press_timer = add_event_loop_timer(¬if->state->event_loop, 500,
|
|
||||||
+ handle_notification_touch_timer, notif);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/*
|
|
||||||
* Searches through the notifications list and returns the next position at
|
|
||||||
* which to insert. If no results for the specified urgency are found,
|
|
||||||
diff --git a/wayland.c b/wayland.c
|
|
||||||
index d247779..6d8b6ff 100644
|
|
||||||
--- a/wayland.c
|
|
||||||
+++ b/wayland.c
|
|
||||||
@@ -120,10 +120,23 @@ static void touch_handle_down(void *data, struct wl_touch *wl_touch,
|
|
||||||
if (id >= MAX_TOUCHPOINTS) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
+ struct mako_state *state = seat->state;
|
|
||||||
seat->touch.pts[id].x = wl_fixed_to_int(surface_x);
|
|
||||||
seat->touch.pts[id].y = wl_fixed_to_int(surface_y);
|
|
||||||
seat->touch.pts[id].time = time;
|
|
||||||
- seat->touch.pts[id].surface = get_surface(seat->state, wl_surface);
|
|
||||||
+ seat->touch.pts[id].surface = get_surface(state, wl_surface);
|
|
||||||
+
|
|
||||||
+ struct mako_notification *notif;
|
|
||||||
+ const struct mako_binding_context ctx = {
|
|
||||||
+ .surface = seat->touch.pts[id].surface,
|
|
||||||
+ .seat = seat,
|
|
||||||
+ .serial = serial,
|
|
||||||
+ };
|
|
||||||
+ wl_list_for_each(notif, &state->notifications, link) {
|
|
||||||
+ if (hotspot_at(¬if->hotspot, seat->touch.pts[id].x, seat->touch.pts[id].y)) {
|
|
||||||
+ notification_handle_touch_start(notif, &ctx);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
static void touch_handle_up(void *data, struct wl_touch *wl_touch,
|
|
||||||
--
|
|
||||||
2.45.2
|
|
||||||
|
|
|
@ -1,284 +0,0 @@
|
||||||
From 0b53bc7fb9494bc7a804a1d088c6b4137d6eef6d Mon Sep 17 00:00:00 2001
|
|
||||||
From: chayleaf <chayleaf-git@pavluk.org>
|
|
||||||
Date: Sat, 24 Aug 2024 08:47:49 +0700
|
|
||||||
Subject: [PATCH 3/5] dynamic timeouts
|
|
||||||
|
|
||||||
Compute notification timeouts on every config change, rather than only
|
|
||||||
on notification creation.
|
|
||||||
---
|
|
||||||
criteria.c | 50 ++++++++++++++++++++++++++++++++++++++----
|
|
||||||
dbus/mako.c | 2 +-
|
|
||||||
dbus/xdg.c | 21 +-----------------
|
|
||||||
event-loop.c | 22 +++----------------
|
|
||||||
include/criteria.h | 4 ++--
|
|
||||||
include/event-loop.h | 2 +-
|
|
||||||
include/notification.h | 1 +
|
|
||||||
notification.c | 2 ++
|
|
||||||
render.c | 4 ++--
|
|
||||||
9 files changed, 59 insertions(+), 49 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/criteria.c b/criteria.c
|
|
||||||
index 9db3966..3108a38 100644
|
|
||||||
--- a/criteria.c
|
|
||||||
+++ b/criteria.c
|
|
||||||
@@ -418,15 +418,38 @@ struct mako_criteria *global_criteria(struct mako_config *config) {
|
|
||||||
return criteria;
|
|
||||||
}
|
|
||||||
|
|
||||||
-// Iterate through `criteria_list`, applying the style from each matching
|
|
||||||
+static void timespec_add(struct timespec *t, int delta_ms) {
|
|
||||||
+ static const long ms = 1000000, s = 1000000000;
|
|
||||||
+
|
|
||||||
+ int delta_ms_low = delta_ms % 1000;
|
|
||||||
+ int delta_s_high = delta_ms / 1000;
|
|
||||||
+
|
|
||||||
+ t->tv_sec += delta_s_high;
|
|
||||||
+
|
|
||||||
+ t->tv_nsec += (long)delta_ms_low * ms;
|
|
||||||
+ if (t->tv_nsec >= s) {
|
|
||||||
+ t->tv_nsec -= s;
|
|
||||||
+ ++t->tv_sec;
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void handle_notification_timer(void *data) {
|
|
||||||
+ struct mako_notification *notif = data;
|
|
||||||
+ struct mako_surface *surface = notif->surface;
|
|
||||||
+ notif->timer = NULL;
|
|
||||||
+
|
|
||||||
+ close_notification(notif, MAKO_NOTIFICATION_CLOSE_EXPIRED, true);
|
|
||||||
+ set_dirty(surface);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+// Iterate through the criteria list, applying the style from each matching
|
|
||||||
// criteria to `notif`. Returns the number of criteria that matched, or -1 if
|
|
||||||
// a failure occurs.
|
|
||||||
-ssize_t apply_each_criteria(struct wl_list *criteria_list,
|
|
||||||
- struct mako_notification *notif) {
|
|
||||||
+ssize_t apply_each_criteria(struct mako_state *state, struct mako_notification *notif) {
|
|
||||||
ssize_t match_count = 0;
|
|
||||||
|
|
||||||
struct mako_criteria *criteria;
|
|
||||||
- wl_list_for_each(criteria, criteria_list, link) {
|
|
||||||
+ wl_list_for_each(criteria, &state->config.criteria, link) {
|
|
||||||
if (!match_criteria(criteria, notif)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
@@ -447,6 +470,25 @@ ssize_t apply_each_criteria(struct wl_list *criteria_list,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+ int32_t expire_timeout = notif->requested_timeout;
|
|
||||||
+ if (expire_timeout < 0 || notif->style.ignore_timeout) {
|
|
||||||
+ expire_timeout = notif->style.default_timeout;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (expire_timeout > 0) {
|
|
||||||
+ struct timespec at = notif->at;
|
|
||||||
+ timespec_add(&at, expire_timeout);
|
|
||||||
+ if (notif->timer) {
|
|
||||||
+ notif->timer->at = at;
|
|
||||||
+ } else {
|
|
||||||
+ notif->timer = add_event_loop_timer(&state->event_loop, &at,
|
|
||||||
+ handle_notification_timer, notif);
|
|
||||||
+ }
|
|
||||||
+ } else if (notif->timer) {
|
|
||||||
+ destroy_timer(notif->timer);
|
|
||||||
+ notif->timer = NULL;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (!notif->surface) {
|
|
||||||
notif->surface = create_surface(notif->state, notif->style.output,
|
|
||||||
notif->style.layer, notif->style.anchor);
|
|
||||||
diff --git a/dbus/mako.c b/dbus/mako.c
|
|
||||||
index 4c95881..8f3c874 100644
|
|
||||||
--- a/dbus/mako.c
|
|
||||||
+++ b/dbus/mako.c
|
|
||||||
@@ -305,7 +305,7 @@ static void reapply_config(struct mako_state *state) {
|
|
||||||
|
|
||||||
finish_style(¬if->style);
|
|
||||||
init_empty_style(¬if->style);
|
|
||||||
- apply_each_criteria(&state->config.criteria, notif);
|
|
||||||
+ apply_each_criteria(state, notif);
|
|
||||||
|
|
||||||
// Having to do this for every single notification really hurts... but
|
|
||||||
// it does do The Right Thing (tm).
|
|
||||||
diff --git a/dbus/xdg.c b/dbus/xdg.c
|
|
||||||
index 1f91431..650dff7 100644
|
|
||||||
--- a/dbus/xdg.c
|
|
||||||
+++ b/dbus/xdg.c
|
|
||||||
@@ -81,15 +81,6 @@ static int handle_get_capabilities(sd_bus_message *msg, void *data,
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
-static void handle_notification_timer(void *data) {
|
|
||||||
- struct mako_notification *notif = data;
|
|
||||||
- struct mako_surface *surface = notif->surface;
|
|
||||||
- notif->timer = NULL;
|
|
||||||
-
|
|
||||||
- close_notification(notif, MAKO_NOTIFICATION_CLOSE_EXPIRED, true);
|
|
||||||
- set_dirty(surface);
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
static int handle_notify(sd_bus_message *msg, void *data,
|
|
||||||
sd_bus_error *ret_error) {
|
|
||||||
struct mako_state *state = data;
|
|
||||||
@@ -382,7 +373,7 @@ static int handle_notify(sd_bus_message *msg, void *data,
|
|
||||||
insert_notification(state, notif);
|
|
||||||
}
|
|
||||||
|
|
||||||
- int match_count = apply_each_criteria(&state->config.criteria, notif);
|
|
||||||
+ int match_count = apply_each_criteria(state, notif);
|
|
||||||
if (match_count == -1) {
|
|
||||||
// We encountered an allocation failure or similar while applying
|
|
||||||
// criteria. The notification may be partially matched, but the worst
|
|
||||||
@@ -398,16 +389,6 @@ static int handle_notify(sd_bus_message *msg, void *data,
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
- int32_t expire_timeout = notif->requested_timeout;
|
|
||||||
- if (expire_timeout < 0 || notif->style.ignore_timeout) {
|
|
||||||
- expire_timeout = notif->style.default_timeout;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- if (expire_timeout > 0) {
|
|
||||||
- notif->timer = add_event_loop_timer(&state->event_loop, expire_timeout,
|
|
||||||
- handle_notification_timer, notif);
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
if (notif->style.icons) {
|
|
||||||
notif->icon = create_icon(notif);
|
|
||||||
}
|
|
||||||
diff --git a/event-loop.c b/event-loop.c
|
|
||||||
index 99c1f4a..92c627a 100644
|
|
||||||
--- a/event-loop.c
|
|
||||||
+++ b/event-loop.c
|
|
||||||
@@ -74,21 +74,6 @@ void finish_event_loop(struct mako_event_loop *loop) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
-static void timespec_add(struct timespec *t, int delta_ms) {
|
|
||||||
- static const long ms = 1000000, s = 1000000000;
|
|
||||||
-
|
|
||||||
- int delta_ms_low = delta_ms % 1000;
|
|
||||||
- int delta_s_high = delta_ms / 1000;
|
|
||||||
-
|
|
||||||
- t->tv_sec += delta_s_high;
|
|
||||||
-
|
|
||||||
- t->tv_nsec += (long)delta_ms_low * ms;
|
|
||||||
- if (t->tv_nsec >= s) {
|
|
||||||
- t->tv_nsec -= s;
|
|
||||||
- ++t->tv_sec;
|
|
||||||
- }
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
static bool timespec_less(struct timespec *t1, struct timespec *t2) {
|
|
||||||
if (t1->tv_sec != t2->tv_sec) {
|
|
||||||
return t1->tv_sec < t2->tv_sec;
|
|
||||||
@@ -124,7 +109,7 @@ static void update_event_loop_timer(struct mako_event_loop *loop) {
|
|
||||||
}
|
|
||||||
|
|
||||||
struct mako_timer *add_event_loop_timer(struct mako_event_loop *loop,
|
|
||||||
- int delay_ms, mako_event_loop_timer_func_t func, void *data) {
|
|
||||||
+ struct timespec *at, mako_event_loop_timer_func_t func, void *data) {
|
|
||||||
struct mako_timer *timer = calloc(1, sizeof(struct mako_timer));
|
|
||||||
if (timer == NULL) {
|
|
||||||
fprintf(stderr, "allocation failed\n");
|
|
||||||
@@ -133,10 +118,9 @@ struct mako_timer *add_event_loop_timer(struct mako_event_loop *loop,
|
|
||||||
timer->event_loop = loop;
|
|
||||||
timer->func = func;
|
|
||||||
timer->user_data = data;
|
|
||||||
- wl_list_insert(&loop->timers, &timer->link);
|
|
||||||
+ timer->at = *at;
|
|
||||||
|
|
||||||
- clock_gettime(CLOCK_MONOTONIC, &timer->at);
|
|
||||||
- timespec_add(&timer->at, delay_ms);
|
|
||||||
+ wl_list_insert(&loop->timers, &timer->link);
|
|
||||||
|
|
||||||
update_event_loop_timer(loop);
|
|
||||||
return timer;
|
|
||||||
diff --git a/include/criteria.h b/include/criteria.h
|
|
||||||
index 2f03514..58c36ef 100644
|
|
||||||
--- a/include/criteria.h
|
|
||||||
+++ b/include/criteria.h
|
|
||||||
@@ -7,6 +7,7 @@
|
|
||||||
#include <wayland-client.h>
|
|
||||||
#include "config.h"
|
|
||||||
#include "types.h"
|
|
||||||
+#include "mako.h"
|
|
||||||
|
|
||||||
struct mako_config;
|
|
||||||
struct mako_notification;
|
|
||||||
@@ -53,8 +54,7 @@ bool parse_criteria(const char *string, struct mako_criteria *criteria);
|
|
||||||
bool apply_criteria_field(struct mako_criteria *criteria, char *token);
|
|
||||||
|
|
||||||
struct mako_criteria *global_criteria(struct mako_config *config);
|
|
||||||
-ssize_t apply_each_criteria(struct wl_list *criteria_list,
|
|
||||||
- struct mako_notification *notif);
|
|
||||||
+ssize_t apply_each_criteria(struct mako_state *state, struct mako_notification *notif);
|
|
||||||
struct mako_criteria *create_criteria_from_notification(
|
|
||||||
struct mako_notification *notif, struct mako_criteria_spec *spec);
|
|
||||||
|
|
||||||
diff --git a/include/event-loop.h b/include/event-loop.h
|
|
||||||
index 95c8d36..cd63e98 100644
|
|
||||||
--- a/include/event-loop.h
|
|
||||||
+++ b/include/event-loop.h
|
|
||||||
@@ -47,7 +47,7 @@ bool init_event_loop(struct mako_event_loop *loop, sd_bus *bus,
|
|
||||||
void finish_event_loop(struct mako_event_loop *loop);
|
|
||||||
int run_event_loop(struct mako_event_loop *loop);
|
|
||||||
struct mako_timer *add_event_loop_timer(struct mako_event_loop *loop,
|
|
||||||
- int delay_ms, mako_event_loop_timer_func_t func, void *data);
|
|
||||||
+ struct timespec *at, mako_event_loop_timer_func_t func, void *data);
|
|
||||||
|
|
||||||
void destroy_timer(struct mako_timer *timer);
|
|
||||||
|
|
||||||
diff --git a/include/notification.h b/include/notification.h
|
|
||||||
index b1482ec..2775d88 100644
|
|
||||||
--- a/include/notification.h
|
|
||||||
+++ b/include/notification.h
|
|
||||||
@@ -56,6 +56,7 @@ struct mako_notification {
|
|
||||||
|
|
||||||
struct mako_hotspot hotspot;
|
|
||||||
struct mako_timer *timer;
|
|
||||||
+ struct timespec at;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct mako_action {
|
|
||||||
diff --git a/notification.c b/notification.c
|
|
||||||
index 32e7f7b..b78bd09 100644
|
|
||||||
--- a/notification.c
|
|
||||||
+++ b/notification.c
|
|
||||||
@@ -68,6 +68,8 @@ void reset_notification(struct mako_notification *notif) {
|
|
||||||
|
|
||||||
destroy_icon(notif->icon);
|
|
||||||
notif->icon = NULL;
|
|
||||||
+
|
|
||||||
+ clock_gettime(CLOCK_MONOTONIC, ¬if->at);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct mako_notification *create_notification(struct mako_state *state) {
|
|
||||||
diff --git a/render.c b/render.c
|
|
||||||
index 5b68632..44b78a0 100644
|
|
||||||
--- a/render.c
|
|
||||||
+++ b/render.c
|
|
||||||
@@ -355,7 +355,7 @@ void render(struct mako_surface *surface, struct pool_buffer *buffer, int scale,
|
|
||||||
// Immediately before rendering we need to re-match all of the criteria
|
|
||||||
// so that matches against the anchor and output work even if the
|
|
||||||
// output was automatically assigned by the compositor.
|
|
||||||
- int rematch_count = apply_each_criteria(&state->config.criteria, notif);
|
|
||||||
+ int rematch_count = apply_each_criteria(state, notif);
|
|
||||||
if (rematch_count == -1) {
|
|
||||||
// We encountered an allocation failure or similar while applying
|
|
||||||
// criteria. The notification may be partially matched, but the
|
|
||||||
@@ -427,7 +427,7 @@ void render(struct mako_surface *surface, struct pool_buffer *buffer, int scale,
|
|
||||||
struct mako_notification *hidden_notif = create_notification(state);
|
|
||||||
hidden_notif->surface = surface;
|
|
||||||
hidden_notif->hidden = true;
|
|
||||||
- apply_each_criteria(&state->config.criteria, hidden_notif);
|
|
||||||
+ apply_each_criteria(state, hidden_notif);
|
|
||||||
|
|
||||||
struct mako_style *style = &hidden_notif->style;
|
|
||||||
|
|
||||||
--
|
|
||||||
2.45.2
|
|
||||||
|
|
|
@ -1,192 +0,0 @@
|
||||||
From e2cb0d80c643b03a61f69f85454c9ed06eda5c3e Mon Sep 17 00:00:00 2001
|
|
||||||
From: chayleaf <chayleaf-git@pavluk.org>
|
|
||||||
Date: Sat, 24 Aug 2024 09:19:34 +0700
|
|
||||||
Subject: [PATCH 4/5] implement notification time freezing
|
|
||||||
|
|
||||||
---
|
|
||||||
config.c | 8 +++++++
|
|
||||||
criteria.c | 49 +++++++++++++++++++++++++++++++++++-------
|
|
||||||
doc/mako.5.scd | 6 ++++++
|
|
||||||
include/config.h | 4 +++-
|
|
||||||
include/notification.h | 2 ++
|
|
||||||
notification.c | 1 +
|
|
||||||
6 files changed, 61 insertions(+), 9 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/config.c b/config.c
|
|
||||||
index 87db932..79dc58a 100644
|
|
||||||
--- a/config.c
|
|
||||||
+++ b/config.c
|
|
||||||
@@ -105,6 +105,7 @@ void init_default_style(struct mako_style *style) {
|
|
||||||
style->actions = true;
|
|
||||||
style->default_timeout = 0;
|
|
||||||
style->ignore_timeout = false;
|
|
||||||
+ style->freeze = false;
|
|
||||||
|
|
||||||
style->colors.background = 0x285577FF;
|
|
||||||
style->colors.text = 0xFFFFFFFF;
|
|
||||||
@@ -305,6 +306,11 @@ bool apply_style(struct mako_style *target, const struct mako_style *style) {
|
|
||||||
target->spec.ignore_timeout = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ if (style->spec.freeze) {
|
|
||||||
+ target->freeze = style->freeze;
|
|
||||||
+ target->spec.freeze = true;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (style->spec.colors.background) {
|
|
||||||
target->colors.background = style->colors.background;
|
|
||||||
target->spec.colors.background = true;
|
|
||||||
@@ -637,6 +643,8 @@ static bool apply_style_option(struct mako_style *style, const char *name,
|
|
||||||
} else if (strcmp(name, "ignore-timeout") == 0) {
|
|
||||||
return spec->ignore_timeout =
|
|
||||||
parse_boolean(value, &style->ignore_timeout);
|
|
||||||
+ } else if (strcmp(name, "freeze") == 0) {
|
|
||||||
+ return spec->freeze = parse_boolean(value, &style->freeze);
|
|
||||||
} else if (strcmp(name, "group-by") == 0) {
|
|
||||||
return spec->group_criteria_spec =
|
|
||||||
parse_criteria_spec(value, &style->group_criteria_spec);
|
|
||||||
diff --git a/criteria.c b/criteria.c
|
|
||||||
index 3108a38..523a467 100644
|
|
||||||
--- a/criteria.c
|
|
||||||
+++ b/criteria.c
|
|
||||||
@@ -418,21 +418,39 @@ struct mako_criteria *global_criteria(struct mako_config *config) {
|
|
||||||
return criteria;
|
|
||||||
}
|
|
||||||
|
|
||||||
-static void timespec_add(struct timespec *t, int delta_ms) {
|
|
||||||
- static const long ms = 1000000, s = 1000000000;
|
|
||||||
+static void timespec_from_ms(struct timespec *t, long time_ms) {
|
|
||||||
+ static const long ms = 1000000;
|
|
||||||
|
|
||||||
- int delta_ms_low = delta_ms % 1000;
|
|
||||||
- int delta_s_high = delta_ms / 1000;
|
|
||||||
+ t->tv_sec = time_ms / 1000;
|
|
||||||
+ t->tv_nsec = (time_ms % 1000) * ms;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void timespec_add(struct timespec *t, struct timespec *u) {
|
|
||||||
+ static const long s = 1000000000;
|
|
||||||
|
|
||||||
- t->tv_sec += delta_s_high;
|
|
||||||
+ t->tv_sec += u->tv_sec;
|
|
||||||
+ t->tv_nsec += u->tv_nsec;
|
|
||||||
|
|
||||||
- t->tv_nsec += (long)delta_ms_low * ms;
|
|
||||||
if (t->tv_nsec >= s) {
|
|
||||||
t->tv_nsec -= s;
|
|
||||||
++t->tv_sec;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+static void timespec_sub(struct timespec *t, struct timespec *u) {
|
|
||||||
+ static const long s = 1000000000;
|
|
||||||
+
|
|
||||||
+ t->tv_sec -= u->tv_sec;
|
|
||||||
+ t->tv_nsec += s;
|
|
||||||
+ t->tv_nsec -= u->tv_nsec;
|
|
||||||
+
|
|
||||||
+ if (t->tv_nsec >= s) {
|
|
||||||
+ t->tv_nsec -= s;
|
|
||||||
+ } else {
|
|
||||||
+ --t->tv_sec;
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
static void handle_notification_timer(void *data) {
|
|
||||||
struct mako_notification *notif = data;
|
|
||||||
struct mako_surface *surface = notif->surface;
|
|
||||||
@@ -474,10 +492,25 @@ ssize_t apply_each_criteria(struct mako_state *state, struct mako_notification *
|
|
||||||
if (expire_timeout < 0 || notif->style.ignore_timeout) {
|
|
||||||
expire_timeout = notif->style.default_timeout;
|
|
||||||
}
|
|
||||||
+ if (notif->frozen != notif->style.freeze) {
|
|
||||||
+ struct timespec now;
|
|
||||||
+ clock_gettime(CLOCK_MONOTONIC, &now);
|
|
||||||
+ if (notif->style.freeze) {
|
|
||||||
+ notif->froze_at = now;
|
|
||||||
+ } else {
|
|
||||||
+ timespec_sub(&now, ¬if->froze_at);
|
|
||||||
+ timespec_add(¬if->at, &now);
|
|
||||||
+ }
|
|
||||||
+ notif->frozen = notif->style.freeze;
|
|
||||||
+ }
|
|
||||||
+ if (notif->frozen) {
|
|
||||||
+ expire_timeout = 0;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
if (expire_timeout > 0) {
|
|
||||||
- struct timespec at = notif->at;
|
|
||||||
- timespec_add(&at, expire_timeout);
|
|
||||||
+ struct timespec at = notif->at, delta;
|
|
||||||
+ timespec_from_ms(&delta, expire_timeout);
|
|
||||||
+ timespec_add(&at, &delta);
|
|
||||||
if (notif->timer) {
|
|
||||||
notif->timer->at = at;
|
|
||||||
} else {
|
|
||||||
diff --git a/doc/mako.5.scd b/doc/mako.5.scd
|
|
||||||
index fff19ed..c0be528 100644
|
|
||||||
--- a/doc/mako.5.scd
|
|
||||||
+++ b/doc/mako.5.scd
|
|
||||||
@@ -421,6 +421,12 @@ associated command-line option.
|
|
||||||
|
|
||||||
Default: 0
|
|
||||||
|
|
||||||
+*freeze*=0|1
|
|
||||||
+ Whether to freeze this notification's active timeout, stopping it from
|
|
||||||
+ progressing. This can be used for pausing notifications while you're away.
|
|
||||||
+
|
|
||||||
+ Default: 0
|
|
||||||
+
|
|
||||||
# COLORS
|
|
||||||
|
|
||||||
Colors can be specified as _#RRGGBB_ or _#RRGGBBAA_.
|
|
||||||
diff --git a/include/config.h b/include/config.h
|
|
||||||
index 5ff541c..53116e1 100644
|
|
||||||
--- a/include/config.h
|
|
||||||
+++ b/include/config.h
|
|
||||||
@@ -42,7 +42,8 @@ struct mako_style_spec {
|
|
||||||
bool width, height, outer_margin, margin, padding, border_size, border_radius, font,
|
|
||||||
markup, format, text_alignment, actions, default_timeout, ignore_timeout,
|
|
||||||
icons, max_icon_size, icon_path, group_criteria_spec, invisible, history,
|
|
||||||
- icon_location, max_visible, layer, output, anchor, long_press_duration;
|
|
||||||
+ icon_location, max_visible, layer, output, anchor, long_press_duration,
|
|
||||||
+ freeze;
|
|
||||||
struct {
|
|
||||||
bool background, text, border, progress;
|
|
||||||
} colors;
|
|
||||||
@@ -76,6 +77,7 @@ struct mako_style {
|
|
||||||
bool actions;
|
|
||||||
int default_timeout; // in ms
|
|
||||||
bool ignore_timeout;
|
|
||||||
+ bool freeze;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
uint32_t background;
|
|
||||||
diff --git a/include/notification.h b/include/notification.h
|
|
||||||
index 2775d88..a631b49 100644
|
|
||||||
--- a/include/notification.h
|
|
||||||
+++ b/include/notification.h
|
|
||||||
@@ -57,6 +57,8 @@ struct mako_notification {
|
|
||||||
struct mako_hotspot hotspot;
|
|
||||||
struct mako_timer *timer;
|
|
||||||
struct timespec at;
|
|
||||||
+ struct timespec froze_at;
|
|
||||||
+ bool frozen;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct mako_action {
|
|
||||||
diff --git a/notification.c b/notification.c
|
|
||||||
index b78bd09..ce0bafd 100644
|
|
||||||
--- a/notification.c
|
|
||||||
+++ b/notification.c
|
|
||||||
@@ -70,6 +70,7 @@ void reset_notification(struct mako_notification *notif) {
|
|
||||||
notif->icon = NULL;
|
|
||||||
|
|
||||||
clock_gettime(CLOCK_MONOTONIC, ¬if->at);
|
|
||||||
+ notif->frozen = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct mako_notification *create_notification(struct mako_state *state) {
|
|
||||||
--
|
|
||||||
2.45.2
|
|
||||||
|
|
|
@ -1,64 +0,0 @@
|
||||||
From cf4c99d9fa92e397b3860a71d293957741abc7c2 Mon Sep 17 00:00:00 2001
|
|
||||||
From: chayleaf <chayleaf-git@pavluk.org>
|
|
||||||
Date: Sat, 24 Aug 2024 14:22:23 +0700
|
|
||||||
Subject: [PATCH 5/5] cherry-pick fixup
|
|
||||||
|
|
||||||
---
|
|
||||||
criteria.c | 4 ++--
|
|
||||||
include/criteria.h | 3 +++
|
|
||||||
notification.c | 6 +++++-
|
|
||||||
3 files changed, 10 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/criteria.c b/criteria.c
|
|
||||||
index 523a467..2514da9 100644
|
|
||||||
--- a/criteria.c
|
|
||||||
+++ b/criteria.c
|
|
||||||
@@ -418,14 +418,14 @@ struct mako_criteria *global_criteria(struct mako_config *config) {
|
|
||||||
return criteria;
|
|
||||||
}
|
|
||||||
|
|
||||||
-static void timespec_from_ms(struct timespec *t, long time_ms) {
|
|
||||||
+void timespec_from_ms(struct timespec *t, long time_ms) {
|
|
||||||
static const long ms = 1000000;
|
|
||||||
|
|
||||||
t->tv_sec = time_ms / 1000;
|
|
||||||
t->tv_nsec = (time_ms % 1000) * ms;
|
|
||||||
}
|
|
||||||
|
|
||||||
-static void timespec_add(struct timespec *t, struct timespec *u) {
|
|
||||||
+void timespec_add(struct timespec *t, struct timespec *u) {
|
|
||||||
static const long s = 1000000000;
|
|
||||||
|
|
||||||
t->tv_sec += u->tv_sec;
|
|
||||||
diff --git a/include/criteria.h b/include/criteria.h
|
|
||||||
index 58c36ef..48f256d 100644
|
|
||||||
--- a/include/criteria.h
|
|
||||||
+++ b/include/criteria.h
|
|
||||||
@@ -60,4 +60,7 @@ struct mako_criteria *create_criteria_from_notification(
|
|
||||||
|
|
||||||
bool validate_criteria(struct mako_criteria *criteria);
|
|
||||||
|
|
||||||
+void timespec_add(struct timespec *t, struct timespec *u);
|
|
||||||
+void timespec_from_ms(struct timespec *t, long time_ms);
|
|
||||||
+
|
|
||||||
#endif
|
|
||||||
diff --git a/notification.c b/notification.c
|
|
||||||
index ce0bafd..730176f 100644
|
|
||||||
--- a/notification.c
|
|
||||||
+++ b/notification.c
|
|
||||||
@@ -475,7 +475,11 @@ void notification_handle_touch_start(struct mako_notification *notif,
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
notif->long_press_ctx = *ctx;
|
|
||||||
- notif->long_press_timer = add_event_loop_timer(¬if->state->event_loop, 500,
|
|
||||||
+ struct timespec at, delta;
|
|
||||||
+ clock_gettime(CLOCK_MONOTONIC, &at);
|
|
||||||
+ timespec_from_ms(&delta, 500);
|
|
||||||
+ timespec_add(&at, &delta);
|
|
||||||
+ notif->long_press_timer = add_event_loop_timer(¬if->state->event_loop, &at,
|
|
||||||
handle_notification_touch_timer, notif);
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.45.2
|
|
||||||
|
|
|
@ -1,181 +0,0 @@
|
||||||
From 637fe90e0c69d77d2ad24576d924b041525fd941 Mon Sep 17 00:00:00 2001
|
|
||||||
From: chayleaf <chayleaf-git@pavluk.org>
|
|
||||||
Date: Sat, 24 Aug 2024 12:10:16 +0700
|
|
||||||
Subject: [PATCH 1/3] wip touch support
|
|
||||||
|
|
||||||
---
|
|
||||||
include/wayland-internal.h | 7 +++
|
|
||||||
source/wayland/display.c | 115 +++++++++++++++++++++++++++++++++++++
|
|
||||||
2 files changed, 122 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/include/wayland-internal.h b/include/wayland-internal.h
|
|
||||||
index e6d248ce..77aaaf9d 100644
|
|
||||||
--- a/include/wayland-internal.h
|
|
||||||
+++ b/include/wayland-internal.h
|
|
||||||
@@ -84,6 +84,8 @@ typedef struct {
|
|
||||||
uint32_t layer_height;
|
|
||||||
} wayland_stuff;
|
|
||||||
|
|
||||||
+#define MAX_TOUCHPOINTS 10
|
|
||||||
+
|
|
||||||
struct _wayland_seat {
|
|
||||||
wayland_stuff *context;
|
|
||||||
uint32_t global_name;
|
|
||||||
@@ -99,6 +101,11 @@ struct _wayland_seat {
|
|
||||||
uint32_t pointer_serial;
|
|
||||||
struct wl_keyboard *keyboard;
|
|
||||||
struct wl_pointer *pointer;
|
|
||||||
+ struct wl_touch *touch;
|
|
||||||
+ struct {
|
|
||||||
+ int32_t x, start_y, move_y;
|
|
||||||
+ uint32_t start_time, move_time;
|
|
||||||
+ } touches[MAX_TOUCHPOINTS];
|
|
||||||
|
|
||||||
#ifdef HAVE_WAYLAND_CURSOR_SHAPE
|
|
||||||
struct wp_cursor_shape_device_v1 *cursor_shape_device;
|
|
||||||
diff --git a/source/wayland/display.c b/source/wayland/display.c
|
|
||||||
index 6cdc7d2f..381c402d 100644
|
|
||||||
--- a/source/wayland/display.c
|
|
||||||
+++ b/source/wayland/display.c
|
|
||||||
@@ -526,6 +526,101 @@ static const struct wl_keyboard_listener wayland_keyboard_listener = {
|
|
||||||
.repeat_info = wayland_keyboard_repeat_info,
|
|
||||||
};
|
|
||||||
|
|
||||||
+static void wayland_touch_down(void *data, struct wl_touch *wl_touch,
|
|
||||||
+ uint32_t serial, uint32_t time, struct wl_surface *wl_surface,
|
|
||||||
+ int32_t id, wl_fixed_t surface_x, wl_fixed_t surface_y) {
|
|
||||||
+ wayland_seat *self = data;
|
|
||||||
+ if (id >= MAX_TOUCHPOINTS) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ self->touches[id].x = wl_fixed_to_int(surface_x);
|
|
||||||
+ self->touches[id].start_y = self->touches[id].move_y = wl_fixed_to_int(surface_y);
|
|
||||||
+ self->touches[id].start_time = self->touches[id].move_time = time;
|
|
||||||
+ RofiViewState *state = rofi_view_get_active();
|
|
||||||
+
|
|
||||||
+ if (state == NULL) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ rofi_view_handle_mouse_motion(state, self->touches[id].x, self->touches[id].start_y,
|
|
||||||
+ FALSE);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void wayland_touch_up(void *data, struct wl_touch *wl_touch,
|
|
||||||
+ uint32_t serial, uint32_t time, int32_t id) {
|
|
||||||
+ wayland_seat *self = data;
|
|
||||||
+ if (id >= MAX_TOUCHPOINTS) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ gboolean is_move =
|
|
||||||
+ time - self->touches[id].start_time > 500
|
|
||||||
+ || self->touches[id].start_time != self->touches[id].move_time;
|
|
||||||
+ if (is_move) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ RofiViewState *state = rofi_view_get_active();
|
|
||||||
+
|
|
||||||
+ if (state == NULL) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ //rofi_view_handle_mouse_motion(state, self->touches[id].x, self->touches[id].start_y,
|
|
||||||
+ // FALSE);
|
|
||||||
+ nk_bindings_seat_handle_key(wayland->bindings_seat, NULL,
|
|
||||||
+ KEY_ENTER + 8,
|
|
||||||
+ NK_BINDINGS_KEY_STATE_PRESS);
|
|
||||||
+ rofi_view_maybe_update(state);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int32_t y_offset_to_line_offset(int32_t y_offset) {
|
|
||||||
+ static const int32_t line_height = 20;
|
|
||||||
+ return -(y_offset / line_height);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void wayland_touch_motion(void *data, struct wl_touch *wl_touch,
|
|
||||||
+ uint32_t time, int32_t id, wl_fixed_t surface_x, wl_fixed_t surface_y) {
|
|
||||||
+ wayland_seat *self = data;
|
|
||||||
+ if (id >= MAX_TOUCHPOINTS) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ RofiViewState *state = rofi_view_get_active();
|
|
||||||
+
|
|
||||||
+ if (state == NULL) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ int32_t x = wl_fixed_to_int(surface_x);
|
|
||||||
+ int32_t y = wl_fixed_to_int(surface_y);
|
|
||||||
+
|
|
||||||
+ int last_pos = y_offset_to_line_offset(self->touches[id].move_y - self->touches[id].start_y);
|
|
||||||
+ int cur_pos = y_offset_to_line_offset(y - self->touches[id].start_y);
|
|
||||||
+
|
|
||||||
+ if (cur_pos != last_pos) {
|
|
||||||
+ rofi_view_handle_mouse_motion(state, x, y, FALSE);
|
|
||||||
+ nk_bindings_seat_handle_scroll(wayland->bindings_seat, NULL,
|
|
||||||
+ NK_BINDINGS_SCROLL_AXIS_VERTICAL,
|
|
||||||
+ cur_pos - last_pos);
|
|
||||||
+ self->touches[id].x = x;
|
|
||||||
+ self->touches[id].move_y = y;
|
|
||||||
+ self->touches[id].move_time = time;
|
|
||||||
+ rofi_view_maybe_update(state);
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void wayland_touch_frame(void *data, struct wl_touch *wl_touch) { }
|
|
||||||
+static void wayland_touch_cancel(void *data, struct wl_touch *wl_touch) { }
|
|
||||||
+static void wayland_touch_shape(void *data, struct wl_touch *wl_touch,
|
|
||||||
+ int32_t id, wl_fixed_t major, wl_fixed_t minor) { }
|
|
||||||
+static void wayland_touch_orientation(void *data, struct wl_touch *wl_touch,
|
|
||||||
+ int32_t id, wl_fixed_t orientation) { }
|
|
||||||
+
|
|
||||||
+static const struct wl_touch_listener wayland_touch_listener = {
|
|
||||||
+ .down = wayland_touch_down,
|
|
||||||
+ .up = wayland_touch_up,
|
|
||||||
+ .motion = wayland_touch_motion,
|
|
||||||
+ .frame = wayland_touch_frame,
|
|
||||||
+ .cancel = wayland_touch_cancel,
|
|
||||||
+ .shape = wayland_touch_shape,
|
|
||||||
+ .orientation = wayland_touch_orientation,
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
static gboolean wayland_cursor_reload_theme(guint scale);
|
|
||||||
|
|
||||||
static void wayland_cursor_set_image(int i) {
|
|
||||||
@@ -1081,9 +1176,20 @@ static void wayland_pointer_release(wayland_seat *self) {
|
|
||||||
self->pointer = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
+static void wayland_touch_release(wayland_seat *self) {
|
|
||||||
+ if (self->touch == NULL) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ wl_touch_release(self->touch);
|
|
||||||
+
|
|
||||||
+ self->touch = NULL;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
static void wayland_seat_release(wayland_seat *self) {
|
|
||||||
wayland_keyboard_release(self);
|
|
||||||
wayland_pointer_release(self);
|
|
||||||
+ wayland_touch_release(self);
|
|
||||||
|
|
||||||
wl_seat_release(self->seat);
|
|
||||||
|
|
||||||
@@ -1113,6 +1219,15 @@ static void wayland_seat_capabilities(void *data, struct wl_seat *seat,
|
|
||||||
wayland_pointer_release(self);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ if ((capabilities & WL_SEAT_CAPABILITY_TOUCH) &&
|
|
||||||
+ (self->touch == NULL)) {
|
|
||||||
+ self->touch = wl_seat_get_touch(self->seat);
|
|
||||||
+ wl_touch_add_listener(self->touch, &wayland_touch_listener, self);
|
|
||||||
+ } else if ((!(capabilities & WL_SEAT_CAPABILITY_TOUCH)) &&
|
|
||||||
+ (self->touch != NULL)) {
|
|
||||||
+ wayland_touch_release(self);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (wayland->data_device_manager != NULL) {
|
|
||||||
self->data_device = wl_data_device_manager_get_data_device(
|
|
||||||
wayland->data_device_manager, seat);
|
|
||||||
--
|
|
||||||
2.45.2
|
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
From 3d02857ec8ab68ae243e651874203e88e6788ae7 Mon Sep 17 00:00:00 2001
|
|
||||||
From: chayleaf <chayleaf-git@pavluk.org>
|
|
||||||
Date: Sat, 24 Aug 2024 13:22:34 +0700
|
|
||||||
Subject: [PATCH 2/3] still scroll after the tap moves outside the rofi window
|
|
||||||
|
|
||||||
---
|
|
||||||
source/wayland/display.c | 1 -
|
|
||||||
1 file changed, 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/source/wayland/display.c b/source/wayland/display.c
|
|
||||||
index 381c402d..5154589a 100644
|
|
||||||
--- a/source/wayland/display.c
|
|
||||||
+++ b/source/wayland/display.c
|
|
||||||
@@ -593,7 +593,6 @@ static void wayland_touch_motion(void *data, struct wl_touch *wl_touch,
|
|
||||||
int cur_pos = y_offset_to_line_offset(y - self->touches[id].start_y);
|
|
||||||
|
|
||||||
if (cur_pos != last_pos) {
|
|
||||||
- rofi_view_handle_mouse_motion(state, x, y, FALSE);
|
|
||||||
nk_bindings_seat_handle_scroll(wayland->bindings_seat, NULL,
|
|
||||||
NK_BINDINGS_SCROLL_AXIS_VERTICAL,
|
|
||||||
cur_pos - last_pos);
|
|
||||||
--
|
|
||||||
2.45.2
|
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
From 8b417bc6304c30bafb56113b868ecac2ffc0ed08 Mon Sep 17 00:00:00 2001
|
|
||||||
From: chayleaf <chayleaf-git@pavluk.org>
|
|
||||||
Date: Sat, 24 Aug 2024 13:29:32 +0700
|
|
||||||
Subject: [PATCH 3/3] exit on long tap
|
|
||||||
|
|
||||||
---
|
|
||||||
source/wayland/display.c | 14 +++++++-------
|
|
||||||
1 file changed, 7 insertions(+), 7 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/source/wayland/display.c b/source/wayland/display.c
|
|
||||||
index 5154589a..cfd883b3 100644
|
|
||||||
--- a/source/wayland/display.c
|
|
||||||
+++ b/source/wayland/display.c
|
|
||||||
@@ -551,10 +551,8 @@ static void wayland_touch_up(void *data, struct wl_touch *wl_touch,
|
|
||||||
if (id >= MAX_TOUCHPOINTS) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
- gboolean is_move =
|
|
||||||
- time - self->touches[id].start_time > 500
|
|
||||||
- || self->touches[id].start_time != self->touches[id].move_time;
|
|
||||||
- if (is_move) {
|
|
||||||
+ gboolean has_moved = self->touches[id].start_time != self->touches[id].move_time;
|
|
||||||
+ if (has_moved) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
RofiViewState *state = rofi_view_get_active();
|
|
||||||
@@ -562,10 +560,12 @@ static void wayland_touch_up(void *data, struct wl_touch *wl_touch,
|
|
||||||
if (state == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
- //rofi_view_handle_mouse_motion(state, self->touches[id].x, self->touches[id].start_y,
|
|
||||||
- // FALSE);
|
|
||||||
+ int key = KEY_ENTER;
|
|
||||||
+ if (time - self->touches[id].start_time > 200) {
|
|
||||||
+ key = KEY_ESC;
|
|
||||||
+ }
|
|
||||||
nk_bindings_seat_handle_key(wayland->bindings_seat, NULL,
|
|
||||||
- KEY_ENTER + 8,
|
|
||||||
+ key + 8,
|
|
||||||
NK_BINDINGS_KEY_STATE_PRESS);
|
|
||||||
rofi_view_maybe_update(state);
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.45.2
|
|
||||||
|
|
|
@ -55,9 +55,9 @@
|
||||||
hardware = {
|
hardware = {
|
||||||
opentabletdriver.enable = true;
|
opentabletdriver.enable = true;
|
||||||
steam-hardware.enable = true;
|
steam-hardware.enable = true;
|
||||||
graphics.enable32Bit = true;
|
opengl.driSupport32Bit = true;
|
||||||
# needed for sway WLR_RENDERER=vulkan
|
# needed for sway WLR_RENDERER=vulkan
|
||||||
graphics.extraPackages = with pkgs; [ vulkan-validation-layers ];
|
opengl.extraPackages = with pkgs; [ vulkan-validation-layers ];
|
||||||
};
|
};
|
||||||
|
|
||||||
# see modules/vfio.nix
|
# see modules/vfio.nix
|
||||||
|
@ -143,7 +143,7 @@
|
||||||
|
|
||||||
programs.ccache.enable = true;
|
programs.ccache.enable = true;
|
||||||
services.sshd.enable = true;
|
services.sshd.enable = true;
|
||||||
# boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
|
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
|
||||||
users.users.hydra-builder = {
|
users.users.hydra-builder = {
|
||||||
uid = 1001;
|
uid = 1001;
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
|
|
|
@ -281,13 +281,7 @@ in {
|
||||||
job_name = "local_medium_freq";
|
job_name = "local_medium_freq";
|
||||||
scrape_interval = "15m";
|
scrape_interval = "15m";
|
||||||
static_configs = [ {
|
static_configs = [ {
|
||||||
targets = [
|
targets = [ "127.0.0.1:9548" "127.0.0.1:9198" "127.0.0.1:9173" ];
|
||||||
"127.0.0.1:9548"
|
|
||||||
"127.0.0.1:9198"
|
|
||||||
(let cfg = config.services.matrix-appservice-discord.settings.metrics;
|
|
||||||
in "${lib.quoteListenAddr cfg.host}:${toString cfg.port}")
|
|
||||||
config.services.matrix-sliding-sync.settings.SYNCV3_PROM
|
|
||||||
];
|
|
||||||
labels.machine = "server";
|
labels.machine = "server";
|
||||||
} ];
|
} ];
|
||||||
}
|
}
|
||||||
|
@ -369,9 +363,6 @@ in {
|
||||||
host = "127.0.0.1";
|
host = "127.0.0.1";
|
||||||
port = 9173;
|
port = 9173;
|
||||||
};
|
};
|
||||||
services.matrix-sliding-sync = {
|
|
||||||
settings.SYNCV3_PROM = "[::]:8011";
|
|
||||||
};
|
|
||||||
services.matrix-synapse.settings = {
|
services.matrix-synapse.settings = {
|
||||||
enable_metrics = true;
|
enable_metrics = true;
|
||||||
federation_metrics_domains = [ "matrix.org" ];
|
federation_metrics_domains = [ "matrix.org" ];
|
||||||
|
|
|
@ -11,7 +11,6 @@ let
|
||||||
matrixClientJson = {
|
matrixClientJson = {
|
||||||
"m.homeserver".base_url = "https://matrix.${cfg.domainName}";
|
"m.homeserver".base_url = "https://matrix.${cfg.domainName}";
|
||||||
"m.identity_server".base_url = "https://vector.im";
|
"m.identity_server".base_url = "https://vector.im";
|
||||||
"org.matrix.msc3575.proxy".url = "https://matrix.${cfg.domainName}";
|
|
||||||
};
|
};
|
||||||
matrixServerConfigResponse = ''
|
matrixServerConfigResponse = ''
|
||||||
add_header Content-Type application/json;
|
add_header Content-Type application/json;
|
||||||
|
@ -42,8 +41,7 @@ in {
|
||||||
locations = {
|
locations = {
|
||||||
"= /.well-known/matrix/server".extraConfig = matrixServerConfigResponse;
|
"= /.well-known/matrix/server".extraConfig = matrixServerConfigResponse;
|
||||||
"= /.well-known/matrix/client".extraConfig = matrixClientConfigResponse;
|
"= /.well-known/matrix/client".extraConfig = matrixClientConfigResponse;
|
||||||
"~ ^/(_matrix|_synapse/client|$)".proxyPass = "http://${lib.quoteListenAddr matrixAddr}:${toString matrixPort}";
|
"/".proxyPass = "http://${lib.quoteListenAddr matrixAddr}:${toString matrixPort}";
|
||||||
"~ ^/(client/|_matrix/client/unstable/org.matrix.msc3575/)".proxyPass = "http://${config.services.matrix-sliding-sync.settings.SYNCV3_BINDADDR}";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -113,13 +111,4 @@ in {
|
||||||
}];
|
}];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
services.matrix-sliding-sync = {
|
|
||||||
enable = true;
|
|
||||||
environmentFile = "/secrets/sliding-sync/env";
|
|
||||||
settings = {
|
|
||||||
SYNCV3_BINDADDR = "[::]:8010";
|
|
||||||
SYNCV3_SERVER = "https://matrix.pavluk.org";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,7 @@ in {
|
||||||
'')
|
'')
|
||||||
cfg.lookingGlass.ivshmem));
|
cfg.lookingGlass.ivshmem));
|
||||||
hardware = {
|
hardware = {
|
||||||
graphics.enable = true;
|
opengl.enable = true;
|
||||||
} // lib.optionalAttrs (cfg.enable && !cfg.nvidiaGpu && options?hardware.amdgpu.loadInInitrd) {
|
} // lib.optionalAttrs (cfg.enable && !cfg.nvidiaGpu && options?hardware.amdgpu.loadInInitrd) {
|
||||||
# disable early KMS so GPU can be properly unbound
|
# disable early KMS so GPU can be properly unbound
|
||||||
# can't use mkif because the option may not even exist
|
# can't use mkif because the option may not even exist
|
||||||
|
|
Loading…
Reference in a new issue