1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
use anyhow::{bail, Result};
use serde::{Deserialize, Serialize};
use std::collections::HashSet;
use std::hash::Hash;
use std::iter::once;
use std::str::FromStr;
use tuirealm::event::{Key, KeyEvent, KeyModifiers};

pub const CONTROL_SHIFT: KeyModifiers =
    KeyModifiers::from_bits_truncate(KeyModifiers::CONTROL.bits() | KeyModifiers::SHIFT.bits());
pub const ALT_SHIFT: KeyModifiers =
    KeyModifiers::from_bits_truncate(KeyModifiers::ALT.bits() | KeyModifiers::SHIFT.bits());
pub const CONTROL_ALT: KeyModifiers =
    KeyModifiers::from_bits_truncate(KeyModifiers::ALT.bits() | KeyModifiers::CONTROL.bits());
pub const CONTROL_ALT_SHIFT: KeyModifiers = KeyModifiers::from_bits_truncate(
    KeyModifiers::ALT.bits() | KeyModifiers::CONTROL.bits() | KeyModifiers::SHIFT.bits(),
);

#[derive(Clone, Deserialize, Serialize)]
pub struct Keys {
    pub global_esc: BindingForEvent,
    pub global_quit: BindingForEvent,
    pub global_left: BindingForEvent,
    pub global_down: BindingForEvent,
    pub global_up: BindingForEvent,
    pub global_right: BindingForEvent,
    pub global_goto_top: BindingForEvent,
    pub global_goto_bottom: BindingForEvent,
    pub global_player_toggle_pause: BindingForEvent,
    pub global_player_next: BindingForEvent,
    pub global_player_previous: BindingForEvent,
    pub global_player_volume_plus_1: BindingForEvent,
    pub global_player_volume_plus_2: BindingForEvent,
    pub global_player_volume_minus_1: BindingForEvent,
    pub global_player_volume_minus_2: BindingForEvent,
    pub global_help: BindingForEvent,
    pub global_player_seek_forward: BindingForEvent,
    pub global_player_seek_backward: BindingForEvent,
    pub global_lyric_adjust_forward: BindingForEvent,
    pub global_lyric_adjust_backward: BindingForEvent,
    pub global_player_speed_up: BindingForEvent,
    pub global_player_speed_down: BindingForEvent,
    pub global_lyric_cycle: BindingForEvent,
    pub global_layout_treeview: BindingForEvent,
    pub global_layout_database: BindingForEvent,
    pub global_player_toggle_gapless: BindingForEvent,
    pub global_config_open: BindingForEvent,
    pub global_save_playlist: BindingForEvent,
    pub global_layout_podcast: BindingForEvent,
    pub global_xywh_move_left: BindingForEvent,
    pub global_xywh_move_right: BindingForEvent,
    pub global_xywh_move_up: BindingForEvent,
    pub global_xywh_move_down: BindingForEvent,
    pub global_xywh_zoom_in: BindingForEvent,
    pub global_xywh_zoom_out: BindingForEvent,
    pub global_xywh_hide: BindingForEvent,
    pub library_load_dir: BindingForEvent,
    pub library_delete: BindingForEvent,
    pub library_yank: BindingForEvent,
    pub library_paste: BindingForEvent,
    pub library_search: BindingForEvent,
    pub library_search_youtube: BindingForEvent,
    pub library_tag_editor_open: BindingForEvent,
    pub library_switch_root: BindingForEvent,
    pub library_add_root: BindingForEvent,
    pub library_remove_root: BindingForEvent,
    pub playlist_delete: BindingForEvent,
    pub playlist_delete_all: BindingForEvent,
    pub playlist_shuffle: BindingForEvent,
    pub playlist_mode_cycle: BindingForEvent,
    pub playlist_play_selected: BindingForEvent,
    pub playlist_search: BindingForEvent,
    pub playlist_swap_down: BindingForEvent,
    pub playlist_swap_up: BindingForEvent,
    pub playlist_cmus_lqueue: BindingForEvent,
    pub playlist_cmus_tqueue: BindingForEvent,
    pub database_add_all: BindingForEvent,
    pub config_save: BindingForEvent,
    pub podcast_mark_played: BindingForEvent,
    pub podcast_mark_all_played: BindingForEvent,
    pub podcast_episode_download: BindingForEvent,
    pub podcast_episode_delete_file: BindingForEvent,
    pub podcast_delete_feed: BindingForEvent,
    pub podcast_delete_all_feeds: BindingForEvent,
    pub podcast_search_add_feed: BindingForEvent,
    pub podcast_refresh_feed: BindingForEvent,
    pub podcast_refresh_all_feeds: BindingForEvent,
}

