Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Listening to System Theme #328

Open
mbeps opened this issue Nov 11, 2024 · 1 comment
Open

Listening to System Theme #328

mbeps opened this issue Nov 11, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@mbeps
Copy link

mbeps commented Nov 11, 2024

Is your feature request related to a problem? Please describe.
Currently, the extension does not change accent colours or listen to the current theme being applied in Gnome.

Describe the solution you'd like
The extension should be able to listen to the current accent colour and change its own accent colour (borders) too.

Describe alternatives you've considered
None

Additional context
Below is a demo:

Screencast.From.2024-11-11.20-35-53.mp4
@mbeps mbeps added the enhancement New feature or request label Nov 11, 2024
@mbeps
Copy link
Author

mbeps commented Nov 11, 2024

I am achieving this by using a script running as a process in the background. Below is the script for anyone who is interested.

#!/bin/bash

apply_pano_background() {
    color_scheme="$1"

    if [ "$color_scheme" == "'prefer-dark'" ]; then
        dconf write /org/gnome/shell/extensions/pano/window-background-color "'rgb(36,36,36)'"
    else
        dconf write /org/gnome/shell/extensions/pano/window-background-color "'rgb(242,242,242)'"
    fi
}

apply_pano_accent_color() {
    accent_color=$(gsettings get org.gnome.desktop.interface accent-color)

    case "$accent_color" in
        "'blue'")
            dconf write /org/gnome/shell/extensions/pano/active-item-border-color "'rgb(53,132,228)'"
            dconf write /org/gnome/shell/extensions/pano/hovered-item-border-color "'rgb(53,132,228)'"
            ;;
        "'teal'")
            dconf write /org/gnome/shell/extensions/pano/active-item-border-color "'rgb(33,144,164)'"
            dconf write /org/gnome/shell/extensions/pano/hovered-item-border-color "'rgb(33,144,164)'"
            ;;
        "'green'")
            dconf write /org/gnome/shell/extensions/pano/active-item-border-color "'rgb(58,148,74)'"
            dconf write /org/gnome/shell/extensions/pano/hovered-item-border-color "'rgb(58,148,74)'"
            ;;
        "'yellow'")
            dconf write /org/gnome/shell/extensions/pano/active-item-border-color "'rgb(200,136,0)'"
            dconf write /org/gnome/shell/extensions/pano/hovered-item-border-color "'rgb(200,136,0)'"
            ;;
        "'orange'")
            dconf write /org/gnome/shell/extensions/pano/active-item-border-color "'rgb(237,91,0)'"
            dconf write /org/gnome/shell/extensions/pano/hovered-item-border-color "'rgb(237,91,0)'"
            ;;
        "'red'")
            dconf write /org/gnome/shell/extensions/pano/active-item-border-color "'rgb(230,45,66)'"
            dconf write /org/gnome/shell/extensions/pano/hovered-item-border-color "'rgb(230,45,66)'"
            ;;
        "'pink'")
            dconf write /org/gnome/shell/extensions/pano/active-item-border-color "'rgb(213,97,153)'"
            dconf write /org/gnome/shell/extensions/pano/hovered-item-border-color "'rgb(213,97,153)'"
            ;;
        "'purple'")
            dconf write /org/gnome/shell/extensions/pano/active-item-border-color "'rgb(145,65,172)'"
            dconf write /org/gnome/shell/extensions/pano/hovered-item-border-color "'rgb(145,65,172)'"
            ;;
        "'slate'")
            dconf write /org/gnome/shell/extensions/pano/active-item-border-color "'rgb(111,131,150)'"
            dconf write /org/gnome/shell/extensions/pano/hovered-item-border-color "'rgb(111,131,150)'"
            ;;
        *)
            dconf write /org/gnome/shell/extensions/pano/active-item-border-color "'rgb(111,131,150)'"
            dconf write /org/gnome/shell/extensions/pano/hovered-item-border-color "'rgb(111,131,150)'"
            ;;
    esac
}

current_scheme=$(gsettings get org.gnome.desktop.interface color-scheme)
current_accent=$(gsettings get org.gnome.desktop.interface accent-color)

apply_pano_background "$current_scheme"
apply_pano_accent_color

gsettings monitor org.gnome.desktop.interface color-scheme | while read -r line; do
    current_scheme=$(gsettings get org.gnome.desktop.interface color-scheme)
    apply_pano_background "$current_scheme"
done &

gsettings monitor org.gnome.desktop.interface accent-color | while read -r line; do
    apply_pano_accent_color
done &

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant