You are not logged in.

#1001 2013-10-06 02:24:46

ids1024
Member
From: California
Registered: 2013-08-16
Posts: 243
Website

Re: The i3 thread

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

#1002 2013-10-06 17:57:45

ajbibb
Member
Registered: 2012-02-12
Posts: 142

Re: The i3 thread

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

#1003 2013-10-11 10:29:04

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,494

Re: The i3 thread

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

#1004 2013-10-11 12:49:03

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: The i3 thread

@ qinohe, your github page link isn't working.

Also, you might want to post a screenshot.

Offline

#1005 2013-10-11 13:45:09

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,494

Re: The i3 thread

x33a wrote:

@ 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

2wlc.png

Last edited by qinohe (2013-10-11 17:05:55)

Offline

#1006 2013-10-20 14:41:31

chickenPie4tea
Member
Registered: 2012-08-21
Posts: 309

Re: The i3 thread

hi all - I have a question smile
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

#1007 2013-10-20 14:45:22

acgtyrant
Member
From: Hangzhou, China
Registered: 2013-04-09
Posts: 65
Website

Re: The i3 thread

@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

#1008 2013-10-20 17:06:09

progandy
Member
Registered: 2012-05-17
Posts: 5,262

Re: The i3 thread

chickenPie4tea wrote:

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

#1009 2013-10-23 03:46:42

cowsquad
Member
From: portland oregon
Registered: 2012-12-15
Posts: 17

Re: The i3 thread

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

ajbibb wrote:

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

#1010 2013-10-23 12:14:38

ajbibb
Member
Registered: 2012-02-12
Posts: 142

Re: The i3 thread

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

#1011 2013-10-24 00:27:27

cowsquad
Member
From: portland oregon
Registered: 2012-12-15
Posts: 17

Re: The i3 thread

ajbibb wrote:

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

#1012 2013-10-24 01:24:21

ajbibb
Member
Registered: 2012-02-12
Posts: 142

Re: The i3 thread

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

#1013 2013-10-24 03:55:21

cowsquad
Member
From: portland oregon
Registered: 2012-12-15
Posts: 17

Re: The i3 thread

ajbibb wrote:

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

#1014 2013-10-24 05:00:55

Green
Member
Registered: 2013-09-22
Posts: 13

Re: The i3 thread

Anyone else having problems with i3 and gnome 3.10?

Offline

#1015 2013-10-24 05:11:39

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: The i3 thread

@ Green, care to elaborate?

Offline

#1016 2013-10-24 05:58:38

Green
Member
Registered: 2013-09-22
Posts: 13

Re: The i3 thread

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

#1017 2013-10-24 11:02:54

mir
Member
Registered: 2010-08-25
Posts: 59

Re: The i3 thread

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

#1018 2013-10-24 12:05:50

ajbibb
Member
Registered: 2012-02-12
Posts: 142

Re: The i3 thread

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

#1019 2013-10-24 21:13:44

cowsquad
Member
From: portland oregon
Registered: 2012-12-15
Posts: 17

Re: The i3 thread

I will install the jshon package and will be awaiting for your update man. thanks for giving me support

ajbibb wrote:
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

#1020 2013-10-24 23:07:59

ajbibb
Member
Registered: 2012-02-12
Posts: 142

Re: The i3 thread

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.

Offline

#1021 2013-10-25 01:09:49

cowsquad
Member
From: portland oregon
Registered: 2012-12-15
Posts: 17

Re: The i3 thread

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

Offline

#1022 2013-10-25 01:13:18

cowsquad
Member
From: portland oregon
Registered: 2012-12-15
Posts: 17

Re: The i3 thread

cowsquad wrote:
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

#1023 2013-10-25 01:35:43

ajbibb
Member
Registered: 2012-02-12
Posts: 142

Re: The i3 thread

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

#1024 2013-10-25 07:18:29

kaszak696
Member
Registered: 2009-05-26
Posts: 543

Re: The i3 thread

cowsquad wrote:

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

#1025 2013-10-26 13:17:28

dom0
Member
Registered: 2013-02-16
Posts: 39

Re: The i3 thread

Nice to see that click events are used by some people :-)

Offline

Board footer

Powered by FluxBB