first commit

This commit is contained in:
coolnsx
2022-11-09 16:00:53 +05:30
commit c625600e3d
35 changed files with 2913 additions and 0 deletions

317
hypr/bluetooth Executable file
View File

@@ -0,0 +1,317 @@
#!/usr/bin/env bash
# _ _ _ _ _ _
# __| |_ __ ___ ___ _ __ _ _ | |__ | |_ _ ___| |_ ___ ___ | |_ | |__
# / _` | '_ ` _ \ / _ \ '_ \| | | |_____| '_ \| | | | |/ _ \ __/ _ \ / _ \| __|| '_ \
# | (_| | | | | | | __/ | | | |_| |_____| |_) | | |_| | __/ || (_) | (_) | |_ | | | |
# \__,_|_| |_| |_|\___|_| |_|\__,_| |_.__/|_|\__,_|\___|\__\___/ \___/ \__||_| |_|
#
# Author: Nick Clyde (clydedroid)
# dmenu support by: Layerex
#
# A script that generates a dmenu menu that uses bluetoothctl to
# connect to bluetooth devices and display status info.
#
# Inspired by networkmanager-dmenu (https://github.com/firecat53/networkmanager-dmenu)
# Thanks to x70b1 (https://github.com/polybar/polybar-scripts/tree/master/polybar-scripts/system-bluetooth-bluetoothctl)
#
# Depends on:
# Arch repositories: dmenu, bluez-utils (contains bluetoothctl)
# Constants
divider="---------"
goback="Back"
# Checks if bluetooth controller is powered on
power_on() {
if bluetoothctl show | grep -F -q "Powered: yes"; then
return 0
else
return 1
fi
}
# Toggles power state
toggle_power() {
if power_on; then
bluetoothctl power off
show_menu
else
if rfkill list bluetooth | grep -F -q 'blocked: yes'; then
rfkill unblock bluetooth && sleep 3
fi
bluetoothctl power on
show_menu
fi
}
# Checks if controller is scanning for new devices
scan_on() {
if bluetoothctl show | grep -F -q "Discovering: yes"; then
echo "Scan: on"
return 0
else
echo "Scan: off"
return 1
fi
}
# Toggles scanning state
toggle_scan() {
if scan_on; then
kill "$(pgrep -F -f "bluetoothctl scan on")"
bluetoothctl scan off
show_menu
else
bluetoothctl scan on &
echo "Scanning..."
sleep 5
show_menu
fi
}
# Checks if controller is able to pair to devices
pairable_on() {
if bluetoothctl show | grep -F -q "Pairable: yes"; then
echo "Pairable: on"
return 0
else
echo "Pairable: off"
return 1
fi
}
# Toggles pairable state
toggle_pairable() {
if pairable_on; then
bluetoothctl pairable off
show_menu
else
bluetoothctl pairable on
show_menu
fi
}
# Checks if controller is discoverable by other devices
discoverable_on() {
if bluetoothctl show | grep -F -q "Discoverable: yes"; then
echo "Discoverable: on"
return 0
else
echo "Discoverable: off"
return 1
fi
}
# Toggles discoverable state
toggle_discoverable() {
if discoverable_on; then
bluetoothctl discoverable off
show_menu
else
bluetoothctl discoverable on
show_menu
fi
}
# Checks if a device is connected
device_connected() {
device_info=$(bluetoothctl info "$1")
if echo "$device_info" | grep -F -q "Connected: yes"; then
return 0
else
return 1
fi
}
# Toggles device connection
toggle_connection() {
if device_connected "$1"; then
bluetoothctl disconnect "$1"
# device_menu "$device"
else
bluetoothctl connect "$1"
# device_menu "$device"
fi
}
# Checks if a device is paired
device_paired() {
device_info=$(bluetoothctl info "$1")
if echo "$device_info" | grep -F -q "Paired: yes"; then
echo "Paired: yes"
return 0
else
echo "Paired: no"
return 1
fi
}
# Toggles device paired state
toggle_paired() {
if device_paired "$1"; then
bluetoothctl remove "$1"
device_menu "$device"
else
bluetoothctl pair "$1"
device_menu "$device"
fi
}
# Checks if a device is trusted
device_trusted() {
device_info=$(bluetoothctl info "$1")
if echo "$device_info" | grep -F -q "Trusted: yes"; then
echo "Trusted: yes"
return 0
else
echo "Trusted: no"
return 1
fi
}
# Toggles device connection
toggle_trust() {
if device_trusted "$1"; then
bluetoothctl untrust "$1"
device_menu "$device"
else
bluetoothctl trust "$1"
device_menu "$device"
fi
}
# Prints a short string with the current bluetooth status
# Useful for status bars like polybar, etc.
print_status() {
if power_on; then
printf ''
mapfile -t paired_devices < <(bluetoothctl paired-devices | grep -F Device | cut -d ' ' -f 2)
counter=0
for device in "${paired_devices[@]}"; do
if device_connected "$device"; then
device_alias="$(bluetoothctl info "$device" | grep -F "Alias" | cut -d ' ' -f 2-)"
if [ $counter -gt 0 ]; then
printf ", %s" "$device_alias"
else
printf " %s" "$device_alias"
fi
((counter++))
fi
done
printf "\n"
else
echo ""
fi
}
# A submenu for a specific device that allows connecting, pairing, and trusting
device_menu() {
device=$1
# Get device name and mac address
device_name="$(echo "$device" | cut -d ' ' -f 3-)"
mac="$(echo "$device" | cut -d ' ' -f 2)"
# Build options
if device_connected "$mac"; then
connected="Connected: yes"
else
connected="Connected: no"
fi
paired=$(device_paired "$mac")
trusted=$(device_trusted "$mac")
options="$connected\n$paired\n$trusted\n$divider\n$goback\nExit"
# Open dmenu menu, read chosen option
chosen="$(echo -e "$options" | run_dmenu "$device_name")"
# Match chosen option to command
case $chosen in
"" | "$divider")
echo "No option chosen."
;;
"$connected")
toggle_connection "$mac"
;;
"$paired")
toggle_paired "$mac"
;;
"$trusted")
toggle_trust "$mac"
;;
"$goback")
show_menu
;;
esac
}
# Opens a dmenu menu with current bluetooth status and options to connect
show_menu() {
# Get menu options
if power_on; then
power="Power: on"
# Human-readable names of devices, one per line
# If scan is off, will only list paired devices
devices=$(bluetoothctl devices | grep -F Device | cut -d ' ' -f 3-)
# Get controller flags
scan=$(scan_on)
pairable=$(pairable_on)
discoverable=$(discoverable_on)
# Options passed to dmenu
options="$devices\n$divider\n$power\n$scan\n$pairable\n$discoverable\nExit"
else
power="Power: off"
options="$power\nExit"
fi
# Open dmenu menu, read chosen option
chosen="$(echo -e "$options" | run_dmenu "Bluetooth")"
# Match chosen option to command
case $chosen in
"" | "$divider")
echo "No option chosen."
;;
"$power")
toggle_power
;;
"$scan")
toggle_scan
;;
"$discoverable")
toggle_discoverable
;;
"$pairable")
toggle_pairable
;;
*)
device=$(bluetoothctl devices | grep -F "$chosen")
# Open a submenu if a device is selected
if [[ $device ]]; then device_menu "$device"; fi
;;
esac
}
original_args=("$@")
# dmenu command to pipe into. Extra arguments to dmenu-bluetooth are passed through to dmenu. This
# allows the user to set fonts, sizes, colours, etc.
run_dmenu() {
bemenu "${original_args[@]}" --fn 'Roboto 16' -i -l 10 -c -W 0.4 -B 3 -p "$1"
}
case "$1" in
--status)
print_status
;;
*)
show_menu
;;
esac

