You are not logged in.
I wrote a python based wrapper for conky with click events. Commands are specified in the items dictionary, with the numbers in the item definitions corresponding to mouse buttons.
#!/usr/bin/env python
import subprocess
import sys
import json
conkyrc="/home/ian/.i3/conkyrc"
print('{"version":1, "click_events": true }')
print('[')
print('[],')
sys.stdout.flush()
subprocess.Popen(["conky","-c",conkyrc])
class Item:
commands={}
processes={}
def __init__(self, commands):
self.commands=commands
self.processes={}
def execute(self,button):
if button in self.commands:
self.processes[button]=subprocess.Popen(self.commands[button],stdout=subprocess.DEVNULL)
def kill(self,button):
self.processes[button].kill()
def is_running(self,button):
if button not in self.processes:
return False
process=self.processes[button]
if process.poll()==None:
return True
return False
def toggle(self,button):
if self.is_running(button):
self.kill(button)
else:
self.execute(button)
items={}
items["MPD"]=Item(
{
1:["st", "-c", "floating", "-e", "ncmpcpp"],
3:["mpc","toggle"]
}
)
items["CPU"]=Item(
{
1:["st", "-c", "floating", "-e", "top"]
}
)
items["Sound"]=Item(
{
1:["st", "-c", "floating", "-e", "alsamixer"],
3:["amixer","sset","Master","toggle"]
}
)
items["Date"]=Item(
{Code
1:["gsimplecal"]
}
)
for i in sys.stdin:
if i=="[\n":
continue
clickevent=json.loads(i.strip(','))
name=clickevent["name"]
button=clickevent["button"]
if name in items:
item=items[name]
item.toggle(button)
"Only wimps use tape backup: _real_ men just upload their important stuff on ftp, and let the rest of the world mirror it."—Linus Torvalds
s/ftp/git/
https://iandouglasscott.com | https://github.org/ids1024 | https://keybase.io/ids1024
Offline
This is an update to post #979 up thread. The bash script I described that allowed you to inject text into any position of the output from i3status for display in the i3bar has been updated to act on mouse clicks anywhere in the bar. Thanks go to kaszak696 and post 989 which helped immensely. The key turns out to be running the i3status in a parallel child process, that seems to free up STDIN to read the mouse clicks.
URL to the script is below:
https://www.dropbox.com/sh/0qptodjk732y … 3_bar_1.sh
Offline
Hello All,
First timer in this thread,
It is a live environment, running Arch of course, i3WM window manager, with dwb, ranger Geany and a lot more.
The build is x86_64 only at the moment.
The files on my GitHub page lets you create a ISO with archiso.
Now I didn't know where to put this one, I thought of 'Community Contributions', but since it runs i3WM, I best place it in this thread.
How to build the files, go to my github page and follow the guidelines in the readme of this repo..
It comes together with another build I created, 'archling-serv' is a parallel project, it is also on my GitHub page.
Have fun qinohe
Btw. I see some nice nifty tools made for i3, will try them soon.
Last edited by qinohe (2013-10-11 13:32:41)
Offline
@ qinohe, your github page link isn't working.
Also, you might want to post a screenshot.
Offline
@ qinohe, your github page link isn't working.
Also, you might want to post a screenshot.
Thanks x33a, the page is reachable again.
Yes, I should add screenshots, I will add them soon ( somewhere today(Netherlands))
Btw. for now cower doesn't work, as I didn't realize my repo is local. (thanks Mr.G.)
So I have to think it over how/in what way I'm gonna add cower, probably will be fixed somewhere this weekend, thanks.
edit:Cower is pulled in trough git and installed, this may be a temporary solution, cause I have other plans, concerning this one.
edit; On request, here is a screenshot
Last edited by qinohe (2013-10-11 17:05:55)
Offline
hi all - I have a question
in Openbox when I open a program on a certain desktop the icon of the program in panel (say tint2) has a flashing square around it - also if I already had an app open - say geany. If I right click on a document and open it in geany - geanys icon has the highlighted flashing square around it to tell me it's active.
Can anything like this be done in i3 ?
I have it set so that the active desktop has a different colour but how to get it to flash/pulse when a new program opens?
Last edited by chickenPie4tea (2013-10-20 14:44:35)
You can like linux without becoming a fanatic!
Offline
@chickenPie4tea Yes! Although I have removed status bar already because I do not need it. If you are good at the tiling windows manager then you will understand too.
As far as I know, i3 will not support this fancy feature. I think you should focus on the window, not such this negligible effect.
Last edited by acgtyrant (2013-10-20 14:47:54)
I use Arch Linux.
Offline
I have it set so that the active desktop has a different colour but how to get it to flash/pulse when a new program opens?
New windows get a red titlebar in my setup. And if the window opens on a different tag, the tag will be red, too. I'm not totally sure but I believe this is the default setup.
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
It doesnt work for me . I did everything it said on the comment section of the i3_bar_1.sh but it doesnt show anything
if I run the script by itself it gives me an error sayint that my array is empy
This is an update to post #979 up thread. The bash script I described that allowed you to inject text into any position of the output from i3status for display in the i3bar has been updated to act on mouse clicks anywhere in the bar. Thanks go to kaszak696 and post 989 which helped immensely. The key turns out to be running the i3status in a parallel child process, that seems to free up STDIN to read the mouse clicks.
URL to the script is below:
https://www.dropbox.com/sh/0qptodjk732y … 3_bar_1.sh
Last edited by cowsquad (2013-10-23 03:57:37)
Offline
Empty array sounds as if i3status is not sending anything for my script to inject data into. I use custom configuration files for my i3status bars. The configuration file for bar_1 is called in line 299 of the script.
i3status --config ~/.config/i3status/config_bar_1 | (read line && read line && while :
If you have not aleady modified this line you need to modify it so that the script will point to your configuration file, or alternatively remove the "--config ~/.config/i3status/config_bar_1" portion of this line to use the default i3status configuration file. There are a couple of comments immediately above line 299 with some more detail in them.
Really hope it is that as I'm not sure I've got any more ideas.
[edit 1] fixed a word tense
Last edited by ajbibb (2013-10-23 12:16:16)
Offline
Empty array sounds as if i3status is not sending anything for my script to inject data into. I use custom configuration files for my i3status bars. The configuration file for bar_1 is called in line 299 of the script.
i3status --config ~/.config/i3status/config_bar_1 | (read line && read line && while :
If you have not aleady modified this line you need to modify it so that the script will point to your configuration file, or alternatively remove the "--config ~/.config/i3status/config_bar_1" portion of this line to use the default i3status configuration file. There are a couple of comments immediately above line 299 with some more detail in them.
Really hope it is that as I'm not sure I've got any more ideas.
[edit 1] fixed a word tense
I dont know whats wrong but the script doesnt work. I removed the line i3status -- ~/.config/i3stats/config_bar1 and it didnt work. I added my default i3status to the same path and it did not work either.
Offline
In reading your response it appears that you took out the entire line including the i3status part. That is needed. Without the config file the line should be:
i3status | (read line && read line && while :
Basically it starts i3status, discards the first 2 lines and then starts the loop where you can inject the text.
You mentioned that you had tried running the script in a console window. Did you get the first 2 lines of output and then the error? The first 2 lines should appear like this:
{"version":1, "click_events": true }
[
Also what happens when you run "i3status" from the command line? It should print the JSON output to the screen.
Offline
In reading your response it appears that you took out the entire line including the i3status part. That is needed. Without the config file the line should be:
i3status | (read line && read line && while :
Basically it starts i3status, discards the first 2 lines and then starts the loop where you can inject the text.
You mentioned that you had tried running the script in a console window. Did you get the first 2 lines of output and then the error? The first 2 lines should appear like this:
{"version":1, "click_events": true } [
Also what happens when you run "i3status" from the command line? It should print the JSON output to the screen.
Now it's working but it showis me the output of my defaul i3status.conf, not the ouput in your i3_bar_1.sh. Am I missing something here?
Last edited by cowsquad (2013-10-24 05:35:49)
Offline
Anyone else having problems with i3 and gnome 3.10?
Offline
@ Green, care to elaborate?
Offline
I can't tell if this is a i3 fault or gnomes fault but for some reason when I run i3-gnome it doesn't show the themes that I am using for gnome 3.10
Last edited by Green (2013-10-24 06:03:39)
Offline
I had a "exec /usr/lib/gnome-settings-daemon/gnome-settings-daemon" line in my .i3/config file to get useable fonts in firefox. Since an update yesterday, gnome-settings-daemon has hidden the mouse cursor. So I removed it. Starting it manually and then killing it somehow works, but what's the right solution now?
P.S.: gnome-settings-daemon displays the following lines:
** (gnome-settings-daemon:3654): WARNING **: Unable to register client: GDBus.Error:org.freedesktop.DBus.
(gnome-settings-daemon:3654): Gvc-WARNING **: Failed to connect context: OK
** (process:3683): WARNING **: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.
Offline
Now it's working but it showis me the output of my defaul i3status.conf, not the ouput in your i3_bar_1.sh. Am I missing something here?
A couple of things:
Just to be clear, once the script is running you pretty much will have just your default status bar. My intention with the script is to give you a framework to hack around. I show how to make three custom fields. Of those three, the firewall status is guaranteed not to display on any computer other than mine, it is almost a certainty the weather field will also not to display anything (you'd have to have stumbled across another one of my obscure posts around here). I would however expect the caps and num lock field to display. That one requires xset which is included in both the the xorg and xorg-apps package groups. The code block for each of the custom fields starts with an "if" statement to make sure any external program or file needed is actually present, if not the field is skipped. If you have xset the caps/num lock fields should display (but see below).
Now that that is out of the way, have you installed the jshon package? If the script cannot find "jshon" the script just takes the input and passes it on to display without processing. You still should be receiving notification of the mouse clicks in the bar, but you probably won't be able to do much with them. My original post said jshon was needed, but your first question quoted my second post which not mention it, so I'm guessing you did not see it.
This feedback is good. It is obvious that I need to vastly expand the comments in the top of the script. I'll try to do that and upload this evening. The newer version will also have another goodie added: if you are playing a song with mpd/ncmpcpp the song title will display in the bar. If you left click on song title you toggle pause/play on and off, if you right click an instance of ncmpcpp will open up on the current workspace.
Offline
I will install the jshon package and will be awaiting for your update man. thanks for giving me support
cowsquad wrote:Now it's working but it showis me the output of my defaul i3status.conf, not the ouput in your i3_bar_1.sh. Am I missing something here?
A couple of things:
Just to be clear, once the script is running you pretty much will have just your default status bar. My intention with the script is to give you a framework to hack around. I show how to make three custom fields. Of those three, the firewall status is guaranteed not to display on any computer other than mine, it is almost a certainty the weather field will also not to display anything (you'd have to have stumbled across another one of my obscure posts around here). I would however expect the caps and num lock field to display. That one requires xset which is included in both the the xorg and xorg-apps package groups. The code block for each of the custom fields starts with an "if" statement to make sure any external program or file needed is actually present, if not the field is skipped. If you have xset the caps/num lock fields should display (but see below).
Now that that is out of the way, have you installed the jshon package? If the script cannot find "jshon" the script just takes the input and passes it on to display without processing. You still should be receiving notification of the mouse clicks in the bar, but you probably won't be able to do much with them. My original post said jshon was needed, but your first question quoted my second post which not mention it, so I'm guessing you did not see it.
This feedback is good. It is obvious that I need to vastly expand the comments in the top of the script. I'll try to do that and upload this evening. The newer version will also have another goodie added: if you are playing a song with mpd/ncmpcpp the song title will display in the bar. If you left click on song title you toggle pause/play on and off, if you right click an instance of ncmpcpp will open up on the current workspace.
Offline
I will install the jshon package and will be awaiting for your update
Newer version has been posted, same link as before. Changes are the expanded comments at the top mainly to reflect the recent conversaton here, and two new custom functions including the mpd/ncmpcpp one.
Offline
cowsquad wrote:I will install the jshon package and will be awaiting for your update
Newer version has been posted, same link as before. Changes are the expanded comments at the top mainly to reflect the recent conversaton here, and two new custom functions including the mpd/ncmpcpp one.
I have to give up on your script. It doesn;t work. I installed jshon and I removed the config_bar_1 line leaving it just with the i3status |
if i run i3status the following error happens
Your order array is empty. Please fix your config
Offline
ajbibb wrote:cowsquad wrote:I will install the jshon package and will be awaiting for your update
Newer version has been posted, same link as before. Changes are the expanded comments at the top mainly to reflect the recent conversaton here, and two new custom functions including the mpd/ncmpcpp one.
I have to give up on your script. It doesn;t work. I installed jshon and I removed the config_bar_1 line leaving it just with the i3status |
if i run i3status the following error happens
Your order array is empty. Please fix your config
One question man. Do I have to make any modifications to my i3status.conf in order for your script to work. Do I leave it empty (i3status.conf)
thank you for your help
Offline
Sorry to hear this is causing so may problems for you. Your i3status.conf file should not be empty, and the default should work fine. An abridged version of the one I'm using is below:
general {
output_format = i3bar
colors = true
interval = 5
}
order += "volume master"
order += "time"
volume master {
format = "♪: %volume"
device = "default"
mixer = "Master"
mixer_idx = 0
}
time {
format = "%Y-%m-%d %H:%M:%S"
}
You do need to make the modifications in the general section as I describe in the script comments and as shown above.
If you don't specifically point to a config file with the --config flag make sure you've not moved the file from its default location. I've screwed around with my system so much I can't accurately remember where the default location is. I think it is ~/.config/i3status.
Offline
One question man. Do I have to make any modifications to my i3status.conf in order for your script to work. Do I leave it empty (i3status.conf)
thank you for your help
i3status with empty config falls back to /etc/i3status.conf and gives output like this:
i3status: trying to auto-detect output_format setting
i3status: falling back to "none"
no IPv6 | 6,0 GB | DHCP: no | VPN: no | W: (100% at 803) 192.168.2.101 | E: down | FULL 29,62% 00:00:00 | 0,53 | 2013-10-25 09:16:51
...
It's by no means a valid JSON, and the script canntot parse this.
Last edited by kaszak696 (2013-10-25 07:24: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
Nice to see that click events are used by some people :-)
Offline