The officially official Devuan Forum!

You are not logged in.

#76 DIY » Packaged dhcpcd 9.3.3 and dhcpcd-gtk 0.7.7 for Beowulf » 2020-11-10 06:51:00

geki
Replies: 2

Well, yeah, I am used to dhcpcd from Gentoo and I just like it - distro-independent network foo. These packages are built on my Devuan Beowulf system.

Changes of dhcpcd

  • Disabled new PRIVSEP feature.

  • Set proper RUNDIR path.

  • Add latest fixes from git HEAD.

Changes of dhcpcd-ui

Have fun! big_smile

#77 Re: Desktop and Multimedia » How do you stop chromium asking for 'keyring password'? » 2020-04-11 08:42:50

Yup, Gentoo recommends compile flags. Debian, or any other binary distro, recommends packages to install/uninstall. In the end, it is all the same. smile

#78 Re: Desktop and Multimedia » How do you stop chromium asking for 'keyring password'? » 2020-04-08 06:15:32

Try from command-line. That helped me back then. To see, if your desktop or config file were actually used or not!

$ chromium-browser --password-store=basic

See https://forums.gentoo.org/viewtopic-p-7951970.html#7951970

Otherwise, what chromium packages are installed? Are there some chromium packages indicating connections to libsecret or gnome-keyring? They should be uninstalled. That are the solutions from Gentoo. smile

#79 Re: Desktop and Multimedia » Using redshift » 2020-04-02 07:14:39

I autostart it like so:

$ cat .config/autostart/redshift-gtk.desktop 
[Desktop Entry]
Type=Application
Exec=redshift-gtk -l 52:9"
Hidden=false
X-MATE-Autostart-enabled=true
Name=Redshift
Comment=Farbtemperaturanpassungswerkzeug

The important part is the '-l' option to make it work:

$ LC_ALL=C redshift -h|grep '\-l'
Usage: redshift -l LAT:LON -t DAY:NIGHT [OPTIONS...]
  -l LAT:LON	Your current location
  -l PROVIDER	Select provider for automatic location updates

#80 Re: Off-topic » new encroachments of our least favourite init » 2019-12-16 15:23:44

Well, I am with Gentoo on my server and lurking in gentoo forums. Some of their users do not like what happens with the OpenRC project, me neither. I keep the old version 0.17 on my server, just for example. Since I am not good with politics talk and such, I just give some links you may follow/read:

Google search on f.g.o.: https://www.google.com/search?q=site%3A … rc+william

Most interesting threads found (on a quick glance):

systemd discussion: agree to disagree: https://forums.gentoo.org/viewtopic-t-1 … t-175.html

williamh pushing usr merge: https://forums.gentoo.org/viewtopic-t-1 … t-100.html

#81 Hardware & System Configuration » [JFYI] intel cpu/wifi versus intel-microcode 20191112.1 versus dhcpcd » 2019-11-23 14:03:22

geki
Replies: 0

Hi there,

JFYI, Devuan Beowulf system with dhcpcd/wpa_supplicant setup is not able to reconnect automatically to my wifi network with that intel-microcode version. The old version 20190618.1 works!

Both microcodes connect fine on boot. But then, only the old microcode allows automatic reconnects. Whysoever roll

Some system infos:

Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
Intel Corporation Wireless-AC 9260 (rev 29)

Working wifi:
[    0.000000] microcode: microcode updated early to revision 0xb4, date = 2019-04-01
[    1.547370] microcode: sig=0x806ea, pf=0x80, revision=0xb4
[    1.547652] microcode: Microcode Update Driver: v2.2.

Broken wifi:
[    0.000000] microcode: microcode updated early to revision 0xc6, date = 2019-08-14
[    1.635718] microcode: sig=0x806ea, pf=0x80, revision=0xc6
[    1.636029] microcode: Microcode Update Driver: v2.2.

Have fun!

#82 Re: Desktop and Multimedia » [SOLVED] Ceres 64-bit and cannot install wine32:i386 » 2019-10-19 10:18:51

Hmm, although I see the ~beowulf1 versions for i386 in the pool (fau mirror, too), apt-get says:

E: Version '2.33.1-0.1+devuan1~beowulf1' for 'libblkid1:i386' was not found
E: Version '2.33.1-0.1+devuan1~beowulf1' for 'libmount1:i386' was not found
E: Version '2.33.1-0.1+devuan1~beowulf1' for 'libuuid1:i386' was not found

#83 Re: Desktop and Multimedia » [SOLVED] Ceres 64-bit and cannot install wine32:i386 » 2019-10-18 22:03:01

