====== Differences ====== This shows you the differences between two versions of the page.
script_skip_lockscreen [2015/01/20 18:13] trianguloy created |
script_skip_lockscreen [2015/11/12 13:31] (current) trianguloy |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== About the script ====== | ====== About the script ====== | ||
- | * Purpose : This script lets you change between desktops without entering the lockscreen one | + | * Purpose : This script lets you change between desktops without entering the lockscreen and/or the floating desktop |
* Author : [[https://plus.google.com/u/1/105066926163073195690|TrianguloY]] | * Author : [[https://plus.google.com/u/1/105066926163073195690|TrianguloY]] | ||
====== How to use the script ====== | ====== How to use the script ====== | ||
- | Set the script in the two fingers swipe left and two fingers swipe right event in general settings. Won't work from another different event. | + | **Updated (12/11/2015): Now you can also skip or not the floating desktop** |
- | If you want to go to the lock screen, use a shortcut or go to settings, configure desktops, long click the one you want to go to. | + | Set the script in the two fingers swipe left and two fingers swipe right event in general settings. Won't work from another different event (but if you want to it can be easily changed) |
+ | |||
+ | If you want to go to the lock screen or to the floating desktop, use a shortcut or go to settings, configure desktops, long click the one you want to go to. | ||
+ | |||
+ | Configuration: | ||
+ | Simply change true<->false if you want to skip the lock screen and/or the floating desktop. | ||
====== Script code ====== | ====== Script code ====== | ||
<sxh javascript> | <sxh javascript> | ||
+ | /* config */ | ||
+ | |||
+ | var skip_LockScreen = true; | ||
+ | var skip_Floating = true; | ||
+ | |||
+ | /* end config */ | ||
+ | |||
var desktopsarray=LL.getAllDesktops(); | var desktopsarray=LL.getAllDesktops(); | ||
var desktops=[]; | var desktops=[]; | ||
var currentid=LL.getCurrentDesktop().getId(); | var currentid=LL.getCurrentDesktop().getId(); | ||
var currentat=-1; | var currentat=-1; | ||
+ | |||
var lockscreenid=LL.getLockscreenDesktop(); | var lockscreenid=LL.getLockscreenDesktop(); | ||
if(lockscreenid!=null)lockscreenid=lockscreenid.getId(); | if(lockscreenid!=null)lockscreenid=lockscreenid.getId(); | ||
+ | var floatingid=LL.getFloatingDesktop(); | ||
+ | if(floatingid!=null)floatingid=floatingid.getId(); | ||
+ | |||
var p=0; | var p=0; | ||
for(var t=0;t<desktopsarray.getLength();++t){ | for(var t=0;t<desktopsarray.getLength();++t){ | ||
var id=desktopsarray.getAt(t); | var id=desktopsarray.getAt(t); | ||
- | if(id==lockscreenid)continue; | + | if(id==currentid){ |
- | if(id==currentid)currentat=p; | + | currentat=p; |
+ | }else{ | ||
+ | if(skip_LockScreen && id==lockscreenid)continue; | ||
+ | if(skip_Floating && id==floatingid)continue; | ||
+ | } | ||
desktops[p++]=id; | desktops[p++]=id; | ||
} | } | ||
+ | |||
var source=LL.getEvent().getSource(); | var source=LL.getEvent().getSource(); | ||
if(source=="C_SWIPE2_RIGHT"){ | if(source=="C_SWIPE2_RIGHT"){ |