Compare commits
45 Commits
tio-patch-
...
339d4113d6
Author | SHA1 | Date | |
---|---|---|---|
339d4113d6 | |||
|
c79c2ed7e8 | ||
|
696fc180c8 | ||
|
f97cecf89c | ||
|
300dd23942 | ||
|
7f58471475 | ||
|
dd101c50b5 | ||
a575fb583e | |||
|
f3e1c0a14c | ||
54c1c74878 | |||
|
11a1a7dc91 | ||
|
85b0e75ff6 | ||
acf400bd54 | |||
4c5a39a77c | |||
|
d3c1054ec0 | ||
9056b40bc4 | |||
|
4d6446d47d | ||
859fe8c2fa | |||
|
19e75fc5c0 | ||
|
8fe0c425f7 | ||
|
e50903aab7 | ||
b417fdebe3 | |||
|
30aa304b4a | ||
|
79a22a493c | ||
69867e2af9 | |||
|
45ebde24a2 | ||
|
da34f2087f | ||
8fa15242e6 | |||
|
7125866bb8 | ||
b342545738 | |||
992c201eed | |||
|
f1a643cb34 | ||
146f416bc4 | |||
0b6549ccc6 | |||
dc00830e31 | |||
703f23f3f8 | |||
6536b3cb21 | |||
e0255d4763 | |||
3dca8cb2a0 | |||
ee1c98250b | |||
2803bf44f4 | |||
d8accac823 | |||
d6757d36c8 | |||
092b572cf3 | |||
ca5367307c |
10
Makefile
10
Makefile
@@ -1,12 +1,12 @@
|
|||||||
# makefile for theme-switcher
|
# makefile for tromjaro-theme-switcher
|
||||||
build:
|
build:
|
||||||
makepkg
|
makepkg -s
|
||||||
|
|
||||||
install:
|
install:
|
||||||
pamac-installer theme-switcher-*.tar.xz
|
pamac-installer tromjaro-theme-switcher-*.tar.zst
|
||||||
|
|
||||||
remove:
|
remove:
|
||||||
pamac-installer --remove theme-switcher
|
pamac-installer --remove tromjaro-theme-switcher
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) -rf src/ pkg/ *.tar.xz
|
$(RM) -rf src/ pkg/ icons.zip *.tar.zst
|
||||||
|
52
PKGBUILD
52
PKGBUILD
@@ -1,36 +1,60 @@
|
|||||||
# Maintainer: TROM <contact@tromsite.com>
|
# Maintainer: TROM <contact@tromsite.com>
|
||||||
pkgname=tromjaro-theme-switcher
|
pkgname=tromjaro-theme-switcher
|
||||||
pkgver=1.2.0
|
pkgver=2.1
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="TROMjaro Theme switcher application"
|
pkgdesc="TROMjaro Theme switcher application"
|
||||||
arch=(any)
|
arch=('x86_64')
|
||||||
url=""
|
url="https://git.trom.tf/TROMjaro/theme-switcher-package"
|
||||||
license=(unknown)
|
license=(unknown)
|
||||||
depends=('yad'
|
depends=('tromjaro-fixes'
|
||||||
'zafiro-icon-theme'
|
'xfconf'
|
||||||
'skeuos-gtk')
|
'gtk4'
|
||||||
|
'colloid-gtk-theme-git'
|
||||||
|
'colloid-dracula-gtk-theme-git'
|
||||||
|
'colloid-gruvbox-gtk-theme-git'
|
||||||
|
'colloid-nord-gtk-theme-git'
|
||||||
|
'zafiro-icon-theme')
|
||||||
|
makedepends=('choosenim')
|
||||||
provides=('tromjaro-theme-switcher')
|
provides=('tromjaro-theme-switcher')
|
||||||
backup=()
|
backup=()
|
||||||
options=(!strip)
|
options=(!strip)
|
||||||
source=("theme-switcher"
|
source=("themeSwitcher.nim"
|
||||||
"tromjaro-theme-switcher.desktop"
|
"tromjaro-theme-switcher.desktop"
|
||||||
"tromjaro-theme-switcher.svg"
|
"tromjaro-theme-switcher.svg"
|
||||||
"https://www.drive.tromsite.com/s/zFtCp3SkZ4NpKix/download")
|
"icons.zip::https://www.drive.tromsite.com/s/zFtCp3SkZ4NpKix/download")
|
||||||
sha256sums=('SKIP'
|
sha256sums=('SKIP'
|
||||||
'SKIP'
|
'SKIP'
|
||||||
'SKIP'
|
'SKIP'
|
||||||
'SKIP')
|
'SKIP')
|
||||||
|
prepare() {
|
||||||
|
# Disable telemetry in choosenim if user is running it for the first time
|
||||||
|
[ -f "$HOME"/.choosenim/analytics ] || {
|
||||||
|
mkdir -p "$HOME"/.choosenim
|
||||||
|
touch "$HOME"/.choosenim/analytics
|
||||||
|
}
|
||||||
|
echo 'Install Nim if not already installed:'
|
||||||
|
choosenim stable
|
||||||
|
echo 'Update Nim to the latest stable release:'
|
||||||
|
choosenim update stable
|
||||||
|
echo 'Refresh nimble package list:'
|
||||||
|
"$HOME"/.nimble/bin/nimble --nim:"$HOME"/.nimble/bin/nim refresh
|
||||||
|
echo 'Install owlkettle from the latest git commit:'
|
||||||
|
"$HOME"/.nimble/bin/nimble --nim:"$HOME"/.nimble/bin/nim install owlkettle
|
||||||
|
}
|
||||||
|
build(){
|
||||||
|
echo 'Compile themeSwitcher.nim for release build:'
|
||||||
|
"$HOME"/.nimble/bin/nim c -d:release --out:${srcdir}/themeSwitcher ${srcdir}/themeSwitcher.nim
|
||||||
|
}
|
||||||
package() {
|
package() {
|
||||||
# copy icons
|
# copy icons
|
||||||
install -d ${pkgdir}/usr/share/tromjaro-theme-switcher/icons
|
install -d ${pkgdir}/usr/share/tromjaro-theme-switcher/icons
|
||||||
install -Dm644 ${srcdir}/icons/* ${pkgdir}/usr/share/tromjaro-theme-switcher/icons
|
install -Dm644 ${srcdir}/icons/* ${pkgdir}/usr/share/tromjaro-theme-switcher/icons
|
||||||
|
|
||||||
# copy executables
|
# copy executables
|
||||||
install -Dm644 ${srcdir}/tromjaro-theme-switcher.desktop ${pkgdir}/usr/share/applications/tromjaro-theme-switcher.desktop
|
install -Dm644 ${srcdir}/tromjaro-theme-switcher.desktop ${pkgdir}/usr/share/applications/tromjaro-theme-switcher.desktop
|
||||||
install -Dm755 ${srcdir}/theme-switcher ${pkgdir}/usr/bin/tromjaro-theme-switcher
|
install -Dm755 ${srcdir}/themeSwitcher ${pkgdir}/usr/bin/tromjaro-theme-switcher
|
||||||
|
|
||||||
# copy the icon
|
# copy the icon
|
||||||
install -d ${pkgdir}/usr/share/icons/hicolor/scalable/apps
|
install -d ${pkgdir}/usr/share/icons/hicolor/scalable/apps
|
||||||
install -Dm644 ${srcdir}/tromjaro-theme-switcher.svg ${pkgdir}/usr/share/icons/hicolor/scalable/apps
|
install -Dm644 ${srcdir}/tromjaro-theme-switcher.svg ${pkgdir}/usr/share/icons/hicolor/scalable/apps
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
# TROMjaro Theme switcher package
|
# TROMjaro Theme switcher
|
||||||
|
|
||||||
TROMjaro Theme switcher application
|
A Theme Switcher app for TROMjaro's default theme-set ([Colloid](https://github.com/vinceliuice/Colloid-gtk-theme)) and icon-set ([Zafiro](https://github.com/zayronxio/Zafiro-icons)). It gives you a nice and easy interface to try out different themes quickly.
|
||||||
|
|
||||||
|
<video width="720" height="480" controls autoplay title="Screen recording of the app in action" src="https://git.trom.tf/TROMjaro/theme-switcher-package/raw/branch/main/screenRecord.mp4" type="video/mp4"></video>
|
||||||
|
|
||||||
## Building the package
|
## Building the package
|
||||||
|
|
||||||
@@ -16,6 +18,6 @@ To remove just installed package, use:
|
|||||||
|
|
||||||
`make remove`
|
`make remove`
|
||||||
|
|
||||||
To cleanup the project, use:
|
To cleanup the project folder, use:
|
||||||
|
|
||||||
`make clean`
|
`make clean`
|
||||||
|
BIN
screenRecord.mp4
Normal file
BIN
screenRecord.mp4
Normal file
Binary file not shown.
@@ -1,60 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
icons=/usr/share/tromjaro-theme-switcher/icons
|
|
||||||
|
|
||||||
set_icon_theme() {
|
|
||||||
# Change icon theme in XFCE
|
|
||||||
xfconf-query -c xsettings -p /Net/IconThemeName -n -t string -s "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
set_theme() {
|
|
||||||
if [ "${1##*-}" = 'Light' ]; then
|
|
||||||
yad --image "dialog-question" --title '' --buttons-layout=center --text-align=center --button='DARK':1 --button='LIGHT':0 --text "Select the panels theme\n\nNote: dark panels may result in light icons over a light theme"
|
|
||||||
case $? in
|
|
||||||
1)
|
|
||||||
# Enable dark panels
|
|
||||||
xfconf-query -c xfce4-panel -p /panels/dark-mode -n -t bool -s true
|
|
||||||
# Use the dark icon theme
|
|
||||||
set_icon_theme zafiro-dark
|
|
||||||
;;
|
|
||||||
0)
|
|
||||||
# Disable dark panels
|
|
||||||
xfconf-query -c xfce4-panel -p /panels/dark-mode -n -t bool -s false
|
|
||||||
# Use the light icon theme
|
|
||||||
set_icon_theme zafiro
|
|
||||||
;;
|
|
||||||
*) exit ;;
|
|
||||||
esac
|
|
||||||
else
|
|
||||||
# Use the dark icon theme
|
|
||||||
set_icon_theme zafiro-dark
|
|
||||||
fi
|
|
||||||
# Change the main theme to the chosen one
|
|
||||||
xfconf-query -c xsettings -p /Net/ThemeName -n -t string -s "Skeuos-$1"
|
|
||||||
xfconf-query -c xfwm4 -p /general/theme -n -t string -s "Skeuos-$1-XFWM"
|
|
||||||
gsettings set org.gnome.desktop.interface gtk-theme "Skeuos-$1"
|
|
||||||
notify-send "Skeuos-$1 theme was enabled"
|
|
||||||
}
|
|
||||||
|
|
||||||
export -f set_icon_theme set_theme
|
|
||||||
|
|
||||||
yad --no-buttons --center --keep-icon-size --use-interp --title 'TROMjaro Theme Switcher' --text-align=center --text "A Theme Switcher for TROMjaro's default theme-set (Skeuos) and icon-set (Zafiro)." --form --columns 5 \
|
|
||||||
--field=!"$icons/Blue-Dark.png"!'Blue-Dark':FBTN "set_theme 'Blue-Dark'" \
|
|
||||||
--field=!"$icons/Violet-Dark.png"!'Violet-Dark':FBTN "set_theme 'Violet-Dark'" \
|
|
||||||
--field=!"$icons/Blue-Light.png"!'Blue-Light':FBTN "set_theme 'Blue-Light'" \
|
|
||||||
--field=!"$icons/Violet-Light.png"!'Violet-Light':FBTN "set_theme 'Violet-Light'" \
|
|
||||||
--field=!"$icons/Teal-Dark.png"!'Teal-Dark':FBTN "set_theme 'Teal-Dark'" \
|
|
||||||
--field=!"$icons/Orange-Dark.png"!'Orange-Dark':FBTN "set_theme 'Orange-Dark'" \
|
|
||||||
--field=!"$icons/Teal-Light.png"!'Teal-Light':FBTN "set_theme 'Teal-Light'" \
|
|
||||||
--field=!"$icons/Orange-Light.png"!'Orange-Light':FBTN "set_theme 'Orange-Light'" \
|
|
||||||
--field=!"$icons/Green-Dark.png"!'Green-Dark (default)':FBTN "set_theme 'Green-Dark'" \
|
|
||||||
--field=!"$icons/Brown-Dark.png"!'Brown-Dark':FBTN "set_theme 'Brown-Dark'" \
|
|
||||||
--field=!"$icons/Green-Light.png"!'Green-Light':FBTN "set_theme 'Green-Light'" \
|
|
||||||
--field=!"$icons/Brown-Light.png"!'Brown-Light':FBTN "set_theme 'Brown-Light'" \
|
|
||||||
--field=!"$icons/Magenta-Dark.png"!'Magenta-Dark':FBTN "set_theme 'Magenta-Dark'" \
|
|
||||||
--field=!"$icons/Yellow-Dark.png"!'Yellow-Dark':FBTN "set_theme 'Yellow-Dark'" \
|
|
||||||
--field=!"$icons/Magenta-Light.png"!'Magenta-Light':FBTN "set_theme 'Magenta-Light'" \
|
|
||||||
--field=!"$icons/Yellow-Light.png"!'Yellow-Light':FBTN "set_theme 'Yellow-Light'" \
|
|
||||||
--field=!"$icons/Red-Dark.png"!'Red-Dark':FBTN "set_theme 'Red-Dark'" \
|
|
||||||
--field=!"$icons/Grey-Dark.png"!'Grey-Dark':FBTN "set_theme 'Grey-Dark'" \
|
|
||||||
--field=!"$icons/Red-Light.png"!'Red-Light':FBTN "set_theme 'Red-Light'" \
|
|
||||||
--field=!"$icons/Grey-Light.png"!'Grey-Light':FBTN "set_theme 'Grey-Light'"
|
|
131
themeSwitcher.nim
Normal file
131
themeSwitcher.nim
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
from std/osproc import execProcess, ProcessOption, startProcess, waitForExit, close
|
||||||
|
from std/envvars import existsEnv, getEnv, delEnv, putEnv
|
||||||
|
from std/os import symlinkExists, getConfigDir, `/`
|
||||||
|
from std/options import Option, some, get, isNone
|
||||||
|
from std/strutils import split, endsWith
|
||||||
|
from std/strformat import fmt
|
||||||
|
import owlkettle
|
||||||
|
|
||||||
|
const
|
||||||
|
# Set the directory path where icons are stored
|
||||||
|
iconsDir = "/usr/share/tromjaro-theme-switcher/icons"
|
||||||
|
# GTK CSS for overriding the default icon size of buttons
|
||||||
|
gtkCSS = "button { -gtk-icon-size: 85px; }"
|
||||||
|
applicationID = "com.tromjaro.ThemeSwitcher"
|
||||||
|
themeColors = ["Grey", "Pink", "Green", "Orange", "Purple", "Yellow", "Teal"]
|
||||||
|
themeStyles = ["Light", "Nord", "Dark", "Dark-Nord"]
|
||||||
|
|
||||||
|
proc runCommand(command: string, args: openArray[string]): bool =
|
||||||
|
## This will run a command with the given args and return true upon success
|
||||||
|
let process = startProcess(command, args=args, options={poParentStreams})
|
||||||
|
result = process.waitForExit() == 0
|
||||||
|
process.close()
|
||||||
|
|
||||||
|
proc setIconTheme(iconName: string) =
|
||||||
|
# Change icon theme in XFCE
|
||||||
|
discard runCommand("/usr/bin/xfconf-query",
|
||||||
|
args=["--channel=xsettings", "--property=/Net/IconThemeName", "--create", "--type=string", "--set", iconName])
|
||||||
|
|
||||||
|
proc enableDarkPanels(): bool =
|
||||||
|
# Return if dark panels is already enabled
|
||||||
|
if execProcess("/usr/bin/xfconf-query",
|
||||||
|
args=["--channel=xfce4-panel", "--property=/panels/dark-mode"], options={}) == "true\n":
|
||||||
|
return
|
||||||
|
# Try to enable it and return true upon success
|
||||||
|
result = runCommand("/usr/bin/xfconf-query",
|
||||||
|
args=["--channel=xfce4-panel", "--property=/panels/dark-mode", "--create", "--type=bool", "--set=true"])
|
||||||
|
|
||||||
|
proc setTheme(themeName: string) =
|
||||||
|
|
||||||
|
var panelNotification: string
|
||||||
|
|
||||||
|
# Set the icon theme and panel color according to the chosen theme
|
||||||
|
if themeName.endsWith("-Dark") or themeName.endsWith("-Dark-Nord"):
|
||||||
|
setIconTheme("zafiro-dark")
|
||||||
|
else:
|
||||||
|
setIconTheme("zafiro")
|
||||||
|
if enableDarkPanels():
|
||||||
|
panelNotification = " with dark panels"
|
||||||
|
|
||||||
|
# Change the main theme to the chosen one
|
||||||
|
discard runCommand("/usr/bin/xfconf-query",
|
||||||
|
args=["--channel=xsettings", "--property=/Net/ThemeName", "--create", "--type=string", "--set", themeName])
|
||||||
|
|
||||||
|
# Send notification about the theme change
|
||||||
|
sendNotification(applicationID, "Theme Switcher", fmt"{themeName} theme{panelNotification} is enabled",
|
||||||
|
icon=fmt"{iconsDir}/{themeName}.svg")
|
||||||
|
|
||||||
|
|
||||||
|
var
|
||||||
|
oldConfigDir: Option[string]
|
||||||
|
configDirChanged: bool
|
||||||
|
|
||||||
|
# Prevent loading GTK theme from ~/.config/gtk-4.0 directory when it is a symlink
|
||||||
|
if symlinkExists(getConfigDir() / "gtk-4.0"):
|
||||||
|
if existsEnv("XDG_CONFIG_HOME"):
|
||||||
|
oldConfigDir = some(getEnv("XDG_CONFIG_HOME"))
|
||||||
|
putEnv("XDG_CONFIG_HOME", "/dev/null")
|
||||||
|
configDirChanged = true
|
||||||
|
|
||||||
|
# Display the GTK-4 GUI using owlkettle
|
||||||
|
viewable App:
|
||||||
|
highlightButton: array[2, string]
|
||||||
|
hooks:
|
||||||
|
build:
|
||||||
|
# Reset the user's XDG_CONFIG_HOME variable back to what it was before
|
||||||
|
if configDirChanged == true:
|
||||||
|
if oldConfigDir.isNone():
|
||||||
|
delEnv("XDG_CONFIG_HOME")
|
||||||
|
else:
|
||||||
|
putEnv("XDG_CONFIG_HOME", get(oldConfigDir))
|
||||||
|
|
||||||
|
let currentTheme: string = execProcess("/usr/bin/xfconf-query",
|
||||||
|
args=["--channel=xsettings", "--property=/Net/ThemeName"],
|
||||||
|
options={})[0 .. ^2]
|
||||||
|
|
||||||
|
let currentThemeSplit: seq[string] = currentTheme.split('-', 2)
|
||||||
|
|
||||||
|
if currentThemeSplit.len() < 3 or currentThemeSplit[0] != "Colloid":
|
||||||
|
return
|
||||||
|
|
||||||
|
let currentThemeColor = currentThemeSplit[1]
|
||||||
|
let currentThemeStyle = currentThemeSplit[2]
|
||||||
|
|
||||||
|
# Highlight current theme button
|
||||||
|
state.highlightButton = [currentThemeColor, currentThemeStyle]
|
||||||
|
|
||||||
|
method view(app: AppState): Widget =
|
||||||
|
result = gui:
|
||||||
|
Window:
|
||||||
|
title = "TROMjaro Theme Switcher"
|
||||||
|
# Shrink window to the smallest size
|
||||||
|
defaultSize = (0, 0)
|
||||||
|
iconName = "tromjaro-theme-switcher"
|
||||||
|
# Vertical box
|
||||||
|
Box(orient = OrientY, margin = 7, spacing = 5):
|
||||||
|
Label:
|
||||||
|
text="A Theme Switcher for TROMjaro's default theme-set (Colloid) and icon-set (Zafiro)."
|
||||||
|
Label {.vAlign: AlignStart.}:
|
||||||
|
useMarkup = true
|
||||||
|
text="<span size='small'>NOTE: Some apps need to be reopened for the theme to be applied.</span>"
|
||||||
|
for themeStyle in themeStyles:
|
||||||
|
# Horizontal box
|
||||||
|
Box(orient = OrientX, spacing = 5):
|
||||||
|
for themeColor in themeColors:
|
||||||
|
Button {.vAlign: AlignCenter, hAlign: AlignCenter.}:
|
||||||
|
icon = fmt"Colloid-{themeColor}-{themeStyle}"
|
||||||
|
# Teal-Dark-Nord theme will have "(default)" added to its tooltip
|
||||||
|
tooltip = if (themeColor, themeStyle) == ("Teal", "Dark-Nord"):
|
||||||
|
fmt"{themeColor}-{themeStyle} (default)"
|
||||||
|
else:
|
||||||
|
fmt"{themeColor}-{themeStyle}"
|
||||||
|
style = if [themeColor, themeStyle] == app.highlightButton:
|
||||||
|
ButtonSuggested
|
||||||
|
else:
|
||||||
|
ButtonFlat
|
||||||
|
proc clicked() =
|
||||||
|
setTheme(fmt"Colloid-{themeColor}-{themeStyle}")
|
||||||
|
# Highlight this button
|
||||||
|
app.highlightButton = [themeColor, themeStyle]
|
||||||
|
|
||||||
|
brew(applicationID, gui(App()), icons=[iconsDir], stylesheets=[newStylesheet(gtkCSS)])
|
Reference in New Issue
Block a user