mirror of
https://github.com/belsabbagh/dotfiles.git
synced 2026-04-11 09:36:46 +00:00
quickshell and hyprland additions
This commit is contained in:
97
.config/quickshell/nucleus-shell/config/Ipc.qml
Normal file
97
.config/quickshell/nucleus-shell/config/Ipc.qml
Normal file
@@ -0,0 +1,97 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import qs.services
|
||||
import qs.modules.interface.settings
|
||||
|
||||
Scope {
|
||||
id: global
|
||||
|
||||
// Track if notification has already been shown
|
||||
property bool themeNotificationShown: false
|
||||
|
||||
// Function to show notification once
|
||||
function notifyPredefinedTheme() {
|
||||
if (!themeNotificationShown) {
|
||||
themeNotificationShown = true
|
||||
Quickshell.execDetached([
|
||||
"notify-send",
|
||||
"Nucleus Shell",
|
||||
`You are using a predefined theme ${Config.runtime.appearance.colors.scheme}. Color generation/Light Theme is not supported for this theme.`,
|
||||
"--urgency=normal",
|
||||
"--expire-time=5000"
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
// Handle Global IPCs
|
||||
IpcHandler {
|
||||
target: "global"
|
||||
|
||||
function toggleTheme() {
|
||||
const currentTheme = Config.runtime.appearance.theme
|
||||
const newTheme = currentTheme === "light" ? "dark" : "light"
|
||||
|
||||
// Predefined themes: validate variant BEFORE changing theme
|
||||
if (!Config.runtime.appearance.colors.autogenerated) {
|
||||
const scheme = Config.runtime.appearance.colors.scheme
|
||||
const file = Theme.map[scheme]?.[newTheme]
|
||||
|
||||
if (!file) {
|
||||
Theme.notifyMissingVariant(scheme, newTheme)
|
||||
return
|
||||
}
|
||||
|
||||
Config.updateKey("appearance.theme", newTheme)
|
||||
|
||||
Quickshell.execDetached([
|
||||
"bash",
|
||||
Directories.scriptsPath + "/interface/switchTheme.sh",
|
||||
file
|
||||
])
|
||||
return
|
||||
}
|
||||
|
||||
// Autogenerated themes: safe to toggle freely
|
||||
Config.updateKey("appearance.theme", newTheme)
|
||||
genThemeColors.running = true
|
||||
}
|
||||
|
||||
function regenColors() {
|
||||
if (Config.runtime.appearance.colors.autogenerated) {
|
||||
genThemeColors.running = true
|
||||
} else {
|
||||
notifyPredefinedTheme()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
property var genColorsCmd: Config.runtime.appearance.colors.runMatugenUserWide
|
||||
? [
|
||||
"bash",
|
||||
Directories.scriptsPath + "/interface/gencolors.sh",
|
||||
"--user-wide",
|
||||
Config.runtime.appearance.background.path,
|
||||
Config.runtime.appearance.colors.matugenScheme,
|
||||
Config.runtime.appearance.theme,
|
||||
Quickshell.shellPath("extras/matugen/config.toml")
|
||||
]
|
||||
: [
|
||||
"bash",
|
||||
Directories.scriptsPath + "/interface/gencolors.sh",
|
||||
Config.runtime.appearance.background.path,
|
||||
Config.runtime.appearance.colors.matugenScheme,
|
||||
Config.runtime.appearance.theme,
|
||||
Quickshell.shellPath("extras/matugen/config.toml")
|
||||
];
|
||||
|
||||
|
||||
|
||||
// Process to generate colors
|
||||
Process {
|
||||
id: genThemeColors
|
||||
|
||||
command: genColorsCmd
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user