SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2009-09-26 18:32:16

rsw
#! CrunchBanger
Registered: 2009-08-26
Posts: 100

Show/hide tint2

I'll admit, my first encounter with tint2 was on #!.  Before that I'd just run Openbox without any panels, perhaps with trayer in the dock on autohide or some such.  I want to go back to the panel-less look (esp. on my netbook) but I enjoyed using tint2 and still want to keep it around.  I threw together this quick & dirty script and bound it to 'Super+b' to give my panel a toggle-by-keystroke functionality.  It's nothing special but I thought I'd share it with you folks incase any of you like the idea smile

#!/usr/bin/python
import commands
import subprocess

output = commands.getoutput('ps -A')
if 'tint2' in output:
    subprocess.call( ["killall", "tint2"] )
else:
    subprocess.call( ["tint2"] )

then in rc.xml:

    <keybind key="W-b">
      <action name="Execute">
        <startupnotify>
          <enabled>true</enabled>
          <name>Toggle tint2</name>
        </startupnotify>
        <command>toggletint</command>
      </action>
    </keybind>  

Now pressing Win+B when the panel is running will terminate it.  Pressing the same when the panel is not running will summon it.  It's magic!

Offline

Help fund CrunchBang, donate to the project!

#2 2009-09-26 18:49:52

babouk
#! CrunchBanger
From: #!_de
Registered: 2009-08-10
Posts: 106
Website

Re: Show/hide tint2

Thanx for sharing! smile

... I'd like to learn some python ...!


waldorf | openbox
pekwm

Offline

#3 2009-09-26 21:15:20

rizzo
#! wanderer
From: ~/
Registered: 2008-11-25
Posts: 5,109

Re: Show/hide tint2

Does killing and restarting tint2 repeatedly effect your system tray? For me I lose some icons that is only rectified by logging out and back in again.

Offline

#4 2009-09-26 21:39:32

rsw
#! CrunchBanger
Registered: 2009-08-26
Posts: 100

Re: Show/hide tint2

For me it depends on what I've got in the tray.  It's most usually populated with nm-applet, xpad, and skype.  I can kill and restart tint2 repeatedly and they don't seem effected whatsoever.

I have had issues though, for example, quod-libet loses its tray icon when tint2 is killed.  I have to reenable it through the plugins menu to get it back.

Pidgin simply unhides the buddylist window when tint2 is killed, but the icon is restored on the tint2 restart.  Rhythmbox seems to work the same as nm-applet/xpad/skype.  I'm sure there are programs that don't like losing their icon and behave very badly when it happens, but I'm not sure which ones they are because I have not come across them smile

Last edited by rsw (2009-09-26 21:40:51)

Offline

#5 2009-09-26 21:59:31

rizzo
#! wanderer
From: ~/
Registered: 2008-11-25
Posts: 5,109

Re: Show/hide tint2

I tend to lose volman and parcellite whenever tint2 is killed and restarted.

Offline

#6 2009-09-26 23:07:37

rsw
#! CrunchBanger
Registered: 2009-08-26
Posts: 100

Re: Show/hide tint2

Hmm... you sure are right.  Parcellite actually seems to not have a problem with it on my machine but I definitely lose volwheel between tint2 instances.  Clearly my script needs some more work smile

Offline

#7 2009-09-27 00:04:56

sircrazy
#! Member
From: Florida
Registered: 2009-07-17
Posts: 85

Re: Show/hide tint2

that is a problem with tint2, you can just add a line to also restart volwheel.


Sigs do it better

Offline

#8 2009-09-27 01:25:18

rsw
#! CrunchBanger
Registered: 2009-08-26
Posts: 100

Re: Show/hide tint2

I had tried that, just adding another subprocess.call for volwheel; but I was monitoring with htop and after toggling a few times I noticed a few concurrent volwheel instances... I'm not sure that's what I want smile

Offline

#9 2009-11-01 02:13:14

jobester
#! CrunchBanger
Registered: 2008-11-29
Posts: 151

Re: Show/hide tint2

Thanks rsw!

I tend to lose volman and parcellite whenever tint2 is killed and restarted.

