File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -55,8 +55,8 @@ struct swaylock_args {
5555 uint32_t font_size ;
5656 uint32_t radius ;
5757 uint32_t thickness ;
58- uint32_t indicator_x_position ;
59- uint32_t indicator_y_position ;
58+ int32_t indicator_x_position ;
59+ int32_t indicator_y_position ;
6060 bool override_indicator_x_position ;
6161 bool override_indicator_y_position ;
6262 bool ignore_empty ;
Original file line number Diff line number Diff line change @@ -224,16 +224,26 @@ static bool render_frame(struct swaylock_surface *surface) {
224224
225225 // Center the indicator unless overridden by the user
226226 if (state -> args .override_indicator_x_position ) {
227- subsurf_xpos = state -> args .indicator_x_position -
228- buffer_width / (2 * surface -> scale ) + 2 / surface -> scale ;
227+ if (state -> args .indicator_x_position < 0 ) {
228+ subsurf_xpos = surface -> width + state -> args .indicator_x_position -
229+ buffer_width / (2 * surface -> scale ) + 2 / surface -> scale ;
230+ } else {
231+ subsurf_xpos = state -> args .indicator_x_position -
232+ buffer_width / (2 * surface -> scale ) + 2 / surface -> scale ;
233+ }
229234 } else {
230235 subsurf_xpos = surface -> width / 2 -
231236 buffer_width / (2 * surface -> scale ) + 2 / surface -> scale ;
232237 }
233238
234239 if (state -> args .override_indicator_y_position ) {
235- subsurf_ypos = state -> args .indicator_y_position -
236- (state -> args .radius + state -> args .thickness );
240+ if (state -> args .indicator_y_position < 0 ) {
241+ subsurf_ypos = surface -> height + state -> args .indicator_y_position -
242+ (state -> args .radius + state -> args .thickness );
243+ } else {
244+ subsurf_ypos = state -> args .indicator_y_position -
245+ (state -> args .radius + state -> args .thickness );
246+ }
237247 } else {
238248 subsurf_ypos = surface -> height / 2 -
239249 (state -> args .radius + state -> args .thickness );
You can’t perform that action at this time.
0 commit comments