Current state here with Beowulf is this:

 libblkid1 : Beschädigt: libblkid1:i386 (!= 2.33.1-0.1+devuan1~beowulf1) aber 2.33.1-0.1+devuan1 soll installiert werden
 libblkid1:i386 : Beschädigt: libblkid1 (!= 2.33.1-0.1+devuan1) aber 2.33.1-0.1+devuan1~beowulf1 soll installiert werden
 libmount1 : Beschädigt: libmount1:i386 (!= 2.33.1-0.1+devuan1~beowulf1) aber 2.33.1-0.1+devuan1 soll installiert werden
 libmount1:i386 : Beschädigt: libmount1 (!= 2.33.1-0.1+devuan1) aber 2.33.1-0.1+devuan1~beowulf1 soll installiert werden
 libuuid1 : Beschädigt: libuuid1:i386 (!= 2.33.1-0.1+devuan1~beowulf1) aber 2.33.1-0.1+devuan1 soll installiert werden
 libuuid1:i386 : Beschädigt: libuuid1 (!= 2.33.1-0.1+devuan1) aber 2.33.1-0.1+devuan1~beowulf1 soll installiert werden

Got around that by downloading the packages with the superfluous '~beowulf1' suffix. If you do it the first time, you do not need the version tag with the package names.

apt-get download libblkid-dev=2.33.1-0.1+devuan1~beowulf1 libblkid1=2.33.1-0.1+devuan1~beowulf1 libmount-dev=2.33.1-0.1+devuan1~beowulf1 libmount1=2.33.1-0.1+devuan1~beowulf1 libuuid1=2.33.1-0.1+devuan1~beowulf1 mount=2.33.1-0.1+devuan1~beowulf1 uuid-dev=2.33.1-0.1+devuan1~beowulf1

And removing that version suffix with this bash script by executing: ./pkg_remove_version_suffix.sh '~beowulf1'
Make sure to have the necessary helper binaries installed!

#!/bin/bash

remove_suffix()
{
	local dpkg
	for dpkg in *${1}*.deb
	do
		mkdir temp_${dpkg}

		dpkg-deb -R ${dpkg} temp_${dpkg}

		sed -e "s/${1}//g" -i temp_${dpkg}/DEBIAN/control

		dpkg-deb -b temp_${dpkg} ${dpkg/${1}}

		rm -rf ${dpkg} temp_${dpkg}
	done
}

if [ -z ${1} ]
then
	echo "no suffix passed to remove"
	exit 1
fi

remove_suffix ${1}

apt-get -o Dpkg::Options::="--force-overwrite" install ./*.deb

exit ${?}

#84 Re: Desktop and Multimedia » wine32 » 2019-09-01 10:13:50

redi wrote:

I have continued to work according to the instructions: https://dev1galaxy.org/viewtopic.php?id=2987

However, wine32 can not be installed with either apt or apt-get. Only aptitude will probably work, but I'll lose elogind:

You have to install the modified debian version of libelogind0:i386, too. The last post of that thread you mentioned. I have to install that modified version like so to overwrite file collision of ChangeLog file:

dpkg --force-overwrite -i ./libelogind0_241.3-1_i386.deb

#85 Re: Desktop and Multimedia » Beowulf: UPower 0.99 removed? Versus Logitech Unifying Receiver » 2019-07-20 15:48:28

geki wrote:

Synaptic disappeared for a while from Debian. Now UPower 0.99 from Devuan. Is this common practice on Debian-based distros? big_smile

#88 Desktop and Multimedia » Beowulf: UPower 0.99 removed? Versus Logitech Unifying Receiver » 2019-07-20 11:50:48

geki
Replies: 8

Hi there!

Had to grab UPower from Debian Buster since its gone from Devuan repos.

Logitech Unifying Receiver (Mouse/Keyboard/whatever) requires UPower 0.99 since Kernel 3.19. Otherwise MATE may just shutdown immediately after boot, since it misinterprets the battery status. *fun*

Synaptic disappeared for a while from Debian. Now UPower 0.99 from Devuan. Is this common practice on Debian-based distros? big_smile

#89 Re: Other Issues » ifup wait at boot » 2019-07-07 10:11:27

JFYI, this looks more sane, as Geoff pointed out. I wonder, if the dependency to iproute2 is acceptable.

--- /etc/init.d/networking	2019-07-07 12:05:57.696076136 +0200
+++ /etc/init.d/networking	2019-07-07 12:11:41.412092526 +0200
@@ -14,6 +14,7 @@
 IFSTATE="$RUN_DIR/ifstate"
 STATEDIR="$RUN_DIR/state"
 
+[ -x /sbin/ip ] || exit 0
 [ -x /sbin/ifup ] || exit 0
 [ -x /sbin/ifdown ] || exit 0
 
@@ -107,7 +108,12 @@
 				    link=${link##.*}
 				    if [ -e "/sys/class/net/$link" ]
 				    then
-					echo "$iface"
+					# link detection does not work unless we up the link
+					ip link set "$iface" up || true
+					if [ "$(cat /sys/class/net/$link/operstate)" = up ]
+					then
+						echo "$iface"
+					fi
 				    fi
 			    done)
 	    if [ -n "$ifaces" ]

#91 Re: Hardware & System Configuration » [SOLVED] Kernel console/VT: boot msgs cut at 80 chars » 2019-06-21 06:28:32

That's it. Thank you!

JFTR, I added option i915.fastboot=1 to the module.

#92 Hardware & System Configuration » [SOLVED] Kernel console/VT: boot msgs cut at 80 chars » 2019-06-20 08:31:13

geki
Replies: 2

Hi all!

I got that cosmetic nuisance that the kernel console/VT is reset to 80 columns for a moment during boot with Devuan Beowulf on my Intel(R) Core(TM) i5-8250U CPU.

- grub screen is in screen res
- loading initramfs text after grub is in screen res
- following boot messages show up in screen res, but then column is reset to 80 (i.e.: cutted text below: 'udevd[457]: spec' and 'udevd[519]: fail')
- just a moment later the column is again reset to screen res

INIT: version 2.93 booting
[info] Using makefile-style concurrent boot in runlevel S.
[....] Starting hot-plug events dispatcher: udevd[    3.754574] udevd[457]: spec
. ok
[ ok [    3.813949] udevd[520]: failed to execute[    3.834440] udevd[519]: fail
done.
[ ok ] Waiting for /dev to be fully populated...done.
[ ok ] Setting up keyboard layout...done.
[ ok ] Activating swap...done.

Is there anyone who knows what is setting the column to 80. Is there any kernel parameter for that evil driver not to reset the column to 80?!

I guess I have to do a video with the smartphone. :-)

#93 DIY » Intel Flicker-Free Boot » 2019-05-18 09:43:42

geki
Replies: 1

Hi there,

with Devuan Beowulf on my Intel(R) Core(TM) i5-8250U CPU, I just had to edit /etc/default/grub and update grub configuration. Just in case you are curious and did not do it yourself, yet.

# cat /etc/default/grub|grep fast
GRUB_CMDLINE_LINUX="i915.fastboot=1"

and

# update-grub2

Done.

#94 Re: Desktop and Multimedia » Software update notifications in XFCE » 2019-04-16 17:11:02

Tried to map [0][1] to python3, with Gio.Application and its dbus connection, but it seems to need a bit more knowledge. Though, an indicator should be possible without Gtk and AppIndicator3. I just need my basic variant.

If anyone is interested:

[0] https://askubuntu.com/questions/690769/ … 750#752750
[1] https://github.com/sneetsher/mysystemin … -service.c

#95 Re: Desktop and Multimedia » Software update notifications in XFCE » 2019-04-16 09:50:34

I added AppIndicator3 as tray icon. UPDATE Got my problems sorted out. Reorder updating of notification and tray indicator and using Gio.SimpleAction as callback mechanism. UPDATE #2 Depend on packages ayatana-indicator-application and mate-indicator-applet or xfce-indicator-plugin.  A round of cleanup. UPDATE #3 mate-indicator-applet needs a patch to send the "secondary-activate" event. I send the patch to Debian maintainer. Hopefully we will see an update to the package with the patch applied. xfce4-indicator-plugin already generates the "secondary-activate" event.

#!/usr/bin/env python3

################################################################################
# Configuration Section Begins Here                                            #
################################################################################

config = dict(
    # The title to be shown on the pop-up and the icon tooltip.
    title = "Updates Available",

    # The message to be shown in the pop-up.
    message = "There are updates available to install.",

    # Icon to use in the system tray and pop-up.
    icon = "/usr/share/update-notifier/updates.svg",

    # Frequency to check for available updates.
    #interval = 900, # 15 minutes
    #interval = 14400, # 4 hours
    interval = 3600, # 1 hour

    # Command to run to check for available updates, and the expected status
    # code that indicates updates are available.
    check = "/usr/bin/apt-get -s dist-upgrade | /bin/grep -c '^Inst '",
)

################################################################################
# Configuration Section Ends Here                                              #
################################################################################

try:
    import gi
    gi.require_version('Gtk', '3.0')
    from gi.repository import Gio, GLib, Gtk
    gi.require_version('AyatanaAppIndicator3', '0.1')
    from gi.repository import AyatanaAppIndicator3 as appindicator

    import sys
    import subprocess
    from time import time
    from random import random
except ImportError:
    print("Failed to import Gio, GLib, Gtk or AyatanaAppIndicator3 or other helpers")
    raise NotImplementedError

# hide tray icon from application
def on_action_hide(action, parameter):
    global tray
    tray.set_status(appindicator.IndicatorStatus.PASSIVE)

# hide tray icon from app indicator
def on_menu_hide(menu_item):
    global tray
    tray.set_status(appindicator.IndicatorStatus.PASSIVE)

def on_connect_changed(indicator, connected):
    global app
    if (connected == False):
        print('packages missing: ayatana-indicator-application and mate-indicator-applet for MATE not installed (other DEs may have similar indicator-applet package for ayatana indicators)')
        app.quit()

# app indicator tray icon
def tray_icon():
    global config
    tray = appindicator.Indicator.new('update.notifier.tray', config['icon'],
        appindicator.IndicatorCategory.SYSTEM_SERVICES)
    tray.set_title(config['title'])
    tray.connect('connection-changed', on_connect_changed)

    # minimalistic menu for tray
    menu = Gtk.Menu()
    item_hide = Gtk.MenuItem.new_with_label('Hide')
    item_hide.connect('activate', on_menu_hide)
    menu.append(item_hide)
    menu.show_all()
    tray.set_menu(menu)
    tray.set_secondary_activate_target(item_hide)
    return tray

def query_update():
    global app, tray, config, next_check

    # keep application running
    app.hold()

    if (int(time()) >= next_check):
        status = subprocess.getoutput(config['check'])

        # Updates?
        if (status != "0"):
            # show tray icon
            tray.set_status(appindicator.IndicatorStatus.ACTIVE)

            # show notification popup
            icon = Gio.Icon.new_for_string(config['icon'])
            notifier = Gio.Notification.new(config['title'])
            notifier.set_body(config['message'])
            notifier.set_default_action('app.hide')
            notifier.set_icon(icon)

            app.send_notification('update-notifier-popup', notifier)

        next_check = next_check + config['interval'] + int(random() * 300)

    # keep application running
    app.release()

    return GLib.SOURCE_CONTINUE;

# + 200 for cron job to run at boot
next_check = int(time()) + 200 + int(random() * 300)

# service to run only one instance and allow to functioning as-is
app = Gio.Application.new('update.notifier.app', Gio.ApplicationFlags.IS_SERVICE)

# have a globally accessible tray instance 
tray = None

try:
    if (app.register() == True):
        # keep application running
        app.hold()

        # application hide action
        action_hide = Gio.SimpleAction.new('hide')
        action_hide.connect('activate', on_action_hide)

        app.add_action(action_hide)

        # keep application running
        app.set_inactivity_timeout(180000)

        # hidden tray icon
        tray = tray_icon()

        source_id = GLib.timeout_add_seconds(60, query_update)

        # keep application running
        app.release()
        app.run(sys.argv)

        GLib.source_remove(source_id)
except GLib.Error as e:
    print('Failed to register service: {0} ({1})'.format(e.message, e.code))

# vim:expandtab

#96 Re: Installation » Package synaptic is missing in beowulf, still in ascii and ceres » 2019-04-07 19:49:19

Looks like it keeps out of debian as long as they have wayland as default. See:

https://bugs.debian.org/cgi-bin/bugrepo … =818366#45

And the synaptic bugreport - the developer asks for help refactoring due to being short on spare time.

https://github.com/mvo5/synaptic/issues … -357439865

Anyone here interested in packaging it or help upstream? Guess I use aptitude for now, if I need to; not so often luckily.

#97 Installation » Package synaptic is missing in beowulf, still in ascii and ceres » 2019-04-07 09:02:58

geki
Replies: 12

Hi all,

just checked pkginfo.devuan.org and it is truely missing. Anyone got any indeas?

#98 Re: Desktop and Multimedia » Software update notifications in XFCE » 2019-03-25 19:54:45

Just for the curious, I ported update notifier to pygobject using glib and gio. There is no longer a status icon. Also posting my cron files for completeness to show how to delay after boot and get an update after some minutes. I have neither seen an update after boot with the pygtk2 version.

I set my update interval to one hour.

$ cat /etc/cron.d/update_notifier 
@reboot root /etc/cron.hourly/update_notifier
$ cat /etc/cron.hourly/update_notifier 
#!/bin/sh

# wait up to 180 seconds to run apt-get

MAILTO=""

test -x /usr/bin/apt-get || exit 0
/usr/bin/python3 -c 'import random; import time; time.sleep(random.random() * 180)' \
	&& /usr/bin/apt-get update
$ cat /usr/share/update-notifier/update-notifier.py
#!/usr/bin/env python3

################################################################################
# Configuration Section Begins Here                                            #
################################################################################

c = dict(
    # The title to be shown on the pop-up and the icon tooltip.
    title = "Updates Available",

    # The message to be shown in the pop-up.
    message = "There are updates available to install.",

    # Icon to use in the system tray and pop-up.
    icon = "/usr/share/update-notifier/updates.svg",

    # Frequency to check for available updates.
    #interval = 900, # 15 minutes
    #interval = 14400, # 4 hours
    interval = 3600, # 1 hour

    # Command to run to check for available updates, and the expected status
    # code that indicates updates are available.
    check = "/usr/bin/apt-get -s dist-upgrade | /bin/grep -c '^Inst '",
)

################################################################################
# Configuration Section Ends Here                                              #
################################################################################

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gio, GLib

import subprocess
from time import time
from random import random

def on_activate(data):
    '''do nothing'''

def main_loop():
    global next_check
    if (int(time()) >= next_check):
        status = subprocess.getoutput(c['check'])

        # Updates?
        if (status != "0"):
            global app
            icon = Gio.Icon.new_for_string(c['icon'])
            notifier = Gio.Notification.new(c['title'])
            notifier.set_body(c['message'])
            notifier.set_icon(icon)

            app.send_notification('update.popup', notifier)

        next_check = next_check + c['interval'] + int(random() * 300)

    return GLib.SOURCE_CONTINUE;

# + 200 for cron job to run after boot
next_check = int(time()) + 200 + int(random() * 300)

# service to run only one instance and allow to functioning as-is
app = Gio.Application.new('update.notifier', Gio.ApplicationFlags.IS_SERVICE)

# either notification action or app activate signal
app.connect('activate', on_activate)

try:
    if (app.register() == True):
        source_id = GLib.timeout_add_seconds(60, main_loop)

        GLib.MainLoop().run()

        GLib.source_remove(source_id)
except GLib.Error as e:
    print('Failed to register service: {0} ({1})'.format(e.message, e.code))

# vim:expandtab

#99 Re: DIY » Change accent and highlight color of Qt5 Kvantum and Gtk 2/3 theme » 2019-02-17 20:31:01

Finally made the first stable version on 20190217.

revision 4 20190308
- check for unknown parameter and abort

revision 3 20190217
- add background color to be changed
- stable version 1

revision 2 20190216
- repackage gnome shell theme resource bundles
- add parameters: debug, verbose, find follow symlinks, alternate gtk theme resource name and alternate gnome shell theme resource name
- properly recolor gtk css svg rc and xml files

revision 1 20190215
- rename colors: accent -> selected; hilight -> accented
- scan rc files next to svg and css

#100 DIY » Change accent and highlight color of Qt5 Kvantum and Gtk 2/3 theme » 2019-02-13 20:12:24

geki
Replies: 1

Hi all,

I happened to find the Qt5 Kvantum theme engine looking to have VLC Qt5 frontend somewhat close to my MATE Gtk3 desktop. Having found out about Kvantum, I stumbled across Adapta Gtk theme[0] and its port to KDE[1]. Its Nokto variant is just great. And they fit perfectly - Qt5 and Gtk3 and you cannot tell. smile

Now, that theme has its blueish accent color. And I just prefer a violet color instead. The last days I put a script together to switch colors for Kvantum themes - quite easy as it is a plain config and svg with hex-rgb color values to replace - and for Gtk 2/3 themes. Gtk is not quite so easy. There are css and svg - again easy -  but there are png and gresource files - png and css container.

Luckily, there is imagemagick's convert and its documentation, gresource and glib-compile-resources to unpack gtk resource files, recolor all png and bundle things up again.

I wonder if this is anyhow useful to anyone but me. O well, whenever I got something I like to make it public. You never know when it may come handy to you?! So, here is the script and take the pieces with pride, if it hoses your system. Have fun! big_smile

#!/bin/bash

# Copyright (c) 2019, Hanno Meyer-Thurow
# All rights reserved.
#
# FreeBSD License (2-clause BSD License)
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 
# 1. Redistributions of source code must retain the above copyright notice, this
#    list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
#    this list of conditions and the following disclaimer in the documentation
#    and/or other materials provided with the distribution.
# 
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# 
# The views and conclusions contained in the software and documentation are those
# of the authors and should not be interpreted as representing official policies,
# either expressed or implied, of the <project name> project.

# CONFIGURATION
#
# only basic error checking, so make sure all configuration are valid

# Kvantum theme is used as-is
theme_kvantum="AdaptaNokto"

# Gtk theme is used as variants
# (meaning an asterisk is appended)
theme_gtk="Adapta-Nokto"

# old rgb colors
color_old_accented="#4db6ac"
color_old_selected="#00bcd4"
color_old_altered="#05abc1"
color_old_background="#009688"

# new rgb colors
color_new_accented="#a146ff"
color_new_selected="#662477"
color_new_altered="#612453"
color_new_background="#880096"

# png recoloring
#
# - imagemagick modulate - percentage difference - base 100
#
# - modulate value order in reversed hsl colorspace
#
# - generated by http://www.fmwconcepts.com/imagemagick/colorconverter/index.php
#
# $ ~/colorconverter -c "#00bcd4" | grep hsl
# hsl(187,255,106)
# hsl(187,100%,41.5686%)
#
# $ ~/colorconverter -c "#662477" | grep hsl
# hsl(288,137,78)
# hsl(288,53.5485%,30.3929%)
#
# 30.3929 / 41.5686	= 73.115
# 53.5485 / 100		= 53.5485
# 288 / 187		= 154.0107
recolor_old_hsl="hsl(187,100%,41.5686%)"
recolor_mod_lsh="73.115,53.5485,154.0107"

# PARAMETERS
#
# set options

debug=""
find_follow_symlinks=""
gtk_theme_resource="gtk.gresource"
gnome_shell_theme_resource="gnome-shell-theme.gresource"
verbose=""

while [ ${#} -gt 0 ]
do
	case "${1}" in
	-d|--debug)
		debug="true"
		shift
		;;
	-l|--follow-symlinks)
		find_follow_symlinks="-L"
		shift
		;;
	-g|--gtk-theme-resource)
		gtk_theme_resource="${2}.gresource"
		shift
		shift
		;;
	-s|--gnome-shell-theme-resource)
		gnome_shell_theme_resource="${2}.gresource"
		shift
		shift
		;;
	-v|--verbose)
		verbose="true"
		shift
		;;
	*)
		echo "unknown parameter: ${1}"
		exit -1
		;;
	esac
done

# PROCESSING
#
# no change from here on

clr_old_acc_lc="$(echo ${color_old_accented} | tr '[:upper:]' '[:lower:]')"
clr_old_sel_lc="$(echo ${color_old_selected} | tr '[:upper:]' '[:lower:]')"
clr_old_alt_lc="$(echo ${color_old_altered} | tr '[:upper:]' '[:lower:]')"
clr_old_bkg_lc="$(echo ${color_old_background} | tr '[:upper:]' '[:lower:]')"

clr_old_acc_uc="$(echo ${color_old_accented} | tr '[:lower:]' '[:upper:]')"
clr_old_sel_uc="$(echo ${color_old_selected} | tr '[:lower:]' '[:upper:]')"
clr_old_alt_uc="$(echo ${color_old_altered} | tr '[:lower:]' '[:upper:]')"
clr_old_bkg_uc="$(echo ${color_old_background} | tr '[:lower:]' '[:upper:]')"

clr_new_acc_lc="$(echo ${color_new_accented} | tr '[:upper:]' '[:lower:]')"
clr_new_sel_lc="$(echo ${color_new_selected} | tr '[:upper:]' '[:lower:]')"
clr_new_alt_lc="$(echo ${color_new_altered} | tr '[:upper:]' '[:lower:]')"
clr_new_bkg_lc="$(echo ${color_new_background} | tr '[:upper:]' '[:lower:]')"

clr_new_acc_uc="$(echo ${color_new_accented} | tr '[:lower:]' '[:upper:]')"
clr_new_sel_uc="$(echo ${color_new_selected} | tr '[:lower:]' '[:upper:]')"
clr_new_alt_uc="$(echo ${color_new_altered} | tr '[:lower:]' '[:upper:]')"
clr_new_bkg_uc="$(echo ${color_new_background} | tr '[:lower:]' '[:upper:]')"

clr_old_acc_rgb="$(printf "%d, %d, %d" \
	0x${clr_old_acc_uc:1:2} 0x${clr_old_acc_uc:3:2} 0x${clr_old_acc_uc:5:2})"
clr_old_sel_rgb="$(printf "%d, %d, %d" \
	0x${clr_old_sel_uc:1:2} 0x${clr_old_sel_uc:3:2} 0x${clr_old_sel_uc:5:2})"
clr_old_alt_rgb="$(printf "%d, %d, %d" \
	0x${clr_old_alt_uc:1:2} 0x${clr_old_alt_uc:3:2} 0x${clr_old_alt_uc:5:2})"
clr_old_bkg_rgb="$(printf "%d, %d, %d" \
	0x${clr_old_bkg_uc:1:2} 0x${clr_old_bkg_uc:3:2} 0x${clr_old_bkg_uc:5:2})"

clr_new_acc_rgb="$(printf "%d, %d, %d" \
	0x${clr_new_acc_uc:1:2} 0x${clr_new_acc_uc:3:2} 0x${clr_new_acc_uc:5:2})"
clr_new_sel_rgb="$(printf "%d, %d, %d" \
	0x${clr_new_sel_uc:1:2} 0x${clr_new_sel_uc:3:2} 0x${clr_new_sel_uc:5:2})"
clr_new_alt_rgb="$(printf "%d, %d, %d" \
	0x${clr_new_alt_uc:1:2} 0x${clr_new_alt_uc:3:2} 0x${clr_new_alt_uc:5:2})"
clr_new_bkg_rgb="$(printf "%d, %d, %d" \
	0x${clr_new_bkg_uc:1:2} 0x${clr_new_bkg_uc:3:2} 0x${clr_new_bkg_uc:5:2})"

if [ "${debug}" = "true" ]
then
	echo "parameter debug: ${debug}"
	echo "parameter verbose: ${verbose}"
	echo
	echo "parameter gtk theme resource: ${gtk_theme_resource}"
	echo "parameter gnome shell theme resource: ${gnome_shell_theme_resource}"
	echo "parameter find follow symlinks: ${find_follow_symlinks}"
	echo
	echo "clr_old_acc_lc=${clr_old_acc_lc}"
	echo "clr_old_sel_lc=${clr_old_sel_lc}"
	echo "clr_old_alt_lc=${clr_old_alt_lc}"
	echo "clr_old_bkg_lc=${clr_old_bkg_lc}"
	echo
	echo "clr_old_acc_uc=${clr_old_acc_uc}"
	echo "clr_old_sel_uc=${clr_old_sel_uc}"
	echo "clr_old_alt_uc=${clr_old_alt_uc}"
	echo "clr_old_bkg_uc=${clr_old_bkg_uc}"
	echo
	echo "clr_new_acc_lc=${clr_new_acc_lc}"
	echo "clr_new_sel_lc=${clr_new_sel_lc}"
	echo "clr_new_alt_lc=${clr_new_alt_lc}"
	echo "clr_new_bkg_lc=${clr_new_bkg_lc}"
	echo
	echo "clr_new_acc_uc=${clr_new_acc_uc}"
	echo "clr_new_sel_uc=${clr_new_sel_uc}"
	echo "clr_new_alt_uc=${clr_new_alt_uc}"
	echo "clr_new_bkg_uc=${clr_new_bkg_uc}"
	echo
	echo "clr_old_acc_rgb=${clr_old_acc_rgb}"
	echo "clr_old_sel_rgb=${clr_old_sel_rgb}"
	echo "clr_old_alt_rgb=${clr_old_alt_rgb}"
	echo "clr_old_bkg_rgb=${clr_old_bkg_rgb}"
	echo
	echo "clr_new_acc_rgb=${clr_new_acc_rgb}"
	echo "clr_new_sel_rgb=${clr_new_sel_rgb}"
	echo "clr_new_alt_rgb=${clr_new_alt_rgb}"
	echo "clr_new_bkg_rgb=${clr_new_bkg_rgb}"

	exit 0
fi

pushd /usr/share/Kvantum || exit 1
[ "${verbose}" = "true" ] && echo " * replacing colors in ${theme_kvantum}"

sed -i "s:${clr_old_acc_lc}:${clr_new_acc_lc}:g" "${theme_kvantum}"/*.*
sed -i "s:${clr_old_sel_lc}:${clr_new_sel_lc}:g" "${theme_kvantum}"/*.*
popd

pushd /usr/share/themes || exit 1
# extract data from resource blobs
for g in $(find "${theme_gtk}"* -type f -name "${gtk_theme_resource}")
do
	gtk_dir="${g%/*}"

	pushd "${gtk_dir}" || continue
	res_css="$(gresource list ${gtk_theme_resource} | grep css | head -n1)"
	res_prefix="${res_css%/*}"
	res_dir="${res_prefix##*/}"

	if [ "${res_dir}" = "" ]
	then
		echo " * failed with css:${res_css} - prefix:${res_prefix} - dir:<empty>"

		popd
		continue
	fi

	[ "${verbose}" = "true" ] && echo " * resource path: ${gtk_dir}"

	mkdir -vp "${res_dir}"/assets

	for r in $(gresource list ${gtk_theme_resource})
	do
		[ "${verbose}" = "true" ] && echo "extract: ${r}"

		gresource extract ${gtk_theme_resource} ${r} \
			> "${res_dir}"/"${r##*${res_dir}/}"
	done
	popd
