mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-05-14 00:02:45 -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:
@@ -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