Here's what I'm trying for my gamepad (nostromo_daemon), it's inconsistent but works most of the time:
(note: don't know python, this was first answer found on Google)

#!/usr/bin/python
import commands
import subprocess
import time

output = commands.getoutput('ps -A')
if 'tint2' in output:
    subprocess.call( ["killall", "tint2"] )
else:
    subprocess.call( ["killall", "nostromo_daemon"] )
    subprocess.call( ["tint2"] )
    time.sleep(4)
    subprocess.call( ["nostromo_daemon"] )

Last edited by jobester (2009-11-01 02:14:10)

Offline

#10 2010-01-14 04:00:56

Chriswaterguy
#! CrunchBanger
From: Jakarta, or somewhere else
Registered: 2009-03-17
Posts: 198
Website

Re: Show/hide tint2

So, rsw... what do you think of jobester's code?

Rsw, I'm assuming that the first code you shared in the original post (the python) is saved as toggletint, or saved as a file for which toggletint is set as an alias? 

I'm not a coder myself, and I'd love to have a simple, easy-to-follow guide to use and share, so I'm hoping for an authoritative version.

Many thanks to rsw & jobester!


Learning Linux slowly because I'm busy with Appropedia

Offline

#11 2010-01-14 07:39:16

tawan
#! Junkie
Registered: 2009-01-30
Posts: 385
Website

Re: Show/hide tint2

you can do this in bash... just alter "whatever" and the rest works out

MYAPP=whatever
if [ `pidof $MYAPP` ]
then
killall $MYAPP
exit 1
else
$MYAPP
fi
exit

The problem with tint2 is that we can't force it to load a new config or else you could force it to load a config with 2px height rather than kill it.

ADComp has some nice tools that work better than this hack - until someone comes across a way to load new tint2 configs without logout.


I blog too much....       geek stuff LinuxMintDebian | linux noob stuff LinuxMintNoob | spiritual stuff Daily Cup of Tao

Offline

#12 2010-01-14 08:41:40

Chriswaterguy
#! CrunchBanger
From: Jakarta, or somewhere else
Registered: 2009-03-17
Posts: 198
Website

Re: Show/hide tint2

Cool, thanks tawan!

ADComp has some nice tools that work better than this hack

Are there particular tools you'd recommend for a semi-novice?


Learning Linux slowly because I'm busy with Appropedia

Offline

#13 2010-01-14 09:02:34

tawan
#! Junkie
Registered: 2009-01-30
Posts: 385
Website

Re: Show/hide tint2

the top 3 of the user made programs listed here


I blog too much....       geek stuff LinuxMintDebian | linux noob stuff LinuxMintNoob | spiritual stuff Daily Cup of Tao

Offline

#14 2010-01-14 13:13:23

thil77
#! CrunchBanger
Registered: 2009-01-12
Posts: 193

Re: Show/hide tint2

The problem with tint2 is that we can't force it to load a new config.

you can force tint2 to reload the config file since version 0.8.
try the command line killall -SIGUSR1 tint2

and autohide are done in SVN. You can try the release candidate 0.9RC here
http://code.google.com/p/tint2/downloads/list

Last edited by thil77 (2010-01-14 13:14:14)

Offline

#15 2010-01-14 20:41:37

tawan
#! Junkie
Registered: 2009-01-30
Posts: 385
Website

Re: Show/hide tint2

thil77 wrote:

you can force tint2 to reload the config file since version 0.8.
try the command line killall -SIGUSR1 tint2

Problem solved cheers! big_smile


I blog too much....       geek stuff LinuxMintDebian | linux noob stuff LinuxMintNoob | spiritual stuff Daily Cup of Tao

Offline

#16 2010-05-26 22:06:30

Marcus
New Member
Registered: 2009-12-05
Posts: 2

Re: Show/hide tint2

Here is a little oneliner to do so:

pkill -SIGUSR1 -x tint2 && [ $(pgrep -f "perl /usr/share/volwheel/volwheel") ] &&  pkill -f "perl /usr/share/volwheel/volwheel" && (sleep 2 && /usr/bin/volwheel) &

Overall killing processes like this is not really suggested but tracking them from start.

Best Regards
Marcus

Offline

#17 2010-05-31 11:15:58

trickyhero
Member
Registered: 2010-05-30
Posts: 11

Re: Show/hide tint2

This would be great to put this in #! by defalt:D
The only thing that would be if it automatically came out when the mouse was near, of course this is probally simple but I just started learning Phyton.

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo