This commit is contained in:
Marco Thomas
2022-01-13 23:38:21 +01:00
parent fc02553f69
commit 61628a5400
20 changed files with 504 additions and 148 deletions

21
scripts/monitor.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/bash
mon=$1
if [ ${mon} == "dual" ]; then
notify-send -i /usr/share/icons/Papirus/48x48/devices/computer.svg "Screen update" "Switching to dual monitor..."
sleep 2
# set layout for dual monitor at home
xrandr --output eDP-1 --mode 2880x1800 --pos 4816x1474 --rotate normal --output DP-1 --off --output DP-2 --off --output DP-3 --primary --mode 3440x1440 --pos 0x0 --rotate normal --output DP-4 --off
# built in screen has higher dpi, so scale the bigger one
xrandr --output DP-3 --scale 1.4
elif [ ${mon} == "single" ]; then
notify-send -i /usr/share/icons/Papirus/48x48/devices/computer.svg "Screen update" "Switching to single monitor..."
sleep 2
# set layout for built in display
xrandr --output eDP-1 --mode 2880x1800 --pos 0x0 --rotate normal --output DP-1 --off --output DP-2 --off --output DP-3 --off --output DP-4 --off
fi
# reload wallpaper etc
$HOME/dots/scripts/reload_desktop.sh

View File

@@ -1,9 +1,13 @@
killall -q polybar
connected=$(xrandr --query | grep "DP-3" | grep " connected" | cut -d" " -f1)
if type "xrandr"; then
for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
echo $m
MON=$m polybar --reload bar &
# workaround to always show tray, when external mon is connected
if [ "$m" == "eDP-1" ] && [ "$connected" == "DP-3" ]; then
pos="none"
fi
MON=$m TRAYPOS=$pos polybar --reload bar &
pos=
done
else
polybar --reload bar &

View File

@@ -3,11 +3,11 @@
# SETTINGS {{{ ---
active_text_color="#5c6773"
active_text_color="#ffffff"
active_bg=
active_underline="#a6cc70"
inactive_text_color="#5c6773"
inactive_text_color="#ffffff"
inactive_bg=
inactive_underline=
@@ -167,14 +167,14 @@ generate_window_list() {
window_count=$(( window_count + 1 ))
continue
fi
# Show the user-selected window property
case "$show" in
"window_class") w_name="$cls" ;;
"window_classname") w_name="$cname" ;;
"window_title") w_name="$title" ;;
esac
# Use user-selected character case
case "$char_case" in
"lower") w_name=$(
@@ -232,7 +232,7 @@ generate_window_list() {
if [ "$window_count" = 0 ]; then
printf "%s" "$empty_desktop_message"
fi
# Print newline
echo ""
}

76
scripts/powermenu.sh Executable file
View File

@@ -0,0 +1,76 @@
#!/usr/bin/env bash
dir="$HOME/.config/rofi"
rofi_command="rofi -theme $dir/powermenu.rasi"
# Options
shutdown="Shutdown"
reboot="Reboot"
lock="Lock"
suspend="Suspend"
logout="Logout"
# Confirmation
confirm_exit() {
rofi -dmenu\
-i\
-no-fixed-num-lines\
-p "Are You Sure? : "\
-theme $dir/confirm.rasi
}
# Message
msg() {
rofi -theme "$dir/message.rasi" -e "Available Options - yes / y / no / n"
}
# Variable passed to rofi
options="$shutdown\n$reboot\n$lock\n$suspend\n$logout"
chosen="$(echo -e "$options" | $rofi_command -p "" -dmenu -selected-row 2)"
case $chosen in
$shutdown)
ans=$(confirm_exit &)
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
systemctl poweroff
elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
exit 0
else
msg
fi
;;
$reboot)
ans=$(confirm_exit &)
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
systemctl reboot
elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
exit 0
else
msg
fi
;;
$lock)
xlock -mode maze
;;
$suspend)
ans=$(confirm_exit &)
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
systemctl suspend
elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
exit 0
else
msg
fi
;;
$logout)
ans=$(confirm_exit &)
if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
i3-msg exit
elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
exit 0
else
msg
fi
;;
esac

18
scripts/reload_desktop.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/sh
# send notification
notify-send -i /usr/share/icons/Papirus/48x48/devices/computer-laptop.svg "Reload" "Reloading desktop..."
# bar
killall -q polybar
while pgrep -u $UID -x polybar > /dev/null; do sleep 1; done
$HOME/dots/scripts/polybar.sh
# wallpaper
feh --bg-fill $HOME/data/Seafile/images/wallpaper/wallpaper.png
# for some reason xmodmap and xset settings reset
source $HOME/.profile
# send notification
notify-send -i /usr/share/icons/Papirus/48x48/devices/computer-laptop.svg "Reload" "Reloaded desktop"