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

Sunday, August 11, 2013

Share your Bash history across terminals in Terminator

As many developers I spent lots of time working with a command line shell. My operating system of choice is Fedora (currently 18) and I am using the excellent Terminator as a more powerful replacement for the basic default shell that comes with Gnome 3.

The typical workflow with Terminator is to use its very intuitive key shortcuts to split the current working window, maximize it, start working, resize when finish and jump back to any other window of interest.

It's a very fast workflow and I cannot see myself going back to anything different.

But this high productive usage has a drawback:

the commands history is not shared across the different windows!

This is often annoying since one of the reasons I am spawning a new shell is to do some "temporary" work without moving away from my current position. And this usually involves redoing some already executed step, so the lack of history is quite annoying.

I will describe here a way to address this problem.

The first thing to know is that the command history is not present because by default bash history is flushed to .bash_history only when you terminate a session.

A way to force a more frequent flush is to play with the environment variable PROMPT_COMMAND

If we modify one of our bash configuration files, .bashrc for instance.

#save history after every command
#use 'history -r' to reload history
PROMPT_COMMAND="history -a ; $PROMPT_COMMAND" 

What we are saying here is to invoke history -a with every new command prompt line. This flush the history to file every time we see a new command prompt. You can verify this if you monitory you .bash_history file.

Have we reached what we were hoping for?

Not yet.

Even if the history is now persisted, you will notice that you running shell do not see this history. This is because the history is loaded only at the beginning of a new session.

The only thing left is to manually force a reload of the history with the command

history -r

Done. We have now access to other shells history.

The last question:

why don't we add the reload of the history directly in the PROMPT_COMMAND variable?

Because you probably don't want that. Having all your shells always sharing a global history will break the most obvious behavior of the shell that is to show you the previous command you typed in that very shell.

Monday, August 27, 2012

Fedora 17 - Google Calendar Integration

I have just found this useful post about how to integrate your Google Calendar with Gnome3 Calendar:

http://www.webupd8.org/2011/09/google-calendar-gnome-shell-integration.html


I have just tried and it's working great!

( I cannot take a snapshot since the key is not working when the Calendar Overlay is open =P )

Friday, August 24, 2012

Gnome-shell: Show contact list

I have recently switched from RHEL 6 to Fedora 17.

I found myself less productive during the first days and I had the opportunity to agree with people that identify RHEL as a good distribution for enterprises and for people that need to be productive from the beginning, without losing time to adapt to a new environment, even if this could be winning in the long run.

But after this thoughts, that I still believe are true, I started to enjoy the experience of Fedora and Gnome3. I think they are able to satisfy you if you are the kind of person that likes to tweak his system and likes to experiment with it.

 In Fedora 17, one of the biggest area in which you can play with settings is Gnome3.

 Like other people I do believe that some of the decision of the developers have been to radical and that it's not giving out of the box the best experience that it could. A typical example is the fact that they've hidden the shutdown functionalities and that you have to press ALT to see them, something that everyone could agree is not intuitive at all. 

But maybe the idea behind all this radical decisions is that they want to offer a minimal customization, to allow people to change everything that they do not like and to extend the behaviour, a la Firefox.


And talking specifically about this customization, one extension that I've found useful is Empathy Contact List in UserMenu https://extensions.gnome.org/extension/396/empathy-contact-list-in-usermenu/


"Shows an Empathy Contact List launcher in UserMenu"


Something that is really useful in my opinion because otherwise, if you are not using external sw like Pidgin, you have to perform a long set of action to open a message window to one of your contact:

- you have to go in expose mode
- you have to type the name of the contact to open his  panel
- you have to click on the message button

Only after you have done all this you can have a message window.
Like others said, I do not think this is very handy.

The linked extension allows you to have easy access to the contact list. Stop.



But there is a problem. It doesn't work in Fedora 17.

The reason for this is that the code of the extension is trying to execute empathy.desktop, the program integrated in Gnome3 to provide instant messaging functionality, but in Fedora 17, the shortcut file, to execute the program has a slightly different name: fedora-empathy.desktop .

To correct this and fix the problem this is what you have to do:

1) open the source code of the extension here

vi ~/.local/share/gnome-shell/extensions/empathy-contacts-in-usermenu@rtt.uy/extension.js

2) edit line 19 changing from 'empathy.desktop' to 'fedora-empathy.desktop' and save

3) restart Gnome3 with ALT+F2 followed by the command r

Enjoy your functionality!


The last thing that I'd like to add is the way to access useful information when you try to understand what is happening with an extension that is not behaving properly. There is a log file that gives you lots of useful information.

The approach I suggest you is to execute this command in a shell before starting to use the problematic extension:

tail -f ~/.xsession-errors

In this way you can clearly see what is wrong. This was my log file, that led me to the fix:
    JS ERROR: !!!   Exception in callback for signal: activate
    JS ERROR: !!!     message = '"Shell.AppSystem.get_default().lookup_app("empathy.desktop") is null"'
    JS ERROR: !!!     lineNumber = '19'
    JS ERROR: !!!     fileName = '"/home/pantinor/.local/share/gnome-shell/extensions/empathy-contacts-in-usermenu@rtt.uy/extension.js"'
    JS ERROR: !!!     stack = '"([object Object],[object _private_Clutter_Event])@/home/pantinor/.local/share/gnome-shell/extensions/empathy-contacts-in-usermenu@rtt.uy/extension.js:19

Thursday, August 2, 2012

Gnome Extensions Installation Silent Error

I was one of those unlucky ones not able to install Gnome Extensions via the website, on my Fedora 17.

 I've found out I wasn't the only one but we were not a big number and there was not a clear solution to our problem.

 Apparently I have found that is somewhat related to SSL and the time set in you laptop. Yes. I do not why, but it was definitely my case.  

This is the error I was receiving:

JS ERROR: !!!   Exception was: TypeError: info is null
JS ERROR: !!!     lineNumber = '83'JS ERROR: !!!     fileName = '"/usr/share/gnome-shell/js/ui/extensionSystem.js"'
JS ERROR: !!!     stack = '"([object _private_Soup_SessionAsync],[object _private_Soup_Message])@/usr/share/gnome-shell/js/ui/extensionSystem.js:83"'
JS ERROR: !!!     message = '"info is null"'

If you are also unable to join your Google account to your Gnome 3 profile, ( Check with the Google one since the other options were working fine ) you will probably have my same problem.

For some reason that I cannot explain it seems that the clock or the timezone set on you Linux are involved in the problem.

 Try to change them switching form either network updated to something else like New York timezone and repeat the process.
It's enough to check if you can join the Google account.

As soon as you see you are able, also the extension installation is fixed.