sdushantha / fontpreview

Highly customizable and minimal font previewer written in bash
MIT License
916 stars 39 forks source link

Only works with one font at a time #7

Closed SebastianMeisel closed 4 years ago

SebastianMeisel commented 4 years ago

For me the font preview works only for one font. When I want to preview a second font I have to quit and restart the script.

Ubuntu 18.04 bash 4.4.20

sdushantha commented 4 years ago

Could you please send a screen recording so that I can see what is happening?

SebastianMeisel commented 4 years ago

Here it is:

Am Sa., 8. Feb. 2020 um 21:04 Uhr schrieb Siddharth Dushantha < notifications@github.com>:

Could you please send a screen recording so that I can see what is happening?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sdushantha/fontpreview/issues/7?email_source=notifications&email_token=ALURSNMOG4F4OG5YMBKDYQ3RB4F6RA5CNFSM4KR4T45KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELF2MTY#issuecomment-583771727, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALURSNLIGN4VWCREXOXN5E3RB4F6RANCNFSM4KR4T45A .

sdushantha commented 4 years ago

Hmm...seems like there is nothing. I think it is not showing up because you replied by email. image

SebastianMeisel commented 4 years ago

I had to zip it, so github accepts it. vokoscreen-2020-02-08_21-11-56.zip

sdushantha commented 4 years ago

Ah okay, now I see what the problem is. I have configured sxiv to be floating window. You have it so that it fills to whole screen. The problem here is that when you are quitting sxiv, and you arent supposed to do that.

Is it possible to set in your window manager to not have a window full screen?

SebastianMeisel commented 4 years ago

That's possible. But I have to figure out how. I'll do that tomorrow and let you know.

Siddharth Dushantha notifications@github.com schrieb am Sa., 8. Feb. 2020, 21:31:

Ah okay, now I see what the problem is. I have configured sxiv to be floating window. You have it so that it fills to whole screen. The problem here is that when you are quitting sxiv, and you arent supposed to do that.

Is it possible to set in your window manager to not have a window full screen?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sdushantha/fontpreview/issues/7?email_source=notifications&email_token=ALURSNM7G2UGITD6ORZBW5LRB4JAXA5CNFSM4KR4T45KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELF253Q#issuecomment-583773934, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALURSNNMNX7I6P4LOBFGCWDRB4JAXANCNFSM4KR4T45A .

nilskuehme commented 4 years ago

Having same issue using floating window

Video: screenrecord

i3-gaps: 4.15.0.1 bash: 4.4.12

maxdevjs commented 4 years ago

Strange..

@nilskuehme do you use Ubuntu or similar?

southwindcg commented 4 years ago

I'm having the same issue, also with a Ubuntu derivative. I believe the problem stems from sxiv being an obsolete version in the Ubuntu repos. The next version after the one I have (1.3.2-1) says the following in the change log:

https://github.com/muennich/sxiv

v24 (October 27, 2017) Automatically reload the current image whenever it changes

Also, the following:

Please make sure to install the corresponding development packages in case that you want to build sxiv on a distribution with separate runtime and development packages (e.g. *-dev on Debian).

maxdevjs commented 4 years ago

For what I read so far in comments/issues, seems to effectively affect Ubuntu/derivative distros.

russsharek commented 4 years ago

Having a similar problem on Debian Buster.

Interestingly, when I comment out the reset on FIRST_RUN=false in the if/then loop of main, it works.

sdushantha commented 4 years ago

@linuxclowns Doesnt commenting out FIRST_RUN=false create new sxiv windows?

Since this seems to be an issue on Ubuntu and derivative distros, I think it would be best to have a note in the README stating that if you use Ubuntu or its a distro that is based on Ubuntu, then you have to manually download and compile sxiv.

What are your guys thoughts on this?

nilskuehme commented 4 years ago

@maxdevjs no i do use Debian.

sdushantha commented 4 years ago

@nilskuehme Well, Ubuntu is based on Debian, so it might be an issue with all Debian based distros

SebastianMeisel commented 4 years ago

I would recommend to change line 113 to:

    if [ $FIRST_RUN == true || ! -z $(ps -o pid= -p $(cat $PIDFILE)) ]; then

That checks if sxvi is still running and else restarts it. Seems a good idea anyway. Works for me.

SebastianMeisel commented 4 years ago

Of course it's rather:

