Changing a icon after a macro has been triggered

peterinhawk

New member
I'd like some help to work out how, or even if it is possible, to toggle a home screen icon - either its image or its colour - when a macro is triggered. The 'use case' being, for example, where I use a macro to drive a particular UI to run on or off a tile in the quick settings. when it's triggered the icon might 'toggle' to a different image or the colour of the icon change. I've been trying to set this up in macrodroid but I suspect I'd need to resort to tasker - but this question in this forum is the last resort. I also use Kustom Widget Creator and had tried to create it there by failed. Thanks
 

420

Active member
I'd like some help to work out how, or even if it is possible, to toggle a home screen icon - either its image or its colour - when a macro is triggered. The 'use case' being, for example, where I use a macro to drive a particular UI to run on or off a tile in the quick settings. when it's triggered the icon might 'toggle' to a different image or the colour of the icon change. I've been trying to set this up in macrodroid but I suspect I'd need to resort to tasker - but this question in this forum is the last resort. I also use Kustom Widget Creator and had tried to create it there by failed. Thanks
What exactly do you mean by "a home screen icon"? Do you mean an icon of a shortcut to another app? I don't think you can change anything about those..

Sorry but it is not clear to me what you want to do..

"where I use a macro to drive a particular UI to run on or off a tile in the quick settings. when it's triggered the icon might 'toggle' to a different image or the colour of the icon change. "

Reading this it seems like you want the quick setting icon/colour to change, and not some home screen icon?

I use KWGT extensively, if you could explain what exactly you are looking for i might be able to help further with KWGT.
 

Snurre

Well-known member
Under 'Macrodroid Specific' you can use 'Widget button modify'
It's possible to choose any other icons or fade the icon you have, it can really give a Nice effect
 
  • Like
Reactions: 420

Snurre

Well-known member
I'm using it on five buttons to toggle WiFi, Bluetooth, fastcharge, airplanemode and connected to my car
When activated they lights up and fades when disconnected
They are also triggered from other macro's and apps that changes the connection
Screenshot_20211017-165347_Nova7.jpgScreenshot_20211017-165522_Nova7.jpg
 

peterinhawk

New member
What exactly do you mean by "a home screen icon"? Do you mean an icon of a shortcut to another app? I don't think you can change anything about those..

Sorry but it is not clear to me what you want to do..

"where I use a macro to drive a particular UI to run on or off a tile in the quick settings. when it's triggered the icon might 'toggle' to a different image or the colour of the icon change. "

Reading this it seems like you want the quick setting icon/colour to change, and not some home screen icon?

I use KWGT extensively, if you could explain what exactly you are looking for i might be able to help further with KWGT.
Thanks and yes I'll explain better. I'd like to have a way of seeing the status of various 'settings' on my home screen. For example I often forward the phone's number to another phone, eg my work phone, so I figure the best way is to record whether I've dialled the code to forward the phone. There doesn't seem to be any other way of visually seeing if the number has been forwarded. Another example is where I've connected to a VPN or not. There's no easy way to indicate that on the home screen but I figured that some interaction with a macro might allow a change to an icon or perhaps the colour of an icon or even some other visual indicator. I have managed to get Kustom to help in a couple of ways - but usually when the Kustom code can pick up a change, for example if the airplane mode is turned on or the location service is either on or off.
 

peterinhawk

New member
Under 'Macrodroid Specific' you can use 'Widget button modify'
It's possible to choose any other icons or fade the icon you have, it can really give a Nice effect
I did look at that and tried it but for some reason the widget icon didn't change. Perhaps some help on how the action is configured to make this happen?
 

420

Active member
Thanks and yes I'll explain better. I'd like to have a way of seeing the status of various 'settings' on my home screen. For example I often forward the phone's number to another phone, eg my work phone, so I figure the best way is to record whether I've dialled the code to forward the phone. There doesn't seem to be any other way of visually seeing if the number has been forwarded. Another example is where I've connected to a VPN or not. There's no easy way to indicate that on the home screen but I figured that some interaction with a macro might allow a change to an icon or perhaps the colour of an icon or even some other visual indicator. I have managed to get Kustom to help in a couple of ways - but usually when the Kustom code can pick up a change, for example if the airplane mode is turned on or the location service is either on or off.
Hmm, i thought your problem was that you did not know how to use KWGT.. but you are really just looking for a way to use these things as a trigger in macrodroid?