impl Keys {
    // In order to check if duplicate keys are configured, please ensure all are included here
    fn iter_global(&self) -> impl Iterator<Item = BindingForEvent> {
        once(self.global_esc)
            .chain(once(self.global_quit))
            .chain(once(self.global_left))
            .chain(once(self.global_down))
            .chain(once(self.global_up))
            .chain(once(self.global_right))
            .chain(once(self.global_goto_top))
            .chain(once(self.global_goto_bottom))
            .chain(once(self.global_player_toggle_pause))
            .chain(once(self.global_player_next))
            .chain(once(self.global_player_previous))
            .chain(once(self.global_player_volume_plus_1))
            .chain(once(self.global_player_volume_plus_2))
            .chain(once(self.global_player_volume_minus_1))
            .chain(once(self.global_player_volume_minus_2))
            .chain(once(self.global_help))
            .chain(once(self.global_player_seek_forward))
            .chain(once(self.global_player_seek_backward))
            .chain(once(self.global_lyric_adjust_forward))
            .chain(once(self.global_lyric_adjust_backward))
            .chain(once(self.global_player_speed_up))
            .chain(once(self.global_player_speed_down))
            .chain(once(self.global_lyric_cycle))
            .chain(once(self.global_layout_treeview))
            .chain(once(self.global_layout_database))
            .chain(once(self.global_player_toggle_gapless))
            .chain(once(self.global_config_open))
            .chain(once(self.global_save_playlist))
            .chain(once(self.global_layout_podcast))
            .chain(once(self.global_xywh_move_left))
            .chain(once(self.global_xywh_move_right))
            .chain(once(self.global_xywh_move_up))
            .chain(once(self.global_xywh_move_down))
            .chain(once(self.global_xywh_zoom_in))
            .chain(once(self.global_xywh_zoom_out))
            .chain(once(self.global_xywh_hide))
        // .chain(once(self.config_save))
    }

    fn iter_library(&self) -> impl Iterator<Item = BindingForEvent> {
        once(self.library_load_dir)
            .chain(once(self.library_delete))
            .chain(once(self.library_yank))
            .chain(once(self.library_paste))
            .chain(once(self.library_search))
            .chain(once(self.library_search_youtube))
            .chain(once(self.library_tag_editor_open))
            .chain(once(self.library_switch_root))
            .chain(once(self.library_add_root))
            .chain(once(self.library_remove_root))
    }

    fn iter_playlist(&self) -> impl Iterator<Item = BindingForEvent> {
        once(self.playlist_delete)
            .chain(once(self.playlist_delete_all))
            .chain(once(self.playlist_shuffle))
            .chain(once(self.playlist_mode_cycle))
            .chain(once(self.playlist_play_selected))
            .chain(once(self.playlist_search))
            .chain(once(self.playlist_swap_down))
            .chain(once(self.playlist_swap_up))
            .chain(once(self.playlist_cmus_lqueue))
            .chain(once(self.playlist_cmus_tqueue))
    }

