forge
Explore
Log in

Don't you dare go Hollow

Add Mod+Ctrl+Shift+T to toggle debug tint

Browse files at this commit

3bd5a012cbf15bd294e1a6290914a6e687cbcf2dIvan MolodetskikhParent: 2187661
README.mdmodified+1 -0
@@ -83,6 +83,7 @@ The general system is: if a hotkey switches somewhere, then adding <kbd>Ctrl</kb
83 | <kbd>Mod</kbd><kbd>F</kbd> | Maximize column |83 | <kbd>Mod</kbd><kbd>F</kbd> | Maximize column |
84 | <kbd>Mod</kbd><kbd>Shift</kbd><kbd>F</kbd> | Toggle full-screen on the focused window |84 | <kbd>Mod</kbd><kbd>Shift</kbd><kbd>F</kbd> | Toggle full-screen on the focused window |
85 | <kbd>Mod</kbd><kbd>PrtSc</kbd> | Save a screenshot to `~/Pictures/Screenshots/` |85 | <kbd>Mod</kbd><kbd>PrtSc</kbd> | Save a screenshot to `~/Pictures/Screenshots/` |
86+| <kbd>Mod</kbd><kbd>Ctrl</kbd><kbd>Shift</kbd><kbd>T</kbd> | Toggle debug tinting of rendered elements |
86 | <kbd>Mod</kbd><kbd>Shift</kbd><kbd>E</kbd> | Exit niri |87 | <kbd>Mod</kbd><kbd>Shift</kbd><kbd>E</kbd> | Exit niri |
87 88
88 [PaperWM]: https://github.com/paperwm/PaperWM89 [PaperWM]: https://github.com/paperwm/PaperWM
src/input.rsmodified+6 -0
@@ -25,6 +25,7 @@ enum Action {
25 Quit,25 Quit,
26 ChangeVt(i32),26 ChangeVt(i32),
27 Suspend,27 Suspend,
28+ ToggleDebugTint,
28 Spawn(String),29 Spawn(String),
29 Screenshot,30 Screenshot,
30 CloseWindow,31 CloseWindow,
@@ -60,6 +61,7 @@ pub enum BackendAction {
60 ChangeVt(i32),61 ChangeVt(i32),
61 Suspend,62 Suspend,
62 Screenshot,63 Screenshot,
64+ ToggleDebugTint,
63 }65 }
64 66
65 pub enum CompositorMod {67 pub enum CompositorMod {
@@ -110,6 +112,7 @@ fn action(comp_mod: CompositorMod, keysym: KeysymHandle, mods: ModifiersState) -
110 KEY_n => Action::Spawn("nautilus".to_owned()),112 KEY_n => Action::Spawn("nautilus".to_owned()),
111 // Alt + PrtSc = SysRq113 // Alt + PrtSc = SysRq
112 KEY_Sys_Req | KEY_Print => Action::Screenshot,114 KEY_Sys_Req | KEY_Print => Action::Screenshot,
115+ KEY_T if mods.shift && mods.ctrl => Action::ToggleDebugTint,
113 KEY_q => Action::CloseWindow,116 KEY_q => Action::CloseWindow,
114 KEY_F => Action::ToggleFullscreen,117 KEY_F => Action::ToggleFullscreen,
115 KEY_comma => Action::ConsumeIntoColumn,118 KEY_comma => Action::ConsumeIntoColumn,
@@ -193,6 +196,9 @@ impl Niri {
193 Action::Suspend => {196 Action::Suspend => {
194 return BackendAction::Suspend;197 return BackendAction::Suspend;
195 }198 }
199+ Action::ToggleDebugTint => {
200+ return BackendAction::ToggleDebugTint;
201+ }
196 Action::Spawn(command) => {202 Action::Spawn(command) => {
197 if let Err(err) = Command::new(command).spawn() {203 if let Err(err) = Command::new(command).spawn() {
198 warn!("error spawning alacritty: {err}");204 warn!("error spawning alacritty: {err}");
src/tty.rsmodified+9 -1
@@ -12,7 +12,7 @@ use smithay::backend::drm::{DrmDevice, DrmDeviceFd, DrmEvent, DrmEventTime};
12 use smithay::backend::egl::{EGLContext, EGLDisplay};12 use smithay::backend::egl::{EGLContext, EGLDisplay};
13 use smithay::backend::libinput::{LibinputInputBackend, LibinputSessionInterface};13 use smithay::backend::libinput::{LibinputInputBackend, LibinputSessionInterface};
14 use smithay::backend::renderer::gles::{GlesRenderer, GlesTexture};14 use smithay::backend::renderer::gles::{GlesRenderer, GlesTexture};
15-use smithay::backend::renderer::{Bind, ImportEgl};15+use smithay::backend::renderer::{Bind, DebugFlags, ImportEgl};
16 use smithay::backend::session::libseat::LibSeatSession;16 use smithay::backend::session::libseat::LibSeatSession;
17 use smithay::backend::session::{Event as SessionEvent, Session};17 use smithay::backend::session::{Event as SessionEvent, Session};
18 use smithay::backend::udev::{self, UdevBackend, UdevEvent};18 use smithay::backend::udev::{self, UdevBackend, UdevEvent};
@@ -192,6 +192,14 @@ impl Tty {
192 }192 }
193 }193 }
194 }194 }
195+ BackendAction::ToggleDebugTint => {
196+ if let Some(device) = tty.output_device.as_mut() {
197+ for (_, compositor) in &mut device.surfaces {
198+ compositor
199+ .set_debug_flags(compositor.debug_flags() ^ DebugFlags::TINT);
200+ }
201+ }
202+ }
195 };203 };
196 })204 })
197 .unwrap();205 .unwrap();
src/winit.rsmodified+4 -0
@@ -2,6 +2,7 @@ use std::time::Duration;
2 2
3 use smithay::backend::renderer::damage::OutputDamageTracker;3 use smithay::backend::renderer::damage::OutputDamageTracker;
4 use smithay::backend::renderer::gles::GlesRenderer;4 use smithay::backend::renderer::gles::GlesRenderer;
5+use smithay::backend::renderer::{DebugFlags, Renderer};
5 use smithay::backend::winit::{self, WinitError, WinitEvent, WinitEventLoop, WinitGraphicsBackend};6 use smithay::backend::winit::{self, WinitError, WinitEvent, WinitEventLoop, WinitGraphicsBackend};
6 use smithay::output::{Mode, Output, PhysicalProperties, Subpixel};7 use smithay::output::{Mode, Output, PhysicalProperties, Subpixel};
7 use smithay::reexports::calloop::timer::{TimeoutAction, Timer};8 use smithay::reexports::calloop::timer::{TimeoutAction, Timer};
@@ -158,6 +159,9 @@ impl Winit {
158 }159 }
159 }160 }
160 }161 }
162+ BackendAction::ToggleDebugTint => {
163+ renderer.set_debug_flags(renderer.debug_flags() ^ DebugFlags::TINT);
164+ }
161 }165 }
162 }166 }
163 WinitEvent::Focus(_) => (),167 WinitEvent::Focus(_) => (),