 Look at me recording in vertical mode. In general, you probably heard me complain about people recording stuff in vertical mode, but I've also have done a couple of vertical videos when they make sense. So before you jump down my throat for having vertical video and being a hypocrite, there are times where you want to. For example, I'm filming my phone's screen, which is in vertical mode. If I was to record this on a standard portrait mode, you would lose resolution. I'm trying to get you the best resolution for this video. So even if you're on a desktop where your screen is in landscape mode, you're getting better resolution. Otherwise, I would have to, it would be squishing things down and cropping things out. We're getting the best resolution here. So just don't jump down my throat because I also hate vertical video when it's used improperly, which is 99% of the time. Anyway, today we're looking at, this is a fresh install of lineage GIS or GSI on my old Motorola Power G 2021, I think it is. And I just loaded it up. I installed Turmux and Turmux API. Those are two packages you're gonna need for what we're doing today. Turmux is a nice little shell environment. It's a terminal with a bunch of, with a package manager and everything to do 99.9% of the things you would do on a desktop Linux machine right here on your Android device. And then we also have to install the Turmux API package. It is important you install them both from the same place. Otherwise they can't interact with each other, which they need to do. So if you install Turmux from FDROID, make sure you install Turmux-API package from Turmux as well, or if you use the Google Play Store, install them both from there, or wherever you get them, make sure you get them both from the same spot. Otherwise they won't interact with each other. Once you have them both installed and you start up Turmux, you're gonna have to do PKG install Turmux-API to access the API. I already have that installed. Once you do that, what the Turmux-API application does is it allows Turmux to really interact with the Android interface. Turmux by itself does all your shell stuff, but if you want to access, for example, your Android clipboard to either put stuff in the clipboard or retrieve stuff from the clipboard, you're gonna want API installed. If you're gonna wanna access your cameras on your device, you're gonna want the Turmux-API installed. Or today we're going to do dialogue boxes. Yeah, so once that's installed, you should have a command called Turmux-dialogue. Run that and by default gives you a blank dialogue. This is going to be kind of like Xenity or Whiptale or one of those easy to use, simple dialogue boxes that you would use on your desktop Linux device to get simple dialogues, but Turmux has it all built in so you can write shell scripts and create icons and links or just run those scripts, however, and you can get a GUI dialogue. And right now we're looking at Turmux-dialogue, but you can also do notifications on your phone or little toaster pop-ups, which we'll look at in the future video. But there's a lot of options for this, just like you get with Xenity or like I said, Whiptale, there's a few other ones out there, but let's go ahead and get started. So just writing that gives you the blank dialogue. If we do dash T, it will give you a title. So we can say, hello world. I might do a lot of typos, gonna type fast, but don't worry, I'm not gonna stress myself out about typing these properly as far as the strings. Hello world, and then we have this little box we can type something in. I can say, hey, back at ya. And if I hit okay, you can see it gives us exocode, and then it also gives us the text that was typed so you can retrieve the text someone typed that way. So let's do that again. Let's clear the screen. We'll run that command again. And instead of hello world, we can say what is your name? And then when we, oh, forgot the closing or opening quotation mark there. And now we get this and I can type in Chris, great, perfect. And I get a responsive Chris in a nice JSON format. But we could also put a placeholder in that text area so I can say enter name here. And when I do that, now we get what is your name? And then down here it says enter your name here and then I click on that and it's just like a placeholder on like an HTML form. There you go. And we get that output that we can grab and do something with our script. You can also do confirmation boxes where you just want yes or no. So for example, instead of just typing this, instead of termux dialog, the default is that input box but we can do confirm. And we can say, instead of what is your name? I can say do you? Again, I typed something wrong. Want to continue. I'm gonna go back and fix that because this video is gonna be long. Bunch of typos right there. And we can hit enter there and we get a dialog box that says, do you wanna confirm? By default it says confirm. Again, we can say yes or no. We'll get that output and then we can do something with it later in our script. And then we can also give dash I and say, that's the title of our box up here. So we can just say instead of, do you wanna continue? We'll just say continue. Again, typos. I'm not gonna worry about the typos. I'm gonna keep saying that. Would you like to continue? And now we say continue as the title and then we'll say, would you like to continue yes or no? If I click no, it will say no. And then you can exit your script or do whatever you wanna do. You can also do date dialogues. So again, termux dash dialog and we can just say date. Again, we can give it a title. We can say dash T, what is the date? Or what is your birth date? Or whatever question you wanna ask. Boom, it's gonna open it up. It's gonna give you a nice little calendar and it's gonna default today's date. So we already know what today's date is. So we could do something like that but we can say instead of what is the date, we can say, what is your DOB for date of birth? And then we can give it a default date. So dash D and we can say 04091975. And now it'll say, what is your DOB for date of birth? And it didn't, it didn't default to that date. It should have. Did I type something wrong? Dash D. As you can see, when you check a date, it gives you the date. Oh, I'm looking at my notes here. But it does not change the default date displayed. The following changed the default date if none is selected. Oh, hmm. So it doesn't default to that day but if I don't select a day, okay. Ah, good. Good thing I wrote notes on my notes and I'll link to all my notes of all these examples below. That doesn't change the default date shown. It will set a default date. If you hit cancel, it returns the default date. That's what that does. See, it's great to have notes and I'm sharing them with you in the description of this video. What about radio buttons? So we can do again, termux, dialogue and we can say radio for radio buttons. And then we can say dash T. Please select a user. And then we're gonna do dash V for our options and then we're gonna give options separated by comma so I can say John, comma, Jack, comma and Jill. And you can give as many as you want. I'm sure there's probably a limit but it's probably a lot. And when you do that, you get an error because I typed something wrong. Let's see. Oh, that shouldn't be an R. That should be a T. There we go. So it says please select a user and then you can select. It's a radio button. So it just lets you select one whichever one you click. It'll return that. It'll give you the index of the item and also the text. Okay, let's look at this. How about a sheet? Okay. It's similar to a radio button but slides from the bottom and instantly enters on selected. No okay button. Okay. So with our last example, again, I was just reading my own notes. We select one and then click okay. If we do the same thing, let's run the same exact command but instead of radio, we're gonna say sheet with two E's that is. It gives you a dialog down here at the bottom and as soon as you select a name, it chooses that. So there's no okay button but it returns the name, there's text that you selected and the index. Great. Now let's look at spinner. So same exact command. We're gonna leave the title the same, the same options but we're gonna say spinner. And now we get a spinner dialog which is basically like a dropdown box here but it's called spinner. I'm not really sure why it's called a spinner but that's what you get. So you can choose it. That's probably good if you have a long list instead of it all being in one dialog. Okay. Another option, how about passwords, right? You wanna enter a password. You don't want it displaying on the screen. So we do the same thing and then we can do a default input so we don't have to give a type because it's gonna default to an input and what we're gonna do here, we can give it a title, please enter a password and then we can put a placeholder if we want. We don't have to but enter password and then we just do dash P and the dash P option tells us that it's password. So if I come in here and start typing it's gonna act like a Android password which only shows you the letter that you're typing as you're typing. Okay. But of course it returns it in plain text in your script. So let's see. How about a multi-line input? So let's go ahead, go to the last one. I'm just gonna leave all that text but instead of dash P we can do dash M. So we're not giving it a type so it knows it's default to input and when I run that, well now I can type in this and this and I can give it a multi-line input and when I click okay, it returns that in a string with the new line backslash N so you can split that up in your script and do stuff with it. How about entering a number? So on Android devices, you have your keyboard, that's what this is called, your touchscreen keyboard down here which can change depending on the type of input you give. If you're writing something in HTML you can say that it's a numeric input and it will default to your numeric options, your numeric pad on your keyboard. I don't know why I keep forgetting the word keyboard. So here we can just say please enter a number and I'll just say enter number and then at the end we're just gonna say N for numeric and when we do that, we come in here, we click here and it defaults to your numeric touchpad so that way they can enter just a number they don't try starting to type. It's easier for them to type on this and it's just great. I just love that you can on machines like this default to a number pad and let's see. And we have number and then the last example I have is selecting the time. So we're just gonna again say termux dash dialogue and this time we're just gonna say the type is a time dash T for title because you don't have to give it a title but it's usually a good idea. We'll just say select a time and there we go. We have your nice little, it's gonna default to whatever clock type system that your phone or user so it's what the user is familiar with. We can do AM, PM, we can change the hours, we can change the minutes. If you want, you can bring up a keyboard I guess. Oh, and then we can type it like that. Just like any other application. So there you go and then it's gonna return the time that you entered in I guess military time with the colon, which is a little interesting. But yeah, there's probably more options but those are all the basic ones. Again, I'll put a link in the description of this video to all these examples. I hope that you enjoyed this tutorial. I hope you found it useful. It's great to be able to write scripts that are specifically for an Android device that gives the user, it makes your shell scripts more user friendly on a touch screen, small touch screen device like a phone. So maybe you'll use this. And of course you can always with Turmux add scripts to your home screen with icons or you can have a shortcut list. That's all stuff that you can do with if you install the Turmux widget app. So yeah, thanks for watching. Please visit my website filmsbychrist.com. That's Chris the K and in a future video we're gonna look at doing this sort of thing but trying to make your script so it's compatible across different devices. So you can write a shell script once that uses dialogues if a GUI interface is available that will work on your desktop Linux or your Android Linux or if there's no GUI interface it will default to the shell. Thanks for watching. And again, please visit filmsbychrist.com. That's Chris the K. There's a link in the description as always. Have a great day.