You are not logged in.

#1 2021-01-18 08:00:28

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,557
Website

jgmenu first run jumps to GTK sync

On a newly installed system, or a live system, the initial display of jgmenu will be that which is configured by running the gtk sync script, ie the background colour is too dark and the red separator text is gone. (This is the best a GTK sync can do.) The original theme specified in ~/.config/jgmenu/jgmenurc is overwritten, though it can be restored by running an OpenBox sync.

This seems to be because the cache file ~/.cache/jgmenu/.last-gtktheme is empty until jgmenu has been run at least once. (Off-topic, but why the dot filename?)

There is an easy workaround: ship ~/.cache/jgmenu/.last-gtktheme in the installed config set with a preseeded content of 'BL-Lithium', the default GTK theme. That will inhibit the unwanted GTK sync from running.

@Johan does that strike you as reasonable?


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#2 2021-01-18 22:13:59

malm
jgmenu developer
Registered: 2016-10-13
Posts: 735
Website

Re: jgmenu first run jumps to GTK sync

John

It would be better if jgmenu-gtktheme didn’t sync if there is no cache file (but just creates the cache file so that it can detect future changes).

We should NOT ship cache files.

And yes, the dot is a bit silly really!

--EDIT add NOT big_smile---

Last edited by malm (2021-01-19 11:25:23)

Offline

#3 2021-01-20 06:39:19

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,557
Website

Re: jgmenu first run jumps to GTK sync

On reflection, I agree about the cache. It's not something that should be pre-installed.

This version of ~/.config/jgmenu/startup might do what is needed:

#!/bin/sh

gtktheme_cache=~/.cache/jgmenu/.last-gtktheme
mkdir -p ~/.cache/jgmenu

gtktheme () {
	while IFS='=' read -r key value; do
		key=${key#"${key%%[![:blank:]]*}"} # strip any leading spaces
		key=${key%"${key##*[![:blank:]]}"} # " " trailing " "
		if [ "${key}" = 'gtk-theme-name' ]; then
			value=${value%%#*} # strip trailing comments
			value=${value#"${value%%[![:blank:]]*}"}
			value=${value%"${value##*[![:blank:]]}"}
			printf '%s' "${value}"
			return 0
		fi
	done < "$HOME/.config/gtk-3.0/settings.ini"
}

old=$(cat "$gtktheme_cache")
new=$(gtktheme)

if [ -n "${old}" ]; then
	if ! [ "${old}" = "${new}" ]; then
	printf '%b\n' "info: change gtk theme from ${old} to ${new}"
	jgmenu_run gtktheme
	fi
else
	printf '%s' "$new" > "$gtktheme_cache"
fi

That might be enough for now?

---
But, actually I'm starting to regret my strong advocacy of GTK syncing last year ( PM starting 2020-4-1  https://forums.bunsenlabs.org/pms_view. … 338#p12338 )
OpenBox syncing is definitely richer, the issues that came up then have been fixed, and while nearly all our users are using OB it might be a bit perverse to force GTK syncing every time the GTK theme changes.

Maybe at some point - before the split with OB becomes unavoidable - we could consider switching from GTK auto-syncing to OB auto-syncing? Since both mechanisms already exist it would just mean changing ~/.config/jgmenu/startup and hooks I guess?

Even further down the road, what would you think of some day adding a new jgmenurc option eg sync_theme with optional values of gtk,ob,0(or NULL)? Then startup and hooks could be dropped from the user directory altogether and the user could control things via that jgmenurc entry.

EDIT: added
mkdir -p ~/.cache/jgmenu

Last edited by johnraff (2021-01-23 05:46:42)


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#4 2021-01-23 16:26:23

malm
jgmenu developer
Registered: 2016-10-13
Posts: 735
Website

Re: jgmenu first run jumps to GTK sync

^ John - I have tried + reviewed the startup scripts. Looks fine and works well.

Offline

#5 2021-01-24 02:02:28

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,557
Website

Re: jgmenu first run jumps to GTK sync

^Thanks for checking!
I'll push that today.
The other stuff we can consider at leisure...


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

Board footer

Powered by FluxBB