You are not logged in.
Hey guys, is there a way to make an application pop up on a click event?
I want a calendar (gsimplecal) to pop-up when I click the clock.
I saw this patch -> http://infra.in.zekjur.net/pipermail/i3 … 01116.html
but, I don't think this is in the codebase.
Alternatively, can this be achieved using conky (running with i3bar)?
Offline
Hey guys, is there a way to make an application pop up on a click event?
I want a calendar (gsimplecal) to pop-up when I click the clock.
I saw this patch -> http://infra.in.zekjur.net/pipermail/i3 … 01116.html
but, I don't think this is in the codebase.
Alternatively, can this be achieved using conky (running with i3bar)?
Click events are a part of i3 already, http://i3wm.org/docs/i3bar-protocol.html section 2.3. It's not explained clearly, but basically it writes json entries to stdin of your status process, and leaves everything else to it. I'm not familiar with conky, but it should have some gizmo to read stdin. Writing some logic to parse clickevent and execute an arbitrary command shouldn't be too difficult.
'What can be asserted without evidence can also be dismissed without evidence.' - Christopher Hitchens
'There's no such thing as addiction, there's only things that you enjoy doing more than life.' - Doug Stanhope
GitHub Junkyard
Offline
If you have a normal i3status running, you could try to wrap it in some script that delegates stdout to i3status and interprets the stdin, e.g. with a read loop ad jshon. Launch programs with "i3-msg exec ... "
Last edited by progandy (2013-09-16 17:38:53)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
This post is for anyone interested in adding custom fields into the i3status output stream for display in the i3bar. I've put together a small BASH script to be called by your i3bar that uses the jshon package from [community] to format the custom text fields. The script should be easily adaptable for any text you want to display. All of the i3bar field attributes can be easily defined using jshon and this script, and you may insert your custom field into any position in the bar.
The script contains functions to create three text fields. Two of them are are particular to my setup, but I think they are useful to show how to create a JSON object and insert it. The third is a caps/num lock indicator that should work on any system.
Script can be found at this link:
https://www.dropbox.com/s/mx5iiraj9oxax60/i3_bar_1.sh
Offline
@ kaszak696 and progandy
thanks for the hints, I'll experiment around.
Offline
This is a crosspost from the i3 screenshot/config thread.
I have developed a script named i3-theme. Its purpose is
to easily set and switch between several sets of
configuration options ("themes") for the i3 window
manager. These sets of configuration options are supposed
to contain options regarding the looks of the window
manager, that is window colors, borderstyle, i3bar colors,
fonts, etc.
There's a bunch of theme files which are distributed
together with the i3-theme script to give the user a
variety of configurations to choose from.
The tarball containing the script, the themes and a README
can be found at:
http://www.okraits.de/upload/i3-theme-0.4.tar.gz
Please feel free to send me feedback and contributions
regarding bugreports, feature requests, improvements,
themes, etc. via mail at okraits at arcor.de. You can also
contact me on irc.twice-irc.de in #i3.
I'm looking forward to your feedback.
Greetings,
Oliver
Edit: Uploaded v0.4 - improved script and added themes - check the README.
Last edited by okraits (2013-09-18 20:53:20)
Offline
I played around a bit with getting gsimplecal to popup, it's not as obnoxious as i thought it would. Here's how i did it:
I added these lines to i3 config to make gsimplecal window to have floating by default and always appear in the same spot:
for_window [class="Gsimplecal"] floating enable
for_window [class="Gsimplecal"] move absolute position 1189px 605px
Then i wrote this class for my python statusbar app to run in a separate thread and open\close the calendar on click:
import json
import sys
from subprocess import Popen, DEVNULL
class ClickEventHandler(Thread):
'''
Handle Click events.
'''
def __init__(self, **kwargs):
Thread.__init__(self, **kwargs)
self.daemon = True
self.calendar_name = 'gsimplecal'
self.event_name = 'Date'
self.calendar = None
def run(self):
for event in sys.stdin:
if event.startswith('['):
continue
elif event.startswith(','):
event = event.lstrip(',')
name = json.loads(event)['name']
if name == self.event_name:
if self.calendar == None:
self.calendar = Popen(self.calendar_name, stdout=DEVNULL)
else:
self.calendar.terminate()
self.calendar = None
else:
pass
It's crude, but gets the job done.
'What can be asserted without evidence can also be dismissed without evidence.' - Christopher Hitchens
'There's no such thing as addiction, there's only things that you enjoy doing more than life.' - Doug Stanhope
GitHub Junkyard
Offline
@ kaszak696
cool
Also, I didn't know that i3 could move windows to a particular position!
As for getting gsimplecal + click events to work, I gave up. I can't find a way to do so with conky + i3bar. And I am not willing to let go of conky. I did request the maintainer of gsimplecal to add tray support, but I doubt he'll agree
Edit: clarified the software I am talking about.
Last edited by x33a (2013-09-20 17:06:48)
Offline
i3bar does have tray support
Mr Green
Offline
Mr Green, I meant the gsimplecal maintainer.
Of course I know i3 has tray support, it was one of the reasons I gave up dwm
Offline
My bad .....
Mr Green
Offline
As for getting gsimplecal + click events to work, I gave up. I can't find a way to do so with conky + i3bar.
Edit: clarified the software I am talking about.
The solution is rather simple, really. All you need is a 'middle man' between conky and i3bar. Here it shows that you need to use a wrapper script anyway, so is should be possible to hack click events into it. I can try to make it work, but i'm shit with bash
'What can be asserted without evidence can also be dismissed without evidence.' - Christopher Hitchens
'There's no such thing as addiction, there's only things that you enjoy doing more than life.' - Doug Stanhope
GitHub Junkyard
Offline
I am sitting here thinking what is the advantage over using a click event to a keyboard shortcut?
Mr Green
Offline
I am sitting here thinking what is the advantage over using a click event to a keyboard shortcut?
For giggles, i guess It's kinda cool, and saves a keybind that could be used for something more useful. Anyway, i think this will work, although no one should trust my mad bash skillz:
#!/bin/sh
echo '{"version":1, "click_events": true }'
echo '['
echo '[],'
exec conky -c $HOME/conkyrc &
CAL_PID=0
NAME="Date"
while read -r line
do
if [ "$line" = "[" ]
then
continue
fi
line=`echo $line | sed "s/^,//"`
getname=`echo $line | jshon -e name -u`
if [ "$getname" = "$NAME" ]
then
if [[ $CAL_PID -eq 0 ]]
then
gsimplecal &
CAL_PID=$!
else
kill $CAL_PID
CAL_PID=0
fi
fi
done
Depends on jshon.
'What can be asserted without evidence can also be dismissed without evidence.' - Christopher Hitchens
'There's no such thing as addiction, there's only things that you enjoy doing more than life.' - Doug Stanhope
GitHub Junkyard
Offline
Not working for me yet, do you have the conkyrc that works with this? Am assuming its looking for the word 'Date'
Mr Green
Offline
Not working for me yet, do you have the conkyrc that works with this? Am assuming its looking for the word 'Date'
I used my own python script to test it, not conky, but the protocol is the same, so it should work either way. Conky should output date string like this:
{"name": "Date", "full_text": "20-09-2013 21:02"}
, so i3bar knows the name field. During click event, it'll write something like this to it's standard input:
{"name":"Date","button":1,"x":1288,"y":767}
Notice that the name field allows proper identification. Script i wrote checks whether click event's name field is 'Date' and if it is, does the calendar magic.
'What can be asserted without evidence can also be dismissed without evidence.' - Christopher Hitchens
'There's no such thing as addiction, there's only things that you enjoy doing more than life.' - Doug Stanhope
GitHub Junkyard
Offline
I get this from my conkyrc as output
{ "full_text" : "Fri 20th Sep 20:10 " , "color" : "#D3D3D3"} ],
Mr Green
Offline
It's not rocket science, let's say you have this line in your conkyrc:
{ "full_text" : "${time}" , "color" : "#D3D3D3"} ],
change it to:
{ "name" : "Date" , "full_text" : "${time}" , "color" : "#D3D3D3"} ],
Last edited by kaszak696 (2013-09-20 19:22:17)
'What can be asserted without evidence can also be dismissed without evidence.' - Christopher Hitchens
'There's no such thing as addiction, there's only things that you enjoy doing more than life.' - Doug Stanhope
GitHub Junkyard
Offline
No that is brain surgery lol... I can see it now.... yay it works now just got to tweak window
Last edited by Mr Green (2013-09-20 19:24:22)
Mr Green
Offline
The solution is rather simple, really. All you need is a 'middle man' between conky and i3bar. Here it shows that you need to use a wrapper script anyway, so is should be possible to hack click events into it.
I was using plain old text output with no json and hence no colours or fancy stuff. Now, thanks to your nudging, I decided to use the json stuff with my conky.
Mr Green wrote:I am sitting here thinking what is the advantage over using a click event to a keyboard shortcut?
For giggles, i guess It's kinda cool, and saves a keybind that could be used for something more useful.
I am trying to save space on my i3bar (15" monitor). So I decided that I'll only show the time, while the date will be taken care by a calendar. While I am a keyboard person mostly, I felt that a mouse click over the clock will be more appropriate in this case.
Anyway, i think this will work, although no one should trust my mad bash skillz.
Your script works perfectly, thanks.
Offline
Think adding a case statement would increase number of clickable objects, do like the idea of a floating terminal displaying htop.....or clicking volume for alsamixer.....
@x33a do not take my comments to heart was just thinking out loud (this is pretty cool).
Last edited by Mr Green (2013-09-21 09:43:09)
Mr Green
Offline
@ Mr Green, no problem. You had a genuine question, especially in a tiling wm thread
Offline
New website for i3-theme theme switch script with screenshots:
Offline
You thought about setting up a git page others might want to help out?
Mr Green
Offline
i3-theme has been renamed to j4-make-config because it might be included in http://www.j4tools.org/ and it will provide more general configuration generation functionality soon:
http://www.okraits.de/index.php?section … ake-config
Other changes:
- added dwm theme
- move current solarized theme to solarized_mod theme
- added new exact solarized theme
Last edited by okraits (2013-10-05 22:51:32)
Offline