From 7c19cae6eba72168958e36f6fa28dc8515fcccac Mon Sep 17 00:00:00 2001 From: Ryan Date: Fri, 15 Dec 2023 13:57:38 +0800 Subject: [PATCH] Refractor --- .config/hypr/scripts/logout.sh | 4 +++- .config/qt5ct/dark.conf | 4 ++-- .config/qt5ct/light.conf | 4 ++-- .config/qt6ct/dark.conf | 4 ++-- .config/qt6ct/light.conf | 4 ++-- .config/sway/scripts/logout.sh | 27 +++++++++++++++++++++++---- .config/sway/scripts/themes.sh | 2 +- 7 files changed, 35 insertions(+), 14 deletions(-) diff --git a/.config/hypr/scripts/logout.sh b/.config/hypr/scripts/logout.sh index 8538b60..66b76bc 100755 --- a/.config/hypr/scripts/logout.sh +++ b/.config/hypr/scripts/logout.sh @@ -23,7 +23,9 @@ if test "$choice" = lock ; then bright=`light` swayidle -w \ - timeout 5 "light -S 1" resume "light -S $bright" & + timeout 5 "light -S 1" resume "light -S $bright" \ + timeout $sleep_time 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' \ + & idlepid=$! # swaylock -e -c 282828 --inside-color 00000003 diff --git a/.config/qt5ct/dark.conf b/.config/qt5ct/dark.conf index a379cb6..e10d7ab 100644 --- a/.config/qt5ct/dark.conf +++ b/.config/qt5ct/dark.conf @@ -6,8 +6,8 @@ standard_dialogs=gtk3 style=Adwaita-Dark [Fonts] -fixed=@Variant(\0\0\0@\0\0\0\x12\0N\0o\0t\0o\0 \0S\0\x61\0n\0s@(\0\0\0\0\0\0\xff\xff\xff\xff\x5\x1\0\x32\x10) -general=@Variant(\0\0\0@\0\0\0\x12\0N\0o\0t\0o\0 \0S\0\x61\0n\0s@(\0\0\0\0\0\0\xff\xff\xff\xff\x5\x1\0\x32\x10) +fixed=@Variant(\0\0\0@\0\0\0\x1a\0I\0\x42\0M\0 \0P\0l\0\x65\0x\0 \0M\0o\0n\0o@(\0\0\0\0\0\0\xff\xff\xff\xff\x5\x1\0\x32\x10) +general=@Variant(\0\0\0@\0\0\0\x1a\0I\0\x42\0M\0 \0P\0l\0\x65\0x\0 \0S\0\x61\0n\0s@(\0\0\0\0\0\0\xff\xff\xff\xff\x5\x1\0\x32\x10) [Interface] activate_item_on_single_click=1 diff --git a/.config/qt5ct/light.conf b/.config/qt5ct/light.conf index d7c18a8..3d02ce9 100644 --- a/.config/qt5ct/light.conf +++ b/.config/qt5ct/light.conf @@ -6,8 +6,8 @@ standard_dialogs=gtk3 style=Adwaita [Fonts] -fixed=@Variant(\0\0\0@\0\0\0\x12\0N\0o\0t\0o\0 \0S\0\x61\0n\0s@(\0\0\0\0\0\0\xff\xff\xff\xff\x5\x1\0\x32\x10) -general=@Variant(\0\0\0@\0\0\0\x12\0N\0o\0t\0o\0 \0S\0\x61\0n\0s@(\0\0\0\0\0\0\xff\xff\xff\xff\x5\x1\0\x32\x10) +fixed=@Variant(\0\0\0@\0\0\0\x1a\0I\0\x42\0M\0 \0P\0l\0\x65\0x\0 \0M\0o\0n\0o@(\0\0\0\0\0\0\xff\xff\xff\xff\x5\x1\0\x32\x10) +general=@Variant(\0\0\0@\0\0\0\x1a\0I\0\x42\0M\0 \0P\0l\0\x65\0x\0 \0S\0\x61\0n\0s@(\0\0\0\0\0\0\xff\xff\xff\xff\x5\x1\0\x32\x10) [Interface] activate_item_on_single_click=1 diff --git a/.config/qt6ct/dark.conf b/.config/qt6ct/dark.conf index b6e1593..0b500e0 100644 --- a/.config/qt6ct/dark.conf +++ b/.config/qt6ct/dark.conf @@ -6,8 +6,8 @@ standard_dialogs=gtk3 style=Adwaita-Dark [Fonts] -fixed="Noto Sans,12,-1,5,400,0,0,0,0,0,0,0,0,0,0,1" -general="Noto Sans,12,-1,5,400,0,0,0,0,0,0,0,0,0,0,1" +fixed="IBM Plex Mono,12,-1,5,400,0,0,0,0,0,0,0,0,0,0,1" +general="IBM Plex Sans,12,-1,5,400,0,0,0,0,0,0,0,0,0,0,1" [Interface] activate_item_on_single_click=1 diff --git a/.config/qt6ct/light.conf b/.config/qt6ct/light.conf index 0e33c58..1ce97ea 100644 --- a/.config/qt6ct/light.conf +++ b/.config/qt6ct/light.conf @@ -6,8 +6,8 @@ standard_dialogs=gtk3 style=Adwaita [Fonts] -fixed="Noto Sans,12,-1,5,400,0,0,0,0,0,0,0,0,0,0,1" -general="Noto Sans,12,-1,5,400,0,0,0,0,0,0,0,0,0,0,1" +fixed="IBM Plex Mono,12,-1,5,400,0,0,0,0,0,0,0,0,0,0,1" +general="IBM Plex Sans,12,-1,5,400,0,0,0,0,0,0,0,0,0,0,1" [Interface] activate_item_on_single_click=1 diff --git a/.config/sway/scripts/logout.sh b/.config/sway/scripts/logout.sh index e2fb54a..04db738 100755 --- a/.config/sway/scripts/logout.sh +++ b/.config/sway/scripts/logout.sh @@ -1,17 +1,36 @@ #!/bin/sh +# +# Modified from sway's locking script + + +if [[ ! $(which swayidle 2> /dev/null) ]]; then + notify-send "ERROR" "Swayidle not found" + exit 1 +fi + +choice=$(echo -e "suspend\nshutdown\npoweroff\nreboot\nlock" | wofi -d --prompt "󰚥 Choose power option" -Oalphabetical) + -choice=`echo -e "suspend\nshutdown\npoweroff\nreboot\nlock" | wofi -d --prompt "󰚥 Choose power option" -Oalphabetical` if test "$choice" = lock ; then + # sleep less when power on + if acpi -a | grep -q on; then + sleep_time=3600 + else + sleep_time=10 + fi + sleep 0.3 + bright=`light` + swayidle -w \ timeout 5 "light -S 1" resume "light -S $bright" \ - timeout 10 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \ + timeout $sleep_time 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \ & idlepid=$! swaylock -e -c 282828 --inside-color 00000003 kill $idlepid swaymsg "output * power on" light -S $bright -else - loginctl $choice +elif test -n "$choice"; then + systemctl $choice fi diff --git a/.config/sway/scripts/themes.sh b/.config/sway/scripts/themes.sh index bd3b292..90dbe5d 100755 --- a/.config/sway/scripts/themes.sh +++ b/.config/sway/scripts/themes.sh @@ -46,4 +46,4 @@ else ln -s ~/Pictures/wall/sway/dark ~/.config/sway/Wallpaper fi -sway reload +hyprctl reload