Numix Theme for Kingsoft Office

I’ve put together a quick theme for Kingsoft Office that makes it fit in the Numix Theme.

Update: If the Kingsoft dialogs are not matching the Ubuntu GTK theme in 14.04, give this fix a try.

sudo apt-get install gtk2-engines-murrine:i386; sudo apt-get install gtk2-engines-pixbuf:i386

Firstly, right click the top bar and enable “Use System Title Bar”

Screenshot from 2014-01-28 12:23:01

Then run the following command, entering your password when asked.

sudo wget http://u.dos95.eu/numix/ongmanicommon.kuip -O /opt/kingsoft/wps-office/office6/res/themes/ongmanicommon.kuip

You should then be left with this, enjoy.

Screenshot from 2014-05-04 20:19:27

 

 

Ubuntu Ambiance Theme for Kingsoft Office

I’ve put together a quick theme for Kingsoft Office that makes it fit in with the rest of Ubuntu.

Update: If the Kingsoft dialogs are not matching the Ubuntu GTK theme in 14.04, give this fix a try.

sudo apt-get install gtk2-engines-murrine:i386; sudo apt-get install gtk2-engines-pixbuf:i386

Firstly, right click the top bar and enable “Use System Title Bar”

Screenshot from 2014-01-28 12:23:01

Then run the following command, entering your password when asked.

sudo wget http://u.dos95.eu/ongmanicommon.kuip -O /opt/kingsoft/wps-office/office6/res/themes/ongmanicommon.kuip

You should then be left with a Ambiance version of Kingsoft Office, enjoy!

Screenshot from 2014-01-28 12:28:21

Unlock Bootloader & Flash TWRP on HTC One with Locked Bootloader (S-OFF) without HTCDev.

THIS ONLY WORKS WITH S-OFF.

I have a HTC One that has S-OFF, however the bootloader is locked. If I want to flash TWRP or any other suitable recovery, there are two ways. I can unlock via HTCDev, which will take a short while and unlocks fastboot, or I can flash TWRP via RUU mode.

Since the phone has S-OFF, we can flash any file via RUU mode, we can flash a custom recovery and unlock the bootloader without needing to use HTCDev.

First, reboot into the bootloader and into RUU mode.

adb reboot-bootloader
fastboot oem rebootRUU

Download M7-TWRP-RUU and flash it.

fastboot flash zip M7-TWRP-RUU.zip
# fastboot flash zip M7-TWRP-RUU.zip
target reported max download size of 1526722560 bytes
sending 'zip' (9392 KB)...
OKAY [ 1.252s]
writing 'zip'...
(bootloader) zip header checking...
(bootloader) zip info parsing...
(bootloader) checking model ID...
(bootloader) checking custom ID...
(bootloader) start image[recovery] unzipping & flushing...
(bootloader) [RUU]UZ,recovery,0
(bootloader) [RUU]UZ,recovery,10
(bootloader) [RUU]UZ,recovery,20
(bootloader) [RUU]UZ,recovery,31
(bootloader) [RUU]UZ,recovery,41
(bootloader) [RUU]UZ,recovery,51
(bootloader) [RUU]UZ,recovery,61
(bootloader) [RUU]UZ,recovery,72
(bootloader) [RUU]UZ,recovery,82
(bootloader) [RUU]UZ,recovery,94
(bootloader) [RUU]UZ,recovery,100
(bootloader) [RUU]WP,recovery,0
(bootloader) [RUU]WP,recovery,100
(bootloader) ...... Successful
OKAY [ 3.399s]
finished. total time: 4.651s

If the green bar does not fill, that’s okay. As long as the output reports success, we’re good.

Reboot the bootloader.

 fastboot reboot-bootloader

Select BOOTLOADER and then RECOVERY. You’ll get dropped into TWRP.

Brilliant, TWRP is installed. You may now want to unlock/lock the bootloader or reset your tampered flag.  You can do this from TWRP.

Drop into an ADB shell in TWRP with “adb shell”.

Copy & Paste these commands exactly. If you make one mistake, you have a chance to brick the entire phone.

Unlock Bootloader

echo -ne "HTCU" | dd of=/dev/block/mmcblk0p3 bs=1 seek=33796

Lock Bootloader

echo -ne '\x00\x00\x00\x00' | dd of=/dev/block/mmcblk0p3 bs=1 seek=33796

Reset Tampered Flag

echo -ne '\x00' | dd of=/dev/block/mmcblk0p7 bs=1 seek=4265988

Exit the shell and boot back into the bootloader and verify any changes.

exit
adb reboot-bootloader

You may now want to go ahead and install any recovery or ROM you wish.

REVERSING

Find the firmware file for your phone and flash it. It will contain the stock recovery. For me it was 3.62.401.1.zip.

Disable Office 2013 Start Screen

I installed Office 2013 a while back and the most obvious change when using it is that new start screen. When wanting to write a document, I’d rather just drop straight into the word processor.