if [ $FIRST_RUN == true ] || [ ! -z $(ps -o pid= -p $(cat $PIDFILE)) ]; then

Sorry for the typo.

sdushantha commented 4 years ago

@SebastianMeisel Hmmm.... not sure if it is working as intended image

SebastianMeisel commented 4 years ago

Yes, after more testing I run into issues too. Will further try to find a solution in that direction. I'll test better before answering again...

Am So., 9. Feb. 2020 um 11:17 Uhr schrieb Siddharth Dushantha < notifications@github.com>:

@SebastianMeisel https://github.com/SebastianMeisel Hmmm.... not sure if it is working as intended [image: image] https://user-images.githubusercontent.com/27065646/74100286-634fb100-4b2d-11ea-8170-605f71ee4103.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sdushantha/fontpreview/issues/7?email_source=notifications&email_token=ALURSNLTVOE3UKDFCUBN4C3RB7J2HA5CNFSM4KR4T45KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELGIDSQ#issuecomment-583827914, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALURSNPY54SLOU5GLRVNL4LRB7J2HANCNFSM4KR4T45A .

SebastianMeisel commented 4 years ago

Could you test this? It seems to work, when sxvi is crashing, but I can't test, if it works if sxvi keeps running:

   if [ $FIRST_RUN == true ] ; then
        FIRST_RUN=false

        # Display the font preview using sxiv
        sxiv -g "$SIZE$POSITION" "$FONT_PREVIEW" -N "fontpreview" -b &

        # Change focus from sxiv, back to the terminal window
        # so that user can continue to search for fonts without
        # having to manually change focus back to the terminal window
        xdotool windowfocus "$(cat "$TERMWIN_IDFILE")"

        # Save the process ID so that we can kill
        # sxiv when the user exits the script
        echo $! >"$PIDFILE"
 elif [ -f $PIDFILE ] && ! PID=$(cat $PIDFILE) [ -n "$PID" -a -e /proc/$PID ] ; then
     echo "Restart sxvi - You maybe using a obsolete version. " >&2
     # Display the font preview using sxiv
     sxiv -g "$SIZE$POSITION" "$FONT_PREVIEW" -N "fontpreview" -b &

     # Change focus from sxiv, back to the terminal window
     # so that user can continue to search for fonts without
     # having to manually change focus back to the terminal window
     xdotool windowfocus "$(cat "$TERMWIN_IDFILE")"

     # Save the process ID so that we can kill
     # sxiv when the user exits the script
     echo $! >"$PIDFILE"
    fi
sdushantha commented 4 years ago

@SebastianMeisel Same issue... image

And here is the code that I added: image

SebastianMeisel commented 4 years ago

Last try:

        # Save the process ID so that we can kill
        # sxiv when the user exits the script
        echo $! >"$PIDFILE"
 elif [ -f $PIDFILE ] ; then
     PID=$(cat $PIDFILE)
     ls -1 /proc/$PID >&2
     if  [ ! -e /proc/$PID ] ; then
         echo "Restart sxvi - You maybe using a obsolete version. " >&2
         # Display the font preview using sxiv
         sxiv -g "$SIZE$POSITION" "$FONT_PREVIEW" -N "fontpreview" -b &

         # Change focus from sxiv, back to the terminal window
         # so that user can continue to search for fonts without
         # having to manually change focus back to the terminal window
         xdotool windowfocus "$(cat "$TERMWIN_IDFILE")"

         # Save the process ID so that we can kill
         # sxiv when the user exits the script
         echo $! >"$PIDFILE"
     fi
    fi
sdushantha commented 4 years ago

@SebastianMeisel Yay it works! Looks like your last try was the best try :blush: Could you make a PR for this?

SebastianMeisel commented 4 years ago

I'll do it tonight (UTC+1;-)

Siddharth Dushantha notifications@github.com schrieb am So., 9. Feb. 2020, 12:04:

@SebastianMeisel https://github.com/SebastianMeisel Yay it works! Looks like your last try was the best try 😊 Could you make a PR for this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sdushantha/fontpreview/issues/7?email_source=notifications&email_token=ALURSNNIW3YGFY42I34Z2TDRB7PMNA5CNFSM4KR4T45KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELGJEIQ#issuecomment-583832098, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALURSNIRXHEI2IKBCUY4FZDRB7PMNANCNFSM4KR4T45A .

sdushantha commented 4 years ago

This has been fixed in version 1.0.2, #21