From 35368bee3c96c17f8eef3030c4bd8845cb96685d Mon Sep 17 00:00:00 2001 From: dqnid Date: Sun, 21 Jan 2024 20:31:10 +0100 Subject: [PATCH] new wayland system --- .focusState | 1 + Applets/monitor.sh | 58 +++++++++++++++++++++------------------- System/ajustaTouchpad.sh | 2 +- Tools/confirm.sh | 45 +++++++++++++++++++++++++++++++ Tools/free_ram.sh | 11 ++++++++ cowsay.sh | 16 +++++++++++ rofi/colors.rasi | 8 +++--- 7 files changed, 109 insertions(+), 32 deletions(-) create mode 100644 .focusState create mode 100755 Tools/confirm.sh create mode 100644 Tools/free_ram.sh create mode 100644 cowsay.sh diff --git a/.focusState b/.focusState new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.focusState @@ -0,0 +1 @@ +1 diff --git a/Applets/monitor.sh b/Applets/monitor.sh index 9209b58..ca2f69f 100755 --- a/Applets/monitor.sh +++ b/Applets/monitor.sh @@ -6,34 +6,38 @@ externo=HDMI-A-0 # ejecutar un solo randr con variables # modificar las variables en función de la entrada # igual renta sacar las opciones del propio xrandr usando awk y grep -if xrandr | grep "$externo connected"; then - eleccion="$(rofi -no-config -no-lazy-grab -sep "|" -dmenu -i -p 'System' -width 12 -line-padding 3 -lines 6 -theme /home/danih/Scripts/rofi/monitor.rasi <<< "Dual Side|Dual Top|Dual Side Vertical|Dual Side Low|Interna|Externa|Duplicar")" - case "$eleccion" in - "Dual Top") - xrandr --output "$interno" --auto --mode 1920x1080 --output "$externo" --auto --above "$interno" --output "$externo2" --off - ;; - "Dual Side") - xrandr --output HDMI-A-0 --primary --mode 1920x1080 --rate 60 --pos 1920x0 --rotate normal --output eDP --mode 1920x1080 --rate 60 --pos 0x600 --rotate normal - ;; - "Dual Side Low") - xrandr --output HDMI-A-0 --mode 1600x900 --pos 0x0 --rotate normal --output eDP --primary --mode 1920x1080 --rate 60 --pos 0x1080 --rotate normal - ;; - "Dual Side Vertical") - xrandr --output HDMI-A-0 --mode 1920x1080 --pos 0x0 --rotate right --output eDP --primary --mode 1920x1080 --pos 1080x1762 --rotate normal - ;; - Duplicar) - xrandr --output "$interno" --auto --output "$externo" --same-as "$interno" - ;; - Externa) +# + +lidstate="$(cat /proc/acpi/button/lid/LID0/state | awk '{print $2}')" + +if test $lidstate == "closed"; then xrandr --output "$interno" --auto --output "$externo" --auto --above "$interno" --output "$externo2" --off - xrandr --output "$externo" --mode 1920x1080 --rate 144 --output "$interno" --off - ;; - Interna) - xrandr --output "$externo" --off --output "$interno" --auto - ;; - esac -else - xrandr --output "$externo" --off --output "$externo2" --off --output "$interno" --auto + xrandr --output "$externo" --mode 1920x1080 --rate 120 --output "$interno" --off + elif xrandr | grep "$externo connected"; then + eleccion="$(rofi -no-config -no-lazy-grab -sep "|" -dmenu -i -p 'System' -width 12 -line-padding 3 -lines 6 -theme /home/danih/Scripts/rofi/monitor.rasi <<< "Externa|Dual Side|Dual Top|Interna|Duplicar")" + case "$eleccion" in + "Dual Top") + xrandr --output "$interno" --auto --mode 1920x1080 --output "$externo" --auto --above "$interno" --output "$externo2" --off + ;; + "Dual Side") + xrandr --output HDMI-A-0 --primary --mode 1920x1080 --rate 60 --pos 1920x0 --rotate normal --output eDP --mode 1920x1080 --rate 60 --pos 0x600 --rotate normal + ;; + "Dual Side Low") + xrandr --output HDMI-A-0 --mode 1600x900 --pos 0x0 --rotate normal --output eDP --primary --mode 1920x1080 --rate 60 --pos 0x1080 --rotate normal + ;; + Duplicar) + xrandr --output "$interno" --auto --output "$externo" --same-as "$interno" + ;; + Externa) + xrandr --output "$interno" --auto --output "$externo" --auto --above "$interno" --output "$externo2" --off + xrandr --output "$externo" --mode 1920x1080 --rate 144 --output "$interno" --off + ;; + Interna) + xrandr --output "$externo" --off --output "$interno" --auto + ;; + esac + else + xrandr --output "$externo" --off --output "$externo2" --off --output "$interno" --auto fi [[ "eleccion" = "" ]] && exit 1 i3 restart diff --git a/System/ajustaTouchpad.sh b/System/ajustaTouchpad.sh index 8f32c61..b914a33 100755 --- a/System/ajustaTouchpad.sh +++ b/System/ajustaTouchpad.sh @@ -7,7 +7,7 @@ scroll=$(xinput list-props $id | grep "Natural Scrolling Enabled (" | awk '{prin echo $id $tap $speed xinput set-prop $id $tap 1 -xinput set-prop $id $speed 0.4 +xinput set-prop $id $speed 0.12 xinput set-prop $id $scroll 1 unset id diff --git a/Tools/confirm.sh b/Tools/confirm.sh new file mode 100755 index 0000000..f132f1c --- /dev/null +++ b/Tools/confirm.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# +dir="~/.config/polybar/floating/scripts/rofi" + +confirm_exit() { + rofi -dmenu\ + -i\ + -no-fixed-num-lines\ + -p "Are You Sure? : "\ + -theme $dir/confirm.rasi +} + +msg() { + rofi -theme "$dir/message.rasi" -e "Available Options - yes / y / no / n" +} + + if test $# == 0; then + echo "./confirm logout|suspend|poweroff|reboot " + exit +fi + +ans=$(confirm_exit &) + if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then + case $1 in + "poweroff") + poweroff + ;; + "suspend") + systemctl suspend + ;; + "reboot") + reboot + ;; + "logout") + i3-msg exit + ;; + default) + echo "./confirm lock|suspend|poweroff|reboot " + ;; + esac + elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then +exit 0 + else + msg +fi diff --git a/Tools/free_ram.sh b/Tools/free_ram.sh new file mode 100644 index 0000000..ee6b9b4 --- /dev/null +++ b/Tools/free_ram.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Display the top applications of memory usage +# http://www.cyberciti.biz/faq/linux-check-memory-usage/#comment-51021 + +while read command percent rss; do + if [[ "${command}" != "COMMAND" ]]; then + rss="$(bc <<< "scale=2;${rss}/1024")" + fi + printf " %-26s%-8s%s\n" "${command}" "${percent}" "${rss} MB" \ + | sed 's/COMMAND/PROGRAM/' | sed 's/RSS MB/#MEM/' +done < <(ps -A --sort -rss -o comm,pmem,rss | head -n 20) diff --git a/cowsay.sh b/cowsay.sh new file mode 100644 index 0000000..2ccdf19 --- /dev/null +++ b/cowsay.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +conversation=() +# conversation=("Hola dinosaurio" "Hola señora vaca" "Estás muuuuuu guapo" "Tu si que estás guapa" "No, tu" "He dicho que tu" "Eso he dicho yo me cago en mis muertos te voy a comer!" "Te falta valor chaval tu a mi no me conoces!" "ñam!" "~muere~") + +for key in "${!conversation[@]}" +do + if test "$(($key % 2))" == "1"; then + python ~/Packages/dinosay/dinosay/dinosay.py -d para "${conversation[$key]}" + sleep 2 + else + cowsay "${conversation[$key]}" + sleep 2 + fi + clear +done diff --git a/rofi/colors.rasi b/rofi/colors.rasi index 87822ae..af93923 100644 --- a/rofi/colors.rasi +++ b/rofi/colors.rasi @@ -3,10 +3,10 @@ * { al: #00000000; - bg: #101010FF; - bga: #09090AA0; + bg: #101010BF; + bga: #09090ABA; fg: #f5f5f5FF; - ac: #2b3648FF; - se: #2b36485A; + ac: #58809aFF; + se: #58809a5A; font: "Terminus 12"; }