    fn iter_podcast(&self) -> impl Iterator<Item = BindingForEvent> {
        once(self.podcast_search_add_feed)
            .chain(once(self.podcast_refresh_feed))
            .chain(once(self.podcast_refresh_all_feeds))
            .chain(once(self.podcast_delete_feed))
            .chain(once(self.podcast_delete_all_feeds))
    }

    fn iter_episode(&self) -> impl Iterator<Item = BindingForEvent> {
        once(self.podcast_mark_played)
            .chain(once(self.podcast_mark_all_played))
            .chain(once(self.podcast_episode_download))
            .chain(once(self.podcast_episode_delete_file))
    }

    pub fn has_unique_elements(&self) -> bool {
        let mut uniq_global = HashSet::new();
        let mut uniq_library = HashSet::new();
        let mut uniq_playlist = HashSet::new();
        let mut uniq_podcast = HashSet::new();
        let mut uniq_episode = HashSet::new();
        self.iter_global().all(move |x| uniq_global.insert(x))
            && self.iter_library().all(move |x| uniq_library.insert(x))
            && self.iter_playlist().all(move |x| uniq_playlist.insert(x))
            && self.iter_podcast().all(move |x| uniq_podcast.insert(x))
            && self.iter_episode().all(move |x| uniq_episode.insert(x))
    }
}

#[derive(Clone, Deserialize, Copy, Eq, PartialEq, Hash, Serialize)]
pub struct BindingForEvent {
    pub code: Key,
    pub modifier: KeyModifiers,
}

impl std::fmt::Display for BindingForEvent {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        let code_string = if let Key::Char(char) = self.code {
            char.to_string()
        } else {
            format!("{:?}", self.code)
        };

        let code_string = code_string.replace("Function(", "F");
        let code_string = code_string.replace(')', "");
        let code_string = code_string.replace(' ', "Space");
        match self.modifier {
            KeyModifiers::NONE => write!(f, "{code_string}"),
            KeyModifiers::SHIFT => write!(f, "SHIFT+{}", code_string.to_uppercase()),
            KeyModifiers::CONTROL => write!(f, "CTRL+{code_string}"),
            KeyModifiers::ALT => write!(f, "ALT+{code_string}"),
            CONTROL_SHIFT => write!(f, "CTRL+SHIFT+{code_string}"),
            ALT_SHIFT => write!(f, "ALT+SHIFT+{code_string}"),
            CONTROL_ALT => write!(f, "CTRL+ALT+{code_string}"),
            CONTROL_ALT_SHIFT => write!(f, "CTRL+ALT+SHIFT+{code_string}"),
            _ => write!(f, "Wrong Modifiers"),
        }
    }
}

impl BindingForEvent {
    pub const fn key_event(&self) -> KeyEvent {
        KeyEvent {
            code: self.code,
            modifiers: self.modifier,
        }
    }

    pub fn mod_key(&self) -> (usize, String) {
        (self.modifier(), self.key())
    }

    pub const fn modifier(&self) -> usize {
        match self.modifier {
            // KeyModifiers::NONE => 0,
            KeyModifiers::SHIFT => 1,
            KeyModifiers::CONTROL => 2,
            KeyModifiers::ALT => 3,
            CONTROL_SHIFT => 4,
            ALT_SHIFT => 5,
            CONTROL_ALT => 6,
            CONTROL_ALT_SHIFT => 7,
            _ => 0,
            // _ => 0,
        }
    }

