*
This commit is contained in:
cho
2024-01-27 15:42:16 +07:00
parent 0e6199ab8b
commit 9ceb9dbd33
47 changed files with 4633 additions and 267 deletions

51
home/default/.local/bin/dark.sh Executable file
View File

@ -0,0 +1,51 @@
#!/bin/sh
[ -z "$1" ] && printf "Usage: screenshot.sh [output|active|window] \n" && exit 0
dark() {
cp -f ~/.config/swaync/style.mocha.css ~/.config/swaync/style.css
setsid -f killall swaync >/dev/null 2>&1
sleep 2 && setsid -f swaync >/dev/null 2>&1
echo 'swaync set'
# TODO
cat ~/.config/foot/foot.ini >> ~/.config/foot/foot.ini
echo 'foot terminal set, reopen to change'
# TODO emacs
# TODO gtk
# TODO gtk flatpak
sudo flatpak override --env GTK_THEME=Materia-dark
# TODO browser
}
light() {
cp -f ~/.config/swaync/style.latte.css ~/.config/swaync/style.css
setsid -f killall swaync >/dev/null 2>&1
sleep 2 && setsid -f swaync >/dev/null 2>&1
echo 'swaync set'
# TODO
cat ~/.config/foot/foot.ini >> ~/.config/foot/foot.ini
echo 'foot terminal set, reopen to change'
# TODO emacs
# TODO gtk
# TODO gtk flatpak
sudo flatpak override --env GTK_THEME=Materia
# TODO browser
}
if [[ -n "$1" ]]; then
case "$1" in
dark) dark
*)
echo $@ is not an argument
break
;;
esac
fi

View File

@ -1,7 +0,0 @@
#!/bin/sh
if [ -z $1 ]
then
emacsclient -nw -c --alternate-editor='emacs -nw' .
else
emacsclient -nw -c --alternate-editor='emacs -nw' "$@"
fi

View File

@ -1,7 +0,0 @@
#!/bin/sh
if [ -z "$1" ]
then
setsid -f emacsclient . >/dev/null 2>&1 || setsid -f emacs . >/dev/null 2>&1
else
setsid -f emacsclient "$@" >/dev/null 2>&1 || setsid -f emacs "$@" >/dev/null 2>&1
fi

View File

@ -2,9 +2,12 @@
if [[ -z "$1" ]]; then
swayidle -w \
timeout 310 'swaylock' \
timeout 300 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
before-sleep "swaylock"
timeout 360 "wlopm --off '*'" resume "wlopm --on '*'" \
before-sleep "swaylock"
fi
#timeout 300 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
if [[ $1 == "-k" ]]; then
killall swayidle
exit 0

View File

@ -15,10 +15,10 @@ fi
case "$url" in
*mkv|*webm|*mp4|*hooktube.com*|*bitchute.com*|*videos.lukesmith.xyz*|*odysee.com*)
setsid -f mpv -quiet "$url" >/dev/null 2>&1 ;;
*youtube.com/watch*|*youtube.com/playlist*|*youtube.com/shorts*|*youtu.be*)
*youtube.com/watch*|*youtube.com/playlist*|*youtube.com/shorts*|*youtu.be*|*youtube-nocookie.com/embed*)
setsid -f flatpak run io.freetubeapp.FreeTube "$url" >/dev/null 2>&1 ;;
*png|*jpg|*jpe|*jpeg|*gif)
curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;;
*png|*jpg|*jpe|*jpeg|*gif|*webp|*PNG|*JPG|*JPE|*JPEG|*GIF|*WEBP)
curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && nsxiv -a "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;;
*pdf|*cbz|*cbr)
curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;;
*epub)

View File

@ -1,25 +1,34 @@
#!/bin/sh
# A dmenu wrapper script for system functions.
export WM=$XDG_CURRENT_DESKTOP
#export WM=$XDG_CURRENT_DESKTOP
if [ "$WINDOW_MANAGER" == "sway" ]; then WM="sway" ; fi
if [ "$WINDOW_MANAGER" == "river" ]; then WM="river" ; fi
case "$(readlink -f /sbin/init)" in
*systemd*) ctl='systemctl' ;;
*) ctl='loginctl' ;;
esac
#case "$(printf "🔒 lock\n🚪 leave $WM\n♻ renew $WM\n🐻 hibernate\n🔃 reboot\n🖥 shutdown\n💤 sleep\n📺 display off\n set background\n start idle\n kill swayidle\n fcitx5\n kill fcitx5\n start emacs daemon\n kill emacs daemon\n restart emacs daemon" | rofi -dmenu -i -l 16 -p 'action')" in
case "$(printf "🔒 lock\n🚪 leave $WM\n♻ renew $WM\n🐻 hibernate\n🔃 reboot\n🖥 shutdown\n💤 sleep\n📺 display off\n set background\n start idle\n kill swayidle\n fcitx5\n kill fcitx5\n start emacs daemon\n kill emacs daemon\n restart emacs daemon" | wofi -L 17 --cache-file=/dev/null --show=dmenu -i -p 'action')" in
case "$(printf "🔒 lock\n🚪 leave $WM\n♻ renew $WM\n🐻 hibernate\n🔃 reboot\n🖥 shutdown\n💤 sleep\n📺 display off\n set background\n start idle\n kill swayidle\n fcitx5\n kill fcitx5\n start emacs daemon\n kill emacs daemon\n restart emacs daemon\ntoggle sworkstyle" | wofi -L 17 --cache-file=/dev/null --show=dmenu -i -p 'action')" in
'🔒 lock')
setsid -f swaylock
setsid -f sleep 2 && swayidle -w timeout 1 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on" && kill $#'
setsid -f sleep 2 && swayidle -w timeout 1 'wlopm --off "*"' resume 'wlopm --on "*" && kill $#'
;;
"🚪 leave $WM")
if [ "$WINDOW_MANAGER" == "sway" ]; then swaymsg exit ; fi
if [ "$WINDOW_MANAGER" == "river" ]; then riverctl exit ; fi
;;
"♻️ renew $WM")
if [ "$WINDOW_MANAGER" == "sway" ]; then swaymsg reload ; fi
if [ "$WINDOW_MANAGER" == "river" ]; then $HOME/.config/river/init ; fi
;;
"🚪 leave $WM") swaymsg exit ;;
"♻️ renew $WM") swaymsg reload ;;
'🐻 hibernate') $ctl hibernate -i ;;
'💤 sleep') $ctl suspend -i ;;
'🔃 reboot') $ctl reboot -i ;;
'🖥️ shutdown') $ctl poweroff -i ;;
'📺 display off') swayidle -w timeout 1 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on" && kill $#' ;;
#'📺 display off') swayidle -w timeout 1 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on" && kill $#' ;;
'📺 display off') swayidle -w timeout 1 'wlopm --off "*"' resume 'wlopm --on "*" && kill $#' ;;
' set background') change-background ;;
' start idle') killall swayidle && sleep 1; setsid -f idle && notify-send 'idle started.';;
' kill swayidle') killall swayidle && notify-send 'idle killed.';;