SEARCH

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

You are not logged in.

#1 2013-10-30 04:41:15

nousername
New Member
Registered: 2013-10-30
Posts: 7

Tint2 autostart issue

My goal is to launch tint2 only occasionally, with a custom script attached to a keybinding that toggles its visility through opening and killing it accordingly.
Once tint2 is opened with autostart, my script works as expected, namely after reopening tint2, all systray icons are present. I close it with "killall tint2".

The problem is that I would like not to have tint2 opened by default, but somehow I cannot kill it gently (i.e. with killall) in the autostart script. I tried the following:

(\
nitrogen --restore && \
cb-compositor --start && \
sleep 2s && \
tint2 && \
sleep 12s && \
killall tint2 \
) &

I cannot just not open tint2, since then launching it later would imply no systray icons present.

How can I get tint2 load its contents at autostart and close gently afterwards?

Offline

Be excellent to each other!

#2 2013-10-30 06:25:15

rebornmechanics
#! CrunchBanger
Registered: 2012-11-05
Posts: 123

Re: Tint2 autostart issue

The real issue here is that your systray doesn't show when starting tint... Never had that behavior.
Killing tint2 and running it again should work, but I suggest you look into the autohide option for a more elegant solution.
Tint2 wiki on google code

Offline

#3 2013-10-30 14:33:09

nousername
New Member
Registered: 2013-10-30
Posts: 7

Re: Tint2 autostart issue

If tint2 is started through default autostart script, systray icons are present. The issue is the case only if it is started for the first time after autostart script. You could check if by doing so you will end up having same situation.

Well, actually I am equally worried why killing tint2 in autoscript does not work. If I could get this working, my issue would be solved.

Autohide is not an option since (a) it does not hide 100% (b) I want to wake up tint2 by a key combination not a mouse.

Last edited by nousername (2013-10-30 14:34:14)

Offline

#4 2013-10-30 14:38:23

iann
#! Die Hard
Registered: 2010-09-10
Posts: 705

Re: Tint2 autostart issue

Your script is not correct.  It *sequentially* calls nitrogen, compositor, tint2, and then killall.  nitrogen runs to completion almost immediately, cb-compositor starts up in the background, then tint2 starts.  Finished.  tint2 sits there and killall never gets executed.  After tint2 dies then killall gets called, not very helpful.

I don't know where your script snippet is being called from, but it needs to be restructured so that tint2 is spawned and does not prevent the execution of killall.  Either killall should be on a completely separate line of your shell, or tint2 needs to be started in the background from within that pointlessly-complicated command.

Offline

#5 2013-10-30 18:07:26

nousername
New Member
Registered: 2013-10-30
Posts: 7

Re: Tint2 autostart issue

thanks iann for help. you're right, sorry for that silly mistake, I'm a newbie when it comes to bash. the code actually is not pointlessly complicated, it's a minor modification of the default !# autostart script.

could anyone tell me why tint2 if started independently has an empty systray? what are the rules for starting it? I mean does it have to be opened only in conjunction with other processes? I can't see that from the default openbox autostart script.

Offline

#6 2013-10-30 19:01:28

iann
#! Die Hard
Registered: 2010-09-10
Posts: 705

Re: Tint2 autostart issue

tint2 doesn't go round interrogating every process when it starts to see if it might want a tray item.  It works the other way.  When a process wants a tray item, it tries to create one.  No tint2, no tray item.  However, if a process does get to create one because tint2 was there when it was needed, then  tint2 is clever enough to remember it even after being killed and restarted.

So what you're doing will kind of work, but any process started during the times when tint2 isn't visible won't be able to get into the tray.  You might want to consider alternative solutions such as autohiding.

Offline

#7 2013-10-30 21:49:14

RemuN
#! Member
Registered: 2013-06-25
Posts: 91

Re: Tint2 autostart issue

iann wrote:

tint2 doesn't go round interrogating every process when it starts to see if it might want a tray item.  It works the other way.  When a process wants a tray item, it tries to create one.  No tint2, no tray item.  However, if a process does get to create one because tint2 was there when it was needed, then  tint2 is clever enough to remember it even after being killed and restarted.

So what you're doing will kind of work, but any process started during the times when tint2 isn't visible won't be able to get into the tray.  You might want to consider alternative solutions such as autohiding.

Keeping this in mind, maybe you can bind the programs you want to show in the systray to the same keycombo..

