VWM Indicator - Change shortcuts with VWM Thread last updated on 2004-01-06 21:27:12

Posted by member 2112 on 2004-01-06 06:25:02

Simplicity uses 4 shortcuts to create VWM indicator and is driven by a mzscript. I believe it works without a fault. I'm putting a VWM indicator in my new theme and believe that the same effect should be acheivable with less lines of code and without mzscript. But I have been unsuccessful so far and I don't know what is wrong.

My shortcut are in an LSBox and look like this...
*shortcut "" $vwm_start$ 3 desk.png deska.png .none #1h !VWMDesk 1
*shortcut "" $vwm_start+13$ 3 desk.png deska.png .none #2 !VWMDesk 2
*shortcut "" $vwm_start+13*2$ 3 desk.png deska.png .none #3 !VWMDesk 3
*shortcut "" $vwm_start+13*3$ 3 desk.png deska.png .none #4 !VWMDesk 4
*shortcut "" $vwm_start$ 3 deska.png .none .none #5 !none
*shortcut "" $vwm_start+13$ 3 deska.png .none .none #6h !none
*shortcut "" $vwm_start+13*2$ 3 deska.png .none .none #7h !none
*shortcut "" $vwm_start+13*3$ 3 deska.png .none .none #8h !none


The code I was originally using to hide and show the appropriate shortcut was this...
VWMOnSwitchTo !execute [!LsBoxGroupHide 5][!LsBoxGroupHide 6 ][!LsBoxGroupHide 7 ][!LsBoxGroupHide 8][!LsBoxGroupShow 1][!LsBoxGroupShow 2][!LsBoxGroupShow 3][!LsBoxGroupShow 4][!LsBoxGroupHide ^@dc^][!LsBoxGroupShow ^@#d^4+^@dc^^@#d^]

This failed to hide the previously active shortcut when you changed from the related VWM desk. So if you changed from desk 2 to 3, sc2 (shortcut 2) would still be active. If you then changed to either desk 1 or 4, sc2 would become inactive but sc3 remain active. I don't see why.

So I then tried this code...
VWMOnSwitchFrom !execute [LsBoxGroupHide ^@#d^4+^@dc^^@#d^][!LsBoxGroupShow ^@dc^]
VWMOnSwitchTo !execute [LsBoxGroupHide ^@dc^][!LsBoxGroupShow ^@#d^4+^@dc^^@#d^]

Sc1 is active when the theme first start and if you change from desk 1 it remains active until you change back to desk 1 and it becomes inactive. Otherwise all shortcuts remain inactive regardless of which desk you are on.

I've gone over these bits of code countless times and it seems to me that in theory they should work. But they don't. Does anyone know why? I would like to avoid using mzscript.

Posted by member 37809 on 2004-01-06 16:17:09 link

I don't see anything wrong either...

Although hiding and showing shortcuts in both VWMOnSwitchFrom and VWMOnSwitchTo seems like overkill.
I think without trying, that you can do
VWMOnSwitchFrom !LsBoxGroupHide ^@#d^4+^@dc^^@#d^
VWMOnSwitchTo !LsBoxGroupShow ^@#d^

This assumes that RabidVWM will execute $VWMOnSwitchTo$ on startup to show the indicator shortcut initially.

But as an alternative (and if the graphics would look correct), you might be able to move a hooked label, which is what I do, to avoid having to toggle shortcuts. I suppose you would do something like:
VWMOnSwitchTo !VWMSelDeskMove ^@#d^vwm_start+(^@dc^-1)*13^@#d^ 3

Posted by member 2112 on 2004-01-06 17:11:37 link

I believe I have to hide and show for the VWMOnSwitchTo and VWMOnSwitchFrom because when I switch from a desk I hide the "active shortcut" and show the "inactive shortcuts". Likewise, with VWMOnSwitchTo I want to hide the "inactive shortcut" and show the "active shortcut".

I don't want to change completely over to using labels since I want the hover effect, but I think I might be more successful by hiding the inactive shortcut them moving the active label as you have suggested. I'll give it a try and let you know how it goes.

Thanks tnl

Posted by member 37809 on 2004-01-06 17:26:19 link

Ah I see now.

IIRC, the value of ^@dc^ in VWMOnSwitchFrom is the switched-from desk, while in VWMOnSwitchTo it is the switched-to desk.

Hover FX would be sweet nonetheless. Even better if available for all modules... ... .. .

BTW a second glance at that code and you're missing the '!' for those LsBox bangs.

Posted by member 2112 on 2004-01-06 17:38:08 link

IIRC, the value of ^@dc^ in VWMOnSwitchFrom is the switched-from desk, while in VWMOnSwitchTo it is the switched-to desk.


That's right. When I change from a desk, I need to hide the active shortcut and show the inactive shortcut for that desk. If I were to just hide the active shortcut I wouldn't have anything else showing where the button for that desk would normally be. I'll give your code a try anyway, just incase I'm confused.

Posted by member 37809 on 2004-01-06 20:18:54 link

I was confused :D

For the behaviour you want, I guess you could try the label and have shortcutgroups for the inactives.

Posted by member 2112 on 2004-01-06 20:29:16 link

Thankyou so much, tnl. The missing ! was the problem all along with that second code. I can't believe I didn't spot it. You've saved me from a huge headache.

Posted by member 37809 on 2004-01-06 21:27:12 link

np :}