fix: adjust hyprland configs

This commit is contained in:
ryan4yin
2023-05-07 12:09:01 +08:00
parent 88faaa950c
commit 82f0248cf6
26 changed files with 318 additions and 475 deletions
+8 -68
View File
@@ -1,70 +1,10 @@
#!/usr/bin/env bash
# Background Image
IMAGE="$HOME/.config/hypr/wallpapers/lockscreen.png"
# Colors
bg='1e1e2e' bgl='313244' fg='d9e0ee'
red='f38ba8' green='a6e3a1' yellow='f9e2af'
blue='89b4fa' magenta='cba6f7' cyan='89dceb'
alpha='00000000'
# CMD
swaylock -f \
\
`# General` \
--ignore-empty-password \
--show-failed-attempts \
--hide-keyboard-layout \
--indicator-caps-lock \
\
`# Appearance` \
--color ${bg}E6 \
`#--image ${IMAGE} --scaling fill` \
--font 'JetBrainsMono Nerd Font' --font-size 18 \
\
`# Backspace Key` \
--key-hl-color ${green} \
--caps-lock-key-hl-color ${blue} \
--bs-hl-color ${red} \
--caps-lock-bs-hl-color ${red} \
\
`# Indicator` \
--indicator-radius 120 \
--indicator-thickness 10 \
\
`# Inside Circle Colors` \
--inside-color ${alpha} \
--inside-clear-color ${alpha} \
--inside-caps-lock-color ${alpha} \
--inside-ver-color ${blue} \
--inside-wrong-color ${red} \
\
`# Layout Colors` \
--layout-bg-color ${cyan} \
--layout-border-color ${cyan} \
--layout-text-color ${bg} \
\
`# Line Colors` \
--line-color ${bg} \
--line-clear-color ${red} \
--line-caps-lock-color ${bg} \
--line-ver-color ${bg} \
--line-wrong-color ${bg} \
\
`# Ring Colors` \
--ring-color ${cyan} \
--ring-clear-color ${bg} \
--ring-caps-lock-color ${magenta} \
--ring-ver-color ${blue} \
--ring-wrong-color ${red} \
\
`# Separator Color` \
--separator-color ${bg} \
\
`# Text Colors` \
--text-color ${fg} \
--text-clear-color ${fg} \
--text-caps-lock-color ${fg} \
--text-ver-color ${bg} \
--text-wrong-color ${bg}
# Times the screen off and puts it to background
swayidle \
timeout 300 'swaymsg "output * power off"' \
resume 'swaymsg "output * power on"' &
# Locks the screen immediately
swaylock
# Kills last background task so idle timer doesn't keep running
kill %%
-83
View File
@@ -1,83 +0,0 @@
#!/usr/bin/env bash
## Wofi Powermenu
## Files
CONFIG="$HOME/.config/hypr/wofi/config"
STYLE="$HOME/.config/hypr/wofi/style.css"
COLORS="$HOME/.config/hypr/wofi/colors"
## Wofi Command
wofi_command="wofi --show dmenu \
--conf ${CONFIG} --style ${STYLE} --color ${COLORS} \
--width=300 --height=165 \
--cache-file=/dev/null \
--hide-scroll --no-actions \
--define=matching=fuzzy"
uptime=$(uptime -p | sed -e 's/up //g')
## Entries
shutdown=" Shutdown"
reboot=" Restart"
lock=" Lock"
suspend=" Sleep"
logout=" Logout"
# Ask for confirmation
cdialog () {
yad --title='Confirm?' --borders=15 --center --fixed --undecorated --button=Yes:0 --button=No:1 --text="Are you sure?" --text-align=center
}
# Variable passed to rofi
open_menu () {
options="$lock\n$suspend\n$logout\n$reboot\n$shutdown"
chosen="$(echo -e "$options" | $wofi_command --prompt "UP - $uptime")"
case $chosen in
$shutdown)
cdialog
if [[ "$?" == 0 ]]; then
systemctl poweroff
else
exit
fi
;;
$reboot)
cdialog
if [[ "$?" == 0 ]]; then
systemctl reboot
else
exit
fi
;;
$lock)
~/.config/hypr/scripts/lockscreen
;;
$suspend)
cdialog
if [[ "$?" == 0 ]]; then
mpc -q pause
amixer set Master mute
~/.config/hypr/scripts/lockscreen
systemctl suspend
else
exit
fi
;;
$logout)
cdialog
if [[ "$?" == 0 ]]; then
kill -9 -1
else
exit
fi
;;
esac
}
if [[ ! $(pidof wofi) ]]; then
open_menu
else
pkill wofi
fi
+4 -28
View File
@@ -5,7 +5,7 @@
iDIR="$HOME/.config/hypr/mako/icons"
time=$(date +%Y-%m-%d-%H-%M-%S)
dir="$(xdg-user-dir PICTURES)/Screenshots"
dir="$(xdg-user-dir PICTURES)/Screenshots" # need
file="Screenshot_${time}_${RANDOM}.png"
# notify and view screenshot
@@ -20,32 +20,12 @@ notify_view () {
fi
}
# countdown
countdown () {
for sec in $(seq $1 -1 1); do
notify-send -h string:x-canonical-private-synchronous:shot-notify -t 1000 -i "$iDIR"/timer.png "Taking shot in : $sec"
sleep 1
done
}
# take shots
shotnow () {
cd ${dir} && grim - | tee "$file" | wl-copy
notify_view
}
shot5 () {
countdown '5'
sleep 1 && cd ${dir} && grim - | tee "$file" | wl-copy
notify_view
}
shot10 () {
countdown '10'
sleep 1 && cd ${dir} && grim - | tee "$file" | wl-copy
notify_view
}
shotwin () {
w_pos=$(hyprctl activewindow | grep 'at:' | cut -d':' -f2 | tr -d ' ' | tail -n1)
w_size=$(hyprctl activewindow | grep 'size:' | cut -d':' -f2 | tr -d ' ' | tail -n1 | sed s/,/x/g)
@@ -64,16 +44,12 @@ fi
if [[ "$1" == "--now" ]]; then
shotnow
elif [[ "$1" == "--in5" ]]; then
shot5
elif [[ "$1" == "--in10" ]]; then
shot10
elif [[ "$1" == "--win" ]]; then
shotwin
elif [[ "$1" == "--area" ]]; then
shotarea
elif [[ "$1" == "--win" ]]; then
shotwin
else
echo -e "Available Options : --now --in5 --in10 --win --area"
echo -e "Available Options : --now --win --area"
fi
exit 0
-16
View File
@@ -1,16 +0,0 @@
#!/usr/bin/env bash
## launch terminal with alt config
CONFIG="$HOME/.config/hypr/foot/foot.ini"
if [ "$1" == "-f" ]; then
foot --app-id='foot-float' --config="$CONFIG"
elif [ "$1" == "-F" ]; then
foot --fullscreen --app-id='foot-full' --font="Iosevka Nerd Font:size=14" --override=pad=35x35 --config="$CONFIG"
elif [ "$1" == "-s" ]; then
foot --app-id='foot-float' --config="$CONFIG" \
--window-size-pixels=$(slurp -b 1B1F28CC -c E06B74ff -s C778DD0D -w 2 -f "%wx%h")
else
foot --config="$CONFIG"
fi
+120
View File
@@ -0,0 +1,120 @@
#!/usr/bin/env python
import subprocess
from pyquery import PyQuery # install using `pip install pyquery`
import json
# weather icons
weather_icons = {
"sunnyDay": "滛",
"clearNight": "望",
"cloudyFoggyDay": "",
"cloudyFoggyNight": "",
"rainyDay": "",
"rainyNight": "",
"snowyIcyDay": "",
"snowyIcyNight": "",
"severe": "",
"default": "",
}
# get location_id
# to get your own location_id, go to https://weather.com & search your location.
# once you choose your location, you can see the location_id in the URL(64 chars long hex string)
# Shenzen, Guangdong's location id: https://weather.com/en-IN/weather/today/l/7a4684e0789c881e79935986f2e9e5ab05b0104ac4310fd8818006dfb66092c3
location_id = "7a4684e0789c881e79935986f2e9e5ab05b0104ac4310fd8818006dfb66092c3"
# get html page
url = "https://weather.com/en-IN/weather/today/l/" + location_id
html_data = PyQuery(url=url)
# current temperature
temp = html_data("span[data-testid='TemperatureValue']").eq(0).text()
# print(temp)
# current status phrase
status = html_data("div[data-testid='wxPhrase']").text()
status = f"{status[:16]}.." if len(status) > 17 else status
# print(status)
# status code
status_code = html_data("#regionHeader").attr("class").split(" ")[2].split("-")[2]
# print(status_code)
# status icon
icon = (
weather_icons[status_code]
if status_code in weather_icons
else weather_icons["default"]
)
# print(icon)
# temperature feels like
temp_feel = html_data(
"div[data-testid='FeelsLikeSection'] > span[data-testid='TemperatureValue']"
).text()
temp_feel_text = f"Feels like {temp_feel}c"
# print(temp_feel_text)
# min-max temperature
temp_min = (
html_data("div[data-testid='wxData'] > span[data-testid='TemperatureValue']")
.eq(0)
.text()
)
temp_max = (
html_data("div[data-testid='wxData'] > span[data-testid='TemperatureValue']")
.eq(1)
.text()
)
temp_min_max = f" {temp_min}\t\t {temp_max}"
# print(temp_min_max)
# wind speed
wind_speed = html_data("span[data-testid='Wind']").text().split("\n")[1]
wind_text = f"煮 {wind_speed}"
# print(wind_text)
# humidity
humidity = html_data("span[data-testid='PercentageValue']").text()
humidity_text = f" {humidity}"
# print(humidity_text)
# visibility
visbility = html_data("span[data-testid='VisibilityValue']").text()
visbility_text = f" {visbility}"
# print(visbility_text)
# air quality index
air_quality_index = html_data("text[data-testid='DonutChartValue']").text()
# print(air_quality_index)
# hourly rain prediction
prediction = html_data("section[aria-label='Hourly Forecast']")(
"div[data-testid='SegmentPrecipPercentage'] > span"
).text()
prediction = prediction.replace("Chance of Rain", "")
prediction = f"\n\n  (hourly) {prediction}" if len(prediction) > 0 else prediction
# print(prediction)
# tooltip text
tooltip_text = str.format(
"\t\t{}\t\t\n{}\n{}\n{}\n\n{}\n{}\n{}{}",
f'<span size="xx-large">{temp}</span>',
f"<big>{icon}</big>",
f"<big>{status}</big>",
f"<small>{temp_feel_text}</small>",
f"<big>{temp_min_max}</big>",
f"{wind_text}\t{humidity_text}",
f"{visbility_text}\tAQI {air_quality_index}",
f"<i>{prediction}</i>",
)
# print waybar module data
out_data = {
"text": f"{icon} {temp}",
"alt": status,
"tooltip": tooltip_text,
"class": status_code,
}
print(json.dumps(out_data))
@@ -1,79 +0,0 @@
#!/usr/bin/env bash
cachedir=~/.cache/rbn
cachefile=${0##*/}-$1
if [ ! -d $cachedir ]; then
mkdir -p $cachedir
fi
if [ ! -f $cachedir/$cachefile ]; then
touch $cachedir/$cachefile
fi
# Save current IFS
SAVEIFS=$IFS
# Change IFS to new line.
IFS=$'\n'
cacheage=$(($(date +%s) - $(stat -c '%Y' "$cachedir/$cachefile")))
if [ $cacheage -gt 1740 ] || [ ! -s $cachedir/$cachefile ]; then
data=($(curl -s https://en.wttr.in/$1\?0qnT 2>&1))
echo ${data[0]} | cut -f1 -d, > $cachedir/$cachefile
echo ${data[1]} | sed -E 's/^.{15}//' >> $cachedir/$cachefile
echo ${data[2]} | sed -E 's/^.{15}//' >> $cachedir/$cachefile
fi
weather=($(cat $cachedir/$cachefile))
# Restore IFSClear
IFS=$SAVEIFS
temperature=$(echo ${weather[2]} | sed -E 's/([[:digit:]])+\.\./\1 to /g')
#echo ${weather[1]##*,}
# https://fontawesome.com/icons?s=solid&c=weather
case $(echo ${weather[1]##*,} | tr '[:upper:]' '[:lower:]') in
"clear" | "sunny")
condition=""
;;
"partly cloudy")
condition="杖"
;;
"cloudy")
condition=""
;;
"overcast")
condition=""
;;
"mist" | "fog" | "freezing fog")
condition=""
;;
"patchy rain possible" | "patchy light drizzle" | "light drizzle" | "patchy light rain" | "light rain" | "light rain shower" | "rain")
condition=""
;;
"moderate rain at times" | "moderate rain" | "heavy rain at times" | "heavy rain" | "moderate or heavy rain shower" | "torrential rain shower" | "rain shower")
condition=""
;;
"patchy snow possible" | "patchy sleet possible" | "patchy freezing drizzle possible" | "freezing drizzle" | "heavy freezing drizzle" | "light freezing rain" | "moderate or heavy freezing rain" | "light sleet" | "ice pellets" | "light sleet showers" | "moderate or heavy sleet showers")
condition="ﭽ"
;;
"blowing snow" | "moderate or heavy sleet" | "patchy light snow" | "light snow" | "light snow showers")
condition="流"
;;
"blizzard" | "patchy moderate snow" | "moderate snow" | "patchy heavy snow" | "heavy snow" | "moderate or heavy snow with thunder" | "moderate or heavy snow showers")
condition="ﰕ"
;;
"thundery outbreaks possible" | "patchy light rain with thunder" | "moderate or heavy rain with thunder" | "patchy light snow with thunder")
condition=""
;;
*)
condition=""
echo -e "{\"text\":\""$condition"\", \"alt\":\""${weather[0]}"\", \"tooltip\":\""${weather[0]}: $temperature ${weather[1]}"\"}"
;;
esac
#echo $temp $condition
echo -e "{\"text\":\""$temperature $condition"\", \"alt\":\""${weather[0]}"\", \"tooltip\":\""${weather[0]}: $temperature ${weather[1]}"\"}"
+4 -5
View File
@@ -7,11 +7,10 @@ STYLE="$HOME/.config/hypr/wlogout/style.css"
if [[ ! $(pidof wlogout) ]]; then
wlogout --layout ${LAYOUT} --css ${STYLE} \
--buttons-per-row 5 \
--column-spacing 50 \
--row-spacing 50 \
--margin-top 390 \
--margin-bottom 390 \
--column-spacing 20 \
--row-spacing 20 \
--margin-top 200 \
--margin-bottom 200 \
--margin-left 150 \
--margin-right 150
else