Skip to content

Commit

Permalink
feat: misc update
Browse files Browse the repository at this point in the history
  • Loading branch information
aayushrathor committed Mar 31, 2024
1 parent 55d9f62 commit ed954a9
Show file tree
Hide file tree
Showing 10 changed files with 230 additions and 107 deletions.
6 changes: 4 additions & 2 deletions .scripts/scripts/batteryWarning
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/bash
#batteryWarning

export XDG_RUNTIME_DIR=/run/user/1000

battery_stat="$(acpi --battery)"
battery_greped_status="$(echo $battery_stat | grep -Pio 'remaining|charged')"
battery_percentage_v="$(echo $battery_stat | grep -Po '(\d+%)' | grep -Po '\d+')"
Expand All @@ -20,8 +22,8 @@ if [ "$battery_greped_status" == "remaining" ]; then
# Remind to disconnect charger if battery >=98%
elif [ "$battery_greped_status" == "charged" ]; then

if [ "$battery_percentage_v" -ge 95 ]; then
if [ "$battery_percentage_v" -ge 90 ]; then
dunstify -a system -i "/usr/share/icons/Papirus/48x48/status/battery-full-charged.svg" -t 9000 -r 9990 -u normal "Battery ${battery_percentage_v}%" "Disconnect Charger please."
aplay /home/aayush/downloads/battery_95.wav
aplay /home/aayush/Downloads/battery_95.wav
fi
fi
42 changes: 42 additions & 0 deletions .scripts/scripts/batterylog
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/sh

LOG_FILE="/home/aayush/battery.log"
BATTERY="BAT1"

get_battery_info() {
UEVENT=$(cat /sys/class/power_supply/$BATTERY/uevent)

for line in $UEVENT; do
case $line in
POWER_SUPPLY_STATUS=*)
STATUS=${line#*=}
;;
POWER_SUPPLY_CAPACITY=*)
CAPACITY=${line#*=}
;;
POWER_SUPPLY_VOLTAGE_NOW=*)
VOLTAGE=${line#*=}
;;
POWER_SUPPLY_CURRENT_NOW=*)
CURRENT=${line#*=}
;;
POWER_SUPPLY_CAPACITY_LEVEL=*)
CAPACITY_LEVEL=${line#*=}
;;
esac
done

if [ ! -e "/sys/class/power_supply/$BATTERY" ]; then
echo "Battery not found" >>$LOG_FILE
exit 1
fi

TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S")
echo "[${TIMESTAMP}] Status:${STATUS}, Capacity:${CAPACITY}%, Voltage:${VOLTAGE}mV, Current:${CURRENT}mA, CapacityLevel:${CAPACITY_LEVEL}" >>$LOG_FILE
}

if [ ! -e $LOG_FILE ]; then
touch $LOG_FILE
fi

get_battery_info
115 changes: 63 additions & 52 deletions .scripts/scripts/open
Original file line number Diff line number Diff line change
Expand Up @@ -7,70 +7,81 @@
# Inspired by https://github.com/mitchweaver/bin/blob/master/application/opn
#


# Fork process without any terminal output
launch() {
nohup "$@" >/dev/null 2>&1 &
exit
nohup "$@" >/dev/null 2>&1 &
exit
}

file_path="$@"

if [ -z "$file_path" ]; then
file_path=$(fzf --prompt "" --pointer "")
[ -z "$file_path" ] && exit
file_path=$(fzf --prompt "" --pointer "")
[ -z "$file_path" ] && exit
fi

file_ext=$(printf "%s" "${file_path##*.}" | tr "[:upper:]" "[:lower:]")

[ -d "$file_path" ] && launch thunar "$file_path"

case "$file_ext" in
mp4|mov|webm|gif|mkv|avi)
launch mpv "$file_path" ;;

jpg|jpeg|png)
launch feh "$file_path" ;;

otf|ttf|woff)
launch fontpreview "$file_path" ;;

mp3|flac|ogg|opus|wav)
launch mpv "$file_path" ;;

pdf|epub)
launch zathura "$file_path" ;;

docx|rtf|odt|ods|pptx|xlsx|csv)
launch libreoffice "$file_path" ;;

xcf)
launch gimp "$file_path" ;;

pcap)
launch wireshark "$file_path" ;;

svg)
launch google-chrome-stable "$file_path" ;;

html|htm|xhtml)
launch google-chrome-stable "$file_path" ;;

openshot|osp)
launch openshot-qt "$file_path" ;;

*)
# If the unknown file is a symlink then we need the actual path so that
# we can check if it a text file that can be opened using $EDITOR
if [[ $(file --mime-type $file_path 2>/dev/null) == *"/symlink"* ]]; then
file_path="$(readlink -f $file_path)"
fi

# This is kinda like a last resort. If the file is just a text file, then
# use the $EDITOR to open it
if [[ $(file --mime-type $file_path 2>/dev/null) == *"text/"* ]]; then
$EDITOR "$file_path"
else
echo "Not sure how to open $file_path"
fi
mp4 | mov | webm | gif | mkv | avi)
launch mpv "$file_path"
;;

jpg | jpeg | png)
launch viewnior "$file_path"
;;

otf | ttf | woff)
launch fontpreview "$file_path"
;;

mp3 | flac | ogg | opus | wav)
launch mpv "$file_path"
;;

pdf | epub)
launch zathura "$file_path"
;;

docx | rtf | odt | ods | pptx | xlsx | csv)
launch libreoffice "$file_path"
;;

xcf)
launch gimp "$file_path"
;;

pcap)
launch wireshark "$file_path"
;;

svg)
launch google-chrome-stable "$file_path"
;;

html | htm | xhtml)
launch google-chrome-stable "$file_path"
;;

openshot | osp)
launch openshot-qt "$file_path"
;;

*)
# If the unknown file is a symlink then we need the actual path so that
# we can check if it a text file that can be opened using $EDITOR
if [[ $(file --mime-type $file_path 2>/dev/null) == *"/symlink"* ]]; then
file_path="$(readlink -f $file_path)"
fi

# This is kinda like a last resort. If the file is just a text file, then
# use the $EDITOR to open it
if [[ $(file --mime-type $file_path 2>/dev/null) == *"text/"* ]]; then
$EDITOR "$file_path"
else
echo "Not sure how to open $file_path"
fi
;;
esac
2 changes: 1 addition & 1 deletion .scripts/scripts/ssmaim_grim
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

date=$(date +%Y%m%d_%H%M%S)
# path=$XDG_DESKTOP_DIR/screenshots/Screenshot_$date.png # script not working with sddm
path=/home/aayush/desktop/screenshots/Screenshot_$date.png
path=/home/aayush/Desktop/screenshots/Screenshot_$date.png
rootid=$(xwininfo -root -int | grep -iPo --color=never "(?<=id:\s)[0-9]*?\s")

if [[ "$1" == "--fullscreen" ]]; then
Expand Down
41 changes: 20 additions & 21 deletions configs/hypr/.config/hypr/hyprland.conf
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#-- Hyprland ------------------------------------------------------------
##
## ██╗░░██╗██╗░░░██╗██████╗░██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░
## ██║░░██║╚██╗░██╔╝██╔══██╗██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗
## ███████║░╚████╔╝░██████╔╝██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║
## ██╔══██║░░╚██╔╝░░██╔═══╝░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║
## ██║░░██║░░░██║░░░██║░░░░░██║░░██║███████╗██║░░██║██║░╚███║██████╔╝
## ╚═╝░░╚═╝░░░╚═╝░░░╚═╝░░░░░╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░
##
#########################################################################
#- Hyprland ------------------------------------------------------------
#
# ██╗░░██╗██╗░░░██╗██████╗░██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░
# ██║░░██║╚██╗░██╔╝██╔══██╗██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗
# ███████║░╚████╔╝░██████╔╝██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║
# ██╔══██║░░╚██╔╝░░██╔═══╝░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║
# ██║░░██║░░░██║░░░██║░░░░░██║░░██║███████╗██║░░██║██║░╚███║██████╔╝
# ╚═╝░░╚═╝░░░╚═╝░░░╚═╝░░░░░╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░
#
#-#######################################################################

