desktop2: !bang command to toggle between 2 desktop areas Thread last updated on 2004-06-18 02:57:01

Posted by member 149795 on 2004-06-16 16:58:53

i need to make a bang command to toggle between
SDABottom -30 and SDABottom 0

im trying to do it with mzscript but keep getting confused. can someone with more experience than me possibly tell me what to do?

Posted by member 1316 on 2004-06-16 18:01:18 link

well, since desktop2 includes bang commands to switch the desktop area, you really don't need to make one yourself. check out the docs.

Posted by member 149795 on 2004-06-16 18:13:49 link

ok maby i was not clear enough, i have read my docs, i will try to explain more what i want to do.

i am using a theme with both top and bottom bars. the bottom bar(taskbar and vmw) has a shortcut to toggle itself. the thing is, it doesnt adjust the desktop area.

so i need a bang to toggle SDAbottom between -26 and -0 so that i can just add it to the same script that toggles the vwm and taskbar

here is what the toggle shortcut is so far

*shortcut "Toggle Bar" 0 -26 taskbar-edge.png .none .none #2 !Execute [!TaskbarToggle][!VWMShow toggle][!ShortcutGroupToggle 3]

i would like to add a the bang command here. i am not too good at if/then/eles statements, but i suppose that could be an option? thanks for all relpys

Posted by member 1316 on 2004-06-16 18:41:09 link

yes, and like I said, desktop2 comes with a bang to switch the desktop area. however, you can not just change the bottom, you need to change all 4 sides. check out the "!Bang Commands for desktop2.dll" section. trust me. it's in there. I'm looking at it right now.

Posted by member 149795 on 2004-06-16 19:08:07 link

ok sorry for not being clear. i realze completely what you say, but it doesnt toggle, it switches.

if you look at my 2nd post, you will see that if i were to put that bang into the toggle shortcut, i would not be able to return to my previous setting.

i would need to utilize !DesktopSetArea 0 26 -0 -30 and !DesktopSetArea 0 26 -0 -0, with one toggle bang command.

i start with -30. i would like to be able to toggle the task bar, and switch to -0, with the shortcut. then i would like to click the shortcut again, and go back to -30.

if i am still wrong about something, please tell me what to do so i am not so confused.

Posted by member 12798 on 2004-06-16 20:02:09 link

all you need is a mzscript that saves the state in a var.
ex.:
*script exec !ifEval ("%{state}" = "1") {!execute [!desktopsetarea bla2][!varset state "2"]} else {!execute [!desktopsetarea bla1][!varset state "1"]}

or another option, you create a second shortcut which switches back. then make it so that if you click the first, it will be hidden and the second will be shown, and for the second vice versa.

Posted by member 149795 on 2004-06-16 20:35:04 link

thanks man, thats what i was looking for.

however it doesnt work right. does that else work in that syntax? cause it will switch to state 2, but not back to 1

Posted by member 149795 on 2004-06-16 21:22:28 link

ok well it dont really matter no more i went with the shortcut method. it works perfectly.

i am still curious why that code does not work, it is correct and i tried alot of things but no success.

Posted by member 12798 on 2004-06-17 05:47:08 link

the script should be ok... of course you need to make a complete script out of it, only that one line won't work, of course (don't know how much you're into scripting...).
so it should be
*script bang !setdeskarea
*script exec !ifnexist "state" !varset state "1" ; defines start value
*script exec !ifEval ("%{state}" = "1") {!execute [!desktopsetarea bla2][!varset state "2"]} else {!execute [!desktopsetarea bla1][!varset state "1"]}
*script ~bang

you could of course put the line with the start value to a *script start line (actually, you should, although it doesn't make any difference in performance ;) ).

Posted by member 45783 on 2004-06-18 02:57:01 link

Use a varfile to define starting variables, *Script start only those commands which are absolutely neccessary.