I'm still on iOS/iPadOS 16 but I assume the following 'workaround' still works - otherwise I will correct my post.
EDIT: The attached Shortcut does not take into account that:
- iOS 17 introduces the separate parameters "Media volume" and "Ringtone volume" instead of just "volume". Updated version in
post#10.
- "Silent Mode" can now be toggled in Shortcuts (at least on iPhone 15 accord. to
post#11). This should be the proper way instead of adjusting the "Ringtone volume".
- When you put an iPhone 15 Pro on silent, a silent bell icon permanently appears in the status bar next to the time. So setting up a Focus with the only intend to get a status bar icon, is not necessary in this case.
If you want a visual feedback of the device being muted, I'd recommend creating an empty Focus (if possible) and toggling that. This way you get an icon in the menu bar to remind you of the 'silent mode'.
- Then use activating/deactivating that Focus to trigger the attached Shortcut.
Depending if the Focus gets activated or deactivated, the Shortcut mutes or restores the system volume.
Shortcuts > Automation > Personal Automation > Trigger: 'Your Focus' > When Turning On and Off > Run Shortcut
- Or: If you want to run the Shortcut directly, the mentioned Automation part is not necessary.
But in the Shortcut you'd have to add activating/deactivation the Focus to use the current If-condition and to still get the icon.