Completed with no bugs...

This commit is contained in:
coolnsx
2023-01-11 00:40:59 +05:30
parent 6911ed7350
commit 156118a04d
4 changed files with 18 additions and 10 deletions

View File

@@ -44,7 +44,7 @@
:monitor 0 :monitor 0
:geometry (geometry :x "50" :geometry (geometry :x "50"
:y "50" :y "50"
:width "20%" :width "30%"
:height "40px" :height "40px"
:anchor "bottom left") :anchor "bottom left")
:stacking "bg" :stacking "bg"

View File

@@ -36,10 +36,10 @@ case $1 in
echo cycle pause | socat - "/tmp/mpvsocket" echo cycle pause | socat - "/tmp/mpvsocket"
;; ;;
next) next)
/home/tanveer/repos_scripts/yt-music play_next pgrep -f mpvsocket >/dev/null 2>&1 && /home/tanveer/repos_scripts/yt-music play_next
;; ;;
prev) prev)
pgrep -f mpvsocket >/dev/null 2>&1 && $HOME/repos_scripts/yt-music play "$(sed 's| >|\t|g' $HOME/.cache/yt-music/prev | cut -d':' -f2)" pgrep -f mpvsocket >/dev/null 2>&1 && ($HOME/repos_scripts/yt-music play "$(sed 's| >|\t|g' $HOME/.cache/yt-music/prev | cut -d':' -f2)")
;; ;;
time) time)
out=$(echo '{"command" :["get_property" , "percent-pos"]}' | socat - /tmp/mpvsocket 2>/dev/null | sed -nE 's_.*data":([^,]*).*_\1_p') out=$(echo '{"command" :["get_property" , "percent-pos"]}' | socat - /tmp/mpvsocket 2>/dev/null | sed -nE 's_.*data":([^,]*).*_\1_p')

View File

@@ -104,6 +104,7 @@ bind = $mainMod, 1, workspace, 1
bind = $mainMod, 2, workspace, 2 bind = $mainMod, 2, workspace, 2
bind = $mainMod, 3, workspace, 3 bind = $mainMod, 3, workspace, 3
bind = $mainMod, 4, workspace, 4 bind = $mainMod, 4, workspace, 4
bind = $mainMod, 49,exec,hyprctl dispatch $(head -1 /tmp/workprev)
# Move active window to a workspace with mainMod + SHIFT + [0-9] # Move active window to a workspace with mainMod + SHIFT + [0-9]
bind = $mainMod SHIFT, 1, movetoworkspace, 1 bind = $mainMod SHIFT, 1, movetoworkspace, 1
@@ -169,7 +170,7 @@ windowrulev2=workspace 4,class:^(pavucontrol)$
exec-once=dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP exec-once=dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
exec-once=ssh-agent exec-once=ssh-agent
exec-once=swaybg -i ~/wall/9.png exec-once=swaybg -i ~/wall/9.png
exec-once=xrdb -merge ~/.config/.Xresources exec-once=xrdb -merge $HOME/.config/.Xresource
exec-once=$hypr_dir/workspace 'focus' exec-once=$hypr_dir/workspace 'focus'
exec-once=eww open-many music_0 time_0 exec-once=eww open-many music_0 time_0
exec-once=sleep 5 && $hypr_dir/workspace exec-once=sleep 5 && $hypr_dir/workspace

View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
setup_dual_monitor(){ setup_dual_monitor(){
sed -i "s/monitor=,1920x1080,0x0,1,mirror,eDP-1/monitor=,preferred,auto,1/g" $HOME/.config/hypr/hyprland.conf sed -i "s/monitor=,1920x1080,0x0,1,mirror,eDP-1/monitor=,preferred,auto,1/g" "$HOME/.config/hypr/hyprland.conf"
sleep 2 sleep 2
if hyprctl monitors | grep -q "HDMI-A-1";then if hyprctl monitors | grep -q "HDMI-A-1";then
notify-send "Setting up dual monitor workflow" notify-send "Setting up dual monitor workflow"
@@ -17,11 +17,12 @@ setup_dual_monitor(){
handle_it(){ handle_it(){
[ -z "$1" ] || notify-send "$1" [ -z "$1" ] || notify-send "$1"
choice=$(printf "Mirror\nExtend" | bemenu --fn 'Roboto 15' -i -c -W 0.2 -B 3 -l 20 -p "what to do??: " -m 1) choice=$(printf "Mirror\nExtend" | bemenu --fn 'Roboto 15' -i -c -W 0.2 -B 3 -l 20 -p "what to do??: " -m 1)
[ -z "$choice" ] && exit 0 || notify-send "${choice}ing screen" [ -z "$choice" ] && exit 0
notify-send "${choice}ing screen"
if [ "$choice" = "Extend" ];then if [ "$choice" = "Extend" ];then
setup_dual_monitor setup_dual_monitor
else else
sed -i "s/monitor=,preferred,auto,1/monitor=,1920x1080,0x0,1,mirror,eDP-1/g" $HOME/.config/hypr/hyprland.conf sed -i "s/monitor=,preferred,auto,1/monitor=,1920x1080,0x0,1,mirror,eDP-1/g" "$HOME/.config/hypr/hyprland.conf"
fi fi
} }
@@ -34,10 +35,16 @@ case $1 in
done ;; done ;;
focus) focus)
#shows the workspace number as notification whenever u switch workspaces and also handles the dual monitor setup on the fly(perfect for laptop users) #shows the workspace number as notification whenever u switch workspaces and also handles the dual monitor setup on the fly(perfect for laptop users)
socat - UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock | while read line;do socat - "UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" | while read -r line;do
printf "%s" "$line" | grep -q "monitoradded" && handle_it "$line" printf "%s" "$line" | grep -q "monitoradded" && handle_it "$line"
printf "%s" "$line" | grep -q "monitorremoved" && sed -i "s/monitor=,1920x1080,0x0,1,mirror,eDP-1/monitor=,preferred,auto,1/g" $HOME/.config/hypr/hyprland.conf && eww close music_1 time_1 printf "%s" "$line" | grep -q "monitorremoved" && sed -i "s/monitor=,1920x1080,0x0,1,mirror,eDP-1/monitor=,preferred,auto,1/g" "$HOME/.config/hypr/hyprland.conf" && eww close music_1 time_1
notify-send -i "lol" "$(printf "$line" | sed -nE 's_^(workspace)>>([^ ]*)_\1 \2_p')" -r 1 -t 700 2>/dev/null #recent workspace switcher
current=$(printf "%s" "$line" | sed -nE 's_^(workspace)>>([^ ]*)_\1 \2_p')
if [ -n "$current" ];then
cat /tmp/workcurr > /tmp/workprev
printf "%s" "$current" > /tmp/workcurr
fi
notify-send -i "lol" "$(printf "%s" "$line" | sed -nE 's_^(workspace)>>([^ ]*)_\1 \2_p')" -r 1 -t 700 2>/dev/null
done ;; done ;;
toggle) toggle)
#toggle between mirror and extend setup. this function should be keybinded #toggle between mirror and extend setup. this function should be keybinded