Last active
June 21, 2024 17:38
-
-
Save ashish-kus/dd562b0bf5e8488a09e0b9c289f4574c to your computer and use it in GitHub Desktop.
minimal Hyprlock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$hypr = ~/.config/hypr | |
source = $hypr/colors.conf # for custom color | |
# GENERAL | |
general { | |
no_fade_in = true | |
grace = 1 | |
disable_loading_bar = false | |
hide_cursor = true | |
ignore_empty_input = true | |
text_trim = true | |
} | |
#BACKGROUND | |
background { | |
monitor = | |
# path = ~/wallpaper.png | |
path = screenshot | |
blur_passes = 2 | |
contrast = 0.8916 | |
brightness = 0.7172 | |
vibrancy = 0.1696 | |
vibrancy_darkness = 0 | |
} | |
# TIME HR | |
label { | |
monitor = | |
text = cmd[update:1000] echo -e "$(date +"%H")" | |
color = rgba(255, 255, 255, 1) | |
shadow_pass = 2 | |
shadow_size = 3 | |
shadow_color = rgb(0,0,0) | |
shadow_boost = 1.2 | |
font_size = 150 | |
# font_family = JetBrains Mono Nerd Font Mono ExtraBold | |
font_family = AlfaSlabOne | |
position = 0, -250 | |
halign = center | |
valign = top | |
} | |
# TIME | |
label { | |
monitor = | |
text = cmd[update:1000] echo -e "$(date +"%M")" | |
# color = 0xff$color0 | |
color = rgba(255, 255, 255, 1) | |
font_size = 150 | |
# font_family = JetBrains Mono Nerd Font Mono ExtraBold | |
font_family = AlfaSlabOne | |
position = 0, -420 | |
halign = center | |
valign = top | |
} | |
# DATE | |
label { | |
monitor = | |
text = cmd[update:1000] echo -e "$(date +"%d %b %A")" | |
color = rgba(255, 255, 255, 1) | |
font_size = 14 | |
font_family = JetBrains Mono Nerd Font Mono ExtraBold | |
position = 0, -130 | |
halign = center | |
valign = center | |
} | |
# LOCATION & WEATHER | |
label { | |
monitor = | |
text = cmd[update:1000] echo "$(bash ~/.config/hypr/bin/location.sh) $(bash ~/.config/hypr/bin/weather.sh)" | |
color = rgba(255, 255, 255, 1) | |
font_size = 10 | |
font_family = JetBrains Mono Nerd Font Mono ExtraBold | |
position = 0, 465 | |
halign = center | |
valign = center | |
} | |
# Music | |
image { | |
monitor = | |
path = | |
size = 60 # lesser side if not 1:1 ratio | |
rounding = 5 # negative values mean circle | |
border_size = 0 | |
rotate = 0 # degrees, counter-clockwise | |
reload_time = 2 | |
reload_cmd = ~/.config/hypr/bin/playerctlock.sh --arturl | |
position = -150, -300 | |
halign = center | |
valign = center | |
opacity=0.5 | |
} | |
# PLAYER TITTLE | |
label { | |
monitor = | |
# text = cmd[update:1000] echo "$(playerctl metadata --format "{{ xesam:title }}" 2>/dev/null | cut -c1-25)" | |
text = cmd[update:1000] echo "$(~/.config/hypr/bin/playerctlock.sh --title)" | |
color = rgba(255, 255, 255, 0.8) | |
font_size = 12 | |
font_family = JetBrains Mono Nerd Font Mono ExtraBold | |
position = 880, -290 | |
halign = left | |
valign = center | |
} | |
# PLAYER Length | |
label { | |
monitor = | |
# text= cmd[update:1000] echo "$(( $(playerctl metadata --format "{{ mpris:length }}" 2>/dev/null) / 60000000 ))m" | |
text = cmd[update:1000] echo "$(~/.config/hypr/bin/playerctlock.sh --length) " | |
color = rgba(255, 255, 255, 1) | |
font_size = 11 | |
font_family = JetBrains Mono Nerd Font Mono | |
position = -730, -310 | |
halign = right | |
valign = center | |
} | |
# PLAYER STATUS | |
label { | |
monitor = | |
# text= cmd[update:1000] echo "$(( $(playerctl metadata --format "{{ mpris:length }}" 2>/dev/null) / 60000000 ))m" | |
text = cmd[update:1000] echo "$(~/.config/hypr/bin/playerctlock.sh --status)" | |
color = rgba(255, 255, 255, 1) | |
font_size = 14 | |
font_family = JetBrains Mono Nerd Font Mono | |
position = -740, -290 | |
halign = right | |
valign = center | |
} | |
# PLAYER SOURCE | |
label { | |
monitor = | |
# text= cmd[update:1000] echo "$(playerctl metadata --format "{{ mpris:trackid }}" 2>/dev/null | grep -Eo "chromium|firefox|spotify")" | |
text = cmd[update:1000] echo "$(~/.config/hypr/bin/playerctlock.sh --source)" | |
color = rgba(255, 255, 255, 0.6) | |
font_size = 10 | |
font_family = JetBrains Mono Nerd Font Mono | |
position = -740, -330 | |
halign = right | |
valign = center | |
} | |
# PLAYER ALBUM | |
label { | |
monitor = | |
# text= cmd[update:1000] echo "$(~/.config/hypr/bin/album.sh)" | |
text = cmd[update:1000] echo "$(~/.config/hypr/bin/playerctlock.sh --album)" | |
color = rgba(255, 255, 255, 1) | |
font_size = 10 | |
font_family = JetBrains Mono Nerd Font Mono | |
position = 880, -330 | |
halign = left | |
valign = center | |
} | |
# PLAYER Artist | |
label { | |
monitor = | |
# text = cmd[update:1000] echo "$(playerctl metadata --format "{{ xesam:artist }}" 2>/dev/null | cut -c1-30)" | |
text = cmd[update:1000] echo "$(~/.config/hypr/bin/playerctlock.sh --artist)" | |
color = rgba(255, 255, 255, 0.8) | |
font_size = 10 | |
font_family = JetBrains Mono Nerd Font Mono ExtraBold | |
position = 880, -310 | |
halign = left | |
valign = center | |
} | |
# INPUT FIELD | |
input-field { | |
monitor = | |
size = 250, 60 | |
outline_thickness = 0 | |
outer_color = rgba(0, 0, 0, 1) | |
dots_size = 0.1 # Scale of input-field height, 0.2 - 0.8 | |
dots_spacing = 1 # Scale of dots' absolute size, 0.0 - 1.0 | |
dots_center = true | |
inner_color = rgba(0, 0, 0, 1) | |
font_color = rgba(200, 200, 200, 1) | |
fade_on_empty = false | |
font_family = JetBrains Mono Nerd Font Mono | |
placeholder_text = <span foreground="##cdd6f4"> $USER</span> | |
hide_input = false | |
position = 0, -470 | |
halign = center | |
valign = center | |
zindex = 10 | |
} | |
# Information | |
label { | |
monitor = | |
text = cmd[update:1000] echo -e "$(~/.config/hypr/bin/infonlock.sh)" | |
color = rgba(255, 255, 255, 1) | |
font_size = 12 | |
font_family = JetBrains Mono Nerd Font Mono ExtraBold | |
position = -20, -510 | |
halign = right | |
valign = center | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Get the current battery percentage | |
battery_percentage=$(cat /sys/class/power_supply/BAT0/capacity) | |
# Get the battery status (Charging or Discharging) | |
battery_status=$(cat /sys/class/power_supply/BAT0/status) | |
# Define the battery icons for each 10% segment | |
battery_icons=("" "" "" "" "" "" "" "" "" "") | |
# Define the charging icon | |
charging_icon="" | |
# Calculate the index for the icon array | |
icon_index=$((battery_percentage / 10)) | |
# Get the corresponding icon | |
battery_icon=${battery_icons[icon_index]} | |
# Check if the battery is charging | |
if [ "$battery_status" = "Charging" ]; then | |
battery_icon="$charging_icon" | |
fi | |
# Output the battery percentage and icon | |
echo "$battery_percentage% $battery_icon" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -eq 0 ]; then | |
echo "Usage: $0 --title | --arturl | --artist | --length | --album | --source" | |
exit 1 | |
fi | |
# Function to get metadata using playerctl | |
get_metadata() { | |
key=$1 | |
playerctl metadata --format "{{ $key }}" 2>/dev/null | |
} | |
# Check for arguments | |
# Function to determine the source and return an icon and text | |
get_source_info() { | |
trackid=$(get_metadata "mpris:trackid") | |
if [[ "$trackid" == *"firefox"* ]]; then | |
echo -e "Firefox " | |
elif [[ "$trackid" == *"spotify"* ]]; then | |
echo -e "Spotify " | |
elif [[ "$trackid" == *"chromium"* ]]; then | |
echo -e "Chrome " | |
else | |
echo "" | |
fi | |
} | |
# Parse the argument | |
case "$1" in | |
--title) | |
title=$(get_metadata "xesam:title") | |
if [ -z "$title" ]; then | |
echo "" | |
else | |
echo "${title:0:28}" # Limit the output to 50 characters | |
fi | |
;; | |
--arturl) | |
url=$(get_metadata "mpris:artUrl") | |
if [ -z "$url" ]; then | |
echo "" | |
else | |
if [[ "$url" == file://* ]]; then | |
url=${url#file://} | |
fi | |
echo "$url" | |
fi | |
;; | |
--artist) | |
artist=$(get_metadata "xesam:artist") | |
if [ -z "$artist" ]; then | |
echo "" | |
else | |
echo "${artist:0:30}" # Limit the output to 50 characters | |
fi | |
;; | |
--length) | |
length=$(get_metadata "mpris:length") | |
if [ -z "$length" ]; then | |
echo "" | |
else | |
# Convert length from microseconds to a more readable format (seconds) | |
echo "$(echo "scale=2; $length / 1000000 / 60" | bc) m" | |
fi | |
;; | |
--status) | |
status=$(playerctl status 2>/dev/null) | |
if [[ $status == "Playing" ]]; then | |
echo "" | |
elif [[ $status == "Paused" ]]; then | |
echo "" | |
else | |
echo "" | |
fi | |
;; | |
--album) | |
album=$(playerctl metadata --format "{{ xesam:album }}" 2>/dev/null) | |
if [[ -n $album ]]; then | |
echo "$album" | |
else | |
status=$(playerctl status 2>/dev/null) | |
if [[ -n $status ]]; then | |
echo "Not album" | |
else | |
echo "" | |
fi | |
fi | |
;; | |
--source) | |
get_source_info | |
;; | |
*) | |
echo "Invalid option: $1" | |
echo "Usage: $0 --title | --url | --artist | --length | --album | --source" | |
exit 1 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment