From 8a4282df8110db03f2f5b0b43f8362d57e1a59d7 Mon Sep 17 00:00:00 2001 From: grassblock Date: Mon, 9 Dec 2024 22:11:37 +0800 Subject: [PATCH] feat: darkman for auto darkmode --- README.md | 1 + .../executable_desktop-notification.sh | 6 ++++ .../dark-mode.d/executable_global-theme.sh | 34 +++++++++++++++++++ .../dark-mode.d/executable_kde-gtk-theme.sh | 7 ++++ .../dark-mode.d/executable_kitty.sh | 2 ++ .../executable_desktop-notification.sh | 6 ++++ .../light-mode.d/executable_global-theme.sh | 29 ++++++++++++++++ .../light-mode.d/executable_kde-gtk-theme.sh | 7 ++++ .../light-mode.d/executable_kitty.sh | 2 ++ 9 files changed, 94 insertions(+) create mode 100644 home/private_dot_local/private_share/dark-mode.d/executable_desktop-notification.sh create mode 100644 home/private_dot_local/private_share/dark-mode.d/executable_global-theme.sh create mode 100644 home/private_dot_local/private_share/dark-mode.d/executable_kde-gtk-theme.sh create mode 100644 home/private_dot_local/private_share/dark-mode.d/executable_kitty.sh create mode 100644 home/private_dot_local/private_share/light-mode.d/executable_desktop-notification.sh create mode 100644 home/private_dot_local/private_share/light-mode.d/executable_global-theme.sh create mode 100644 home/private_dot_local/private_share/light-mode.d/executable_kde-gtk-theme.sh create mode 100644 home/private_dot_local/private_share/light-mode.d/executable_kitty.sh diff --git a/README.md b/README.md index 8f21648..5ea1b22 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ chezmoi init https://codeberg.org/grassblock/hyprdots.git && chezmoi merge $FILE - udiskie - networkmanager_dmenu - gradience-git +- darkman # Themes - Nordic (gtk2/3) diff --git a/home/private_dot_local/private_share/dark-mode.d/executable_desktop-notification.sh b/home/private_dot_local/private_share/dark-mode.d/executable_desktop-notification.sh new file mode 100644 index 0000000..e29e357 --- /dev/null +++ b/home/private_dot_local/private_share/dark-mode.d/executable_desktop-notification.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# trigger a small, passive popup dialog to inform the user about darkman's activity +# reference https://wiki.archlinux.org/title/Desktop_notifications#Usage_in_programming + +notify-send --app-name="darkman" --urgency=low --icon=weather-clear-night "switching to dark mode" \ No newline at end of file diff --git a/home/private_dot_local/private_share/dark-mode.d/executable_global-theme.sh b/home/private_dot_local/private_share/dark-mode.d/executable_global-theme.sh new file mode 100644 index 0000000..5a01aa6 --- /dev/null +++ b/home/private_dot_local/private_share/dark-mode.d/executable_global-theme.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +# Change the global Plasma Theme. On Manjaro you can use "org.manjaro.breath-dark.desktop" +# or you can create your own global Plasma Theme with the "Plasma Look And Feel Explorer". +# Reference: https://userbase.kde.org/Plasma/Create_a_Global_Theme_Package +# +# Since Plasma 5.26 the lookandfeeltool does not work anymore without "faking" the screen. +# Reference: https://bugs.kde.org/show_bug.cgi?id=460643 + +# Global Theme +lookandfeeltool -platform offscreen --apply "Utterly-Nord" + +# Window decoration +# https://askubuntu.com/questions/1183294/switching-plasma-theme-from-the-command-line +kwriteconfig6 --file ~/.config/kwinrc --group org.kde.kdecoration2 --key library org.kde.klassy + +kwriteconfig6 --file ~/.config/kwinrc --group org.kde.kdecoration2 --key theme Klassy + +# Icon theme +/usr/lib/plasma-changeicons Papirus-Dark + +# gtk4 theme +flatpak run --command="gradience-cli" com.github.GradienceTeam.Gradience apply -n "Nord-bluish" --gtk gtk4 + +# application style +# https://reddit.com/r/kde/comments/f7wemr/how_change_application_style_without_system/ +kwriteconfig6 --file kdeglobals --group KDE --key widgetStyle Lightly + +# cursorTheme +# https://askubuntu.com/questions/1025338/how-can-i-set-the-cursor-theme-on-kde-plasma-5-programmatically +kwriteconfig6 --file ~/.config/kcminputrc --group Mouse --key cursorTheme Bibata-Modern-Ice + +# notify +notify-send --app-name="darkman" --urgency=low --icon=weather-clear "theme switch success. to make them fully take effect, please logout and login again." diff --git a/home/private_dot_local/private_share/dark-mode.d/executable_kde-gtk-theme.sh b/home/private_dot_local/private_share/dark-mode.d/executable_kde-gtk-theme.sh new file mode 100644 index 0000000..49132ee --- /dev/null +++ b/home/private_dot_local/private_share/dark-mode.d/executable_kde-gtk-theme.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +# GTK apps are not affected by the Plasma Global Theme, which only applies to Qt based programs. +# GTK themes can be installed here: Global Theme > Application Style > Configure GNOME/GTK Application Style. +# Reference: https://wiki.archlinux.org/title/Uniform_look_for_Qt_and_GTK_applications + +dbus-send --session --dest=org.kde.GtkConfig --type=method_call /GtkConfig org.kde.GtkConfig.setGtkTheme "string:Nordic-bluish-dark" diff --git a/home/private_dot_local/private_share/dark-mode.d/executable_kitty.sh b/home/private_dot_local/private_share/dark-mode.d/executable_kitty.sh new file mode 100644 index 0000000..f220a8c --- /dev/null +++ b/home/private_dot_local/private_share/dark-mode.d/executable_kitty.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +kitten themes --config-file-name=themes.conf --reload-in=all "Nord" diff --git a/home/private_dot_local/private_share/light-mode.d/executable_desktop-notification.sh b/home/private_dot_local/private_share/light-mode.d/executable_desktop-notification.sh new file mode 100644 index 0000000..160edde --- /dev/null +++ b/home/private_dot_local/private_share/light-mode.d/executable_desktop-notification.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# trigger a small, passive popup dialog to inform the user about darkman's activity +# reference https://wiki.archlinux.org/title/Desktop_notifications#Usage_in_programming + +notify-send --app-name="darkman" --urgency=low --icon=weather-clear "switching to light mode" \ No newline at end of file diff --git a/home/private_dot_local/private_share/light-mode.d/executable_global-theme.sh b/home/private_dot_local/private_share/light-mode.d/executable_global-theme.sh new file mode 100644 index 0000000..4f0afd7 --- /dev/null +++ b/home/private_dot_local/private_share/light-mode.d/executable_global-theme.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +# Change the global Plasma Theme. On Manjaro you can use "org.manjaro.breath-light.desktop" +# or you can create your own global Plasma Theme with the "Plasma Look And Feel Explorer". +# Reference: https://userbase.kde.org/Plasma/Create_a_Global_Theme_Package +# +# Since Plasma 5.26 the lookandfeeltool does not work anymore without "faking" the screen. +# Reference: https://bugs.kde.org/show_bug.cgi?id=460643 + +# Global Theme +lookandfeeltool -platform offscreen --apply "Utterly-Nord-Light" + +# Window decoration +# https://askubuntu.com/questions/1183294/switching-plasma-theme-from-the-command-line +kwriteconfig6 --file ~/.config/kwinrc --group org.kde.kdecoration2 --key library org.kde.klassy + +kwriteconfig6 --file ~/.config/kwinrc --group org.kde.kdecoration2 --key theme Klassy + +# Icon theme +/usr/lib/plasma-changeicons Papirus-Light + +# gtk4 theme +flatpak run --command="gradience-cli" com.github.GradienceTeam.Gradience apply -n "Nord Semi-Light" --gtk gtk4 + +# application style +kwriteconfig6 --file kdeglobals --group KDE --key widgetStyle Lightly + +# notify +notify-send --app-name="darkman" --urgency=low --icon=weather-clear "theme switch success. to make them fully take effect, please logout and login again." diff --git a/home/private_dot_local/private_share/light-mode.d/executable_kde-gtk-theme.sh b/home/private_dot_local/private_share/light-mode.d/executable_kde-gtk-theme.sh new file mode 100644 index 0000000..fbcdfd4 --- /dev/null +++ b/home/private_dot_local/private_share/light-mode.d/executable_kde-gtk-theme.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +# GTK apps are not affected by the Plasma Global Theme, which only applies to Qt based programs. +# GTK themes can be installed here: Global Theme > Application Style > Configure GNOME/GTK Application Style. +# Reference: https://wiki.archlinux.org/title/Uniform_look_for_Qt_and_GTK_applications + +dbus-send --session --dest=org.kde.GtkConfig --type=method_call /GtkConfig org.kde.GtkConfig.setGtkTheme "string:Vimix-light-beryl" diff --git a/home/private_dot_local/private_share/light-mode.d/executable_kitty.sh b/home/private_dot_local/private_share/light-mode.d/executable_kitty.sh new file mode 100644 index 0000000..0cbf5a2 --- /dev/null +++ b/home/private_dot_local/private_share/light-mode.d/executable_kitty.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +kitten themes --config-file-name=themes.conf "PaperColor Light"