done

for g in $(find "${theme_gtk}"* -type f -name "${gnome_shell_theme_resource}")
do
	gtk_dir="${g%/*}"

	pushd "${gtk_dir}" || continue
	res_prefix="/org/gnome/shell/theme/"

	[ "${verbose}" = "true" ] && echo " * resource path: ${gtk_dir}"

	mkdir -vp assets icons

	for r in $(gresource list ${gnome_shell_theme_resource})
	do
		[ "${verbose}" = "true" ] && echo "extract: ${r}"

		gresource extract ${gnome_shell_theme_resource} ${r} \
			> "${r/"${res_prefix}"}"
	done
	popd
done

# recolor css/svg/xml/rc
[ "${verbose}" = "true" ] && echo " * replacing colors in ${theme_gtk}*"

for f in css svg rc xml
do
	find ${find_follow_symlinks} "${theme_gtk}"* -type f \
		-name '*.'${f} -exec sed \
		-e "s:${clr_old_acc_uc}:${clr_new_acc_uc}:g" \
		-e "s:${clr_old_sel_uc}:${clr_new_sel_uc}:g" \
		-e "s:${clr_old_alt_uc}:${clr_new_alt_uc}:g" \
		-e "s:${clr_old_bkg_uc}:${clr_new_bkg_uc}:g" \
		-e "s:(${clr_old_acc_rgb}:(${clr_new_acc_rgb}:g" \
		-e "s:(${clr_old_sel_rgb}:(${clr_new_sel_rgb}:g" \
		-e "s:(${clr_old_alt_rgb}:(${clr_new_alt_rgb}:g" \
		-e "s:(${clr_old_bkg_rgb}:(${clr_new_bkg_rgb}:g" \
		-i {} +
