forked from Shinonome/dots-hyprland
ctrl+super+shift+d for dark/light toggle (like powertoys)
This commit is contained in:
@@ -5,6 +5,7 @@ import qs.modules.common
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import Quickshell.Hyprland
|
||||
|
||||
/**
|
||||
* Automatically reloads generated material colors.
|
||||
@@ -71,4 +72,26 @@ Singleton {
|
||||
}
|
||||
onLoadFailed: root.resetFilePathNextTime();
|
||||
}
|
||||
|
||||
function toggleLightDark() {
|
||||
const currentlyDark = Appearance.m3colors.darkmode;
|
||||
Quickshell.execDetached([Directories.wallpaperSwitchScriptPath, "--mode", currentlyDark ? "light" : "dark", "--noswitch"]);
|
||||
}
|
||||
|
||||
GlobalShortcut {
|
||||
name: "toggleLightDark"
|
||||
description: "Toggles between dark theme and light theme"
|
||||
|
||||
onPressed: {
|
||||
root.toggleLightDark();
|
||||
}
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
target: "theme"
|
||||
|
||||
function toggleLightDark(): void {
|
||||
root.toggleLightDark();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user