I'm sorry but i never forwarded a call in my life and i don't use a VPN, so i really don't know what you could try to make that work.. i know there are people on this forum that do use a VPN though so i hope they will be able to help you with this! (not sure about the call forwarding)
 

Snurre

Well-known member
I was just thinking about your phone forwarding
If you just dial a number for the forwarding you can make a button and let MD do the dialing and then use the 'Widget button modify'
Just a thought
 

Dm114

Well-known member
As
I'd like some help to work out how, or even if it is possible, to toggle a home screen icon - either its image or its colour - when a macro is triggered. The 'use case' being, for example, where I use a macro to drive a particular UI to run on or off a tile in the quick settings. when it's triggered the icon might 'toggle' to a different image or the colour of the icon change. I've been trying to set this up in macrodroid but I suspect I'd need to resort to tasker - but this question in this forum is the last resort. I also use Kustom Widget Creator and had tried to create it there by failed. Thanks
As @Snurre said, you can use 'Widget button modify' action to dynamically modify an icon on the home screen. But, as you seem to have several situations you want to visualize on the screen, KWGT could be a good solution (I'm using it too).
 
  • Like
Reactions: 420

Snurre

Well-known member
It is possible to have more than one 'if else' but I think just one 'else'
What is it ecsatly you want to do?
 

Qarboz

Well-known member
you can also insert constraints in actions
Thanks for this insight which has been really helpful. I've created quite a few 'toggles' based on this approach. One aspect I'm interested in is whether its possible to create a 'If Else' statement that has more than 1 'else'? For example to toggle a volume through a low / medium / high setting on one button?

you can insert constraints in actions
 

peterinhawk

New member
As

As @Snurre said, you can use 'Widget button modify' action to dynamically modify an icon on the home screen. But, as you seem to have several situations you want to visualize on the screen, KWGT could be a good solution (I'm using it too).
Yes I've ended up with a bit of a collection of macro buttons on the home screen and I agree Kustom is probably the way forward. But I couldn't figure out how to 'toggle' the icons as per macrodroid
 

420

Active member
Yes I've ended up with a bit of a collection of macro buttons on the home screen and I agree Kustom is probably the way forward. But I couldn't figure out how to 'toggle' the icons as per macrodroid
I'll give you an example;

In macrodroid add an action - Tasker/Locale Plugin - Kustom Widget - KWGT Send Variable

In the "Tasker Text" field you enter whatever you want to set the KWGT variable to.

In the "Kustom variabe" field you enter a name for your KWGT variable (this can also be anything you want, you don't have to create it in KWGT first)

So for example; "Tasker Text" = Medium, "Kustom variable" = Volume

Now you can use this kustom variable in their formula's, for example;

$if(br(tasker,Volume)=Soft,Looks_one,if(br(tasker,Volume)=Medium,Looks_two,Looks_3))$

In this example Looks_one, two and 3 are three different KWGT icons.

Note that the KWGT variable will not be updated (and therefor will be empty) untill the first time the macrodroid action runs or is tested.

Edit; Incase you just want it to display the KWGT variable value directly (instead of changing an icon depending on it's value) you can also do that using formula's like this; $br(tasker,Volume)$
 
Last edited:

420

Active member
One aspect I'm interested in is whether its possible to create a 'If Else' statement that has more than 1 'else'? For example to toggle a volume through a low / medium / high setting on one button?
You cannot have more then 1 "else" in 1 if clause but this can certainly be done, create a (local) string variable and then add an if clause;

(It could also be done with a (local) integer variable but i think this is easier)

If - string variable name = Low
Set - string variable name - Medium
More action(s)
Else if - string variable name = Medium
Set - string variable name - High
More action(s)
Else if - string variable name = High
Set - string variable name - Low
More action(s)
End if

You will have to set it manually the first time, after that each time (this part of) the macro runs it will go to the next setting.
 

Dm114

Well-known member
three-state button without if...then

View attachment 1292

it's not elegant, but it works :p
Another way to write it in a more "elegant" manner could be:
If rotaz=1 do all actions according to this value
Else if rotaz=2 do all actions according to this value
Else rotaz=0 + do all actions according to this value
Endif
 
Top