mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-24 01:38:28 +02:00
refactor(home/linux/desktop): home/linux/desktop => home/linux/gui
This commit is contained in:
54
home/linux/gui/hyprland/conf/scripts/brightness
Executable file
54
home/linux/gui/hyprland/conf/scripts/brightness
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Script To Manage Brightness (in Wayland).
|
||||
|
||||
iDIR="$HOME/.config/hypr/mako/icons"
|
||||
|
||||
# Get brightness
|
||||
get_backlight() {
|
||||
LIGHT=$(printf "%.0f\n" $(light -G))
|
||||
echo "${LIGHT}%"
|
||||
}
|
||||
|
||||
# Get icons
|
||||
get_icon() {
|
||||
backlight="$(get_backlight)"
|
||||
current="${backlight%%%}"
|
||||
if [[ ("$current" -ge "0") && ("$current" -le "20") ]]; then
|
||||
icon="$iDIR/brightness-20.png"
|
||||
elif [[ ("$current" -ge "20") && ("$current" -le "40") ]]; then
|
||||
icon="$iDIR/brightness-40.png"
|
||||
elif [[ ("$current" -ge "40") && ("$current" -le "60") ]]; then
|
||||
icon="$iDIR/brightness-60.png"
|
||||
elif [[ ("$current" -ge "60") && ("$current" -le "80") ]]; then
|
||||
icon="$iDIR/brightness-80.png"
|
||||
elif [[ ("$current" -ge "80") && ("$current" -le "100") ]]; then
|
||||
icon="$iDIR/brightness-100.png"
|
||||
fi
|
||||
}
|
||||
|
||||
# Notify
|
||||
notify_user() {
|
||||
notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$icon" "Brightness : $(get_backlight)"
|
||||
}
|
||||
|
||||
# Increase brightness
|
||||
inc_backlight() {
|
||||
light -A 5 && get_icon && notify_user
|
||||
}
|
||||
|
||||
# Decrease brightness
|
||||
dec_backlight() {
|
||||
light -U 5 && get_icon && notify_user
|
||||
}
|
||||
|
||||
# Execute accordingly
|
||||
if [[ "$1" == "--get" ]]; then
|
||||
get_backlight
|
||||
elif [[ "$1" == "--inc" ]]; then
|
||||
inc_backlight
|
||||
elif [[ "$1" == "--dec" ]]; then
|
||||
dec_backlight
|
||||
else
|
||||
get_backlight
|
||||
fi
|
||||
20
home/linux/gui/hyprland/conf/scripts/colorpicker
Executable file
20
home/linux/gui/hyprland/conf/scripts/colorpicker
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Simple Script To Pick Color Quickly.
|
||||
|
||||
color=$(grim -g "$(slurp -b 1B1F2800 -p)" -t ppm - | convert - -format '%[pixel:p{0,0}]' txt:- | tail -n1 | cut -d' ' -f4)
|
||||
image=/tmp/${color}.png
|
||||
|
||||
main() {
|
||||
if [[ "$color" ]]; then
|
||||
# copy color code to clipboard
|
||||
echo $color | tr -d "\n" | wl-copy
|
||||
# generate preview
|
||||
convert -size 48x48 xc:"$color" ${image}
|
||||
# notify about it
|
||||
notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i ${image} "$color, copied to clipboard."
|
||||
fi
|
||||
}
|
||||
|
||||
# Run the script
|
||||
main
|
||||
10
home/linux/gui/hyprland/conf/scripts/lockscreen
Executable file
10
home/linux/gui/hyprland/conf/scripts/lockscreen
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# 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 %%
|
||||
7
home/linux/gui/hyprland/conf/scripts/menu
Executable file
7
home/linux/gui/hyprland/conf/scripts/menu
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [[ ! $(pidof anyrun) ]]; then
|
||||
anyrun
|
||||
else
|
||||
pkill anyrun
|
||||
fi
|
||||
9
home/linux/gui/hyprland/conf/scripts/notifications
Executable file
9
home/linux/gui/hyprland/conf/scripts/notifications
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## launch mako with alt config
|
||||
|
||||
CONFIG="$HOME/.config/hypr/mako/config"
|
||||
|
||||
if [[ ! $(pidof mako) ]]; then
|
||||
mako --config ${CONFIG}
|
||||
fi
|
||||
24
home/linux/gui/hyprland/conf/scripts/startup
Executable file
24
home/linux/gui/hyprland/conf/scripts/startup
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Autostart Programs
|
||||
|
||||
# Kill already running process
|
||||
_ps=(waybar mako mpd)
|
||||
for _prs in "${_ps[@]}"; do
|
||||
if [[ $(pidof ${_prs}) ]]; then
|
||||
killall -9 ${_prs}
|
||||
fi
|
||||
done
|
||||
|
||||
# Set wallpaper via a wallpaper.service
|
||||
# it will by start by home-manager automatically, do not need to restart it here.
|
||||
# systemctl --user restart wallpaper.service
|
||||
|
||||
# Lauch notification daemon (mako)
|
||||
~/.config/hypr/scripts/notifications &
|
||||
|
||||
# Lauch statusbar (waybar)
|
||||
~/.config/hypr/scripts/statusbar &
|
||||
|
||||
# Start mpd
|
||||
exec mpd &
|
||||
10
home/linux/gui/hyprland/conf/scripts/statusbar
Executable file
10
home/linux/gui/hyprland/conf/scripts/statusbar
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## launch waybar with alt config
|
||||
|
||||
CONFIG="$HOME/.config/hypr/waybar/config.jsonc"
|
||||
STYLE="$HOME/.config/hypr/waybar/style.css"
|
||||
|
||||
if [[ ! $(pidof waybar) ]]; then
|
||||
waybar --bar main-bar --log-level error --config ${CONFIG} --style ${STYLE}
|
||||
fi
|
||||
76
home/linux/gui/hyprland/conf/scripts/volume
Executable file
76
home/linux/gui/hyprland/conf/scripts/volume
Executable file
@@ -0,0 +1,76 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Script To Manage Speaker Volume(in Wayland).
|
||||
|
||||
iDIR="$HOME/.config/hypr/mako/icons"
|
||||
|
||||
# Get Volume
|
||||
get_volume() {
|
||||
volume=$(amixer get Master | tail -n1 | awk -F ' ' '{print $5}' | tr -d '[]')
|
||||
echo "$volume"
|
||||
}
|
||||
|
||||
# Get icons
|
||||
get_icon() {
|
||||
vol="$(get_volume)"
|
||||
current="${vol%%%}"
|
||||
if [[ "$current" -eq "0" ]]; then
|
||||
icon="$iDIR/volume-mute.png"
|
||||
elif [[ ("$current" -ge "0") && ("$current" -le "30") ]]; then
|
||||
icon="$iDIR/volume-low.png"
|
||||
elif [[ ("$current" -ge "30") && ("$current" -le "60") ]]; then
|
||||
icon="$iDIR/volume-mid.png"
|
||||
elif [[ ("$current" -ge "60") && ("$current" -le "100") ]]; then
|
||||
icon="$iDIR/volume-high.png"
|
||||
fi
|
||||
}
|
||||
|
||||
# Notify
|
||||
notify_user() {
|
||||
notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$icon" "Volume : $(get_volume)"
|
||||
}
|
||||
|
||||
# Increase Volume
|
||||
inc_volume() {
|
||||
amixer -Mq set Master,0 5%+ unmute && get_icon && notify_user
|
||||
}
|
||||
|
||||
# Decrease Volume
|
||||
dec_volume() {
|
||||
amixer -Mq set Master,0 5%- unmute && get_icon && notify_user
|
||||
}
|
||||
|
||||
# Toggle Mute
|
||||
toggle_mute() {
|
||||
amixer get Master | grep '\[on\]' &>/dev/null
|
||||
if [[ "$?" == 0 ]]; then
|
||||
amixer set Master toggle && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$iDIR/volume-mute.png" "Mute"
|
||||
else
|
||||
amixer set Master toggle && get_icon && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$icon" "Unmute"
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggle Mic
|
||||
toggle_mic() {
|
||||
amixer get Capture | grep '\[on\]' &>/dev/null
|
||||
if [[ "$?" == 0 ]]; then
|
||||
amixer -D pulse sset Capture toggle && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$iDIR/microphone-mute.png" "Microphone Switched OFF"
|
||||
else
|
||||
amixer -D pulse sset Capture toggle && get_icon && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$iDIR/microphone.png" "Microphone Switched ON"
|
||||
fi
|
||||
}
|
||||
|
||||
# Execute accordingly
|
||||
if [[ "$1" == "--get" ]]; then
|
||||
get_volume
|
||||
elif [[ "$1" == "--inc" ]]; then
|
||||
inc_volume
|
||||
elif [[ "$1" == "--dec" ]]; then
|
||||
dec_volume
|
||||
elif [[ "$1" == "--toggle" ]]; then
|
||||
toggle_mute
|
||||
elif [[ "$1" == "--toggle-mic" ]]; then
|
||||
toggle_mic
|
||||
else
|
||||
get_volume
|
||||
fi
|
||||
18
home/linux/gui/hyprland/conf/scripts/wlogout
Executable file
18
home/linux/gui/hyprland/conf/scripts/wlogout
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## wlogout with alt layout and style file
|
||||
|
||||
LAYOUT="$HOME/.config/hypr/wlogout/layout"
|
||||
STYLE="$HOME/.config/hypr/wlogout/style.css"
|
||||
|
||||
if [[ ! $(pidof wlogout) ]]; then
|
||||
wlogout --layout ${LAYOUT} --css ${STYLE} \
|
||||
--column-spacing 20 \
|
||||
--row-spacing 20 \
|
||||
--margin-top 200 \
|
||||
--margin-bottom 200 \
|
||||
--margin-left 150 \
|
||||
--margin-right 150
|
||||
else
|
||||
pkill wlogout
|
||||
fi
|
||||
Reference in New Issue
Block a user