default-config: Use spawn-sh more
Browse files at this commit6e0b38050d4f0c8656b0ecee3140f4f07e2b895bParent: bf472971 changed file +14 -11
- resources/default-config.kdl +14 -11
resources/default-config.kdlmodified+14 -11
| @@ -366,22 +366,25 @@ binds { | |||
| 366 | Mod+D hotkey-overlay-title="Run an Application: fuzzel" { spawn "fuzzel"; } | 366 | Mod+D hotkey-overlay-title="Run an Application: fuzzel" { spawn "fuzzel"; } |
| 367 | Super+Alt+L hotkey-overlay-title="Lock the Screen: swaylock" { spawn "swaylock"; } | 367 | Super+Alt+L hotkey-overlay-title="Lock the Screen: swaylock" { spawn "swaylock"; } |
| 368 | 368 | ||
| 369 | + // Use spawn-sh to run a shell command. Do this if you need pipes, multiple commands, etc. | ||
| 370 | + // Note: the entire command goes as a single argument. It's passed verbatim to `sh -c`. | ||
| 371 | + // For example, this is a standard bind to toggle the screen reader (orca). | ||
| 372 | + Super+Alt+S allow-when-locked=true hotkey-overlay-title=null { spawn-sh "pkill orca || exec orca"; } | ||
| 373 | + | ||
| 369 | // Example volume keys mappings for PipeWire & WirePlumber. | 374 | // Example volume keys mappings for PipeWire & WirePlumber. |
| 370 | // The allow-when-locked=true property makes them work even when the session is locked. | 375 | // The allow-when-locked=true property makes them work even when the session is locked. |
| 371 | - XF86AudioRaiseVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1+"; } | 376 | + // Using spawn-sh allows to pass multiple arguments together with the command. |
| 372 | - XF86AudioLowerVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1-"; } | 377 | + XF86AudioRaiseVolume allow-when-locked=true { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1+"; } |
| 373 | - XF86AudioMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle"; } | 378 | + XF86AudioLowerVolume allow-when-locked=true { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1-"; } |
| 374 | - XF86AudioMicMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SOURCE@" "toggle"; } | 379 | + XF86AudioMute allow-when-locked=true { spawn-sh "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; } |
| 380 | + XF86AudioMicMute allow-when-locked=true { spawn-sh "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; } | ||
| 375 | 381 | ||
| 376 | // Example brightness key mappings for brightnessctl. | 382 | // Example brightness key mappings for brightnessctl. |
| 383 | + // You can use regular spawn with multiple arguments too (to avoid going through "sh"), | ||
| 384 | + // but you need to manually put each argument in separate "" quotes. | ||
| 377 | XF86MonBrightnessUp allow-when-locked=true { spawn "brightnessctl" "--class=backlight" "set" "+10%"; } | 385 | XF86MonBrightnessUp allow-when-locked=true { spawn "brightnessctl" "--class=backlight" "set" "+10%"; } |
| 378 | XF86MonBrightnessDown allow-when-locked=true { spawn "brightnessctl" "--class=backlight" "set" "10%-"; } | 386 | XF86MonBrightnessDown allow-when-locked=true { spawn "brightnessctl" "--class=backlight" "set" "10%-"; } |
| 379 | 387 | ||
| 380 | - // Use spawn-sh to run a shell command. Do this if you need pipes, multiple commands, etc. | ||
| 381 | - // Note: the entire command goes as a single argument. It's passed verbatim to `sh -c`. | ||
| 382 | - // For example, this is a standard bind to toggle the screen reader (orca). | ||
| 383 | - Super+Alt+S allow-when-locked=true hotkey-overlay-title=null { spawn-sh "pkill orca || exec orca"; } | ||
| 384 | - | ||
| 385 | // Open/close the Overview: a zoomed-out view of workspaces and windows. | 388 | // Open/close the Overview: a zoomed-out view of workspaces and windows. |
| 386 | // You can also move the mouse into the top-left hot corner, | 389 | // You can also move the mouse into the top-left hot corner, |
| 387 | // or do a four-finger swipe up on a touchpad. | 390 | // or do a four-finger swipe up on a touchpad. |
| @@ -492,8 +495,8 @@ binds { | |||
| 492 | // These binds are also affected by touchpad's natural-scroll, so these | 495 | // These binds are also affected by touchpad's natural-scroll, so these |
| 493 | // example binds are "inverted", since we have natural-scroll enabled for | 496 | // example binds are "inverted", since we have natural-scroll enabled for |
| 494 | // touchpads by default. | 497 | // touchpads by default. |
| 495 | - // Mod+TouchpadScrollDown { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.02+"; } | 498 | + // Mod+TouchpadScrollDown { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.02+"; } |
| 496 | - // Mod+TouchpadScrollUp { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.02-"; } | 499 | + // Mod+TouchpadScrollUp { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.02-"; } |
| 497 | 500 | ||
| 498 | // You can refer to workspaces by index. However, keep in mind that | 501 | // You can refer to workspaces by index. However, keep in mind that |
| 499 | // niri is a dynamic workspace system, so these commands are kind of | 502 | // niri is a dynamic workspace system, so these commands are kind of |