You are not logged in.

#1 2019-09-13 15:32:01

Cristhian
Member
Registered: 2018-02-17
Posts: 76

[SOLVED] i3bar or i3blocks not working as they wish

Hi , I'm using i3wm and i3blocks to customize i3bar.
I've written do many bash scripts but today everything stopped working .
I will post a sample of my i3blocks.conf, the output and a script in bash I wrote .

[SOLUTION for i3blocks not finding scripts after update] Install i3blocks-contrib from AUR or clone from git and specify in i3blocks.conf the position of the scripts adding this string in general variable space (before any block):

command=/location/to/i3block-contrib/$BLOCK_NAME/$BLOCK_NAME

[SOLUTION to prevent i3blocks from freezing] Just use xsel instead of xclip in my script and averything works fine, I don' t know why xclip caused that.

Edit:
I found that the first 2 lines  of the script cause time to freeze

source /tmp/vari
source /tmp/vario

my script  Pass.sh

#!/bin/bash
source /tmp/vari
source /tmp/vario

case $BLOCK_BUTTON in

        1) echo R="0" > /tmp/vario;;
        4) echo "R=$((R+1))" > /tmp/vario;;
        5) echo "R=$((R-1))" > /tmp/vario;;
esac
case $R in
        0)echo " cristhian.bruno9@gmail.com"
        echo J="cristhian.bruno9@gmail.com" > /tmp/vari
        echo $J | xclip -selection c    ;;
        2)echo "Aukey"
        echo J="00:23:02:30:43:14" > /tmp/vari
        echo $J | xclip -selection c    ;;
esac

my i3blocks.conf:

# i3blocks configuration file
#
# The i3blocks man page describes the usage of the binary,
# and its website describes the configuration:
#
#     https://vivien.github.io/i3blocks


# Global properties
separator=true
separator_block_width=15

[Pass]
label=Pass:
command=~/Downloads/Scripts/Pass.sh
interval=1

[greetings]
color=#f5af19
command=echo "Hello, $USER!"
interval=once

[time]
command=date '+%Y-%m-%d %H:%M:%S'
interval=1

the output of i3blocks:

Documentation Hello, sirth! 2019-09-13 17:28:45

and sometimes also the time stop refreshing.

Everything is update to the latest version

Last edited by Cristhian (2019-09-15 08:57:01)

Offline

#2 2019-09-14 17:56:59

TheLetterN
Member
Registered: 2014-08-17
Posts: 10

Re: [SOLVED] i3bar or i3blocks not working as they wish

If your issue is the same as mine, it looks like the newest version of i3blocks removes /usr/lib/i3blocks where the default blocklets were stored, so all the default blocklets are gone.

[2019-09-13 23:52] [ALPM-SCRIPTLET]                                             
[2019-09-13 23:52] [ALPM-SCRIPTLET]   i3blocks-1.5-1 removed any additional scripts.
[2019-09-13 23:52] [ALPM-SCRIPTLET]   If you need them, clone https://github.com/vivien/i3blocks-contrib
[2019-09-13 23:52] [ALPM-SCRIPTLET] 

The solution for me was to clone https://github.com/vivien/i3blocks-contrib into my ~/.config/i3blocks folder, and in my i3blocks config (which for me is ~/.config/i3blocks/config) I changed:

# Global properties                                                             
#                                                                               
# The top properties below are applied to every block, but can be overridden.   
# Each block command defaults to the script name to avoid boilerplate.  
command=/usr/lib/i3blocks/$BLOCK_NAME

to:

  
# Global properties                                                             
#                                                                               
# The top properties below are applied to every block, but can be overridden.   
# Each block command defaults to the script name to avoid boilerplate.                                     
command=~/.config/i3blocks/i3blocks-contrib/$BLOCK_NAME/$BLOCK_NAME

Your own setup might be different, so use whatever directory structure you're using, but it should work if the top command= in your config file points to the right place.

Offline

#3 2019-09-14 21:36:18

Cristhian
Member
Registered: 2018-02-17
Posts: 76

Re: [SOLVED] i3bar or i3blocks not working as they wish

TheLetterN wrote:

If your issue is the same as mine, it looks like the newest version of i3blocks removes /usr/lib/i3blocks where the default blocklets were stored, so all the default blocklets are gone.

[2019-09-13 23:52] [ALPM-SCRIPTLET]                                             
[2019-09-13 23:52] [ALPM-SCRIPTLET]   i3blocks-1.5-1 removed any additional scripts.
[2019-09-13 23:52] [ALPM-SCRIPTLET]   If you need them, clone https://github.com/vivien/i3blocks-contrib
[2019-09-13 23:52] [ALPM-SCRIPTLET] 

The solution for me was to clone https://github.com/vivien/i3blocks-contrib into my ~/.config/i3blocks folder, and in my i3blocks config (which for me is ~/.config/i3blocks/config) I changed:

# Global properties                                                             
#                                                                               
# The top properties below are applied to every block, but can be overridden.   
# Each block command defaults to the script name to avoid boilerplate.  
command=/usr/lib/i3blocks/$BLOCK_NAME

to:

  
# Global properties                                                             
#                                                                               
# The top properties below are applied to every block, but can be overridden.   
# Each block command defaults to the script name to avoid boilerplate.                                     
command=~/.config/i3blocks/i3blocks-contrib/$BLOCK_NAME/$BLOCK_NAME

Your own setup might be different, so use whatever directory structure you're using, but it should work if the top command= in your config file points to the right place.

absolutely yes. I did the same thing to solve that problem , just a little change. Some scripts , like "bandwidth" has more than one script like bandwidth 1, 2 and 3 so i used a different command for every block.

command=/usr/lib/i3blocks/bandwidth/bandwidth3

PS: I did not clone anything, just installing contrib from AUR and everything went in /usr/lib/i3blocks
Now the main problem is about my script.
It seems that the pipe command xclip reading from the variable, is not working anymore for i3blocks.
Do you know another solution to copy into clipboard form a variable?

Last edited by Cristhian (2019-09-14 21:40:11)

Offline

#4 2019-09-21 03:04:55

TheLetterN
Member
Registered: 2014-08-17
Posts: 10

Re: [SOLVED] i3bar or i3blocks not working as they wish

Have you tried setting the DISPLAY variable in your script or command? xclip might not be automatically finding your X session, so you might have to do DISPLAY=:0.0 in the appropriate spot, assuming you've only got one X session running.

Offline

#5 2019-10-19 06:29:31

Minsc
Member
Registered: 2012-07-16
Posts: 95

Re: [SOLVED] i3bar or i3blocks not working as they wish

Apologies for the late bump - I also ran into this issue. My fix:

Install i3blocks-contrib from AUR or git.

Edit

~/.i3blocks.conf

and replace the command path with:

command=/usr/lib/i3blocks/$BLOCK_NAME/$BLOCK_NAME

Last edited by Minsc (2019-10-19 06:30:51)

Offline

Board footer

Powered by FluxBB