How to Create a Basic Cydia Tweak Without Coding Knowledge

Have you ever wondered how jailbreak tweaks are made? Maybe you wanted to make one yourself? If yes, then this tutorial is for you. I’ll be explaining everything from installing theos to making a tweak and running it on your jailbroken iPhone or iPad.

Step 1: Installing the Prerequisites

Before we begin making any Cydia tweak, it’s important to install a few packages that will aid and prepare for the process.

Open Cydia and add the following repository: https://coolstar.org/publicrepo/. Then, install the following tweaks and dependencies:

  • iOS Toolchain
  • LLVM+clang
  • Core Utilities
  • Core Utilities (/bin)
  • perl
  • git
  • make
  • MTerminal

Step 2: Installing Theos

I’ll be talking about Theos a lot through out this tutorial. In fact, Theos is the tool that allows us to create a tweak of our owns.

Open the MTerminal app on your home screen and type:

  1. su
  2. root password (default is alpine)
  3. passwd
  4. *Your new root password*
  5. *Repeat your new root password*
  6. cd /var
  7. git config –global http.sslVerify “false” (with quotes)
  8. git clone https://github.com/theos/theos
  9. make update theos
  10. cp /usr/local/bin/perl /usr/bin

Step 3: Installing SDK

Open this website on your Safari browser and download the iOS 8.1 SDK (even if you’re on a lower or newer version, use the 8.1 version). Unpack the SDK using your favorite file manager (iFile or Filza) and place it to /var/theos/sdks.

Done! You’re now ready to make tweaks!

Step 4: Create a Theos project

  1. Open MTerminal
  2. Type the following:
  • su
  • *Your root password*
  • cd /var/mobile
  • /var/theos/bin/nic.pl

You’ll see something like this:

How to Create a Basic Cydia Tweak Without Coding Knowledge 1

Within the MTerminal screen:

  1. Choose the template iphone/tweak (type 11), name the project.
  2. Type com.YourNickName.YourTweakName in package name
  3. Type your nickname
  4. Hit enter when you see “MobileSubstrate bundle filter”
  5. Hit enter when you see “List of applications to terminate upon installation”

Now, in your file manager, in the home directory, you’ll see a folder named with the name you’ve chosen for your tweak.

Step 5: Understanding hooking

The iOS SpringBoard consists of headers. (You can search for them here). iOS tweaks replace methods in headers by hooking into them. Here’s a hooking example:

So, that’s hooking! Now, you need to learn about methods.

Step 6: Understanding methods

There are 3 main types of methods. These are booleans, doubles, and voids. A method can be found in a header. For example, here is a method from the SBFolder header:

-(BOOL)shouldRemoveWhenEmpty

This method is a boolean. Boolean methods start with -(BOOL) or -(_Bool). Booleans are like switches. They can only have two types: YES and NO. So, let’s modify a boolean.

Modifying booleans is pretty simple, right? Here are some tips to help you understand booleans better:

  • if the boolean starts with a +, you should write +(BOOL)booleanName, not -(BOOL)booleanName
  • if the boolean has (_Bool) instead of (BOOL), use it like this: -(_Bool)booleanName
  • Booleans can only return YES and NO. If you return them to somewhere else, the tweak won’t work.

Step 7: Making a Cydia tweak

Now, let’s write our tweak! We’ll make a simple one, which will stop folders from removing themselves when they’re empty.

  1. Open the tweak directory.
  2. Open the file called makefile.
  3. Change include $THEOS/makefiles/common.mk to include /var/theos/makefiles/common.mk. If the line looks like include theos/makefiles/common.mk, do the same with it.
  4. At the top of the file (before include /var/theos/makefiles/common.mk) add the following line: ARCHS = armv7 armv7s arm64
  5. Open the file called tweak.xm
  6. Delete everything.

The Tweak.xm file is the file which will become a tweak later.

First, let’s hook into SBFolder like this:

%hook SBFolder

%end

Second, let’s modify the method shouldRemoveWhenEmpty to NO, so the folder isn’t removed when it’s empty:

-(BOOL)shouldRemoveWhenEmpty {

return NO;

}

Well, that’s it. You’ve written your first tweak. Now, let’s install it! If you didn’t understand something, here’s the full code:

Open MTerminal again and type the following:

  • su
  • *Your root password*
  • cd /var/mobile/name-of-folder-where-the-tweak.xm-file-is-located
  • make package install

Done! Wait for some time, and your tweak will be compiled, and the device will respring. Once your iPhone is turned back on, try creating a folder, and then removing all the apps from there.

See? It worked!

How to Create a Basic Cydia Tweak Without Coding Knowledge 2

Stop here if that’s all you want to learn. The section below will talk about doubles and teach you how to make a more advanced Cydia tweaks.

Making an Advanced Tweak (Part 2)

Doubles are values which usually return numbers. Here’s a double from the SBDockView header:

-(void)setBackgroundAlpha:(double)arg1.

This double sets the background alpha of the dock. But wait, void? A double and a void? Yes, a double and a void. Since we’re making a tweak with a double, let me explain how to change such a double.

A simple double would be changed like this:

-(double)doubleName {

return 0.5;

}

You can change 0.5 to any other value. But, a double with a void would be changed like this:

-(void)voidName:(double)doubleName {

%orig(0.5);

}

Or any other number. Also, there are voids with booleans these are changed like this:

-(void)voidName:(BOOL)booleanName {

%orig(YES);

}

Or NO.

So now, let’s write a tweak with a double! It will remove the dock background, by setting its alpha (transparency to 0.0):

First, we hook into SBDockView:

Now, as in the first example do the following in MTerminal:

  • su
  • *Your root password*
  • cd /var/mobile/tweak-folder
  • make package install

Wait for your jailbroken iOS device to restart. After that, the dock background will disappear or should I say become transparent.

How to Create a Basic Cydia Tweak Without Coding Knowledge 3

Another Tweak (Part 3)

This last portion of the tutorial will show you how to make a tweak that stops remove the “Press Home button to unlock” text on the lock screen.

Voids are blocks of code. Here’s a void from SBDashBoardMainPageView:

-(void)_layoutCallToActionLabel.

Modifying the code:

-(void)_layoutCallToActionLabel {

Stuff to do;

}.

Note: to modify the code, just put the code you want to be used instead of the original into the brackets. But to add code to the original void, first type %orig; inside the brackets and only after the code.

Let’s hide the press home to unlock text!

The method _layoutCallToActionLabel puts the slide to unlock text to the lockscreen. We will disable it like this:

Now, compile the tweak as in example 1 and 2, and try it!

Hooooray, it worked!

How to Create a Basic Cydia Tweak Without Coding Knowledge 4

If you want to learn more about this process and make even more legit tweaks, I suggest you dive into Objective-C and logos. Developers such as Antique_Dev and LaughingQuoll also have some great tutorials on how to make Cydia tweaks as well.

For now that’s all, bye!

One Response

  1. Soup

Leave a Reply