    pub fn key(&self) -> String {
        match self.code {
            Key::Backspace => "Backspace".to_string(),
            Key::Enter => "Enter".to_string(),
            Key::Left => "Left".to_string(),
            Key::Right => "Right".to_string(),
            Key::Up => "Up".to_string(),
            Key::Down => "Down".to_string(),
            Key::Home => "Home".to_string(),
            Key::End => "End".to_string(),
            Key::PageUp => "PageUp".to_string(),
            Key::PageDown => "PageDown".to_string(),
            Key::Tab => "Tab".to_string(),
            Key::BackTab => "BackTab".to_string(),
            Key::Delete => "Delete".to_string(),
            Key::Insert => "Insert".to_string(),
            Key::Function(int) => format!("F{int}"),
            Key::Char(char) => {
                if char == ' ' {
                    "Space".to_string()
                } else {
                    format!("{char}")
                }
            }
            Key::Null => "Null".to_string(),
            Key::Esc => "Esc".to_string(),
            Key::CapsLock => "CapsLock".to_string(),
            Key::ScrollLock => "ScrollLock".to_string(),
            Key::NumLock => "NumLock".to_string(),
            Key::PrintScreen => "PrintScreen".to_string(),
            Key::Pause => "Pause".to_string(),
            Key::Menu => "Menu".to_string(),
            Key::KeypadBegin => "KeyPadBegin".to_string(),
            Key::Media(media_key) => format!("Media {media_key:?}"),
        }
    }

    pub fn key_from_str(str: &str) -> Result<Key> {
        if str.is_empty() {
            bail!("Empty key")
        }

        if str.len() < 2 {
            let mut chars = str.chars();
            if let Some(char) = chars.next() {
                return Ok(Key::Char(char));
            }
        }
        if str.starts_with('F') {
            let mut chars = str.chars();
            chars.next();
            let my_int = u8::from_str(chars.as_str())?;
            if my_int > 12 {
                bail!("Function key should be smaller than F12.");
            }
            return Ok(Key::Function(my_int));
        }
        let str_lower_case = str.to_lowercase();
        let special_key = match str_lower_case.as_ref() {
            "backspace" => Key::Backspace,
            "enter" => Key::Enter,
            "left" => Key::Left,
            "right" => Key::Right,
            "up" => Key::Up,
            "down" => Key::Down,
            "home" => Key::Home,
            "end" => Key::End,
            "pageup" => Key::PageUp,
            "pagedown" => Key::PageDown,
            "tab" => Key::Tab,
            "backtab" => Key::BackTab,
            "delete" => Key::Delete,
            "insert" => Key::Insert,
            "esc" => Key::Esc,
            "f1" => Key::Function(1),
            "f2" => Key::Function(2),
            "f3" => Key::Function(3),
            "f4" => Key::Function(4),
            "f5" => Key::Function(5),
            "f6" => Key::Function(6),
            "f7" => Key::Function(7),
            "f8" => Key::Function(8),
            "f9" => Key::Function(9),
            "f10" => Key::Function(10),
            "f11" => Key::Function(11),
            "f12" => Key::Function(12),
            "space" => Key::Char(' '),
            // "null" => Key::Null,
            &_ => bail!("Error key configured"),
        };
        Ok(special_key)
    }
}

