Showing posts with label gnome. Show all posts
Showing posts with label gnome. Show all posts

Wednesday, January 28, 2015

How to bring back the "New Document -> Empty Document" menu in Gnome 3

Long time ago, the Gnome developers removed the right-click menu entry "New Document -> Empty Document" in Nautilus (the file browser). The solution to fix this is easy therefore it seemed not necessary to post it.
However, last week a friend told me that he hates Gnome 3 so much and as I asked why, one of the reasons was that this menu entry is gone.
So here is the solution (so that you start to love Gnome 3!):

  1. Create a folder called "Templates" directly into your $HOME directory if it does not exist
  2. Put a empty text file in there and name it "Textfile" (or anything else)
  3. Do a right click anywhere and be delighted with seeing "New Document -> Textfile"

The cool thing on this approach is that you can put any file with any content into the Templates directory.
Eg. you can put a template python script in there with the headers and scaffolding already in place, or a presentation with the company branding already applied... anything! Its universal!

Tuesday, January 20, 2015

Create a custom sandboxed webapp in Firefox

Google, Facebook, Twitter and others depend on getting as much information about you as possible and therefore use your account information to track and profile you not only on their services but also on 3rd party websites to fit the advertisement to your interests.
On this website you can check out how unique your browser is and how easy it is to identify and track you.
To make this a bit harder for them and save yourself the trouble of constantly logging in and out I will show how you can create a webapp with an independent profile for your Linux desktop.


It is very easy to create a custom launcher for each webapp and Firefox allows to create multiple profiles since a very long time. So in principle it is very simple and easy!

Let's do a webapp for Facebook! First, create a new Firefox profile, which will be used for the "Facebook-only-Firefox". Therefore, start the Firefox profile manager by typing:

$ firefox -ProfileManager

Now add a new profil 'facebook' and close the manager again. Next, create the launcher by copying the original Firefox launcher to the $HOME directory and rename it:

$ cp /usr/local/share/applications/firefox.desktop ~/.local/share/applications/facebook.desktop

Then we edit the facebook.desktop file and set the launcher name, the icon and the process how the application will be started. I suggest to get a nice icon for your application from the web and save it to ~/.icons/facebook.png. If the folder does not exist yet, create it!

$ vim ~/.local/share/applications/facebook.desktop

[...]
Name=Facebook
Exec=firefox -P facebook -new-instance www.facebook.com
Icon=facebook.png
-P profile-name opens firefox with profile "profile-name"
-new-instance opens Firefox in a new instance, as a separate process
Icon= If the icon is stored under ~/.icons/ there is no need to enter a path!

To immediately see you application in gnome-shell you can press Alt + F2 and type "r" and ENTER. This reloads the gnome-shell. Now you can use Facebook in its own browser, but don't forget to log out in your everyday browser ;)
To hide the tabs and therefore save screen space I recommend the Hide Tab Bar With One Tab addon.

NOTE:
There is one tiny problem you have to consider and which I didn't find a work around yet:
If you start the Facebook webapp and want to open your Standard-Firefox afterwards, it doesn't select the right profile. You could either change the firefox.desktop by copying to it to your $HOME as above and adding the default profile to the Exec line:

$ cp /usr/local/share/applications/firefox.desktop ~/.local/share/applications/firefox.desktop
$ vim ~/.local/share/applications/facebook.desktop

[...]
Exec=firefox -P default -new-instance
or you have to start the default firefox first and then open the webapp. Do you know a solution to this?
Happy socializing 2.0!

UPDATE:
Mozilla develops a webapp framework for their Marketplace that works in a similar fashion like we show here: Separate profile directory, minimal UI, own launcher,... The only difference is that they also create a separate binary and therefore do not have the multi-instance problem. A third-party developer (dietrich ayala) created an extension, "Standalone" which uses this framework to create webapps from any page on the web. Awesome!

Wednesday, April 10, 2013

Create a custom launcher icon in gnome-shell

Today, I realised that navigating into a certain folder to start mincraft with a terminal command is much to complicated. A nice minecraft icon within the other installed applications would be great!


All I needed to do was to create a file: ~/.local/share/applications/minecraft.desktop and fill it with such a content:
[Desktop Entry]
Encoding=UTF-8
Name=Minecraft
GenericName=Game
Comment=Block Building Game
Exec=java -Xmx1024M -Xms512M -jar /path/to/minecraft.jar
Icon=/path/to/minecraft/icon.png
Terminal=false
Type=Application
MimeType=text/plain;
Categories=Game;
Name[en_US]=Minecraft
You still need to download a beautiful icon and adopt the two lines in bold (path to your executable and to the icon). Further you need to run
chmod a+x ~/.local/share/applications/minecraft.desktop
to give this file proper rights for execution. This is it! It works for any other application/script too!

Friday, January 25, 2013

Insert a CD image file in gnome-boxes

As I heard about the new Age of Empires II extension "Forgotten Empires" created not by Microsoft, but by an awesome community, I needed to play this game again! I don't like Wine that much as I once got a bunch of viruses having it just installed, therefore I decided to install Windows XP in a virtual machine.
I chose GNOME Boxes as it uses kvm. It was really fast and easy to install, I just needed my Windows-Installer-CD as an *.iso file.

However, I could not find any option to insert another *.iso image file to be mounted in the guest system. The user interface just does not provide to change the CD disc image - so we have to change the kvm options in another way. Open your terminal and type:

$ virsh edit Windows\ XP\ Pro.iso

(If you installed something else than Windows XP you might have to look in the folder .local/share/gnome-boxes/images/ how your machine is called.)
In this file search for the lines saying something like the following and exchange your iso-filename (+path):

<disk type='file' device='cdrom'>
   <driver name='qemu' type='raw'/>
   <source file='/home/tux/AoE.iso' startupPolicy='optional'/>

(If you need help using vim, check this out.)
Save it, reboot your Windows and enjoy having your disc image in the CD drive of the guest!