ctrl+super+shift+d for dark/light toggle (like powertoys)

This commit is contained in:
end-4
2026-05-14 10:43:23 +02:00
parent d1daedc6d2
commit 239b532ec6
2 changed files with 27 additions and 3 deletions
+4 -3
View File
@@ -23,9 +23,8 @@ hl.bind("SUPER_R", hl.dsp.global("quickshell:workspaceNumber"), { ignore_mods =
hl.bind("SUPER_L", hl.dsp.global("quickshell:workspaceNumber"), { ignore_mods = true, transparent = true, release = true }) hl.bind("SUPER_L", hl.dsp.global("quickshell:workspaceNumber"), { ignore_mods = true, transparent = true, release = true })
hl.bind("SUPER_R", hl.dsp.global("quickshell:workspaceNumber"), { ignore_mods = true, transparent = true, release = true }) hl.bind("SUPER_R", hl.dsp.global("quickshell:workspaceNumber"), { ignore_mods = true, transparent = true, release = true })
hl.bind("SUPER + Tab", hl.dsp.global("quickshell:overviewWorkspacesToggle"), { description = "Shell: Toggle overview" }) hl.bind("SUPER + Tab", hl.dsp.global("quickshell:overviewWorkspacesToggle"), { description = "Shell: Toggle overview" })
hl.bind("SUPER + V", hl.dsp.global("quickshell:overviewClipboardToggle"), hl.bind("SUPER + V", hl.dsp.global("quickshell:overviewClipboardToggle"))
{ description = "Shell: Clipboard history >> clipboard" }) hl.bind("SUPER + Period", hl.dsp.global("quickshell:overviewEmojiToggle"))
hl.bind("SUPER + Period", hl.dsp.global("quickshell:overviewEmojiToggle"), { description = "Shell: Emoji >> clipboard" })
hl.bind("SUPER + A", hl.dsp.global("quickshell:sidebarLeftToggle"), { description = "Shell: Toggle left sidebar" }) hl.bind("SUPER + A", hl.dsp.global("quickshell:sidebarLeftToggle"), { description = "Shell: Toggle left sidebar" })
hl.bind("SUPER + ALT + A", hl.dsp.global("quickshell:sidebarLeftToggleDetach")) hl.bind("SUPER + ALT + A", hl.dsp.global("quickshell:sidebarLeftToggleDetach"))
hl.bind("SUPER + B", hl.dsp.global("quickshell:sidebarLeftToggle")) hl.bind("SUPER + B", hl.dsp.global("quickshell:sidebarLeftToggle"))
@@ -53,6 +52,8 @@ hl.bind("CTRL + SUPER + T", hl.dsp.global("quickshell:wallpaperSelectorToggle"),
{ description = "Shell: Toggle wallpaper selector" }) { description = "Shell: Toggle wallpaper selector" })
hl.bind("CTRL + SUPER + ALT + T", hl.dsp.global("quickshell:wallpaperSelectorRandom"), hl.bind("CTRL + SUPER + ALT + T", hl.dsp.global("quickshell:wallpaperSelectorRandom"),
{ description = "Shell: Select random wallpaper" }) { description = "Shell: Select random wallpaper" })
hl.bind("CTRL + SUPER + SHIFT + D", hl.dsp.global("quickshell:toggleLightDark"),
{ description = "Shell: Toggle light/dark mode" })
hl.bind("CTRL + SUPER + T", hl.dsp.exec_cmd(qsIsAlive .. " || " .. qsScripts .. "/colors/switchwall.sh")) hl.bind("CTRL + SUPER + T", hl.dsp.exec_cmd(qsIsAlive .. " || " .. qsScripts .. "/colors/switchwall.sh"))
hl.bind("CTRL + SUPER + R", hl.dsp.exec_cmd("killall ydotool qs quickshell; qs -c $qsConfig &"), hl.bind("CTRL + SUPER + R", hl.dsp.exec_cmd("killall ydotool qs quickshell; qs -c $qsConfig &"),
{ description = "Shell: Restart widgets" }) { description = "Shell: Restart widgets" })
@@ -5,6 +5,7 @@ import qs.modules.common
import QtQuick import QtQuick
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
import Quickshell.Hyprland
/** /**
* Automatically reloads generated material colors. * Automatically reloads generated material colors.
@@ -71,4 +72,26 @@ Singleton {
} }
onLoadFailed: root.resetFilePathNextTime(); 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();
}
}
} }