done

# recolor png
for f in $(find ${find_follow_symlinks} "${theme_gtk}"* -type f -name '*.png')
do
	file="${f/\.png}"
	f_mask="${file}-mask.png"
	f_out="${file}-out.png"

	[ "${verbose}" = "true" ] && echo "recoloring: ${f}"

	convert "${f}" -colorspace HSL -channel Hue,Saturation -separate +channel \
		-background none -fuzz 10% -transparent "${recolor_old_hsl}" \
		-composite -negate "${f_mask}"
	convert "${f}" -mask "${f_mask}" -modulate ${recolor_mod_lsh} \
		+mask "${f_out}"

	mv "${f_out}" "${f}"
	rm -f "${f_mask}"
done

# rebuild data into resource blobs
for g in $(find "${theme_gtk}"* -type f -name "${gtk_theme_resource}")
do
	gtk_dir="${g%/*}"

	pushd "${gtk_dir}" || continue
	res_css="$(gresource list ${gtk_theme_resource} | grep css | head -n1)"
	res_prefix="${res_css%/*}"
	res_dir="${res_prefix##*/}"

	if [ ! -d "${res_dir}" ]
	then
		echo " * failed with css:${res_css} - prefix:${res_prefix} - dir:${res_dir}"

		popd
		continue
	fi

	[ "${verbose}" = "true" ] && echo " * resource path: ${gtk_dir}"

	pushd "${res_dir}"
	echo "<?xml version="1.0" encoding="UTF-8"?>" > ${gtk_theme_resource}.xml
	echo "<gresources>" >> ${gtk_theme_resource}.xml
	echo "  <gresource prefix=\"${res_prefix}\">" >> ${gtk_theme_resource}.xml
	for f in $(find * -type f | sort -u | grep -v \.xml)
	do
		echo "    <file>${f}</file>" >> ${gtk_theme_resource}.xml
	done
	echo "  </gresource>" >> ${gtk_theme_resource}.xml
	echo "</gresources>" >> ${gtk_theme_resource}.xml
	popd

	[ "${verbose}" = "true" ] && echo "compile: ${res_dir}/${gtk_theme_resource}"

	glib-compile-resources --target="${res_dir}"/${gtk_theme_resource} \
		--sourcedir="${res_dir}" "${res_dir}"/${gtk_theme_resource}.xml

	if [ ${?} -eq 0 ]
	then
		mv -v "${res_dir}"/${gtk_theme_resource} ${gtk_theme_resource}
	else
		echo " * resource not regenerated in ${gtk_dir}"
	fi

	rm -rf "${res_dir}"
	popd
