You are not logged in.

#1 2017-08-13 19:12:37

beppo
Member
Registered: 2017-08-01
Posts: 26

[SOLVED] Rofi freezes - How to detach firefox from within script

Hi guys!
Just yesterday I wrote my first rofi modi script for ultra fast websearches, that might allow me to boost my productivity to infinity and beyond. (im using i3wm)

#!/bin/bash
if [[ -z "$@" ]]; then
        sr -elvi | awk '{if (NR!=1) print $1}'
else
        sr -browser=firefox $1 $2
fi

Boy, those 4 lines took me way longer as I'm willing to admit.
btw. thats how I start rofi:

 #start rofi
bindsym $mod+d exec "rofi -kb-row-select 'Tab' -kb-row-tab 'Control+space' -monitor primary -combi-modi websearch:~/.config/rofi/websearch.sh,run -show combi -modi combi"

Today when I booted up my computer, and opened up facebook via rofi (also mainly for ultra productivity..), my desktop froze whilest still displaying the rofi menu. But interestingly enough it was not a total freeze. I could still move the mouse but clicking would not cause any action. Also the clock on the i3-status bar was still updating its seconds.

But after going into the terminal via Ctrl +Alt + F2 and killing the rofi process things get really interesting. Because now, not only did the desktop unfreeze but also every possible variation of rofi actions worked seemlessly flawless.
First I thought I might have used rofi too fast and some systemresources where not available, but even after waiting for some minutes, the outcome was the same.

Any tips on how to track down the issue?

Last edited by beppo (2017-08-16 11:42:35)

Offline

#2 2017-08-13 19:35:08

beppo
Member
Registered: 2017-08-01
Posts: 26

Re: [SOLVED] Rofi freezes - How to detach firefox from within script

Problem is, the surfraw command needs a & at the end.

Edit:
This does work when I execute

sr -browser=firefox archlinux & 

in the terminal, but not in the script. any ideas on how to make it work in the shell script?

Last edited by beppo (2017-08-13 20:03:22)

Offline

#3 2017-08-13 21:13:29

cirrus
Member
From: Glasgow Scotland
Registered: 2012-08-24
Posts: 340
Website

Re: [SOLVED] Rofi freezes - How to detach firefox from within script

Dont reinvent the wheel, joking aside you might find this of use
http://tune9.net/watch/kxJClZIXSnM/rofi … cript.html

Offline

#4 2017-08-14 10:17:46

beppo
Member
Registered: 2017-08-01
Posts: 26

Re: [SOLVED] Rofi freezes - How to detach firefox from within script

Thanks, I've already been there, thats not what I'm looking for. You can already have multiple rofi scripts in one instance with the combi mode.

Offline

#5 2017-08-14 11:07:50

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

Re: [SOLVED] Rofi freezes - How to detach firefox from within script

I tried your script. I did put your bash script as websearch, made it executable and then run rofi. It worked flowless everytime. So my guess is you have problem with running rofi, there is no issue with your script. Are you starting rofi instance at boot? or have any conflicting configuration somewhere (in Xresources etc.,). Are you able to run rofi simply without your websearch script?

Offline

#6 2017-08-14 13:23:55

beppo
Member
Registered: 2017-08-01
Posts: 26

Re: [SOLVED] Rofi freezes - How to detach firefox from within script

Which browser did you use, did you have an Instance of the browser open already? I think if you use a commandline browser its not a problem. But when i have no open Firefox instance running, it freezes on me.
I do not start rofi on startup, and I have only custom colors in my .Xresources.

Offline

#7 2017-08-14 18:46:11

beppo
Member
Registered: 2017-08-01
Posts: 26

Re: [SOLVED] Rofi freezes - How to detach firefox from within script

Alright, I fixed it!
Detaching the process with coproc did the trick.

coproc (sr $1 $2 & >& /dev/null &) 

[Solved]

Offline

#8 2017-08-15 03:34:37

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

Re: [SOLVED] Rofi freezes - How to detach firefox from within script

I was using firefox, which was already open. If I close the firefox I get the similar problem as you have described.

Note: to mark this thread solved, kindly edit your first post and prepend [solved] to the title.

Offline

Board footer

Powered by FluxBB