From 2990b556e2e4c8fdc6caca6edd218c535dc61b39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=9Eahin=20Akkaya?= Date: Mon, 25 Dec 2023 14:07:42 +0300 Subject: [PATCH] Add darkman config --- .config/darkman/config.yaml | 3 ++ .../darkman/scripts/desktop-notification.sh | 7 +++++ .../scripts/examples/kde-global-theme.sh | 12 +++++++ .../darkman/scripts/examples/kde-gtk-theme.sh | 16 ++++++++++ .config/darkman/scripts/examples/mako.sh | 3 ++ .config/darkman/scripts/gtk.sh | 4 +++ .config/darkman/scripts/terminal-stuff.sh | 31 +++++++++++++++++++ 7 files changed, 76 insertions(+) create mode 100644 .config/darkman/config.yaml create mode 100755 .config/darkman/scripts/desktop-notification.sh create mode 100755 .config/darkman/scripts/examples/kde-global-theme.sh create mode 100755 .config/darkman/scripts/examples/kde-gtk-theme.sh create mode 100755 .config/darkman/scripts/examples/mako.sh create mode 100755 .config/darkman/scripts/gtk.sh create mode 100755 .config/darkman/scripts/terminal-stuff.sh diff --git a/.config/darkman/config.yaml b/.config/darkman/config.yaml new file mode 100644 index 0000000..2185224 --- /dev/null +++ b/.config/darkman/config.yaml @@ -0,0 +1,3 @@ +lat: 40.0 +lng: 29.0 +dbusserver: true diff --git a/.config/darkman/scripts/desktop-notification.sh b/.config/darkman/scripts/desktop-notification.sh new file mode 100755 index 0000000..9614b59 --- /dev/null +++ b/.config/darkman/scripts/desktop-notification.sh @@ -0,0 +1,7 @@ +#!/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 + +theme=$(darkman get) +notify-send --app-name="darkman" --urgency=low --icon=weather-clear-night "switching to $theme mode" diff --git a/.config/darkman/scripts/examples/kde-global-theme.sh b/.config/darkman/scripts/examples/kde-global-theme.sh new file mode 100755 index 0000000..c074d66 --- /dev/null +++ b/.config/darkman/scripts/examples/kde-global-theme.sh @@ -0,0 +1,12 @@ +#!/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 + +lookandfeeltool -platform offscreen --apply "org.kde.breeze.desktop" +# lookandfeeltool -platform offscreen --apply "org.kde.breezetwilight.desktop" +# lookandfeeltool -platform offscreen --apply "org.kde.breezedark.desktop" diff --git a/.config/darkman/scripts/examples/kde-gtk-theme.sh b/.config/darkman/scripts/examples/kde-gtk-theme.sh new file mode 100755 index 0000000..694d68b --- /dev/null +++ b/.config/darkman/scripts/examples/kde-gtk-theme.sh @@ -0,0 +1,16 @@ +#!/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 + +source "$HOME/scripts/common-vars.sh" +if [ $theme == "dark" ]; then + theme_string="Breeze-dark-gtk" +else + theme_string="Default" +fi + +echo "string:$theme_string" + +dbus-send --session --dest=org.kde.GtkConfig --type=method_call /GtkConfig org.kde.GtkConfig.setGtkTheme "string:$theme_string" diff --git a/.config/darkman/scripts/examples/mako.sh b/.config/darkman/scripts/examples/mako.sh new file mode 100755 index 0000000..cc2baa5 --- /dev/null +++ b/.config/darkman/scripts/examples/mako.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +makoctl set-mode dark diff --git a/.config/darkman/scripts/gtk.sh b/.config/darkman/scripts/gtk.sh new file mode 100755 index 0000000..f56b5b2 --- /dev/null +++ b/.config/darkman/scripts/gtk.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +theme=$(darkman get) +gsettings set org.gnome.desktop.interface color-scheme "prefer-$theme" diff --git a/.config/darkman/scripts/terminal-stuff.sh b/.config/darkman/scripts/terminal-stuff.sh new file mode 100755 index 0000000..3da4a16 --- /dev/null +++ b/.config/darkman/scripts/terminal-stuff.sh @@ -0,0 +1,31 @@ +#!/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 + + +theme=$(darkman get) +PATH="$HOME/.local/bin/:$PATH" + +if [ $theme == "dark" ]; then + sed -i 's/tokyonight_day/tokyonight_storm/g' "$HOME/.config/kitty/kitty.conf" + sed -i 's/Light/Origin/g' "$HOME/.config/bat/config" + sed -i 's/flat-remix-light/tokyo-storm/g' "$HOME/.config/btop/btop.conf" +else + sed -i 's/tokyonight_storm/tokyonight_day/g' "$HOME/.config/kitty/kitty.conf" + sed -i 's/Origin/Light/g' "$HOME/.config/bat/config" + sed -i 's/tokyo-storm/flat-remix-light/g' "$HOME/.config/btop/btop.conf" +fi + +kill -SIGUSR1 $(pgrep kitty) +tmux source-file "$HOME/.config/tmux/$theme.conf" + + +# This uses the neovim-remote python package to control other neovim instances. +# see: https://github.com/mhinz/neovim-remote +# Further, it is assumed that toggling the background in neovim is enough. +# Anything else should be handled by the set color scheme. + +for server in $(nvr --serverlist); do + nvr --servername "$server" -cc "set background=$theme" +done