done

for g in $(find "${theme_gtk}"* -type f -name "${gnome_shell_theme_resource}")
do
	gtk_dir="${g%/*}"

	pushd "${gtk_dir}" || continue
	res_prefix="/org/gnome/shell/theme/"

	[ "${verbose}" = "true" ] && echo " * resource path: ${gtk_dir}"

	echo "<?xml version="1.0" encoding="UTF-8"?>" > ${gnome_shell_theme_resource}.xml
	echo "<gresources>" >> ${gnome_shell_theme_resource}.xml
	echo "  <gresource prefix=\"${res_prefix}\">" >> ${gnome_shell_theme_resource}.xml
	for r in $(gresource list ${gnome_shell_theme_resource})
	do
		echo "    <file>${r/"${res_prefix}"}</file>" >> ${gnome_shell_theme_resource}.xml
	done
	echo "  </gresource>" >> ${gnome_shell_theme_resource}.xml
	echo "</gresources>" >> ${gnome_shell_theme_resource}.xml

	[ "${verbose}" = "true" ] && echo "compile: new_${gnome_shell_theme_resource}"

	glib-compile-resources --target="new_${gnome_shell_theme_resource}" \
		--sourcedir=. ${gnome_shell_theme_resource}.xml

	if [ ${?} -eq 0 ]
	then
		mv -v "new_${gnome_shell_theme_resource}" ${gnome_shell_theme_resource}
	else
		echo " * resource not regenerated in ${gtk_dir}"
	fi

	rm -f ${gnome_shell_theme_resource}.xml
	popd
done
popd

unset theme_kvantum theme_gtk \
	color_old_accented color_old_selected color_old_altered \
	color_old_background color_new_accented color_new_selected \
	color_new_altered color_new_background \
	clr_old_acc_lc clr_old_sel_lc clr_old_alt_lc clr_old_bkg_lc \
	clr_old_acc_uc clr_old_sel_uc clr_old_alt_uc clr_old_bkg_uc \
	clr_old_acc_rgb clr_old_sel_rgb clr_old_alt_rgb clr_old_bkg_rgb \
	clr_new_acc_lc clr_new_sel_lc clr_new_alt_lc clr_new_bkg_lc \
	clr_new_acc_uc clr_new_sel_uc clr_new_alt_uc clr_new_bkg_uc \
	clr_new_acc_rgb clr_new_sel_rgb clr_new_alt_rgb clr_new_bkg_rgb \
	recolor_old_hsl recolor_mod_lsh f file f_mask f_out \
	res_css res_prefix res_dir g gtk_dir \
	debug find_follow_symlinks gtk_theme_resource \
	gnome_shell_theme_resource verbose

exit 0

[0] https://github.com/adapta-project/adapt … /README.md
[1] https://github.com/PapirusDevelopmentTe … /README.md

Board footer

Forum Software