6
hypr/date Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/sh
for i in $(seq 5);do
notify-send "$(date)" -r 3 -t 1200 &
sleep 1
done

185
hypr/hyprland.conf Normal file
View File

@@ -0,0 +1,185 @@
# This is an example Hyprland config file.
#
# Refer to the wiki for more information.
#
# Please note not all available settings / options are set here.
# For a full list, see the wiki
#
# See https://wiki.hyprland.org/Configuring/Monitors/
monitor=,preferred,auto,1,mirror,eDP-1
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
# Execute your favorite apps at launch
# exec-once = waybar & hyprpaper & firefox
# Source a file (multi-file configs)
# source = ~/.config/hypr/myColors.conf
# For all categories, see https://wiki.hyprland.org/Configuring/Variables/
input {
kb_layout = us
kb_variant =
kb_model =
kb_options =
kb_rules =
follow_mouse = 1
touchpad {
natural_scroll = yes
}
sensitivity = 0 # -1.0 - 1.0, 0 means no modification.
}
general {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
gaps_in = 2
gaps_out = 4
border_size = 3
col.active_border = rgba(1affffee)
col.inactive_border = rgba(595959aa)
layout = dwindle
}
decoration {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
rounding = 10
blur = no
drop_shadow = yes
shadow_range = 4
shadow_render_power = 3
col.shadow = rgba(1a1a1aee)
}
animations {
enabled = yes
# Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more
bezier = myBezier, 0.05, 0.9, 0.1, 1.05
animation = windows, 1, 7, myBezier
animation = windowsOut, 1, 7, default, popin 80%
animation = border, 1, 10, default
animation = fade, 1, 7, default
animation = workspaces, 1, 6, default
}
dwindle {
# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
preserve_split = yes # you probably want this
}
master {
# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
new_is_master = true
}
gestures {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
workspace_swipe = true
workspace_swipe_fingers = 3
}
# Example per-device config
# See https://wiki.hyprland.org/Configuring/Keywords/#executing for more
device:epic mouse V1 {
sensitivity = -0.5
}
# Example windowrule v1
# windowrule = float, ^(kitty)$
# Example windowrule v2
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
$mainMod = SUPER
# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
bind = $mainMod, W, killactive,
bind = $mainMod, M, fullscreen,
bind = $mainMod, F, togglefloating,
bind = $mainMod, P, pseudo, # dwindle
bind = $mainMod, J, togglesplit, # dwindle
# Move focus with mainMod + arrow keys
bind = $mainMod, left, movefocus, l
bind = $mainMod, right, movefocus, r
bind = $mainMod, up, movefocus, u
bind = $mainMod, down, movefocus, d
bind = SUPER,Tab,cyclenext,
bind = SUPER,Tab,bringactivetotop,
bind = ALT,Tab,cyclenext,
bind = ALT,Tab,bringactivetotop,
# Switch workspaces with mainMod + [0-9]
bind = $mainMod, 1, workspace, 1
bind = $mainMod, 2, workspace, 2
bind = $mainMod, 3, workspace, 3
bind = $mainMod, 4, workspace, 4
# Move active window to a workspace with mainMod + SHIFT + [0-9]
bind = $mainMod SHIFT, 1, movetoworkspace, 1
bind = $mainMod SHIFT, 2, movetoworkspace, 2
bind = $mainMod SHIFT, 3, movetoworkspace, 3
bind = $mainMod SHIFT, 4, movetoworkspace, 4
# Scroll through existing workspaces with mainMod + scroll
bind = $mainMod, mouse_down, workspace, e+1
bind = $mainMod, mouse_up, workspace, e-1
# Move/resize windows with mainMod + LMB/RMB and dragging
bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow
#applications shortcuts
bind = $mainMod, return, exec, foot
#bind = $mainMod, Q, exec, wofi --show drun
bind = $mainMod, Q, exec, dmenu_run_history
bind = $mainMod, A, exec, google-chrome-stable
bind = $mainMod, C, exec, code
bind = $mainMod, E, exec, pcmanfm
bind = $mainMod, B, exec, $HOME/repos_scripts/bkmark "add"
bind = $mainMod, I, exec, $HOME/repos_scripts/bkmark
bind = SUPERSHIFT, B, exec, $HOME/repos_scripts/bkmark "rm"
#bind = $mainMod, S, exec, skypeforlinux
bind = $mainMod, F11, exec, $HOME/.config/hypr/info
bind = $mainMod, F6, exec, $HOME/.config/hypr/bluetooth
bind = $mainMod, F1, exec, $HOME/.config/hypr/screenshot 'selclip'
bind = $mainMod, Print, exec, $HOME/.config/hypr/screenshot 'fullclip'
bind = $mainMod, F12, exec, $HOME/.config/hypr/date
bind = $mainMod, Delete, exec, $HOME/.config/hypr/workspace
#media keys
binde=, XF86AudioRaiseVolume, exec, pamixer -i 2 && $HOME/.config/hypr/volume
binde=$mainMod, F2, exec, pamixer -d 2 && $HOME/.config/hypr/volume #my XF86AudioLowerVolume doesn't work
binde=$mainMod, F9, exec, playerctl play-pause
binde=, XF86MonBrightnessDown, exec, light -U 5 && notify-send -h int:value:$(light -G | cut -d'.' -f1) "☀️ " -t 1000 -r 1
binde=, XF86MonBrightnessUp, exec, light -A 5 && notify-send -h int:value:$(light -G | cut -d'.' -f1) "☀️ " -t 1000 -r 1
#windows rules
windowrulev2=workspace 1,class:^(google-chrome)$
windowrulev2=workspace 2,class:^(foot)$
windowrulev2=workspace 3,class:^(Pcmanfm)$
windowrulev2=workspace 3,class:^(mpv)$
windowrulev2=workspace 3,class:^([c|C]ode)
windowrulev2=workspace 4,class:^(Skype)$
windowrulev2=workspace 4,class:^(pavucontrol)$
#startup applications
exec-once=dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
exec-once=dunst
exec-once=ssh-agent
exec-once=swaybg -i ~/wall/2.jpg
#exec-once=skypeforlinux
exec-once=google-chrome-stable 'https://web.skype.com/?openPstnPage=true'