env = QT_QPA_PLATFORMTHEME,qt6ct # QT_STYLE_OVERRIDE,kvantum
env = XDG_SESSION_TYPE,wayland
Expand Down Expand Up @@ -79,7 +79,7 @@ decoration {
shadow_render_power=2
col.shadow= 0x4D000000
col.shadow_inactive=0x4D000000
shadow_offset = [0 0]
# shadow_offset = [0 0]
shadow_scale = 1.0
dim_inactive = false
dim_strength = 0.2
Expand Down Expand Up @@ -263,7 +263,7 @@ windowrulev2 = float, class:(thunar)
windowrulev2 = size 1161 619, class:(thunar)
windowrulev2 = center, class:(thunar)

### File / Folder pickers
# File / Folder pickers
windowrulev2 = float, title:(.*Open Files.*)
windowrulev2 = size 60% 50%, title:(.*Open Files.*)
windowrulev2 = center, title:(.*Open Files.*)
Expand Down Expand Up @@ -479,12 +479,11 @@ bind = SHIFT, F8, exec, dunstctl close-all
# exec-once = swayidle -w timeout 1200 '~/.config/hypr/scripts/lockscreen' timeout 1200 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' before-sleep '~/.config/hypr/scripts/lockscreen'

#-- xwaylandvideobridge ----------------------------------------
# windowrulev2 = opacity 0.0 override 0.0 override,class:^(xwaylandvideobridge)$
# windowrulev2 = noanim,class:^(xwaylandvideobridge)$
# windowrulev2 = nofocus,class:^(xwaylandvideobridge)$
# windowrulev2 = noinitialfocus,class:^(xwaylandvideobridge)$
# windowrulev2 = pin, class:(xwaylandvideobridge)
# windowrulev2 = noborder, class:(xwaylandvideobridge)
windowrulev2 = opacity 0.0 override 0.0 override,class:^(xwaylandvideobridge)$
windowrulev2 = noanim,class:^(xwaylandvideobridge)$
windowrulev2 = noinitialfocus,class:^(xwaylandvideobridge)$
windowrulev2 = maxsize 1 1,class:^(xwaylandvideobridge)$
windowrulev2 = noblur,class:^(xwaylandvideobridge)$

#-- pyprland----------- ----------------------------------------
bind = SUPER SHIFT, Z, exec, pypr zoom
Expand Down Expand Up @@ -514,7 +513,7 @@ bind = SUPER,V,exec,pypr toggle volume

#-- Startup ----------------------------------------------------
exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
exec-once=/usr/lib/polkit-kde-authentication-agent-1
exec-once = dunst -config /home/aayush/.config/dunst/dunstrc
exec-once = udev-block-notify
exec-once = nm-applet --indicator
Expand All @@ -527,8 +526,8 @@ exec-once = kdeconnect-indicator
exec-once = blueman-applet
exec-once = pypr
exec-once = wlsunset -l 22.7 -L 75.8
# exec-once = xwaylandvideobridge
exec-once = /home/aayush/downloads/r-quick-share.AppImage
exec-once = xwaylandvideobridge
exec-once = thunar --daemon
exec-once = hyprctl notify -1 5000 "rgb(ff1ea3)" "AUTOSTART APPLICATION :)"

#-- Screen Sharing ---------------------------------------------
Expand Down
41 changes: 35 additions & 6 deletions configs/waybar/.config/waybar/config
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"memory",
"temperature",
"battery",
"custom/powermenu"
"group/power"
],
"hyprland/window": {
"format": "{}"
Expand Down Expand Up @@ -76,9 +76,9 @@
},
"network": {
"format": "{ifname}",
"format-wifi": " {bandwidthDownBytes} {bandwidthUpBytes}",
"format-wifi": " {bandwidthDownBytes} {bandwidthUpBytes}",
"format-alt": "󰀂 {ifname} 󰀑 {essid}",
"format-ethernet": "(eth) {bandwidthDownBytes} {bandwidthUpBytes}",
"format-ethernet": "(eth) {bandwidthDownBytes} {bandwidthUpBytes}",
"format-linked": " {ifname} (No IP)",
"format-disconnected": "睊 Disconnected",
"tooltip-format-wifi": " {essid} ({signalStrength}%)\nIP: {ipaddr}/{cidr}\nSignal Strength: {signalStrength}% | Down Speed: {bandwidthDownBytes}, Up Speed: {bandwidthUpBytes}",
Expand Down Expand Up @@ -154,9 +154,38 @@
"interval": 1
},
"custom/dunst": {
"exec": "~/.config/polybar/scripts/dunst-snooze.sh",
"interval": 1,
"on-click": "dunstctl set-paused toggle"
"return-type": "json",
"exec": "~/.config/waybar/scripts/dunst.sh",
"on-click": "dunstctl set-paused toggle",
"restart-interval": 1
},
"group/power": {
"orientation": "inherit",
"drawer": {
"transition-duration": 500,
"children-class": "not-power",
"transition-left-to-right": false
},
"modules": [
"custom/power",
"custom/lock",
"custom/reboot"
]
},
"custom/lock": {
"format": "󰍁",
"tooltip": false,
"on-click": "swaylock"
},
"custom/reboot": {
"format": "󰜉",
"tooltip": false,
"on-click": "reboot"
},
"custom/power": {
"format": "",
"tooltip": false,
"on-click": "shutdown now"
},
"custom/powermenu": {
"on-click": "~/.config/rofi/scripts/powermenu_t6",
Expand Down
14 changes: 11 additions & 3 deletions configs/waybar/.config/waybar/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,16 @@ window#waybar {
}

/* If workspaces is the leftmost module, omit left margin */
.modules-left > widget:first-child > #workspaces {
.modules-left>widget:first-child>#workspaces {
margin-left: 0;
}

/* If workspaces is the rightmost module, omit right margin */
.modules-right > widget:last-child > #workspaces {
.modules-right>widget:last-child>#workspaces {
margin-right: 0;
}

#custom-power,
#custom-powermenu,
#custom-media,
#custom-dunst,
Expand Down Expand Up @@ -139,11 +140,18 @@ window#waybar {
color: #24283b;
}

#custom-powermenu {
#custom-power {
color: #f7768e;
padding-right: 15px;
}

#custom-lock,
#custom-reboot,
#custom-power {
font-size: 16px;
padding: 0px 10px;
}

#backlight,
#memory {
color: #cba6f7;
Expand Down
Loading

0 comments on commit ed954a9

Please sign in to comment.