impl Default for Keys {
    #[allow(clippy::too_many_lines)]
    fn default() -> Self {
        Self {
            global_esc: BindingForEvent {
                code: Key::Esc,
                modifier: KeyModifiers::NONE,
            },
            global_quit: BindingForEvent {
                code: Key::Char('q'),
                modifier: KeyModifiers::NONE,
            },
            global_left: BindingForEvent {
                code: Key::Char('h'),
                modifier: KeyModifiers::NONE,
            },
            global_down: BindingForEvent {
                code: Key::Char('j'),
                modifier: KeyModifiers::NONE,
            },
            global_up: BindingForEvent {
                code: Key::Char('k'),
                modifier: KeyModifiers::NONE,
            },
            global_right: BindingForEvent {
                code: Key::Char('l'),
                modifier: KeyModifiers::NONE,
            },
            global_goto_top: BindingForEvent {
                code: Key::Char('g'),
                modifier: KeyModifiers::NONE,
            },
            global_goto_bottom: BindingForEvent {
                code: Key::Char('G'),
                modifier: KeyModifiers::SHIFT,
            },
            global_player_toggle_pause: BindingForEvent {
                code: Key::Char(' '),
                modifier: KeyModifiers::NONE,
            },
            global_player_next: BindingForEvent {
                code: Key::Char('n'),
                modifier: KeyModifiers::NONE,
            },
            global_player_previous: BindingForEvent {
                code: Key::Char('N'),
                modifier: KeyModifiers::SHIFT,
            },
            global_player_volume_plus_1: BindingForEvent {
                code: Key::Char('+'),
                modifier: KeyModifiers::SHIFT,
            },
            global_player_volume_plus_2: BindingForEvent {
                code: Key::Char('='),
                modifier: KeyModifiers::NONE,
            },
            global_player_volume_minus_1: BindingForEvent {
                code: Key::Char('_'),
                modifier: KeyModifiers::SHIFT,
            },
            global_player_volume_minus_2: BindingForEvent {
                code: Key::Char('-'),
                modifier: KeyModifiers::NONE,
            },
            global_help: BindingForEvent {
                code: Key::Char('h'),
                modifier: KeyModifiers::CONTROL,
            },
            global_player_seek_forward: BindingForEvent {
                code: Key::Char('f'),
                modifier: KeyModifiers::NONE,
            },
            global_player_seek_backward: BindingForEvent {
                code: Key::Char('b'),
                modifier: KeyModifiers::NONE,
            },
            global_player_speed_up: BindingForEvent {
                code: Key::Char('f'),
                modifier: KeyModifiers::CONTROL,
            },
            global_player_speed_down: BindingForEvent {
                code: Key::Char('b'),
                modifier: KeyModifiers::CONTROL,
            },

            global_lyric_adjust_forward: BindingForEvent {
                code: Key::Char('F'),
                modifier: KeyModifiers::SHIFT,
            },
            global_lyric_adjust_backward: BindingForEvent {
                code: Key::Char('B'),
                modifier: KeyModifiers::SHIFT,
            },
            global_lyric_cycle: BindingForEvent {
                code: Key::Char('T'),
                modifier: KeyModifiers::SHIFT,
            },
            library_load_dir: BindingForEvent {
                code: Key::Char('L'),
                modifier: KeyModifiers::SHIFT,
            },
            library_delete: BindingForEvent {
                code: Key::Char('d'),
                modifier: KeyModifiers::NONE,
            },
            library_yank: BindingForEvent {
                code: Key::Char('y'),
                modifier: KeyModifiers::NONE,
            },
            library_paste: BindingForEvent {
                code: Key::Char('p'),
                modifier: KeyModifiers::NONE,
            },
            library_search: BindingForEvent {
                code: Key::Char('/'),
                modifier: KeyModifiers::NONE,
            },
            library_search_youtube: BindingForEvent {
                code: Key::Char('s'),
                modifier: KeyModifiers::NONE,
            },
            library_tag_editor_open: BindingForEvent {
                code: Key::Char('t'),
                modifier: KeyModifiers::NONE,
            },
            playlist_delete: BindingForEvent {
                code: Key::Char('d'),
                modifier: KeyModifiers::NONE,
            },
            playlist_delete_all: BindingForEvent {
                code: Key::Char('D'),
                modifier: KeyModifiers::SHIFT,
            },
            playlist_shuffle: BindingForEvent {
                code: Key::Char('r'),
                modifier: KeyModifiers::NONE,
            },
            playlist_mode_cycle: BindingForEvent {
                code: Key::Char('m'),
                modifier: KeyModifiers::NONE,
            },
            playlist_play_selected: BindingForEvent {
                code: Key::Char('l'),
                modifier: KeyModifiers::NONE,
            },
            playlist_search: BindingForEvent {
                code: Key::Char('/'),
                modifier: KeyModifiers::NONE,
            },
            playlist_swap_down: BindingForEvent {
                code: Key::Char('J'),
                modifier: KeyModifiers::SHIFT,
            },
            playlist_swap_up: BindingForEvent {
                code: Key::Char('K'),
                modifier: KeyModifiers::SHIFT,
            },
            playlist_cmus_lqueue: BindingForEvent {
                code: Key::Char('S'),
                modifier: KeyModifiers::SHIFT,
            },
            playlist_cmus_tqueue: BindingForEvent {
                code: Key::Char('s'),
                modifier: KeyModifiers::NONE,
            },
            global_layout_treeview: BindingForEvent {
                code: Key::Char('1'),
                modifier: KeyModifiers::NONE,
            },
            global_layout_database: BindingForEvent {
                code: Key::Char('2'),
                modifier: KeyModifiers::NONE,
            },
            database_add_all: BindingForEvent {
                code: Key::Char('L'),
                modifier: KeyModifiers::SHIFT,
            },
            global_player_toggle_gapless: BindingForEvent {
                code: Key::Char('g'),
                modifier: KeyModifiers::CONTROL,
            },
            global_config_open: BindingForEvent {
                code: Key::Char('C'),
                modifier: KeyModifiers::SHIFT,
            },
            config_save: BindingForEvent {
                code: Key::Char('s'),
                modifier: KeyModifiers::CONTROL,
            },
            library_switch_root: BindingForEvent {
                code: Key::Char('o'),
                modifier: KeyModifiers::NONE,
            },
            library_add_root: BindingForEvent {
                code: Key::Char('a'),
                modifier: KeyModifiers::NONE,
            },
            library_remove_root: BindingForEvent {
                code: Key::Char('A'),
                modifier: KeyModifiers::SHIFT,
            },
            global_save_playlist: BindingForEvent {
                code: Key::Char('s'),
                modifier: KeyModifiers::CONTROL,
            },
            global_layout_podcast: BindingForEvent {
                code: Key::Char('3'),
                modifier: KeyModifiers::NONE,
            },
            podcast_search_add_feed: BindingForEvent {
                code: Key::Char('s'),
                modifier: KeyModifiers::NONE,
            },
            podcast_mark_played: BindingForEvent {
                code: Key::Char('m'),
                modifier: KeyModifiers::NONE,
            },
            podcast_mark_all_played: BindingForEvent {
                code: Key::Char('M'),
                modifier: KeyModifiers::SHIFT,
            },
            podcast_refresh_feed: BindingForEvent {
                code: Key::Char('r'),
                modifier: KeyModifiers::NONE,
            },
            podcast_refresh_all_feeds: BindingForEvent {
                code: Key::Char('R'),
                modifier: KeyModifiers::SHIFT,
            },
            podcast_episode_download: BindingForEvent {
                code: Key::Char('d'),
                modifier: KeyModifiers::NONE,
            },
            podcast_episode_delete_file: BindingForEvent {
                code: Key::Char('x'),
                modifier: KeyModifiers::NONE,
            },
            podcast_delete_feed: BindingForEvent {
                code: Key::Char('d'),
                modifier: KeyModifiers::NONE,
            },
            podcast_delete_all_feeds: BindingForEvent {
                code: Key::Char('D'),
                modifier: KeyModifiers::SHIFT,
            },
            global_xywh_move_left: BindingForEvent {
                code: Key::Left,
                modifier: CONTROL_SHIFT,
            },
            global_xywh_move_right: BindingForEvent {
                code: Key::Right,
                modifier: CONTROL_SHIFT,
            },
            global_xywh_move_up: BindingForEvent {
                code: Key::Up,
                modifier: CONTROL_SHIFT,
            },
            global_xywh_move_down: BindingForEvent {
                code: Key::Down,
                modifier: CONTROL_SHIFT,
            },
            global_xywh_zoom_in: BindingForEvent {
                code: Key::PageUp,
                modifier: CONTROL_SHIFT,
            },
            global_xywh_zoom_out: BindingForEvent {
                code: Key::PageDown,
                modifier: CONTROL_SHIFT,
            },
            global_xywh_hide: BindingForEvent {
                code: Key::End,
                modifier: CONTROL_SHIFT,
            },
        }
    }
}