Skip to content

Instantly share code, notes, and snippets.

View aperezdc's full-sized avatar
🛋️
Couch-potatoing

Adrian Perez aperezdc

🛋️
Couch-potatoing
View GitHub Profile
@aperezdc
aperezdc / webkitgtk-themecolor-example.c
Created June 16, 2025 12:45
Example: changing header bar colors depending on WebKitWebView:theme-color
/*
* Compile with:
* gcc $(pkg-config webkitgtk-6.0 --cflags --libs) webkitgtk-themecolor-example.c
*
* SPDX-License-Identifier: MIT
*/
#include <gio/gio.h>
#include <webkit/webkit.h>
@aperezdc
aperezdc / local.conf
Created March 13, 2023 10:08
Patch to build meta-webkit with WPE WebKit 2.39.91 and Cog 0.17.1
# To be added in the local.conf file for a configured Yocto build
EXTRA_IMAGE_FEATURES += "debug-tweaks tools-profile"
INHIBIT_PACKAGE_STRIP = "1"
PREFERRED_VERSION_cog = "0.17.%"
PREFERRED_VERSION_wpewebkit = "2.39.%"
PACKAGECONFIG:pn-wpewebkit:append = " mediastream mediasource"
PACKAGECONFIG:pn-wpewebkit:remove = "experimental-features"
@aperezdc
aperezdc / apicall.js
Created March 6, 2023 11:38
Injected script to use Promise-based async calls with WebKit user script message handlers
// SPDX-License-Identifier: MIT
(function (_console, _window, _Map, _Promise) {
"use strict";
let currentTxnId = 0;
const txnMap = new _Map();
const warning = _console.warn;
function makeTxnId() {
@aperezdc
aperezdc / minicog.c
Last active June 23, 2025 05:38
Minimal WPE launcher, with user message handler to poweroff/reboot a device
/*
* SPDX-License-Identifier: MIT
*
* cc -o minicog minicog.c $(pkg-config wpe-webkit-1.1 cogcore --cflags --libs)
*/
#include <cog/cog.h>
#include <sys/reboot.h>
static const char *s_starturl = NULL;
@aperezdc
aperezdc / minicog-urihandler-cors.c
Last active June 23, 2025 05:38
Minimal WPE launcher
/*
* SPDX-License-Identifier: MIT
*
* cc -o minicog minicog.c $(pkg-config wpe-webkit-1.1 cogcore --cflags --libs)
*/
#include <cog/cog.h>
static const char *s_starturl = NULL;
@aperezdc
aperezdc / minicog.c
Created March 2, 2023 14:49
Minimal WPE launcher using libcogcore
/*
* SPDX-License-Identifier: MIT
*
* cc -o minicog minicog.c $(pkg-config wpe-webkit-1.1 cogcore --cflags --libs)
*/
#include <cog/cog.h>
static const char *s_starturl = NULL;
@aperezdc
aperezdc / aur-muon-meson-bootstrap.diff
Last active December 21, 2021 08:58
Make AUR package meson-muon-git bootstrap instead of using Ninja
commit be9c283f963b844bd71d9735ac1707ec4c28395e
Author: Adrian Perez de Castro <[email protected]>
Date: Sun Nov 14 23:04:49 2021 +0200
Local changes
diff --git a/PKGBUILD b/PKGBUILD
index 8b663ef..8a73fcd 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@aperezdc
aperezdc / 00-HOWTO.md
Last active January 30, 2021 20:58
How to patch DB Set XL to work on arctic climate

DB Set XL on Arctic

This shows how to patch DB Set XL v0.82 so it won't disable itself when starting a game in arctic climate. The resulting patched file was tested with OpenTTD.

Requisites

  • Original dbsetxlw.grf, downloadable from here
  • grfcodec
  • patch
@aperezdc
aperezdc / CMakeLists.txt
Last active June 23, 2025 05:39
CMake madness
cmake_minimum_required (VERSION 2.8)
# projectname is the same as the main-executable
project(pctest)
find_package(PkgConfig)
pkg_check_modules(PC one)
message("PC_INCLUDE_DIRS ... ${PC_INCLUDE_DIRS}")
message("PC_CFLAGS ......... ${PC_CFLAGS}")
message("PC_CFLAGS_OTHER ... ${PC_CFLAGS_OTHER}")
@aperezdc
aperezdc / PKGBUILD-j4status-git.sh
Last active February 10, 2019 17:32
Updated PKGBUILD for the j4status-git package
# Maintainer: Moritz Maxeiner <[email protected]>
pkgname=j4status-git
pkgver=445.8c017e4
pkgrel=1
pkgdesc="A plugin-based status line generator: j4status generates a status line to use with bar programs (like i3bar). It is plugin-based to allow anyone to extend it easily."
arch=('i686' 'x86_64')
url='https://sardemff7.github.io/j4status/'
license=('GPL')
provides=('j4status')