📝 Added pcmanfm to bspc rules

This commit is contained in:
z3rOR0ne 2022-12-24 01:21:52 -08:00
parent 127ed43979
commit d7a801c233
3 changed files with 69 additions and 2 deletions

View file

@ -58,9 +58,8 @@ bspc rule -a Pavucontrol state=floating center=on rectangle=960x810+1440+810 &
bspc rule -a Lxappearance state=floating center=on rectangle=960x810+1440+810 &
bspc rule -a Mousepad state=floating center=on rectangle=960x810+1440+810 &
bspc rule -a Brave-browser center=on rectangle=1595x970+1440+810 &
bspc rule -a Pcmanfm center=on rectangle=1595x970+1440+810 &
# bspc rule -a pavucontrol state=floating rectangle=480x270+1440+810 sticky=on layer=above
# bspc rule -a lxappearance state=floating rectangle=480x270+1440+810 sticky=on layer=above
# bspc rule -a Gimp desktop='^8' state=floating follow=on
# bspc rule -a Chromium desktop='^2'
# bspc rule -a mplayer2 state=floating

43
hsl2hex.sh Normal file
View file

@ -0,0 +1,43 @@
# Convert HSL values to RGB
function hsl_to_rgb() {
local hue=$1
local saturation=$2
local lightness=$3
# Check for achromatic color
if [[ $saturation -eq 0 ]]; then
echo "$lightness $lightness $lightness"
return
fi
# Convert HSL values to RGB
local intermediate_value=$((lightness * 2 - saturation))
local maximum_value=$(((intermediate_value + saturation) * 2))
local hue_sixth=$((hue * 6))
local red=$((hue_sixth < 1 ? intermediate_value : hue_sixth < 3 ? maximum_value : hue_sixth < 4 ? intermediate_value : lightness))
local green=$((hue_sixth < 2 ? intermediate_value : hue_sixth < 4 ? maximum_value : hue_sixth < 5 ? intermediate_value : lightness))
local blue=$((hue_sixth < 3 ? intermediate_value : hue_sixth < 5 ? maximum_value : hue_sixth < 6 ? intermediate_value : lightness))
echo "$red $green $blue"
}
# Convert RGB values to HEX
function rgb_to_hex() {
local red=$1
local green=$2
local blue=$3
printf '#%02X%02X%02X' $red $green $blue
}
# Convert HSL to HEX
function hsl_to_hex() {
local hue=$1
local saturation=$2
local lightness=$3
# Convert HSL to RGB
local red green blue
read red green blue <<<$(hsl_to_rgb $hue $saturation $lightness)
# Convert RGB to HEX
rgb_to_hex $red $green $blue
}

25
hsl2hex.txt Normal file
View file

@ -0,0 +1,25 @@
Certainly! Here is a detailed explanation of the ternary operators in the "Convert HSL values to RGB" section of the hsl_to_rgb function:
Copy code
local red=$((hue_sixth < 1 ? intermediate_value : hue_sixth < 3 ? maximum_value : hue_sixth < 4 ? intermediate_value : lightness))
local green=$((hue_sixth < 2 ? intermediate_value : hue_sixth < 4 ? maximum_value : hue_sixth < 5 ? intermediate_value : lightness))
local blue=$((hue_sixth < 3 ? intermediate_value : hue_sixth < 5 ? maximum_value : hue_sixth < 6 ? intermediate_value : lightness))
Each of these lines uses a ternary operator to calculate the value of the red, green, or blue variable. The syntax for the ternary operator in bash is expr ? expr : expr, where expr is a valid expression.
The ternary operator works by evaluating the expression before the ? character. If the expression evaluates to a non-zero value (i.e., true), then the expression before the : character is evaluated and returned. If the expression evaluates to a zero value (i.e., false), then the expression after the : character is evaluated and returned.
For example, in the following code snippet:
Copy code
x=5
y=10
z=$((x > y ? x : y))
echo $z
The ternary operator ((x > y ? x : y)) will evaluate to y, since x is not greater than y. As a result, the value of z will be 10.
In the "Convert HSL values to RGB" section of the hsl_to_rgb function, the ternary operators are used to determine which of the intermediate or maximum values should be assigned to the red, green, or blue variables, based on the value of hue_sixth.
For example, in the first line of code:
Copy code
local red=$((hue_sixth < 1 ? intermediate_value :