Skip to content

Commit d00925c

Browse files
authored
feat: add Capture Region to Clipboard button action (#296)
* feat: add Capture Region to Clipboard button action * feat: add Capture Region locale entries for all languages * fix: merge identical Screenshot/CaptureRegion match arms (clippy) On Linux and Windows, Screenshot and CaptureRegion dispatch to the same native shortcut (Print Screen / Win+Shift+S), so clippy::match_same_arms flagged the duplicated arms under -D warnings. Merge each pair with a single | pattern. macOS keeps distinct arms (region uses a different shortcut). No behavior change. * fix: merge Screenshot/CaptureRegion icon arm (clippy match_same_arms) The icon picker mapped both Screenshot and CaptureRegion to camera.svg, which clippy::match_same_arms flagged under -D warnings in the workspace clippy run. Merge into a single | pattern. No behavior change. --------- Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
1 parent 45070bb commit d00925c

23 files changed

Lines changed: 58 additions & 4 deletions

File tree

crates/openlogi-core/src/binding.rs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,11 @@ pub enum Action {
434434
LockScreen,
435435
/// Capture a screenshot.
436436
Screenshot,
437+
/// Capture a selected screen region to the clipboard.
438+
///
439+
/// macOS uses Cmd+Shift+Ctrl+4; Windows uses Win+Shift+S. Linux delegates
440+
/// to the desktop environment's screenshot handler via Print Screen.
441+
CaptureRegion,
437442

438443
// ── Media ────────────────────────────────────────────────────────────────
439444
/// Toggle media play/pause.
@@ -703,6 +708,7 @@ impl Action {
703708
Action::LaunchpadShow => "Launchpad".into(),
704709
Action::LockScreen => "Lock Screen".into(),
705710
Action::Screenshot => "Screenshot".into(),
711+
Action::CaptureRegion => "Capture Region".into(),
706712
Action::PlayPause => "Play / Pause".into(),
707713
Action::NextTrack => "Next Track".into(),
708714
Action::PrevTrack => "Previous Track".into(),
@@ -754,7 +760,9 @@ impl Action {
754760
| Action::NextDesktop
755761
| Action::ShowDesktop
756762
| Action::LaunchpadShow => Category::Navigation,
757-
Action::None | Action::LockScreen | Action::Screenshot => Category::System,
763+
Action::None | Action::LockScreen | Action::Screenshot | Action::CaptureRegion => {
764+
Category::System
765+
}
758766
Action::PlayPause
759767
| Action::NextTrack
760768
| Action::PrevTrack
@@ -813,6 +821,7 @@ impl Action {
813821
Action::None,
814822
Action::LockScreen,
815823
Action::Screenshot,
824+
Action::CaptureRegion,
816825
// Media
817826
Action::PlayPause,
818827
Action::NextTrack,
@@ -1036,6 +1045,25 @@ mod tests {
10361045
);
10371046
}
10381047

1048+
#[test]
1049+
fn binding_capture_region_roundtrips_as_single_string() {
1050+
let toml = "bindings.Back = \"CaptureRegion\"";
1051+
let parsed = toml::from_str::<BindingWrapper>(toml).expect("deserialize");
1052+
assert_eq!(
1053+
parsed.bindings[&ButtonId::Back],
1054+
Binding::Single(Action::CaptureRegion)
1055+
);
1056+
1057+
let back = binding_roundtrip(parsed.bindings);
1058+
assert_eq!(
1059+
back[&ButtonId::Back],
1060+
Binding::Single(Action::CaptureRegion)
1061+
);
1062+
assert_eq!(Action::CaptureRegion.label(), "Capture Region");
1063+
assert_eq!(Action::CaptureRegion.category(), Category::System);
1064+
assert!(Action::catalog().contains(&Action::CaptureRegion));
1065+
}
1066+
10391067
// ── Gesture classification ────────────────────────────────────────────────
10401068

10411069
#[test]

crates/openlogi-gui/locales/da.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ _version: 1
182182
"Launchpad": "Launchpad"
183183
"Lock Screen": "Lås skærm"
184184
"Screenshot": "Skærmbillede"
185+
"Capture Region": "Optag område"
185186
"Play / Pause": "Afspil / pause"
186187
"Next Track": "Næste nummer"
187188
"Previous Track": "Forrige nummer"

crates/openlogi-gui/locales/de.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ _version: 1
182182
"Launchpad": "Launchpad"
183183
"Lock Screen": "Bildschirm sperren"
184184
"Screenshot": "Bildschirmfoto"
185+
"Capture Region": "Bereich aufnehmen"
185186
"Play / Pause": "Wiedergabe / Pause"
186187
"Next Track": "Nächster Titel"
187188
"Previous Track": "Vorheriger Titel"

crates/openlogi-gui/locales/el.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ _version: 1
182182
"Launchpad": "Launchpad"
183183
"Lock Screen": "Κλείδωμα οθόνης"
184184
"Screenshot": "Στιγμιότυπο οθόνης"
185+
"Capture Region": "Λήψη περιοχής"
185186
"Play / Pause": "Αναπαραγωγή / Παύση"
186187
"Next Track": "Επόμενο κομμάτι"
187188
"Previous Track": "Προηγούμενο κομμάτι"

crates/openlogi-gui/locales/en.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ _version: 1
182182
"Launchpad": "Launchpad"
183183
"Lock Screen": "Lock Screen"
184184
"Screenshot": "Screenshot"
185+
"Capture Region": "Capture Region"
185186
"Play / Pause": "Play / Pause"
186187
"Next Track": "Next Track"
187188
"Previous Track": "Previous Track"

crates/openlogi-gui/locales/es.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ _version: 1
182182
"Launchpad": "Launchpad"
183183
"Lock Screen": "Bloquear pantalla"
184184
"Screenshot": "Captura de pantalla"
185+
"Capture Region": "Capturar región"
185186
"Play / Pause": "Reproducir / Pausar"
186187
"Next Track": "Pista siguiente"
187188
"Previous Track": "Pista anterior"

crates/openlogi-gui/locales/fi.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ _version: 1
182182
"Launchpad": "Launchpad"
183183
"Lock Screen": "Lukitse näyttö"
184184
"Screenshot": "Kuvakaappaus"
185+
"Capture Region": "Kaappaa alue"
185186
"Play / Pause": "Toista / Keskeytä"
186187
"Next Track": "Seuraava kappale"
187188
"Previous Track": "Edellinen kappale"

crates/openlogi-gui/locales/fr.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ _version: 1
182182
"Launchpad": "Launchpad"
183183
"Lock Screen": "Verrouiller l'écran"
184184
"Screenshot": "Capture d'écran"
185+
"Capture Region": "Capturer une zone"
185186
"Play / Pause": "Lecture / Pause"
186187
"Next Track": "Piste suivante"
187188
"Previous Track": "Piste précédente"

crates/openlogi-gui/locales/it.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ _version: 1
182182
"Launchpad": "Launchpad"
183183
"Lock Screen": "Blocca schermo"
184184
"Screenshot": "Istantanea schermo"
185+
"Capture Region": "Cattura area"
185186
"Play / Pause": "Riproduci / Pausa"
186187
"Next Track": "Traccia successiva"
187188
"Previous Track": "Traccia precedente"

crates/openlogi-gui/locales/ja.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ _version: 1
182182
"Launchpad": "Launchpad"
183183
"Lock Screen": "画面をロック"
184184
"Screenshot": "スクリーンショット"
185+
"Capture Region": "範囲をキャプチャ"
185186
"Play / Pause": "再生 / 一時停止"
186187
"Next Track": "次の曲"
187188
"Previous Track": "前の曲"

0 commit comments

Comments
 (0)