Skip to content

Commit

Permalink
Merge pull request #17 from jp1995/dev
Browse files Browse the repository at this point in the history
minor update with fixes, incl for #16
  • Loading branch information
jp1995 authored Jul 9, 2023
2 parents 33be2a4 + 27f6ed3 commit fdceb65
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 31 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Kappa Launcher is a simple bash script that uses rofi to display and launch your
* Streams that you don't follow can also be looked up and launched.

## Installation
### LATEST VERSION: 01 MARCH 2022. HELIX API MIGRATION. UPDOOT UR SHIT.

### Install using ```make```
```bash
Expand Down
57 changes: 27 additions & 30 deletions kpl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ _filecheck () {
echo -e "First start detected, generating configuration file \n"
_config
echo -e "Configuration file created in .config/kpl \n"
echo "Edit it with your OAuth key (https://spheroid.xyz/kappa/) and relaunch the script"
echo "Edit it with your OAuth key (https://jp1995.github.io/kappa/) and relaunch the script"
exit
fi
}
Expand Down Expand Up @@ -147,6 +147,11 @@ _choice () {
}

_monospaced () {
# The default font mono in kpl config is not in fc-list for some reason
if [ $1 = "mono" ]; then
export MONO=1
return
fi
# Check if font is in list of monospaced fonts
MONOFONTS=$(fc-list :mono | sed 's/:\ /:/' | awk -F : -v quote="'" '{print quote $2 quote}' | sort -u)
export MONO=$(echo "$MONOFONTS" | grep -ic "'$*'")
Expand All @@ -158,33 +163,28 @@ _fontname () {
FNAME=$(echo $FONT | awk -F " " '{$NF=""; print $0}' | sed 's/\ $//')
_monospaced "$FNAME"
if [[ $MONO -eq 1 ]]; then
echo "Using monospaced font found kpl config"
export FNAME="$FNAME"
return
else
FONT=""
fi
fi
# If FONT set in rofi config, test if its monospaced before using
FNAME=$(grep -e "^[[:space:]].*font:" $R_FILE | cut -d \" -f 2 | awk '{$NF=""; print $0}' | sed 's/\ $//')
if [[ ! -z $FNAME ]]; then
_monospaced "$FNAME"
if [[ $MONO -eq 1 ]]; then
export FNAME="$FNAME"
return
if [ -f $R_FILE ]; then
FNAME=$(grep -e "^[[:space:]].*font:" $R_FILE | cut -d \" -f 2 | awk '{$NF=""; print $0}' | sed 's/\ $//')
if [[ ! -z $FNAME ]]; then
_monospaced "$FNAME"
if [[ $MONO -eq 1 ]]; then
echo "Using monospaced font found in rofi config"
export FNAME="$FNAME"
return
fi
fi
fi
# If FONT set in xresources, test if its monospaced before using or
# default to mono (family class which fontconfig will pick from monospaced fonts)
FNAME=$(rofi -dump-xresources 2> /dev/null | grep font | cut -d: -f 2 | sed 's/^\ *//g' | awk '{$NF=""; print $0}' | sed 's/\ $//')
if [[ $FNAME != "mono" ]]; then
_monospaced "$FNAME"
fi
if [[ $MONO -eq 1 ]]; then
export FNAME="$FNAME"
return
else
FNAME="mono"
fi
# Default to mono
echo "No font set in kpl or rofi configs, defaulting to mono"
FNAME="mono"
}

_fontsize (){
Expand All @@ -194,18 +194,15 @@ _fontsize (){
return
fi
# If font is set in rofi config
FSIZE=$(grep -e "^[[:space:]].*font:" $R_FILE | cut -d \" -f 2 | awk '{print $NF}')
if [[ ! -z $FSIZE ]]; then
export FSIZE
return
fi
# If font is set from xresources else use default of 12
FSIZE=$(rofi -dump-xresources 2> /dev/null | grep font | cut -d: -f 2 | sed 's/^\ *//' | awk '{print $NF}')
if [[ ! -z $FSIZE ]]; then
export FSIZE
else
export FSIZE=12
if [ -f $R_FILE ]; then
FSIZE=$(grep -e "^[[:space:]].*font:" $R_FILE | cut -d \" -f 2 | awk '{print $NF}')
if [[ ! -z $FSIZE ]]; then
export FSIZE
return
fi
fi
# Default to 12
export FSIZE=12
}

# Setting working directory, checking for configuration file, generating it if needed.
Expand Down

0 comments on commit fdceb65

Please sign in to comment.