diff options
| author | 2024-11-26 16:37:54 -0500 | |
|---|---|---|
| committer | 2024-11-26 16:40:13 -0500 | |
| commit | 2178e5f94d26b6bdefa44e56d47a9257a2e73e74 (patch) | |
| tree | f36dc1c5cee2cead9b6e94922d66f30ac8a410fe | |
| parent | f9eea19c5a13de915e9df49cc0260aa98b82b9f3 (diff) | |
| download | mauri-2178e5f94d26b6bdefa44e56d47a9257a2e73e74.tar.gz mauri-2178e5f94d26b6bdefa44e56d47a9257a2e73e74.tar.bz2 mauri-2178e5f94d26b6bdefa44e56d47a9257a2e73e74.zip | |
Quit on sway exit, pin deps, refactor flake
Signed-off-by: Andrew Opalach <andrew@akon.city>
| -rw-r--r-- | flake.lock | 17 | ||||
| -rw-r--r-- | flake.nix | 286 | ||||
| -rw-r--r-- | meson_options.txt | 2 | ||||
| -rw-r--r-- | src/context.h | 2 | ||||
| -rw-r--r-- | src/objects/pass.cc | 8 | ||||
| -rw-r--r-- | subprojects/libakiyo.wrap | 2 | ||||
| -rw-r--r-- | subprojects/libalabaster.wrap | 2 | ||||
| -rw-r--r-- | subprojects/stela.wrap | 2 | ||||
| -rw-r--r-- | taro/daemon.c | 43 | ||||
| -rw-r--r-- | taro/tests/notcurses_ffmpeg.c | 4 | ||||
| -rw-r--r-- | taro/ui.c | 10 |
11 files changed, 202 insertions, 176 deletions
@@ -5,26 +5,25 @@ "systems": "systems" }, "locked": { - "lastModified": 1726560853, - "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" + "id": "flake-utils", + "type": "indirect" } }, "nixpkgs": { "locked": { - "lastModified": 1730785428, - "narHash": "sha256-Zwl8YgTVJTEum+L+0zVAWvXAGbWAuXHax3KzuejaDyo=", + "lastModified": 1732014248, + "narHash": "sha256-y/MEyuJ5oBWrWAic/14LaIr/u5E0wRVzyYsouYY3W6w=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "4aa36568d413aca0ea84a1684d2d46f55dbabad7", + "rev": "23e89b7da85c3640bbc2173fe04f4bd114342367", "type": "github" }, "original": { @@ -1,149 +1,161 @@ { inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - flake-utils.url = "github:numtide/flake-utils"; + nixpkgs = { + url = "github:NixOS/nixpkgs/nixos-unstable"; + }; }; - outputs = { self, nixpkgs, flake-utils }: - flake-utils.lib.eachSystem [ "x86_64-linux" "i686-linux" "aarch64-linux" ] - (system: - let - pkgs = import nixpkgs { inherit system; }; - in - with pkgs; - rec { - packages.default = stdenv.mkDerivation { - name = "mauri"; - version = "0.13"; - src = fetchgit { - url = "https://git.akon.city/mauri"; - rev = "f789c1103856a253871846da6e41fcdf7aacd78b"; - postFetch = '' - export NIX_SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt - cd "$out" - ${lib.getExe meson} subprojects download \ - libalabaster libakiyo stela janus stb s3tc-dxt-decompression notcurses + outputs = { self, nixpkgs, flake-utils }: let + forAllSupportedSystems = function: + nixpkgs.lib.genAttrs [ + "x86_64-linux" + "i686-linux" + "aarch64-linux" + ] (system: function nixpkgs.legacyPackages.${system}); + forAllDevSystems = function: + nixpkgs.lib.genAttrs [ + "x86_64-linux" + ] (system: function nixpkgs.legacyPackages.${system}); + in rec { + packages = forAllSupportedSystems (pkgs: { + default = with pkgs; stdenv.mkDerivation { + name = "mauri"; + version = "0.13"; + src = fetchgit { + url = "https://git.akon.city/mauri"; + rev = "f789c1103856a253871846da6e41fcdf7aacd78b"; + postFetch = '' + export NIX_SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt - cd "$out/subprojects/libalabaster" - ${lib.getExe meson} subprojects download c89atomic + cd "$out" + ${lib.getExe meson} subprojects download \ + libalabaster libakiyo stela janus stb s3tc-dxt-decompression notcurses - cd "$out/subprojects/libakiyo" - ${lib.getExe meson} subprojects download libev + cd "$out/subprojects/libalabaster" + ${lib.getExe meson} subprojects download c89atomic - cd "$out" + cd "$out/subprojects/libakiyo" + ${lib.getExe meson} subprojects download libev - find subprojects -type d -name .git -prune -execdir rm -r {} + - ''; - sha256 = "cBSiL6+k4vVmj4SBxmgc4viT6PWeEzm1UNPD4KuEMfY="; - }; - nativeBuildInputs = [ - git - gcc - pkg-config - ninja - meson - cmake - makeWrapper - ]; - buildInputs = [ - lz4 - glm - nlohmann_json - fftw - glfw3 - wayland - wayland-protocols - wayland-scanner - wlr-protocols - egl-wayland - xorg.libXext - xorg.libXrandr - jansson - # notcurses build - libdeflate - libunistring - ncurses - ffmpeg-headless - ]; - fixupPhase = '' - wrapProgram $out/bin/taro --prefix LD_LIBRARY_PATH : "$out/lib64" - ''; - meta = with lib; { - homepage = "https://akon.city/"; - description = ""; - changelog = ""; - license = [ licenses.gpl3Only ]; - maintainers = with lib.maintainers; []; - }; - }; + cd "$out" - devShells.default = mkShell { - NIX_HARDENING_ENABLE = ""; - nativeBuildInputs = packages.default.nativeBuildInputs ++ [ - gdb - clang-tools - perf-tools - valgrind - asciidoctor - ]; - buildInputs = packages.default.buildInputs ++ [ - # sway build - json_c - pcre2 - libxkbcommon - cairo - pango - libevdev - libinput - libdrm - gdk-pixbuf - xwayland - xorg.xcbutilwm - # wlroots build - mesa - vulkan-headers - vulkan-loader - glslang - seatd - libdisplay-info - libliftoff - hwdata - ]; - shellHook = '' - export NIX_SHELL="mauri" - unset SOURCE_DATE_EPOCH - exec ${pkgs.zsh}/bin/zsh -l - ''; - }; + find subprojects -type d -name .git -prune -execdir rm -r {} + + ''; + sha256 = "cBSiL6+k4vVmj4SBxmgc4viT6PWeEzm1UNPD4KuEMfY="; + }; + nativeBuildInputs = [ + git + gcc + pkg-config + ninja + meson + cmake + makeWrapper + ]; + buildInputs = [ + lz4 + glm + nlohmann_json + fftw + glfw3 + wayland + wayland-protocols + wayland-scanner + wlr-protocols + egl-wayland + xorg.libXext + xorg.libXrandr + jansson + # notcurses build + libdeflate + libunistring + ncurses + ffmpeg-headless + ]; + fixupPhase = '' + wrapProgram $out/bin/taro --prefix LD_LIBRARY_PATH : "$out/lib64" + ''; + meta = with lib; { + homepage = "https://akon.city/"; + description = ""; + changelog = ""; + license = [ licenses.gpl3Only ]; + maintainers = []; + }; + }; + }); - devShells.mingw64 = let - gcc = pkgsCross.ucrt64.buildPackages.wrapCC (pkgsCross.ucrt64.buildPackages.gcc-unwrapped.override ({ - threadsCross = { - model = "win32"; - package = null; - }; - })); - gccWin32Stdenv = overrideCC pkgsCross.ucrt64.stdenv gcc; - in mkShell.override { stdenv = gccWin32Stdenv; } { - NIX_HARDENING_ENABLE = ""; - nativeBuildInputs = [ - git - buildPackages.gcc - gdb - pkg-config - ninja - meson - cmake - wineWowPackages.staging - ]; - buildInputs = with pkgsCross.ucrt64; [ - (zlib.override { shared = false; static = true; }) - ]; - shellHook = '' - export NIX_SHELL="mauri-mingw64" - unset SOURCE_DATE_EPOCH - exec ${pkgs.zsh}/bin/zsh -l - ''; + devShells = forAllDevSystems (pkgs: { + default = with pkgs; mkShell { + NIX_HARDENING_ENABLE = ""; + nativeBuildInputs = packages.${system}.default.nativeBuildInputs ++ [ + gdb + clang-tools + perf-tools + valgrind + asciidoctor + ]; + buildInputs = packages.${system}.default.buildInputs ++ [ + # sway build + json_c + pcre2 + libxkbcommon + cairo + pango + libevdev + libinput + libdrm + gdk-pixbuf + xwayland + xorg.xcbutilwm + # wlroots build + mesa + vulkan-headers + vulkan-loader + glslang + seatd + libdisplay-info + libliftoff + hwdata + ]; + shellHook = '' + export SHELL="${pkgs.bashInteractive}/bin/bash" + export NIX_BUILD_SHELL=$SHELL + export NIX_SHELL="mauri" + export PS1="(\$NIX_SHELL)"$PS1 + ''; + }; + + mingw64 = with pkgs; let + gcc = pkgsCross.ucrt64.buildPackages.wrapCC (pkgsCross.ucrt64.buildPackages.gcc-unwrapped.override ({ + threadsCross = { + model = "win32"; + package = null; }; - }); + })); + gccWin32Stdenv = overrideCC pkgsCross.ucrt64.stdenv gcc; + in mkShell.override { stdenv = gccWin32Stdenv; } { + NIX_HARDENING_ENABLE = ""; + nativeBuildInputs = [ + git + buildPackages.gcc + gdb + pkg-config + ninja + meson + cmake + wineWowPackages.staging + ]; + buildInputs = with pkgsCross.ucrt64; [ + (zlib.override { shared = false; static = true; }) + ]; + shellHook = '' + export SHELL="${pkgs.bashInteractive}/bin/bash" + export NIX_BUILD_SHELL=$SHELL + export NIX_SHELL="mauri-mingw64" + export PS1="(\$NIX_SHELL)"$PS1 + ''; + }; + }); + }; } diff --git a/meson_options.txt b/meson_options.txt index ea6cec6..f7e67ba 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,3 +1,3 @@ -option('window', type: 'combo', choices: ['wayland', 'x11'], value: 'wayland') +option('window', type: 'combo', choices: ['wayland', 'x11', 'glfw'], value: 'wayland') option('taro', type: 'feature', value: 'enabled') option('audio', type: 'feature', value: 'disabled') diff --git a/src/context.h b/src/context.h index 8866a7f..5dfcc8b 100644 --- a/src/context.h +++ b/src/context.h @@ -31,7 +31,7 @@ class Context auto create_window(s32 width, s32 height, const std::string &name, const std::string monitor) -> bool { - this->window = stl_window_create(); + this->window = stl_window_create(NULL); this->window->pointer_pos_callback = pointer_pos_callback; this->window->should_close_callback = should_close_callback; this->window->userdata = this; diff --git a/src/objects/pass.cc b/src/objects/pass.cc index afe7c8a..4d2fd0f 100644 --- a/src/objects/pass.cc +++ b/src/objects/pass.cc @@ -274,8 +274,8 @@ RenderPass::RenderPass(Engine *engine, Pass *pass) #ifdef _DEBUG_ debug("PASS (%s)", this->command == COPY ? "copy" : "draw"); debug(" object: %s (passthrough: %s, fullscreen %s)", this->object->name.c_str(), - AL_BOOLSTR(this->object->passthrough), AL_BOOLSTR(this->object->fullscreen)); - debug(" visible: %s", AL_BOOLSTR(this->object->visible)); + BOOLSTR(this->object->passthrough), BOOLSTR(this->object->fullscreen)); + debug(" visible: %s", BOOLSTR(this->object->visible)); debug(" shader: %s", this->shader->origin()->name.c_str()); debug(" target: %s", pass->target.c_str()); debug(" textures (%u):", this->shader->origin()->texture_count); @@ -304,8 +304,8 @@ RenderPass::RenderPass(Engine *engine, Pass *pass) debug(" %s %s %s", uniform_type_to_string(uniform->type).c_str(), uniform->uname.c_str(), glm::to_string(*uniform->value).c_str()); } - debug(" model: %s", AL_BOOLSTR(this->model)); - debug(" combine: %s", AL_BOOLSTR(this->combine)); + debug(" model: %s", BOOLSTR(this->model)); + debug(" combine: %s", BOOLSTR(this->combine)); #endif } diff --git a/subprojects/libakiyo.wrap b/subprojects/libakiyo.wrap index 2cd2caa..002abff 100644 --- a/subprojects/libakiyo.wrap +++ b/subprojects/libakiyo.wrap @@ -1,4 +1,4 @@ [wrap-git] url = https://git.akon.city/libakiyo -revision = master +revision = 62b75446102ca32b23a78188b0aca8fe31d8b2c0 depth = 1 diff --git a/subprojects/libalabaster.wrap b/subprojects/libalabaster.wrap index c0358cf..3c1d0b1 100644 --- a/subprojects/libalabaster.wrap +++ b/subprojects/libalabaster.wrap @@ -1,4 +1,4 @@ [wrap-git] url = https://git.akon.city/libalabaster -revision = master +revision = 27cbe448f08a783196e49aa58d9af57240a20d43 depth = 1 diff --git a/subprojects/stela.wrap b/subprojects/stela.wrap index 7807a8c..6a95860 100644 --- a/subprojects/stela.wrap +++ b/subprojects/stela.wrap @@ -1,4 +1,4 @@ [wrap-git] url = https://git.akon.city/stela -revision = master +revision = 5c0e9eb465c5c291b0d2658ad01f15e050042df1 depth = 1 diff --git a/taro/daemon.c b/taro/daemon.c index d325271..3eec7e1 100644 --- a/taro/daemon.c +++ b/taro/daemon.c @@ -121,15 +121,14 @@ static pid_t exec_or_exit(char *args[]) static void maybe_kill_wallpaper(struct monitor *monitor) { - if (monitor->pid == -1) return; - - if (monitor->paused) { - signal_monitor(monitor, SIGCONT); - monitor->paused = false; + if (monitor->pid != -1) { + if (monitor->paused) { + signal_monitor(monitor, SIGCONT); + monitor->paused = false; + } + signal_monitor(monitor, SIGTERM); + monitor->pid = -1; } - - signal_monitor(monitor, SIGTERM); - monitor->pid = -1; } static bool run_wallpaper(struct daemon *dmon, struct monitor *monitor) @@ -355,8 +354,13 @@ static void ipc_poll_callback(void *userdata, s32 revents) al_log_info("tarod", "connected to sway ipc socket"); dmon->ipc_connected = true; } - dmon->out.index += aki_socket_write(&dmon->ipc_socket, dmon->out.buf + dmon->out.index, - dmon->out.size - dmon->out.index); + ssize_t ret = aki_socket_write(&dmon->ipc_socket, + dmon->out.buf + dmon->out.index, dmon->out.size - dmon->out.index); + if (ret <= 0) { + aki_signal_send(&dmon->quit_signal); + return; + } + dmon->out.index += ret; if (dmon->out.index == dmon->out.size) { aki_poll_stop(&dmon->ipc_poll); aki_poll_set(&dmon->ipc_poll, aki_socket_get_fd(&dmon->ipc_socket), AKI_POLL_READ); @@ -366,16 +370,26 @@ static void ipc_poll_callback(void *userdata, s32 revents) if (revents & AKI_POLL_READ) { if (dmon->ipc.index < SWAY_IPC_HEADER_LENGTH) { - dmon->ipc.index += aki_socket_read(&dmon->ipc_socket, dmon->ipc.buf + dmon->ipc.index, - SWAY_IPC_HEADER_LENGTH - dmon->ipc.index); + ssize_t ret = aki_socket_read(&dmon->ipc_socket, + dmon->ipc.buf + dmon->ipc.index, SWAY_IPC_HEADER_LENGTH - dmon->ipc.index); + if (ret <= 0) { + aki_signal_send(&dmon->quit_signal); + return; + } + dmon->ipc.index += ret; } if (dmon->ipc.index == SWAY_IPC_HEADER_LENGTH && !dmon->ipc.size) { dmon->ipc.size = *((s32 *)&dmon->ipc.buf[6]) + SWAY_IPC_HEADER_LENGTH; ensure_ipc_buf_size(dmon, dmon->ipc.size); } if (dmon->ipc.size) { - dmon->ipc.index += aki_socket_read(&dmon->ipc_socket, dmon->ipc.buf + dmon->ipc.index, - dmon->ipc.size - dmon->ipc.index); + ssize_t ret = aki_socket_read(&dmon->ipc_socket, + dmon->ipc.buf + dmon->ipc.index, dmon->ipc.size - dmon->ipc.index); + if (ret <= 0) { + aki_signal_send(&dmon->quit_signal); + return; + } + dmon->ipc.index += ret; if (dmon->ipc.index == dmon->ipc.size) { ipc_handle_response(dmon, dmon->ipc.buf + SWAY_IPC_HEADER_LENGTH, dmon->ipc.size - SWAY_IPC_HEADER_LENGTH); @@ -399,6 +413,7 @@ static void quit_signal_callback(void *userdata) struct monitor *monitor; al_array_foreach(dmon->monitors, i, monitor) { aki_fs_event_stop(&monitor->selection_event); + maybe_kill_wallpaper(monitor); } aki_fs_event_stop(&dmon->conf_event); if (!dmon->ipc_errored) { diff --git a/taro/tests/notcurses_ffmpeg.c b/taro/tests/notcurses_ffmpeg.c index 1a9f44d..dd798c9 100644 --- a/taro/tests/notcurses_ffmpeg.c +++ b/taro/tests/notcurses_ffmpeg.c @@ -1,7 +1,7 @@ -#include <notcurses/notcurses.h> -#include <notcurses/nckeys.h> #include <al/types.h> #include <aki/common.h> +#include <notcurses/notcurses.h> +#include <notcurses/nckeys.h> s32 main(void) { @@ -1,11 +1,11 @@ -#include <notcurses/notcurses.h> -#include <notcurses/nckeys.h> #include <al/log.h> #include <al/lib.h> #include <al/random.h> #include <aki/common.h> #include <aki/event_loop.h> #include <aki/timer.h> +#include <notcurses/notcurses.h> +#include <notcurses/nckeys.h> #include "db.h" #include "file_ext.h" @@ -716,7 +716,7 @@ void draw_monitors(struct ui *u, struct monitors *m) } else if (i == (u32)m->set_monitor) { ncplane_set_bg_palindex(u->mp, 7); ncplane_set_fg_palindex(u->mp, 0); - m->flash -= AL_MAX(TIMER_UPDATE_BASE * (u->delay / 1000000.f), 0.001f); + m->flash -= MAX(TIMER_UPDATE_BASE * (u->delay / 1000000.f), 0.001f); } else { ncplane_set_fg_default(u->mp); ncplane_set_bg_default(u->mp); @@ -829,7 +829,7 @@ void draw_grid_tiles(struct ui *u, struct grid *g, bool update_text) set_tile_highlight(t, 8, 0); } else if (index == g->set_index && g->set_index >= 0) { set_tile_highlight(t, 7, 0); - g->flash -= AL_MAX(TIMER_UPDATE_BASE * (u->delay / 1000000.f), 0.001f); + g->flash -= MAX(TIMER_UPDATE_BASE * (u->delay / 1000000.f), 0.001f); } else { ncplane_set_fg_default(t->p); ncplane_set_bg_default(t->p); @@ -1154,7 +1154,7 @@ static void timer_callback(void *userdata, struct aki_timer *timer) draw_grid_tiles(u, &u->g, true); draw_info(u, &u->n, true); } else { - u->text_update -= AL_MAX(TIMER_UPDATE_BASE * (u->delay / 1000000.f), 0.001f); + u->text_update -= MAX(TIMER_UPDATE_BASE * (u->delay / 1000000.f), 0.001f); draw_grid_tiles(u, &u->g, false); draw_info(u, &u->n, false); } |