Word
You can go into each application’s settings and disable this screen manually, but this is time consuming and the settings are hard to find. With some registry digging, I found an option that allows the new screen to be disabled office-wide. I’ve linked to a zip below which contains two registry files. One to make the disable and one to revert. Open the zip up in your achive manager, and click the file you want to install.

Disable Start Screen: http://u.dos95.eu/DisableStart.zip

KomodoEdit Macro for PHP/HTML/CSS Tidy on Ubuntu

I found a cool Komodo Macro on the web for tidying a couple of languages. Unfortunately it does not work with the latest version of  Komodo.

I’ve modified it to work with the latest version of Komodo. I’ve also modified it tidy PHP and HTML at the same time.  If you want to use it on Ubuntu, you need to install the following.

sudo apt-get install astyle
sudo apt-get install perltidy
sudo apt-get install tidy 
sudo apt-get install csstidy 
sudo apt-get install php-pear 
sudo pear install channel://pear.php.net/php_beautifier-0.1.15

Here is the macro itself.

komodo.assertMacroVersion(3);
if (komodo.view.scintilla) { komodo.view.scintilla.focus(); }

var formatter;
var language = komodo.koDoc.language;
var cannot_tidy_selection = false;
switch (language) {
 case 'C':
 formatter = 'astyle --style=linux';
 break;
 case 'C++':
 formatter = 'astyle --style=kr';
 break;
 case 'C#':
 formatter = 'astyle --style=ansi';
 break;
 case 'CSS':
 formatter = 'csstidy - --preserve_css=true --lowercase_s=true --silent=true --case_properties=true --sort_properties=false --template=low --remove_bslash=false';
 break;
 case 'HTML':
 cannot_tidy_selection = true;
 formatter = 'tidy -q -utf8 -asxhtml -i -w 80';
 break;
 case 'JSON':
 formatter = 'astyle --style=java';
 break;
 case 'Perl':
 formatter = 'perltidy';
 break;
 case 'PHP':
 formatter = 'php_beautifier -s4 -l"Pear(newline_class=false,newline_function=false)" 2> /dev/null; tidy -q -utf8 -asxhtml -i -w 80 --show-body-only true 2> /dev/null';
 break;
 case 'XUL':
 cannot_tidy_selection = true;
 formatter = 'tidy -q -utf8 -xml -i -w 80';
 break;
 default:
 alert("I don't know how to tidy " + language);
 exit(1);
}

//save current cursor position
var currentPos = komodo.editor.currentPos;

try {
 // Save the file. After the operation you can check what changes where made by
 // File -> Show Unsaved Changes
 komodo.doCommand('cmd_save');

 // Group operations into a single undo
 komodo.editor.beginUndoAction();

 // Select entire buffer & pipe it into formatter.
 //komodo.doCommand('cmd_selectAll');
 //Run_RunEncodedCommand(window, formatter + " {'insertOutput': True, 'operateOnSelection': True}");

 //var text_not_selected = komodo.editor.selText == "";
 var text_not_selected = cannot_tidy_selection
 || komodo.editor.selText == "";
 if (text_not_selected) {
 komodo.doCommand('cmd_selectAll');
 }
 Run_RunEncodedCommand(window, formatter + " {'insertOutput': True, 'operateOnSelection': True}");

 if (text_not_selected) {
 komodo.editor.gotoPos(currentPos);
 }

 // Restore cursor. It will be close to the where it started depending on how the text was modified.
 komodo.editor.gotoPos(currentPos);

 // On windows, when the output of a command is inserted into an edit buffer it has unix line ends.
 komodo.doCommand('cmd_cleanLineEndings ');

} catch (e) {
 alert(e);

} finally {
 // Must end undo action or may corrupt edit buffer
 komodo.editor.endUndoAction();
}

Theming Kingsoft Office for ElementaryOS

You may of noticed recently that the popular Microsoft Office clone Kingsoft Office has recently released a Linux port. Compared to LibreOffice, Kingsoft offers a very easy and modern user interface that regular PC uses will find easy to use.

However, Kingsoft Office uses Delphi and does not follow GTK styling. Because of this it looks out of place on ElementaryOS, fortunately there is an easy fix for this which involves modifying Kingsofts Ongmani theme files.

Source OMG! Ubuntu!

Firstly you need to install and download Kingsoft Office, you can follow the instructions here. You will need to install ia32-libs if you are running on a 64bit system.

You now need to theme Kingsoft Office, +Zsolt Ádám Albert has put together a pre-made theme that fits with the Elementary style. You can use these commands below for a quick install.

wget http://u.dos95.eu/wps_office_elementary_theme.zip
sudo unzip -o wps_office_elementary_theme.zip -d /opt/kingsoft/wps-office/office6/res/themes
rm -f wps_office_elementary_theme.zip

Open up Kingsoft Writer, you should now have something looking like this. Now you can office, elementary style :)

Screenshot from 2013-06-04 11:56:43