And can't you just put killall tint2 at the very end of your autostart? Maybe add a sleep timer?

Offline

#8 2013-10-31 14:59:07

nousername
New Member
Registered: 2013-10-30
Posts: 7

Re: Tint2 autostart issue

thanks ian for the explanation.
remun, I don't undertand what you mean.

is there any tool that would be invisible and have the ability to listen to calls for systray and remember them?

Offline

#9 2013-10-31 16:09:16

damo
#! gimpbanger
From: N51.5 W002.8 (mostly)
Registered: 2011-11-24
Posts: 2,171

Re: Tint2 autostart issue

Not sure where your problem lies? I've just removed tint2 from my autostart and rebooted - no panel as expected. Starting tint2 then gets the normal panel, including systray and the usual items. Killing/restarting manually gets the same result


Artwork at deviantArt;  Iceweasel Personas;  SLiM #! Themes;  Openbox themes

Online

#10 2013-10-31 16:20:47

porkpiehat
#! Die Hard
Registered: 2012-10-02
Posts: 583

Re: Tint2 autostart issue

damo wrote:

Not sure where your problem lies? I've just removed tint2 from my autostart and rebooted - no panel as expected. Starting tint2 then gets the normal panel, including systray and the usual items. Killing/restarting manually gets the same result

This is my experience as well. tint2 does appear to load things into the systray even if they are started while it is not active.

nousername, as iann told you your problem with the autostart block comes partly from how the block is constructed (with &&) -- the way you have it written now, your sleep and killall commands are never run, because they are waiting for tint2 to complete successfully. The easiest solution to this would be to put the killall command on a separate line after the autostart block, like this:

(\
nitrogen --restore && \
cb-compositor --start && \
sleep 2s && \
tint2 \
) &
sleep 12s && killall tint2 &

But a much better solution would be to use autohide, or use xdotool to toggle the visibility of the tint2 window, as in this script I lifted from the Arch forum (you could bind this script to an openbox keybind).

#!/bin/bash

WINID=$(xdotool search --class tint2)

# exit if tint2 not running
(( $? > 0 )) && exit 1

# toggle window mapped state
if xdotool search --onlyvisible --class tint2 > /dev/null ; then
    xdotool windowunmap $WINID
else
    xdotool windowmap $WINID
fi

Last edited by porkpiehat (2013-10-31 16:36:50)


I love mankind; it's people I can't stand. -- Linus van Pelt

Offline

#11 2013-10-31 16:22:28

RemuN
#! Member
Registered: 2013-06-25
Posts: 91

Re: Tint2 autostart issue

nousername wrote:

remun, I don't undertand what you mean.

Never mind, scratch that.

nousername wrote:

is there any tool that would be invisible and have the ability to listen to calls for systray and remember them?

Though like damo I can't reproduce your problem, you could try using an 'empty' tint2 in your autostart.
Like this:

# Tint2 config file

# Background definitions
# ID 1
rounded = 5
border_width = 1
background_color = #2E3436 0
border_color = #000000 0

# Panel
panel_monitor = 1
panel_position = bottom right horizontal
panel_items = T
panel_size = 1% 22
panel_margin = 1 1
panel_padding = 0 0 2
panel_dock = 0
wm_menu = 1
panel_layer = bottom
panel_background_id = 1

# Panel Autohide
autohide = 0
autohide_show_timeout = 0.3
autohide_hide_timeout = 2
autohide_height = 5
strut_policy = none

# Taskbar
taskbar_mode = multi_desktop
taskbar_padding = 5 0 0
taskbar_background_id = 1
taskbar_active_background_id = 1

# Tasks
urgent_nb_of_blink = 7
task_icon = 0
task_text = 0
task_centered = 0
task_maximum_size = 110 20
task_padding = 3 0
task_background_id = 1
task_active_background_id = 1
task_urgent_background_id = 1
task_iconified_background_id = 1

# System Tray
systray = 0

# Mouse
mouse_middle = none
mouse_right = none
mouse_scroll_up = none
mouse_scroll_down = none

# End of config

Then use your desired keybind to start the 2nd tint2rc that carries your systray.

This way tint2 will be started upon startup, you just wont see it.

EDIT: Porkpiehat's 2nd solution is a much better one

Last edited by RemuN (2013-10-31 16:24:53)

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