BIN
hypr/hyprland.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

17
hypr/info Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/sh
i=1
while [ $i -le "5" ];do
mem=$(sed -nE 's_.*MemAvailable:[[:space:]]*(.*) kB_\1_p' /proc/meminfo)
mem=$(((7919488 - mem)/1000))
temp=$(cat /sys/class/thermal/thermal_zone0/temp)
temp=$((temp / 1000))
bat_stats=$(cat /sys/class/power_supply/BAT*/status)
vol_stats=$(pamixer --get-mute)
[ "$bat_stats" = "Discharging" ] && bat_icon=🔋 || bat_icon=🔌
[ "$vol_stats" = "true" ] && vol_icon=🔇 || vol_icon=🔊
notify-send "<------------(STATS)------------>" "🧠 CPU usage : $(top -ibn1 | sed -nE 's_%Cpu\(s\):(.*)us.*_\1_p' | cut -d' ' -f2-3) %\n🌡 Cpu Temp : $temp °C\n🔳 RAM : $mem MB / 7733 MB\n$bat_icon Battery : $(cat /sys/class/power_supply/BAT*/capacity) (${bat_stats})\n☀ Brightness : $(light -G | cut -d'.' -f1)%\n$vol_icon Volume : $(pamixer --get-volume-human)" -r 2 -t 1500 &
: $((i+=1))
sleep 1
done

