Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use relative paths and more portable commands #173

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions files/applets/bin/appasroot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
## Applets : Run Applications as Root

# Import Current Theme
source "$HOME"/.config/rofi/applets/shared/theme.bash
theme="$type/$style"
SCRIPT_INVOCATION="$0"
INPUT_THEME="$1"
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
source "$SCRIPT_DIR/../shared/theme.bash"

# Theme Elements
prompt='Applications'
Expand Down
19 changes: 11 additions & 8 deletions files/applets/bin/apps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
## Applets : Favorite Applications

# Import Current Theme
source "$HOME"/.config/rofi/applets/shared/theme.bash
theme="$type/$style"
SCRIPT_INVOCATION="$0"
INPUT_THEME="$1"
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
source "$SCRIPT_DIR/../shared/theme.bash"


# Theme Elements
prompt='Applications'
Expand All @@ -22,12 +25,12 @@ elif [[ ( "$theme" == *'type-2'* ) || ( "$theme" == *'type-4'* ) ]]; then
fi

# CMDs (add your apps here)
term_cmd='alacritty'
file_cmd='thunar'
text_cmd='geany'
web_cmd='firefox'
music_cmd='alacritty -e ncmpcpp'
setting_cmd='xfce4-settings-manager'
term_cmd="${TERMINAL_CMD:-alacritty}"
file_cmd="${FILE_BROWSER_CMD:-thunar}"
text_cmd="${TEXT_EDITOR_CMD:-geany}"
web_cmd="${WEB_BROWSER_CMD:-firefox}"
music_cmd="${MUSIC_CMD:-alacritty -e ncmpcpp}"
setting_cmd="${SETTINGS_CMD:-xfce4-settings-manager}"

# Options
layout=`cat ${theme} | grep 'USE_ICON' | cut -d'=' -f2`
Expand Down
6 changes: 4 additions & 2 deletions files/applets/bin/battery.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
## Applets : Battery

# Import Current Theme
source "$HOME"/.config/rofi/applets/shared/theme.bash
theme="$type/$style"
SCRIPT_INVOCATION="$0"
INPUT_THEME="$1"
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
source "$SCRIPT_DIR/../shared/theme.bash"

# Battery Info
battery="`acpi -b | cut -d',' -f1 | cut -d':' -f1`"
Expand Down
6 changes: 4 additions & 2 deletions files/applets/bin/brightness.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
## Applets : Brightness

# Import Current Theme
source "$HOME"/.config/rofi/applets/shared/theme.bash
theme="$type/$style"
SCRIPT_INVOCATION="$0"
INPUT_THEME="$1"
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
source "$SCRIPT_DIR/../shared/theme.bash"

# Brightness Info
backlight="$(printf "%.0f\n" `light -G`)"
Expand Down
7 changes: 5 additions & 2 deletions files/applets/bin/mpd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
## Applets : MPD (music)

# Import Current Theme
source "$HOME"/.config/rofi/applets/shared/theme.bash
theme="$type/$style"
SCRIPT_INVOCATION="$0"
INPUT_THEME="$1"
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
source "$SCRIPT_DIR/../shared/theme.bash"


# Theme Elements
status="`mpc status`"
Expand Down
11 changes: 8 additions & 3 deletions files/applets/bin/powermenu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@
## Applets : Power Menu

# Import Current Theme
source "$HOME"/.config/rofi/applets/shared/theme.bash
theme="$type/$style"
SCRIPT_INVOCATION="$0"
INPUT_THEME="$1"
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
source "$SCRIPT_DIR/../shared/theme.bash"

# Theme Elements
prompt="`hostname`"
mesg="Uptime : `uptime -p | sed -e 's/up //g'`"

uptime=$($SCRIPT_DIR/../../shared/uptime.sh)

mesg="Uptime : $uptime"

if [[ ( "$theme" == *'type-1'* ) || ( "$theme" == *'type-3'* ) || ( "$theme" == *'type-5'* ) ]]; then
list_col='1'
Expand Down
6 changes: 4 additions & 2 deletions files/applets/bin/quicklinks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
## Applets : Quick Links

# Import Current Theme
source "$HOME"/.config/rofi/applets/shared/theme.bash
theme="$type/$style"
SCRIPT_INVOCATION="$0"
INPUT_THEME="$1"
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
source "$SCRIPT_DIR/../shared/theme.bash"

# Theme Elements
prompt='Quick Links'
Expand Down
6 changes: 4 additions & 2 deletions files/applets/bin/screenshot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
## Applets : Screenshot

# Import Current Theme
source "$HOME"/.config/rofi/applets/shared/theme.bash
theme="$type/$style"
SCRIPT_INVOCATION="$0"
INPUT_THEME="$1"
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
source "$SCRIPT_DIR/../shared/theme.bash"

