| 115 | }; |
| 116 | |
| 117 | class wayfire_idle_plugin : public wf::per_output_plugin_instance_t |
| 118 | { |
| 119 | double rotation = 0.0; |
| 120 | |
| 121 | wf::option_wrapper_t<int> zoom_speed{"idle/cube_zoom_speed"}; |
| 122 | screensaver_animation_t screensaver_animation{zoom_speed}; |
| 123 | wf::option_wrapper_t<int> screensaver_timeout{"idle/screensaver_timeout"}; |
| 124 | wf::option_wrapper_t<double> cube_rotate_speed{"idle/cube_rotate_speed"}; |
| 125 | wf::option_wrapper_t<double> cube_max_zoom{"idle/cube_max_zoom"}; |
| 126 | wf::option_wrapper_t<bool> disable_on_fullscreen{"idle/disable_on_fullscreen"}; |
| 127 | wf::option_wrapper_t<bool> disable_initially{"idle/disable_initially"}; |
| 128 | |
| 129 | std::optional<wf::idle_inhibitor_t> fullscreen_inhibitor; |
| 130 | bool has_fullscreen = false; |
| 131 | |
| 132 | cube_screensaver_state state = CUBE_SCREENSAVER_DISABLED; |
| 133 | bool hook_set = false; |
| 134 | bool output_inhibited = false; |
| 135 | uint32_t last_time; |
| 136 | wf::wl_timer<false> timeout_screensaver; |
| 137 | wf::signal::connection_t<wf::seat_activity_signal> on_seat_activity; |
| 138 | wf::shared_data::ref_ptr_t<wayfire_idle> global_idle; |
| 139 | |
| 140 | wf::activator_callback toggle = [=] (auto) |
| 141 | { |
| 142 | if (global_idle->hotkey_inhibitor.has_value()) |
| 143 | { |
| 144 | global_idle->hotkey_inhibitor.reset(); |
| 145 | } else |
| 146 | { |
| 147 | global_idle->hotkey_inhibitor.emplace(); |
| 148 | } |
| 149 | |
| 150 | return true; |
| 151 | }; |
| 152 | |
| 153 | wf::signal::connection_t<wf::fullscreen_layer_focused_signal> fullscreen_state_changed = |
| 154 | [=] (wf::fullscreen_layer_focused_signal *ev) |
| 155 | { |
| 156 | this->has_fullscreen = ev->has_promoted; |
| 157 | update_fullscreen(); |
| 158 | }; |
| 159 | |
| 160 | wf::signal::connection_t<wf::idle_inhibit_changed_signal> inhibit_changed = |
| 161 | [=] (wf::idle_inhibit_changed_signal *ev) |
| 162 | { |
| 163 | if (!ev) |
| 164 | { |
| 165 | return; |
| 166 | } |
| 167 | |
| 168 | if (ev->inhibit) |
| 169 | { |
| 170 | wf::get_core().disconnect(&global_idle->on_seat_activity); |
| 171 | wf::get_core().disconnect(&on_seat_activity); |
| 172 | global_idle->timeout_dpms.disconnect(); |
| 173 | timeout_screensaver.disconnect(); |
| 174 | } else |
nothing calls this directly
no test coverage detected