new stuff

This commit is contained in:
Gwenhael Le Moine 2024-08-25 21:01:33 +02:00
parent 4d36f86422
commit 16811275da
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
5 changed files with 136 additions and 28 deletions

View file

@ -168,7 +168,6 @@ meson setup \
-Dstrip=true \ -Dstrip=true \
-Ddefault-wallpaper=true \ -Ddefault-wallpaper=true \
-Dswaybar=true \ -Dswaybar=true \
-Dxwayland=enabled \
-Dtray=enabled \ -Dtray=enabled \
-Dgdk-pixbuf=enabled \ -Dgdk-pixbuf=enabled \
-Dswaynag=true \ -Dswaynag=true \

View file

@ -338,7 +338,7 @@ index 0000000000..423abc425e
+#include <xdg-shell-client-protocol.h> +#include <xdg-shell-client-protocol.h>
+#include <xdg-shell-protocol.h> +#include <xdg-shell-protocol.h>
+ +
+#include "background-image.h" +#include "swaybar/image.h"
+#include "cairo.h" +#include "cairo.h"
+#include "cairo_util.h" +#include "cairo_util.h"
+#include "list.h" +#include "list.h"
@ -469,7 +469,7 @@ index 0000000000..423abc425e
+} +}
+ +
+static struct swaybar_dbusmenu_surface *swaybar_dbusmenu_surface_create() { +static struct swaybar_dbusmenu_surface *swaybar_dbusmenu_surface_create() {
+ struct swaybar_dbusmenu_surface *dbusmenu = calloc(1, + struct swaybar_dbusmenu_surface *dbusmenu = calloc(1,
+ sizeof(struct swaybar_dbusmenu_surface)); + sizeof(struct swaybar_dbusmenu_surface));
+ if (!dbusmenu) { + if (!dbusmenu) {
+ sway_log(SWAY_DEBUG, "Could not allocate dbusmenu"); + sway_log(SWAY_DEBUG, "Could not allocate dbusmenu");
@ -606,7 +606,7 @@ index 0000000000..423abc425e
+ return item; + return item;
+ } + }
+ if (item->submenu && item->submenu->item_id != 0) { + if (item->submenu && item->submenu->item_id != 0) {
+ struct swaybar_dbusmenu_menu_item *found_item = + struct swaybar_dbusmenu_menu_item *found_item =
+ find_item_under_menu(item->submenu, item_id); + find_item_under_menu(item->submenu, item_id);
+ if (found_item) { + if (found_item) {
+ return found_item; + return found_item;
@ -627,7 +627,7 @@ index 0000000000..423abc425e
+} +}
+ +
+static struct swaybar_dbusmenu_menu * +static struct swaybar_dbusmenu_menu *
+find_parent_menu_under_menu(struct swaybar_dbusmenu_menu *menu, +find_parent_menu_under_menu(struct swaybar_dbusmenu_menu *menu,
+ struct swaybar_dbusmenu_menu *child_menu) { + struct swaybar_dbusmenu_menu *child_menu) {
+ if (!menu->items) { + if (!menu->items) {
+ return NULL; + return NULL;
@ -745,7 +745,7 @@ index 0000000000..423abc425e
+ list_free(icon_search_paths); + list_free(icon_search_paths);
+ +
+ if (icon_path) { + if (icon_path) {
+ cairo_surface_t *icon = load_background_image(icon_path); + cairo_surface_t *icon = load_image(icon_path);
+ free(icon_path); + free(icon_path);
+ cairo_surface_t *icon_scaled = + cairo_surface_t *icon_scaled =
+ cairo_image_surface_scale(icon, size, size); + cairo_image_surface_scale(icon, size, size);
@ -911,7 +911,7 @@ index 0000000000..423abc425e
+ } + }
+ } + }
+ +
+ cairo_surface_t *recorder = + cairo_surface_t *recorder =
+ cairo_recording_surface_create(CAIRO_CONTENT_COLOR_ALPHA, NULL); + cairo_recording_surface_create(CAIRO_CONTENT_COLOR_ALPHA, NULL);
+ if (!recorder) { + if (!recorder) {
+ return; + return;
@ -1077,7 +1077,7 @@ index 0000000000..423abc425e
+ swaybar_dbusmenu_draw(sni->tray->menu, menu_id); + swaybar_dbusmenu_draw(sni->tray->menu, menu_id);
+ +
+ sd_bus_call_method_async(sni->tray->bus, NULL, sni->service, sni->menu, + sd_bus_call_method_async(sni->tray->bus, NULL, sni->service, sni->menu,
+ menu_interface, "Event", NULL, NULL, "isvu", menu_id, "opened", "y", 0, + menu_interface, "Event", NULL, NULL, "isvu", menu_id, "opened", "y", 0,
+ time(NULL)); + time(NULL));
+ +
+ sway_log(SWAY_DEBUG, "%s%s opened id %d", sni->service, sni->menu, menu_id); + sway_log(SWAY_DEBUG, "%s%s opened id %d", sni->service, sni->menu, menu_id);
@ -1098,7 +1098,7 @@ index 0000000000..423abc425e
+ slot->menu_id = menu_id; + slot->menu_id = menu_id;
+ +
+ int ret = sd_bus_call_method_async(sni->tray->bus, &slot->slot, sni->service, + int ret = sd_bus_call_method_async(sni->tray->bus, &slot->slot, sni->service,
+ sni->menu, menu_interface, "AboutToShow", about_to_show_callback, slot, "i", + sni->menu, menu_interface, "AboutToShow", about_to_show_callback, slot, "i",
+ menu_id); + menu_id);
+ +
+ if (ret >= 0) { + if (ret >= 0) {
@ -1171,7 +1171,7 @@ index 0000000000..423abc425e
+ log_value = toggle_type; + log_value = toggle_type;
+ } else if (strcmp(key, "toggle-state") == 0) { + } else if (strcmp(key, "toggle-state") == 0) {
+ sd_bus_message_read(msg, "v", "i", &item->toggle_state); + sd_bus_message_read(msg, "v", "i", &item->toggle_state);
+ log_value = item->toggle_state == 0 ? + log_value = item->toggle_state == 0 ?
+ "off" : item->toggle_state == 1 ? "on" : "indeterminate"; + "off" : item->toggle_state == 1 ? "on" : "indeterminate";
+ } else if (strcmp(key, "children-display") == 0) { + } else if (strcmp(key, "children-display") == 0) {
+ char *children_display; + char *children_display;
@ -1204,7 +1204,7 @@ index 0000000000..423abc425e
+ return sd_bus_message_exit_container(msg); + return sd_bus_message_exit_container(msg);
+} +}
+ +
+static int get_layout_callback(sd_bus_message *msg, void *data, +static int get_layout_callback(sd_bus_message *msg, void *data,
+ sd_bus_error *error) { + sd_bus_error *error) {
+ struct swaybar_sni_slot *slot = data; + struct swaybar_sni_slot *slot = data;
+ struct swaybar_sni *sni = slot->sni; + struct swaybar_sni *sni = slot->sni;
@ -1258,7 +1258,7 @@ index 0000000000..423abc425e
+ while (!sd_bus_message_at_end(msg, 1)) { + while (!sd_bus_message_at_end(msg, 1)) {
+ sd_bus_message_enter_container(msg, 'r', "ia{sv}av"); + sd_bus_message_enter_container(msg, 'r', "ia{sv}av");
+ +
+ struct swaybar_dbusmenu_menu_item *item + struct swaybar_dbusmenu_menu_item *item
+ = calloc(1, sizeof(struct swaybar_dbusmenu_menu_item)); + = calloc(1, sizeof(struct swaybar_dbusmenu_menu_item));
+ if (!item) { + if (!item) {
+ ret = -ENOMEM; + ret = -ENOMEM;
@ -1318,7 +1318,7 @@ index 0000000000..423abc425e
+ +
+static void swaybar_dbusmenu_subscribe_signal(struct swaybar_dbusmenu *menu, +static void swaybar_dbusmenu_subscribe_signal(struct swaybar_dbusmenu *menu,
+ const char *signal_name, sd_bus_message_handler_t callback) { + const char *signal_name, sd_bus_message_handler_t callback) {
+ int ret = sd_bus_match_signal_async( menu->sni->tray->bus, NULL, + int ret = sd_bus_match_signal_async( menu->sni->tray->bus, NULL,
+ menu->sni->service, menu->sni->menu, menu_interface, signal_name, callback, + menu->sni->service, menu->sni->menu, menu_interface, signal_name, callback,
+ NULL, menu->sni); + NULL, menu->sni);
+ +
@ -1395,7 +1395,7 @@ index 0000000000..423abc425e
+static void swaybar_dbusmenu_setup(struct swaybar_dbusmenu *menu) { +static void swaybar_dbusmenu_setup(struct swaybar_dbusmenu *menu) {
+ struct swaybar_sni_slot *slot = calloc(1, sizeof(struct swaybar_sni_slot)); + struct swaybar_sni_slot *slot = calloc(1, sizeof(struct swaybar_sni_slot));
+ slot->sni = menu->sni; + slot->sni = menu->sni;
+ int ret = sd_bus_call_method_async( menu->sni->tray->bus, &slot->slot, + int ret = sd_bus_call_method_async( menu->sni->tray->bus, &slot->slot,
+ menu->sni->service, menu->sni->path, "org.freedesktop.DBus.Properties", + menu->sni->service, menu->sni->path, "org.freedesktop.DBus.Properties",
+ "Get", get_icon_theme_path_callback, slot, "ss", menu->sni->interface, + "Get", get_icon_theme_path_callback, slot, "ss", menu->sni->interface,
+ "IconThemePath"); + "IconThemePath");
@ -1412,7 +1412,7 @@ index 0000000000..423abc425e
+} +}
+ +
+void swaybar_dbusmenu_open(struct swaybar_sni *sni, +void swaybar_dbusmenu_open(struct swaybar_sni *sni,
+ struct swaybar_output *output, struct swaybar_seat *seat, uint32_t serial, + struct swaybar_output *output, struct swaybar_seat *seat, uint32_t serial,
+ int x, int y) { + int x, int y) {
+ struct swaybar_dbusmenu *dbusmenu = sni->tray->menu; + struct swaybar_dbusmenu *dbusmenu = sni->tray->menu;
+ if (!dbusmenu) { + if (!dbusmenu) {
@ -1464,14 +1464,14 @@ index 0000000000..423abc425e
+ struct swaybar_tray *tray = focused_menu->dbusmenu->sni->tray; + struct swaybar_tray *tray = focused_menu->dbusmenu->sni->tray;
+ struct swaybar_sni *sni = tray->menu->sni; + struct swaybar_sni *sni = tray->menu->sni;
+ if (focused_menu->last_hovered_item != item) { + if (focused_menu->last_hovered_item != item) {
+ sd_bus_call_method_async(tray->bus, NULL, sni->service, sni->menu, + sd_bus_call_method_async(tray->bus, NULL, sni->service, sni->menu,
+ menu_interface, "Event", NULL, NULL, "isvu", item->id, "hovered", + menu_interface, "Event", NULL, NULL, "isvu", item->id, "hovered",
+ "y", 0, time(NULL)); + "y", 0, time(NULL));
+ +
+ sway_log(SWAY_DEBUG, "%s%s hovered id %d", sni->service, sni->menu, + sway_log(SWAY_DEBUG, "%s%s hovered id %d", sni->service, sni->menu,
+ item->id); + item->id);
+ +
+ // open child menu if current item has a child menu and close other + // open child menu if current item has a child menu and close other
+ // potential open child menus. Only one child menu can be open at a time + // potential open child menus. Only one child menu can be open at a time
+ close_child_menus_except(focused_menu, item->id); + close_child_menus_except(focused_menu, item->id);
+ open_menu_id(focused_menu->dbusmenu, item->id); + open_menu_id(focused_menu->dbusmenu, item->id);
@ -1484,7 +1484,7 @@ index 0000000000..423abc425e
+ } + }
+} +}
+ +
+bool dbusmenu_pointer_motion(struct swaybar_seat *seat, +bool dbusmenu_pointer_motion(struct swaybar_seat *seat,
+ struct wl_pointer *wl_pointer, uint32_t time_, wl_fixed_t surface_x, + struct wl_pointer *wl_pointer, uint32_t time_, wl_fixed_t surface_x,
+ wl_fixed_t surface_y) { + wl_fixed_t surface_y) {
+ struct swaybar_tray *tray = seat->bar->tray; + struct swaybar_tray *tray = seat->bar->tray;
@ -1513,7 +1513,7 @@ index 0000000000..423abc425e
+ for (int i = 0; i < menu->items->length; ++i) { + for (int i = 0; i < menu->items->length; ++i) {
+ struct swaybar_dbusmenu_menu_item *item = menu->items->items[i]; + struct swaybar_dbusmenu_menu_item *item = menu->items->items[i];
+ struct swaybar_dbusmenu_menu *child_menu = item->submenu; + struct swaybar_dbusmenu_menu *child_menu = item->submenu;
+ if (child_menu && child_menu->surface + if (child_menu && child_menu->surface
+ && child_menu->surface->surface == surface) { + && child_menu->surface->surface == surface) {
+ return child_menu; + return child_menu;
+ } + }
@ -1553,14 +1553,14 @@ index 0000000000..423abc425e
+ int scale = menu->dbusmenu->output->scale; + int scale = menu->dbusmenu->output->scale;
+ int x = seat->pointer.x * scale; + int x = seat->pointer.x * scale;
+ int y = seat->pointer.y * scale; + int y = seat->pointer.y * scale;
+ if (item->submenu && item->submenu->item_id != 0 + if (item->submenu && item->submenu->item_id != 0
+ && !is_in_hotspot(&item->hotspot, x, y)) { + && !is_in_hotspot(&item->hotspot, x, y)) {
+ close_menus_by_id(menu, item->id); + close_menus_by_id(menu, item->id);
+ } + }
+ } + }
+} +}
+ +
+bool dbusmenu_pointer_frame(struct swaybar_seat *data, +bool dbusmenu_pointer_frame(struct swaybar_seat *data,
+ struct wl_pointer *wl_pointer) { + struct wl_pointer *wl_pointer) {
+ struct swaybar_tray *tray = data->bar->tray; + struct swaybar_tray *tray = data->bar->tray;
+ if (!(tray && tray->menu && tray->menu_pointer_focus)) { + if (!(tray && tray->menu && tray->menu_pointer_focus)) {
@ -1639,13 +1639,13 @@ index 0000000000..423abc425e
+ item->id); + item->id);
+ +
+ sd_bus_call_method_async(tray->bus, NULL, sni->service, sni->menu, + sd_bus_call_method_async(tray->bus, NULL, sni->service, sni->menu,
+ menu_interface, "Event", NULL, NULL, "isvu", item->id, "clicked", "y", 0, + menu_interface, "Event", NULL, NULL, "isvu", item->id, "clicked", "y", 0,
+ time(NULL)); + time(NULL));
+ +
+ if (item->submenu) { + if (item->submenu) {
+ open_menu_id(dbusmenu, item->id); + open_menu_id(dbusmenu, item->id);
+ } else { + } else {
+ // The user clicked an menu item other than a submenu. That means + // The user clicked an menu item other than a submenu. That means
+ // the user made it's choise. Close the tray menu. + // the user made it's choise. Close the tray menu.
+ swaybar_dbusmenu_destroy(tray->menu); + swaybar_dbusmenu_destroy(tray->menu);
+ } + }
@ -1657,7 +1657,7 @@ index 0000000000..423abc425e
+ +
+static bool dbusmenu_pointer_button_left(struct swaybar_dbusmenu *dbusmenu, +static bool dbusmenu_pointer_button_left(struct swaybar_dbusmenu *dbusmenu,
+ struct swaybar_seat *seat) { + struct swaybar_seat *seat) {
+ struct swaybar_dbusmenu_menu *focused_menu + struct swaybar_dbusmenu_menu *focused_menu
+ = dbusmenu->sni->tray->menu_pointer_focus; + = dbusmenu->sni->tray->menu_pointer_focus;
+ +
+ if (!focused_menu) { + if (!focused_menu) {

View file

@ -33,7 +33,7 @@ cd "$TMP"/"$PRGNAM"/ || exit 1
qmake6 DOCS_DIR=/usr/doc/"$PRGNAM" MAN_DIR=/usr/man/man1 OpenRGB.pro qmake6 DOCS_DIR=/usr/doc/"$PRGNAM" MAN_DIR=/usr/man/man1 OpenRGB.pro
CFLAGS="$SLKCFLAGS" \ CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \
make make -j $(nproc)
make INSTALL_ROOT="$PKG" install make INSTALL_ROOT="$PKG" install
find "$PKG" -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ find "$PKG" -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \

View file

@ -0,0 +1,91 @@
#!/bin/bash
set -x
CWD=$(pwd)
PRGNAM=$(basename "$CWD")
BUILD=1
VERSION=${VERSION:-latest}
ARCH=$(uname -m)
TAG=gwh
OUTPUT=/tmp
TMP=/tmp/$TAG
PKG=$TMP/pkg-$PRGNAM
REPOSITORY=/home/installs/SlackBuilds/_repositories/$PRGNAM
PREFIX=/usr
mkdir -p $TMP
# Cleaning
rm -fr "${TMP:?}"/"$PRGNAM" "$PKG"
# Fetching sources
[ ! -e "$REPOSITORY" ] && git clone https://src.le-moine.org/gwh/saturn_bertolotti.git "$REPOSITORY"
cd "$REPOSITORY" || exit 1
git pull --all
cp -R "$REPOSITORY" $TMP/"$PRGNAM"
# Preparation
cd $TMP/"$PRGNAM" || exit 1
[ "$VERSION" == "latest" ] && VERSION=$(git describe --tags --abbrev=0)
[ "$VERSION" == "" ] && VERSION=trunk
if [ "$VERSION" == "trunk" ]; then
VERSION="git_r$(git rev-list --count HEAD)_$(git log -1 --format=%h)"
else
git checkout "$VERSION"
fi
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
# Building
make all PREFIX=/usr
# Installation
make install DESTDIR="$PKG" PREFIX=/usr
# Cleaning
cd "$PKG" || exit 1
find -0 . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
find -0 . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
cd "$PKG" || exit 1
[ -d "$PKG$PREFIX"/man ] && find "$PKG$PREFIX"/man -type f -name "*.?" -exec gzip -9 {} \;
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
# Packaging
mkdir install
cat <<EOF > install/slack-desc
$PRGNAM: $PRGNAM (HP48 emulator)
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM: https://www.hpcalc.org/details/4382
$PRGNAM: https://src.le-moine.org/gwh/saturn_bertolotti.git
EOF
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
/sbin/makepkg --linkadd y --chown n --prepend "$OUTPUT/$PRGNAM-$(echo "$VERSION" | tr -d '-')-$ARCH-$BUILD$TAG.txz"

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# variables # variables
BUILD=${BUILD:-1} BUILD=${BUILD:-2}
GITHUB_REPO=wez/wezterm GITHUB_REPO=wez/wezterm
VERSION=${VERSION:-latest} VERSION=${VERSION:-latest}
@ -36,12 +36,30 @@ cd $TMP/$PRGNAM
[ "x$VERSION" == "x" ] && VERSION=trunk [ "x$VERSION" == "x" ] && VERSION=trunk
[ "x$VERSION" == "xtrunk" ] && VERSION="git_r$(git rev-list --count HEAD)_$(git log -1 --format=%h)" || git checkout $VERSION [ "x$VERSION" == "xtrunk" ] && VERSION="git_r$(git rev-list --count HEAD)_$(git log -1 --format=%h)" || git checkout $VERSION
cargo build --release ./get-deps
cargo build --release --features distro-defaults
mkdir -p $PKG$PREFIX/bin mkdir -p $PKG$PREFIX/bin
find target/release/ -type f -executable -maxdepth 1 -exec cp {} $PKG$PREFIX/bin/ \; find target/release/ -type f -executable -maxdepth 1 -not -name \*.so -exec cp {} $PKG$PREFIX/bin/ \;
chmod 755 $PKG$PREFIX/bin/* chmod 755 $PKG$PREFIX/bin/*
install -Dm 644 assets/icon/terminal.png $PKG/usr/share/icons/hicolor/128x128/apps/org.wezfurlong.$PRGNAM.png
install -Dm 644 assets/$PRGNAM.desktop $PKG/usr/share/applications/org.wezfurlong.$PRGNAM.desktop
install -Dm 644 assets/$PRGNAM.appdata.xml $PKG/usr/share/metainfo/org.wezfurlong.$PRGNAM.appdata.xml
install -Dm 644 assets/$PRGNAM-nautilus.py $PKG/usr/share/nautilus-python/extensions/$PRGNAM-nautilus.py
install -Dm 755 assets/open-$PRGNAM-here -t $PKG/usr/bin
install -Dm 644 assets/shell-completion/bash $PKG/usr/share/bash-completion/completions/$PRGNAM
install -Dm 644 assets/shell-completion/fish $PKG/usr/share/fish/vendor_completions.d/$PRGNAM.fish
install -Dm 644 assets/shell-completion/zsh $PKG/usr/share/zsh/site-functions/_$PRGNAM
install -Dm 644 assets/shell-integration/* -t $PKG/etc/profile.d
mkdir -p $PKG/usr/share/terminfo
tic -x -o $PKG/usr/share/terminfo termwiz/data/$PRGNAM.terminfo
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
# move doc/ to the appropriate location # move doc/ to the appropriate location
mkdir -p $PKG$PREFIX/doc/$PRGNAM mkdir -p $PKG$PREFIX/doc/$PRGNAM
cp *.md $PKG$PREFIX/doc/$PRGNAM cp *.md $PKG$PREFIX/doc/$PRGNAM