Tag: theme

  • KDE Plasma sunrise (bright) & sunset (dark) theme automatic switch

    Under System Settings > Appearance & Style > Colours & Themes > Night Light in KDE Plasma there is the expected option to automatically switch at specific times between cool and warm colour temperature for the screen. I marked my location on the map and selected Sunset and sunrise at manual location to take care of the switch automatically. This works perfectly!

    For whichever reason, and there is many, KDE Plasma cannot do the same with the bright and dark theme. This is such a miss that one wonders how anything ever gets agreed upon in large open source projects such as KDE in this case. Gnome supports the option as many other.

    As there are more ways than one to skin a cat, I had several choices to work around this missing feature. I was really looking for something quick and dirty, nothing to install and trust, and easy to undo if needed.

    I decided to use the colour temperature as an indicator of when the bright or dark theme was needed. So at 6500 K it was the cool day light temperature and the bright theme should be used. On the contrary anything below this temperature, that is warm night light, should use the dark theme. Then I would simply check for this system value at a set interval and change the theme if it changed. This simple script is placed in the System Settings > System > Autostart section as an Application and it will launch upon boot and run in the background. Copy or download & unzip the below file and remember to make the .sh file executable:

    #!/bin/bash

    current_theme=""

    while true; do
    # Retrieve the current temperature from KWin using dbus-send
    temperature=$(dbus-send --session --dest=org.kde.KWin --type=method_call --print-reply \
    /org/kde/KWin/NightLight org.freedesktop.DBus.Properties.Get string:org.kde.KWin.NightLight string:currentTemperature \
    | grep -oP 'variant\s+uint32\s+\K\d+')

    # Decide the target theme based on the temperature
    if (( temperature == 6500 )); then
    target_theme="org.fedoraproject.fedora.desktop" # Light theme for == 6500
    elif (( temperature < 6500 )); then
    target_theme="org.kde.breezedark.desktop" # Dark theme for < 6500
    fi

    # Switch theme only if it's different from the current one
    if [[ "$target_theme" != "$current_theme" ]]; then
    lookandfeeltool -a "$target_theme"
    # Update the current theme to the new one
    current_theme="$target_theme"
    # KDE notification
    notify-send "Theme Switcher" "Switched to $(basename "$target_theme") theme."
    fi

    # Sleep for 15 minutes (900 seconds)
    sleep 900
    done

  • Thanks Ryan!

    My gratitude goes to Ryan Marganti from SoulSizzle Design for taking the time to notify me about my dysfunctional comment form.

    Thanks to his email I realised that apparently my blog suffered from an incompatibility between my latest active theme and the excellent spam stopper plugin. This caused all submitted comments to fail. This has now been fixed, well actually even improved a bit.

    No wonder I have had no comments for nearly two months… not even spam.

    Once more: Thank you Ryan!

  • Tags vs. Categories, my ontological classification

    When writing something I usually have a hard time categorising the content as very seldom it will fit into one single category. The solution to this may simply be adding it to more categories instead but then the category hierarchy actually breaks. Instead I definitely prefer to assign tags to content which is much more specific and does not limit you in any way, as there is really no predefined containers but instead any word in the vocabulary can be used to tag your content. During my research determining if WordPress actually had improved the categorisation system I came across an interesting piece of writing about ontology on the web which I recommend you to read through in its full length.

    The latest version of WordPress does seem to handle tags fine although there is some misconception between the tag and category idea. It is somehow mingled together to actually overlap each other although still not the same. I guess the WordPress developers are worried about legacy installations and possible issues during an upgrade path, so they keep things backwards compatible somehow.

    As you can see on this site I make no use of the categories whatsoever. I am forced by WordPress to assign any content to at least one category which I left as the default “Uncategorized”. The name is really irrelevant as I make no use of categories in the display. You may notice the tags assigned to each post just below the title where before the category was displayed.

    To make this little change depending on your theme you may have to edit a couple of files. In my own case I edited three files:

    1. page.php
    2. index.php
    3. single.php

    The change required is the same in all three files, namely replace the following snippet:

    <?php the_category(',') ?>

    with this one:

    <?php /*the_category(',')*/ the_tags( ' ', ', ', ''); ?>

    That is all. Now you will have a nice list of tags instead of the irrational categories list which does not really suit written content.