Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Bit of help with a python script?

  • 12-06-2012 10:09PM
    #1
    Registered Users, Registered Users 2 Posts: 3,579 ✭✭✭


    Hi guys, my mam is a bit of a noob, she can figure out how to use Skype on linux, but the concept of multiple instances is too much, so I often see two or three skype icons on her laptop.

    I found this script to run from the Skype icon that checks if there's a current instance running, and focuses the current instance if there is, otherwise launches Skype, the problem is, it doesn't focus the current Skype window if it's been closed to the menu bar:
    #!/usr/bin/env python
    import dbus
    import sys
    import os
    
    try:
        # Try and set skype window to normal
        remote_bus = dbus.SessionBus()
        out_connection = remote_bus.get_object('com.Skype.API', '/com/Skype')
        out_connection.Invoke('NAME mySkypeController')
        out_connection.Invoke('PROTOCOL 5')
        #out_connection.Invoke('SET WINDOWSTATE MAXIMIZED')
        out_connection.Invoke('SET WINDOWSTATE NORMAL')
        out_connection.Invoke('FOCUS')
    except:
        os.system("skype")
        sys.exit()
    
    (from here: https://github.com/djeikyb/skype-single-instance)

    Any python gurus out there help me out?
    Even adding a simple GTK popup with an OK button saying "Skype is running, check the taskbar!"
    I tried something like the answer in this post but didn't succeed in the end.

    Cheers!


Comments

  • Closed Accounts Posts: 18,966 ✭✭✭✭syklops


    I am not a python guru in any way shape or form, but this problem can be solved with a basic shell script. The logic being, check if skype is running, if it is, alert on it, if not start it. SO:

    #!/bin/sh

    if [ "$(pidof skype)" ]
    then
    gdialog --msgbox "Skype is already running check the taskbar" #then teach your mum where the taskbar is.
    else
    skype


    This is a really basic hack of a solution but would serve your needs. You could then port it to python using the same logic.


  • Registered Users, Registered Users 2 Posts: 3,579 ✭✭✭BopNiblets


    Cheers I'll give that a go, if it works with a different script that'll do.
    The current instance focus thing would be handy though.

    Edit, that works a charm syklops, only you forgot an fi at the end, cheers. :pac:


  • Closed Accounts Posts: 18,966 ✭✭✭✭syklops


    BopNiblets wrote: »
    Cheers I'll give that a go, if it works with a different script that'll do.
    The current instance focus thing would be handy though.

    Edit, that works a charm syklops, only you forgot an fi at the end, cheers. :pac:

    Damnit!

    Ok great, glad it works though!


  • Registered Users, Registered Users 2 Posts: 3,739 ✭✭✭Stuxnet


    tell your ma skype 4.0 for linux has just been released ;)

    http://blogs.skype.com/linux/

    thanks Microsoft :)


  • Registered Users, Registered Users 2 Posts: 37,485 ✭✭✭✭Khannie


    Stuxnet wrote: »
    tell your ma skype 4.0 for linux has just been released ;)

    http://blogs.skype.com/linux/

    thanks Microsoft :)

    I am shocked. Seriously! I hate all the whizz bang of the windows version of skype though. It once told me that I had some credit and maybe I'd like to call a friend? I nearly punched it in the ear. Will have to give this a whirl though.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 37,485 ✭✭✭✭Khannie


    New version installed. Looks good! Thanks for the tip.


  • Registered Users, Registered Users 2 Posts: 14,081 ✭✭✭✭Johnboy1951


    Khannie wrote: »
    New version installed. Looks good! Thanks for the tip.

    I read somewhere that the new version is advert supported ..... is that true?

    I will stick to the older version rather than have ads thrown at me!


  • Registered Users, Registered Users 2 Posts: 37,485 ✭✭✭✭Khannie


    I haven't seen any ads yet. I do give skype money though by making calls to phones so I wouldn't rule it out. What I did in case I wanted to revert was to back up my .Skype directory, uninstall 2.2 then installed 4.0. The 4.0 upgrade definitely alters your .Skype directory so back it up if you want the option of a roll back.


  • Registered Users, Registered Users 2 Posts: 14,081 ✭✭✭✭Johnboy1951


    Khannie wrote: »
    I haven't seen any ads yet. I do give skype money though by making calls to phones so I wouldn't rule it out. What I did in case I wanted to revert was to back up my .Skype directory, uninstall 2.2 then installed 4.0. The 4.0 upgrade definitely alters your .Skype directory so back it up if you want the option of a roll back.

    Yes .... it appears that thet ads are only for those who don't pay Skype :D

    http://www.pcpro.co.uk/news/375145/skype-to-show-ads-during-calls

    I think I will stay with the ad-free version ...... I use it only rarely.


  • Registered Users, Registered Users 2 Posts: 37,485 ✭✭✭✭Khannie


    Skype Rep wrote:
    "So, you should think of Conversation Ads as a way for Skype to generate fun interactivity between your circle of friends and family and the brands you care about."

    "Ultimately, we believe this will help make Skype a more engaging and useful place to have your conversations each and every day," she claimed.

    AAAAAhaahahahahaha. I am loling hard here. I hate it when people insult your intelligence with blatant lies like that.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 14,081 ✭✭✭✭Johnboy1951


    I suppose some ads are conversation pieces :)

    I still remember

    "... and Sally O'Brien and the way she might look at you"

    :D:D


  • Registered Users, Registered Users 2 Posts: 3,579 ✭✭✭BopNiblets


    The new version focuses the current instance already running so that's cool.
    I'll see if there's any ads during calls but hopefully the big hosts file I have on Mint will nuke 'em.


  • Registered Users, Registered Users 2 Posts: 37,485 ✭✭✭✭Khannie


    BopNiblets wrote: »
    I'll see if there's any ads during calls but hopefully the big hosts file I have on Mint will nuke 'em.

    Nice idea. Did you get this online? edit: Found one.


  • Registered Users, Registered Users 2 Posts: 3,579 ✭✭✭BopNiblets


    Khannie wrote: »
    BopNiblets wrote: »
    I'll see if there's any ads during calls but hopefully the big hosts file I have on Mint will nuke 'em.

    Nice idea. Did you get this online? edit: Found one.
    I use this one, nice and easy:
    http://someonewhocares.org/hosts/

    gksu gedit /etc/hosts
    Copy and paste, if anyone's thinking of doing it.


Advertisement