# Theme Elements
prompt='Screenshot'
Expand Down
7 changes: 5 additions & 2 deletions files/applets/bin/volume.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
## Applets : Volume

# Import Current Theme
source "$HOME"/.config/rofi/applets/shared/theme.bash
theme="$type/$style"
SCRIPT_INVOCATION="$0"
INPUT_THEME="$1"
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
source "$SCRIPT_DIR/../shared/theme.bash"


# Volume Info
mixer="`amixer info Master | grep 'Mixer name' | cut -d':' -f2 | tr -d \',' '`"
Expand Down
2 changes: 1 addition & 1 deletion files/applets/shared/colors.rasi
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@

/* Import color-scheme from `colors` directory */

@import "~/.config/rofi/colors/onedark.rasi"
@import "../../colors/onedark.rasi"
19 changes: 17 additions & 2 deletions files/applets/shared/theme.bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
## Current Theme
DEFAULT_TYPE='type-1'
DEFAULT_STYLE='style-1'

type="$HOME/.config/rofi/applets/type-1"
style='style-1.rasi'
# INPUT_THEME should be set by the script that sources this file,
# if the user wants to override the default theme.
if [ -z "$INPUT_THEME" ]; then
theme="$SCRIPT_DIR/../$DEFAULT_TYPE/$DEFAULT_STYLE.rasi"
elif [[ $1 == "-h" || $1 == "--help" ]]; then
echo "Usage: $SCRIPT_INVOCATION [theme]"
exit 0
else
theme="$SCRIPT_DIR/../$theme.rasi"
if [ ! -f "$theme" ]; then
# fail if we still can't find it.
echo "Theme not found!"
exit 1
fi
fi
2 changes: 1 addition & 1 deletion files/applets/type-4/style-1.rasi
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ inputbar {
border-radius: 0px;
border-color: @selected;
background-color: transparent;
background-image: url("~/.config/rofi/images/a.png", width);
background-image: url("./images/a.png", width);
text-color: @foreground;
children: [ "textbox-prompt-colon", "prompt"];
}
Expand Down
2 changes: 1 addition & 1 deletion files/applets/type-4/style-2.rasi
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ inputbar {
border-radius: 20px;
border-color: @selected;
background-color: transparent;
background-image: url("~/.config/rofi/images/d.png", width);
background-image: url("./images/d.png", width);
text-color: @foreground;
children: [ "dummy", "textbox-prompt-colon", "prompt", "dummy"];
}
Expand Down
2 changes: 1 addition & 1 deletion files/applets/type-4/style-3.rasi
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ inputbar {
border-radius: 40px;
border-color: @selected;
background-color: transparent;
background-image: url("~/.config/rofi/images/i.jpg", width);
background-image: url("./images/i.jpg", width);
text-color: @foreground;
children: [ "textbox-prompt-colon", "dummy", "prompt"];
}
Expand Down
2 changes: 1 addition & 1 deletion files/applets/type-5/style-1.rasi
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ mainbox {
/*****----- Imagebox -----*****/
imagebox {
background-color: transparent;
background-image: url("~/.config/rofi/images/e.jpg", height);
background-image: url("./images/e.jpg", height);
children: [ "dummy", "inputbar", "dummy" ];
}

Expand Down
2 changes: 1 addition & 1 deletion files/applets/type-5/style-2.rasi
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ mainbox {
imagebox {
border-radius: 20px;
background-color: transparent;
background-image: url("~/.config/rofi/images/j.jpg", height);
background-image: url("./images/j.jpg", height);
children: [ "dummy", "inputbar", "dummy" ];
}

Expand Down
2 changes: 1 addition & 1 deletion files/applets/type-5/style-3.rasi
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ imagebox {
border-radius: 100%;
border-color: @selected;
background-color: transparent;
background-image: url("~/.config/rofi/images/g.png", height);
background-image: url("./images/g.png", height);
children: [ "dummy", "inputbar", "dummy" ];
}

Expand Down
12 changes: 9 additions & 3 deletions files/launchers/type-1/launcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@
## style-6 style-7 style-8 style-9 style-10
## style-11 style-12 style-13 style-14 style-15

dir="$HOME/.config/rofi/launchers/type-1"
theme='style-1'
INPUT_THEME=$1
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
theme=$($SCRIPT_DIR/../../shared/theme.sh "$SCRIPT_DIR" '1' '15' "$INPUT_THEME")

if [ $? -ne 0 ]; then
echo $theme
exit 1
fi

## Run
rofi \
-show drun \
-theme ${dir}/${theme}.rasi
-theme $theme
2 changes: 1 addition & 1 deletion files/launchers/type-1/shared/colors.rasi
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@

/* Import color-scheme from `colors` directory */

@import "~/.config/rofi/colors/onedark.rasi"
@import "../../../colors/onedark.rasi"
12 changes: 9 additions & 3 deletions files/launchers/type-2/launcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@
## style-6 style-7 style-8 style-9 style-10
## style-11 style-12 style-13 style-14 style-15

dir="$HOME/.config/rofi/launchers/type-2"
theme='style-1'
INPUT_THEME=$1
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
theme=$($SCRIPT_DIR/../../shared/theme.sh "$SCRIPT_DIR" '1' '15' "$INPUT_THEME")

if [ $? -ne 0 ]; then
echo $theme
exit 1
fi

## Run
rofi \
-show drun \
-theme ${dir}/${theme}.rasi
-theme $theme
2 changes: 1 addition & 1 deletion files/launchers/type-2/shared/colors.rasi
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@

/* Import color-scheme from `colors` directory */

@import "~/.config/rofi/colors/onedark.rasi"
@import "../../../colors/onedark.rasi"
14 changes: 11 additions & 3 deletions files/launchers/type-3/launcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,18 @@
## style-1 style-2 style-3 style-4 style-5
## style-6 style-7 style-8 style-9 style-10

dir="$HOME/.config/rofi/launchers/type-3"
theme='style-10'
INPUT_THEME=$1
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
theme=$($SCRIPT_DIR/../../shared/theme.sh "$SCRIPT_DIR" '10' '10' "$INPUT_THEME")

if [ $? -ne 0 ]; then
echo $theme
exit 1
fi



## Run
rofi \
-show drun \
-theme ${dir}/${theme}.rasi
-theme $theme
2 changes: 1 addition & 1 deletion files/launchers/type-3/shared/colors.rasi
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@

/* Import color-scheme from `colors` directory */

@import "~/.config/rofi/colors/onedark.rasi"
@import "../../../colors/onedark.rasi"
12 changes: 9 additions & 3 deletions files/launchers/type-4/launcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@
## style-1 style-2 style-3 style-4 style-5
## style-6 style-7 style-8 style-9 style-10

dir="$HOME/.config/rofi/launchers/type-4"
theme='style-1'
INPUT_THEME=$1
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
theme=$($SCRIPT_DIR/../../shared/theme.sh "$SCRIPT_DIR" '1' '10' "$INPUT_THEME")

if [ $? -ne 0 ]; then
echo $theme
exit 1
fi

## Run
rofi \
-show drun \
-theme ${dir}/${theme}.rasi
-theme $theme
2 changes: 1 addition & 1 deletion files/launchers/type-4/shared/colors.rasi
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@

/* Import color-scheme from `colors` directory */

@import "~/.config/rofi/colors/onedark.rasi"
@import "../../../colors/onedark.rasi"
12 changes: 9 additions & 3 deletions files/launchers/type-5/launcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@
#
## style-1 style-2 style-3 style-4 style-5

dir="$HOME/.config/rofi/launchers/type-5"
theme='style-1'
INPUT_THEME=$1
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
theme=$($SCRIPT_DIR/../../shared/theme.sh "$SCRIPT_DIR" '1' '5' "$INPUT_THEME")

if [ $? -ne 0 ]; then
echo $theme
exit 1
fi

## Run
rofi \
-show drun \
-theme ${dir}/${theme}.rasi
-theme $theme
2 changes: 1 addition & 1 deletion files/launchers/type-5/style-1.rasi
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ window {
border-radius: 0px;
border-color: black;
cursor: "default";
background-image: url("~/.config/rofi/images/paper.png", none);
background-image: url("./images/paper.png", none);
}

/*****----- Main Box -----*****/
Expand Down
2 changes: 1 addition & 1 deletion files/launchers/type-5/style-2.rasi
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ window {
padding: 0px;
border-radius: 12px;
cursor: "default";
background-image: url("~/.config/rofi/images/gradient.png", width);
background-image: url("./images/gradient.png", width);
}

/*****----- Main Box -----*****/
Expand Down
6 changes: 3 additions & 3 deletions files/launchers/type-5/style-5.rasi
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ window {
border-radius: 20px;
cursor: "default";
background-color: #162022;
background-image: url("~/.config/rofi/images/flowers-1.png", width);
background-image: url("./images/flowers-1.png", width);
}

/*****----- Main Box -----*****/
Expand All @@ -63,7 +63,7 @@ inputbar {
border: 2px;
border-radius: 20px;
border-color: white;
background-image: url("~/.config/rofi/images/flowers-3.png", none);
background-image: url("./images/flowers-3.png", none);
children: [ "textbox-prompt-colon", "entry" ];
}

Expand Down Expand Up @@ -108,7 +108,7 @@ listview {
border: 2px;
border-radius: 20px;
border-color: white;
background-image: url("~/.config/rofi/images/flowers-2.png", width);
background-image: url("./images/flowers-2.png", width);
cursor: "default";
}

Expand Down
Loading