File tree Expand file tree Collapse file tree 5 files changed +90
-0
lines changed Expand file tree Collapse file tree 5 files changed +90
-0
lines changed Original file line number Diff line number Diff line change @@ -227,6 +227,23 @@ export function setupActions(settings) {
227227 registerMinimapAction ( "switch-global-up" , ( mw , space ) => space . switchGlobalUp ( ) ) ;
228228 registerMinimapAction ( "switch-global-down" , ( mw , space ) => space . switchGlobalDown ( ) ) ;
229229
230+ registerAction ( "move-global-right" ,
231+ ( mw , space ) => space . moveGlobal ( Meta . MotionDirection . RIGHT ) ,
232+ { settings }
233+ ) ;
234+ registerAction ( "move-global-left" ,
235+ ( mw , space ) => space . moveGlobal ( Meta . MotionDirection . LEFT ) ,
236+ { settings }
237+ ) ;
238+ registerAction ( "move-global-up" ,
239+ ( mw , space ) => space . moveGlobal ( Meta . MotionDirection . UP ) ,
240+ { settings }
241+ ) ;
242+ registerAction ( "move-global-down" ,
243+ ( mw , space ) => space . moveGlobal ( Meta . MotionDirection . DO ) ,
244+ { settings }
245+ ) ;
246+
230247 registerMinimapAction ( "move-left" ,
231248 ( _mw , space ) => space . swap ( Meta . MotionDirection . LEFT ) ) ;
232249 registerMinimapAction ( "move-right" ,
Original file line number Diff line number Diff line change @@ -39,6 +39,10 @@ const actions = {
3939 'switch-global-right' ,
4040 'switch-global-up' ,
4141 'switch-global-down' ,
42+ 'move-global-left' ,
43+ 'move-global-right' ,
44+ 'move-global-up' ,
45+ 'move-global-down' ,
4246 'switch-up-or-else-workspace' ,
4347 'switch-down-or-else-workspace' ,
4448 'switch-first' ,
Original file line number Diff line number Diff line change 285285 <default ><![CDATA[ []]]> </default >
286286 <summary >Switch to window or monitor below</summary >
287287 </key >
288+ <key type =" as" name =" move-global-right" >
289+ <default ><![CDATA[ []]]> </default >
290+ <summary >Move active window to the next spot or monitor to the right</summary >
291+ </key >
292+ <key type =" as" name =" move-global-left" >
293+ <default ><![CDATA[ []]]> </default >
294+ <summary >Move active window to the next spot or monitor to the left</summary >
295+ </key >
296+ <key type =" as" name =" move-global-up" >
297+ <default ><![CDATA[ []]]> </default >
298+ <summary >Move active window to the next spot or monitor above</summary >
299+ </key >
300+ <key type =" as" name =" move-global-down" >
301+ <default ><![CDATA[ []]]> </default >
302+ <summary >Move active window to the next spot or monitor below</summary >
303+ </key >
288304 <key type =" as" name =" switch-up-or-else-workspace" >
289305 <default ><![CDATA[ []]]> </default >
290306 <summary >Switch to window or workspace above</summary >
Original file line number Diff line number Diff line change @@ -1262,6 +1262,59 @@ export class Space extends Array {
12621262 ensureViewport ( metaWindow , space ) ;
12631263 }
12641264
1265+ moveGlobal ( direction ) {
1266+ let space = this ;
1267+ let index = space . selectedIndex ( ) ;
1268+ if ( index === - 1 ) {
1269+ return ;
1270+ }
1271+
1272+ let column = space [ index ] ;
1273+ let row = column . indexOf ( space . selectedWindow ) ;
1274+ if ( row === - 1 ) {
1275+ let selected = sortWindows ( this , column ) [ column . length - 1 ] ;
1276+ row = column . indexOf ( selected ) ;
1277+ }
1278+
1279+ switch ( direction ) {
1280+ case Meta . MotionDirection . LEFT :
1281+ if ( index > 0 ) {
1282+ space . swap ( direction ) ;
1283+ return ;
1284+ } else {
1285+ spaces . switchMonitor ( Meta . DisplayDirection . LEFT , true ) ;
1286+ return ;
1287+ }
1288+
1289+ case Meta . MotionDirection . RIGHT :
1290+ if ( index < space . length - 1 ) {
1291+ space . swap ( direction ) ;
1292+ return ;
1293+ } else {
1294+ spaces . switchMonitor ( Meta . DisplayDirection . RIGHT , true ) ;
1295+ return ;
1296+ }
1297+
1298+ case Meta . MotionDirection . UP :
1299+ if ( row > 0 ) {
1300+ space . swap ( direction ) ;
1301+ return ;
1302+ } else {
1303+ spaces . switchMonitor ( Meta . DisplayDirection . UP , true ) ;
1304+ return ;
1305+ }
1306+
1307+ case Meta . MotionDirection . DOWN :
1308+ if ( row < column . length - 1 ) {
1309+ space . swap ( direction ) ;
1310+ return ;
1311+ } else {
1312+ spaces . switchMonitor ( Meta . DisplayDirection . DOWN , true ) ;
1313+ return ;
1314+ }
1315+ }
1316+ }
1317+
12651318 _drift ( dx ) {
12661319 if ( dx === 0 ) {
12671320 return ;
You can’t perform that action at this time.
0 commit comments