mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-05-13 15:52:46 -04:00
feat: add cycleProfile IPC command and default Mod+P keybind (#2411)
* feat: add cycleProfile IPC command for display outputs Adds `dms ipc outputs cycleProfile` which cycles through configured display profiles in order, wrapping around from the last back to the first. Useful for binding to a compositor keybind (e.g. Super+P in niri/Hyprland) without needing an external wrapper script. * feat: add Mod+P default keybind for cycling display profiles Binds Super+P to `dms ipc outputs cycleProfile` in both the niri and Hyprland default keybind configs. Mod+Shift+P is already reserved for powering off monitors on both compositors, so Mod+P is a natural fit.
This commit is contained in:
@@ -158,5 +158,8 @@ bind = , Print, exec, dms screenshot
|
||||
bind = CTRL, Print, exec, dms screenshot full
|
||||
bind = ALT, Print, exec, dms screenshot window
|
||||
|
||||
# === Display Profiles ===
|
||||
bind = SUPER, P, exec, dms ipc outputs cycleProfile
|
||||
|
||||
# === System Controls ===
|
||||
bind = SUPER SHIFT, P, dpms, toggle
|
||||
|
||||
@@ -215,6 +215,11 @@ binds {
|
||||
Print { screenshot; }
|
||||
Ctrl+Print { screenshot-screen; }
|
||||
Alt+Print { screenshot-window; }
|
||||
// === Display Profiles ===
|
||||
Mod+P hotkey-overlay-title="Cycle Display Profile" {
|
||||
spawn "dms" "ipc" "outputs" "cycleProfile";
|
||||
}
|
||||
|
||||
// === System Controls ===
|
||||
Mod+Escape allow-inhibiting=false { toggle-keyboard-shortcuts-inhibit; }
|
||||
Mod+Shift+P { power-off-monitors; }
|
||||
|
||||
@@ -1726,6 +1726,22 @@ Item {
|
||||
return `PROFILE_SET_SUCCESS: ${profileName}`;
|
||||
}
|
||||
|
||||
function cycleProfile(): string {
|
||||
if (SettingsData.displayProfileAutoSelect)
|
||||
return "ERROR: Auto profile selection is enabled. Use toggleAuto first";
|
||||
|
||||
const profiles = DisplayConfigState.validatedProfiles;
|
||||
const ids = Object.keys(profiles).filter(id => profiles[id].name);
|
||||
if (ids.length === 0)
|
||||
return "ERROR: No profiles configured";
|
||||
|
||||
const activeId = SettingsData.getActiveDisplayProfile(CompositorService.compositor);
|
||||
const idx = ids.indexOf(activeId);
|
||||
const nextId = ids[(idx + 1) % ids.length];
|
||||
DisplayConfigState.activateProfile(nextId);
|
||||
return `PROFILE_SET_SUCCESS: ${profiles[nextId].name}`;
|
||||
}
|
||||
|
||||
function toggleAuto(): string {
|
||||
SettingsData.displayProfileAutoSelect = !SettingsData.displayProfileAutoSelect;
|
||||
SettingsData.saveSettings();
|
||||
|
||||
Reference in New Issue
Block a user