10
hypr/power Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/sh
$HOME/.config/hypr/workspace &
case "$(printf "lock\\nsuspend\\nlogout\\nreboot\\npoweroff" | bemenu --fn 'Roboto 15' -i -c -W 0.6 -B 3 -l 5 -p "⏻ " -H 40)" in
#lock) $HOME/.config/bspwm/screenlock.sh ;;
suspend) systemctl suspend ;;
logout) systemctl logout ;;
reboot) systemctl reboot ;;
poweroff) systemctl poweroff ;;
esac

8
hypr/screenshot Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/sh
x="Screenshot copied to clipboard"
[ "$*" = "fullclip" ] && grim - | xclip -selection clipboard -t image/png
[ "$*" = "fullsave" ] && grim && x="Screenshot saved"
[ "$*" = "selclip" ] && grim -g "$(slurp)" - | xclip -selection clipboard -t image/png
notify-send "$x"

5
hypr/volume Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/sh
vol_icon=🔊
pamixer --get-mute | sh && vol_icon=🔇
notify-send -h int:value:$(pamixer --get-volume) "$vol_icon" -t 1000 -r 1

BIN
hypr/wall_2K.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
hypr/wall_4K.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
hypr/wall_8K.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

9
hypr/wifi Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/bash
if rfkill list wifi | grep -q 'yes$' ; then
doas rfkill unblock wifi
notify-send "wifi on" -r 1
else
doas rfkill block wifi
notify-send "wifi off" -r 1
fi

10
hypr/workspace Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/sh
if [ -z "$*" ];then
for i in $(seq 4);do
notify-send "$(hyprctl clients | sed -nE 's_.*class: ([^ ]*).*_\1_p;s_.*workspace: ([^ ]*).*_workspace \1 : _p' | sed 'N;s/\n/ /')" -r 3 -t 1200
sleep 1
done
else
socat - UNIX-CONNECT:/tmp/hypr/$(echo $HYPRLAND_INSTANCE_SIGNATURE)/.socket2.sock | while read line; do notify-send "$(printf "$line" | sed -nE 's_^(.*workspace)>>([^ ]*)_\1 \2_p')" -r 1 -t 700 2>/dev/null ;notify-send "$(printf "$line" | sed -nE 's_activewindow>>([^,]*).*_\1_p')" -r 2 -t 700 2>/dev/null; done
fi