initial commit
This commit is contained in:
25
bspwm/bspwm_resize.sh
Executable file
25
bspwm/bspwm_resize.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
[ "$#" -eq 3 ] || { echo "Needs exactly three arguments."; exit 1; }
|
||||
|
||||
motion="$1"
|
||||
direction="$2"
|
||||
size="$3"
|
||||
|
||||
if [ "$motion" = 'expand' ]; then
|
||||
# These expand the window's given side
|
||||
case "$direction" in
|
||||
north) bspc node -z top 0 -"$size" ;;
|
||||
east) bspc node -z right "$size" 0 ;;
|
||||
south) bspc node -z bottom 0 "$size" ;;
|
||||
west) bspc node -z left -"$size" 0 ;;
|
||||
esac
|
||||
else
|
||||
# These contract the window's given side
|
||||
case "$direction" in
|
||||
north) bspc node -z top 0 "$size" ;;
|
||||
east) bspc node -z right -"$size" 0 ;;
|
||||
south) bspc node -z bottom 0 -"$size" ;;
|
||||
west) bspc node -z left "$size" 0 ;;
|
||||
esac
|
||||
fi
|
||||
78
bspwm/bspwmrc
Executable file
78
bspwm/bspwmrc
Executable file
@@ -0,0 +1,78 @@
|
||||
#! /bin/sh
|
||||
|
||||
killall picom
|
||||
killall uim-xim
|
||||
killall uim-toolbar-gtk-systray
|
||||
killall eww
|
||||
exec ~/.screenlayout/dual.sh &
|
||||
pgrep -x sxhkd > /dev/null || sxhkd -m -1 &
|
||||
setxkbmap -layout "us,ru" -option "grp:caps_toggle" &
|
||||
|
||||
bspc monitor eDP-1 -d Browsing I II III IV Coding Zettlr Messengers Admin
|
||||
bspc monitor HDMI-1 -d V VI VII
|
||||
bspc config border_width 3
|
||||
bspc config window_gap 28
|
||||
if [[ -e /tmp/grayscale ]] then
|
||||
picom --window-shader-fg=/home/greg/.config/picom/picom.conf.glsl &
|
||||
nitrogen --set-auto "/home/greg/Pictures/Wallpapers/desert_grayscale.jpg"
|
||||
bspc config focused_border_color \#747474
|
||||
bspc config presel_feedback_color \#747474
|
||||
bspc config marked_border_color \#747474
|
||||
else
|
||||
picom &
|
||||
nitrogen --restore &
|
||||
bspc config focused_border_color \#027C9B
|
||||
bspc config presel_feedback_color \#027C9B
|
||||
bspc config marked_border_color \#027C9B
|
||||
bspc config automatic_scheme alternate
|
||||
fi
|
||||
|
||||
uim-xim &
|
||||
uim-toolbar-gtk-systray &
|
||||
xmousepasteblock &
|
||||
xsel -fin </dev/null &
|
||||
killall xbindkeys
|
||||
xbindkeys &
|
||||
bspc config split_ratio 0.5
|
||||
bspc config borderless_monocle true
|
||||
bspc config gapless_monocle true
|
||||
|
||||
#bspc config focus_follows_pointer true
|
||||
|
||||
# Discord is an ass
|
||||
bspc config ignore_ewmh_focus true
|
||||
|
||||
exec ~/.config/polybar/hack/launch.sh &
|
||||
exec ~/.config/bspwm/polyhide.sh &
|
||||
|
||||
bspc rule -a zenity state=floating
|
||||
bspc rule -a Gimp desktop='^8' state=floating follow=on
|
||||
bspc rule -a Kupfer.py focus=on
|
||||
bspc rule -a Screenkey manage=off
|
||||
bspc rule -a nitrogen state=floating sticky=on
|
||||
|
||||
bspc rule -a TelegramDesktop desktop='^8' follow=off
|
||||
bspc rule -a Element desktop='^8' follow=off
|
||||
bspc rule -a WebCord desktop='^8' follow=off
|
||||
bspc rule -a superProductivity desktop='^7' follow=off
|
||||
bspc rule -a steam desktop='^9' follow=off
|
||||
|
||||
bspc rule -a matplotlib state=floating
|
||||
bspc rule -a "kitty" rectangle=800x500+560+290
|
||||
bspc rule -a "Extract" state=floating
|
||||
|
||||
bspc config pointer_modifier mod4
|
||||
|
||||
# exec ~/.config/bspwm/marked.sh &
|
||||
|
||||
if [ ! -e /tmp/startup_completed ]; then
|
||||
|
||||
pactl set-sink-volume 0 0%
|
||||
telegram-desktop &
|
||||
# element-desktop &
|
||||
# webcord &
|
||||
nextcloud &
|
||||
superproductivity &
|
||||
sleep 0.25
|
||||
touch /tmp/startup_completed
|
||||
fi
|
||||
41
bspwm/bspwmrc.save
Executable file
41
bspwm/bspwmrc.save
Executable file
@@ -0,0 +1,41 @@
|
||||
#! /bin/sh
|
||||
|
||||
pgrep -x sxhkd > /dev/null || sxhkd &
|
||||
$HOME/.config/polybar/launch.sh --hack
|
||||
setxkbmap -layout "us,ru" -option "grp:alt_shift_toggle,grp:caps_toggle" &
|
||||
bspc monitor -d Browsing II III IV V VI Coding Zettlr Messengers Admin Gaming
|
||||
|
||||
bspc config border_width 2
|
||||
bspc config window_gap 12
|
||||
|
||||
bspc config split_ratio 0.52
|
||||
bspc config borderless_monocle true
|
||||
bspc config gapless_monocle true
|
||||
|
||||
# Discord is an ass
|
||||
bspc config ignore_ewmh_focus true
|
||||
|
||||
bspc rule -a Gimp desktop='^8' state=floating follow=on
|
||||
bspc rule -a Firefox desktop='^2'
|
||||
bspc rule -a mplayer2 state=floating
|
||||
bspc rule -a Kupfer.py focus=on
|
||||
bspc rule -a Screenkey manage=off
|
||||
|
||||
bspc rule -a TelegramDesktop desktop='^9' follow=off
|
||||
bspc rule -a Element desktop='^9' follow=off
|
||||
bspc rule -a WebCord desktop='^9' follow=off
|
||||
|
||||
bspc rule -a steam desktop='^11' state=floating
|
||||
~/.config/bspwm/games.sh
|
||||
bspc config pointer_modifier mod4
|
||||
|
||||
if [ ! -e /tmp/startup_completed ]; then
|
||||
bspc rule ...
|
||||
telegram-desktop &
|
||||
element-desktop &
|
||||
webcord &
|
||||
nextcloud &
|
||||
sleep 0.25
|
||||
bspc rule ...
|
||||
touch /tmp/startup_completed
|
||||
fi
|
||||
13
bspwm/capsindicator.sh
Executable file
13
bspwm/capsindicator.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get the current layout
|
||||
layout=$(setxkbmap -query | grep layout | awk '{print $2}')
|
||||
|
||||
# Check if the layout is Russian
|
||||
if [ "$layout" = "ru" ]; then
|
||||
# Turn on the Caps Lock indicator (you may need to adjust this command based on your system)
|
||||
xset led named "Caps Lock"
|
||||
else
|
||||
# Turn off the Caps Lock indicator
|
||||
xset -led named "Caps Lock"
|
||||
fi
|
||||
22
bspwm/cryfsunlock.sh
Executable file
22
bspwm/cryfsunlock.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
CRYFS_DIR="/home/greg/.cryfs/"
|
||||
CRYFS_MOUNT_DIR="/home/greg/cryfs/"
|
||||
|
||||
# Retrieve volume name with zenity
|
||||
VOLUME=$(zenity --entry --title="Unlock Cryfs" --text="Volume:")
|
||||
|
||||
# Retrieve password with zenity
|
||||
PASSWORD=$(zenity --password --title="Unlock Cryfs" --text="Volume password:")
|
||||
|
||||
# Unlock the volume
|
||||
cryfs "$CRYFS_DIR$VOLUME" $CRYFS_MOUNT_DIR$VOLUME <<< $PASSWORD
|
||||
|
||||
# If the unlock was successful, show a success message
|
||||
if [ $? -eq 0 ]; then
|
||||
notify-send "Unlock Cryfs" "Volume $VOLUME unlocked successfully"
|
||||
exit 0
|
||||
else
|
||||
notify-send "Unlock Cryfs" "Failed to unlock volume $VOLUME"
|
||||
exit 1
|
||||
fi
|
||||
8
bspwm/games.sh
Executable file
8
bspwm/games.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
steamlib=/games/SteamLibrary # path to your steamlibrary
|
||||
mygames=$(ls $steamlib/steamapps/appmanifest_*.acf | sed 's/[^0-9]*//g') # this sed command removes everything but the digits
|
||||
|
||||
for game in $mygames; do
|
||||
bspc rule -a steam_app_$game desktop=^11 state=fullscreen floating=on
|
||||
done
|
||||
10
bspwm/grayscale.sh
Executable file
10
bspwm/grayscale.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ -e "/tmp/grayscale" ]]; then
|
||||
rm /tmp/grayscale
|
||||
# nitrogen --save --set-auto "/home/greg/Pictures/Wallpapers/blue_rainy_leaves.jpg"
|
||||
else
|
||||
touch /tmp/grayscale
|
||||
# nitrogen --save --set-auto "/home/greg/Pictures/Wallpapers/berlin-tower-grayscale1.jpg"
|
||||
fi
|
||||
bspc wm -r
|
||||
1
bspwm/lockscreen.sh
Executable file
1
bspwm/lockscreen.sh
Executable file
@@ -0,0 +1 @@
|
||||
betterlockscreen --lock
|
||||
11
bspwm/margin.sh
Executable file
11
bspwm/margin.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ $( bspc config window_gap ) == 28 ]; then
|
||||
bspc config window_gap 4
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ $( bspc config window_gap ) == 4 ]; then
|
||||
bspc config window_gap 28
|
||||
exit
|
||||
fi
|
||||
19
bspwm/marked.sh
Executable file
19
bspwm/marked.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
while read -r line; do
|
||||
case "$line" in
|
||||
*'marked on')
|
||||
# Get all marked windows and set their border width
|
||||
for win in $(bspc query -N -n .marked); do
|
||||
bspc config -n "$win" border_width 10
|
||||
done
|
||||
;;
|
||||
*'marked off')
|
||||
# Set border width for all windows to 2
|
||||
for win in $(bspc query -N -n .marked); do
|
||||
bspc config -n "$win" border_width 2
|
||||
done
|
||||
;;
|
||||
esac
|
||||
done < <(bspc subscribe report node_flag)
|
||||
|
||||
7
bspwm/monocle_improved.sh
Executable file
7
bspwm/monocle_improved.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
for node_i in $(bspc query -N -n '.!focused.window' -d focused); do
|
||||
bspc node $node_i -g hidden;
|
||||
done
|
||||
|
||||
bspc desktop -l next
|
||||
14
bspwm/music.sh
Executable file
14
bspwm/music.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
bspc wm -h off
|
||||
kitty btop &
|
||||
sleep 0.5
|
||||
kitty cava &
|
||||
sleep 0.5
|
||||
|
||||
bspwm_resize contract north 250
|
||||
sleep 0.5
|
||||
bspwm_resize expand west 100
|
||||
|
||||
bspc node older -f
|
||||
bspc wm -h on
|
||||
|
||||
ncmpcpp
|
||||
17
bspwm/polyhide.sh
Executable file
17
bspwm/polyhide.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ $( bspc config top_padding ) == 36 ]; then
|
||||
polybar-msg cmd hide
|
||||
sleep .0
|
||||
bspc config top_padding 0
|
||||
bspc config bottom_padding 0
|
||||
bspc config left_padding 0
|
||||
bspc config right_padding 0
|
||||
else
|
||||
bspc config top_padding 36
|
||||
bspc config bottom_padding 9
|
||||
bspc config left_padding 11
|
||||
bspc config right_padding 11
|
||||
sleep .0
|
||||
polybar-msg cmd show
|
||||
fi
|
||||
9
bspwm/prevent_suspend.sh
Executable file
9
bspwm/prevent_suspend.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
# Check if xset q has "timeout" equal to 0 and if so, return 1
|
||||
if xset q | grep "timeout: 0" >/dev/null; then
|
||||
xset s 580 10
|
||||
echo "Suspend lock disabled"
|
||||
else
|
||||
xset s off
|
||||
echo "Suspend lock enabled"
|
||||
fi
|
||||
|
||||
17
bspwm/proxy.sh
Executable file
17
bspwm/proxy.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
TOGGLE_FILE="/tmp/toggle_ssocks"
|
||||
|
||||
if [ -f "$TOGGLE_FILE" ]; then
|
||||
echo "Enabling spoofdpi"
|
||||
killall sslocal
|
||||
http_proxy="" spoof-dpi -addr 127.0.0.1 -port 1080 &
|
||||
rm "$TOGGLE_FILE"
|
||||
|
||||
else
|
||||
echo "Enabling shadowsocks"
|
||||
killall spoof-dpi
|
||||
http_proxy="" sslocal -c /etc/shadowsocks-rust/mega.json &
|
||||
touch "$TOGGLE_FILE"
|
||||
|
||||
fi
|
||||
22
bspwm/ptt.sh
Executable file
22
bspwm/ptt.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Replace 'F12' with your configured push-to-talk key
|
||||
PUSH_TO_TALK_KEY="F7"
|
||||
|
||||
# Get the window ID of the Discord application
|
||||
DISCORD_WINDOW=$(xdotool search --onlyvisible --class "discord")
|
||||
|
||||
# Loop to keep the script running
|
||||
while true; do
|
||||
# Check if the Discord window is active
|
||||
if xdotool getactivewindow getwindowname | grep -q "Discord"; then
|
||||
# Check if the push-to-talk key is pressed
|
||||
if xinput --query-state "AT Translated Set 2 keyboard" | grep -q "key$$68$$=down"; then
|
||||
# Simulate key press
|
||||
xdotool keydown $PUSH_TO_TALK_KEY
|
||||
sleep 0.1 # Hold the key down for a short duration
|
||||
xdotool keyup $PUSH_TO_TALK_KEY
|
||||
fi
|
||||
fi
|
||||
sleep 0.1 # Check every 100ms
|
||||
done
|
||||
34
bspwm/set_window_size.sh
Executable file
34
bspwm/set_window_size.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
# Get current window size
|
||||
current_size=$(bspc query -T -n focused | jq -r '.rectangle.width, .rectangle.height')
|
||||
|
||||
#current_width=$(echo $current_size | head -n 1)
|
||||
#current_height=$(echo $current_size | tail -n 1)
|
||||
current_width=$(echo "$current_size" | sed -n '1p')
|
||||
current_height=$(echo "$current_size" | sed -n '2p')
|
||||
|
||||
# Define target size
|
||||
target_width=$1
|
||||
target_height=$2
|
||||
|
||||
echo "Current size: $current_width x $current_height"
|
||||
|
||||
# Calculate dx and dy
|
||||
dx=$((target_width - current_width))
|
||||
dy=$((target_height - current_height))
|
||||
|
||||
# Resize the window horizontally
|
||||
if [ $dx -gt 0 ]; then
|
||||
handle="right"
|
||||
else
|
||||
handle="left"
|
||||
fi
|
||||
bspc node --resize $handle ${dx#-} 0 # Use absolute value for dx
|
||||
|
||||
# Resize the window vertically
|
||||
if [ $dy -gt 0 ]; then
|
||||
handle="bottom"
|
||||
else
|
||||
handle="top"
|
||||
fi
|
||||
bspc node --resize $handle 0 ${dy#-} # Use absolute value for dy
|
||||
|
||||
26
bspwm/shrink.sh
Executable file
26
bspwm/shrink.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ $( bspc config left_padding ) == 11 ]; then
|
||||
bspc config left_padding 100
|
||||
bspc config right_padding 100
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ $( bspc config left_padding ) == 100 ]; then
|
||||
bspc config left_padding 200
|
||||
bspc config right_padding 200
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ $( bspc config left_padding ) == 200 ]; then
|
||||
bspc config left_padding 300
|
||||
bspc config right_padding 300
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ $( bspc config left_padding ) == 300 ]; then
|
||||
bspc config left_padding 11
|
||||
bspc config right_padding 11
|
||||
exit
|
||||
fi
|
||||
|
||||
72
bspwm/sxseq.sh
Executable file
72
bspwm/sxseq.sh
Executable file
@@ -0,0 +1,72 @@
|
||||
#!/bin/bash
|
||||
|
||||
# # Variables
|
||||
# DB_PATH="/home/greg/Nextcloud2/Backups/keepass.kdbx"
|
||||
# ENTRY_NAME="logseq"
|
||||
# VAULT_LOCATION="/home/greg/.cryfs/logseq"
|
||||
# MOUNT_POINT="/home/greg/cryfs/logseq" # Change this to your CryFS mount point
|
||||
#
|
||||
# # Retrieve the password from the KeePassXC database
|
||||
# CREDENTIALS=$(keepassxc-cli show -s "$DB_PATH" "$ENTRY_NAME")
|
||||
# PASSWORD=$(echo "$CREDENTIALS" | grep 'Password:' | cut -d ' ' -f 2)
|
||||
#
|
||||
# # Check if the password was retrieved successfully
|
||||
# if [ $? -ne 0 ]; then
|
||||
# echo "Failed to retrieve the password from the database."
|
||||
# exit 1
|
||||
# fi
|
||||
#
|
||||
# # Unlock the CryFS volume
|
||||
# cryfs "$VAULT_LOCATION" "$MOUNT_POINT" <<< "$PASSWORD"
|
||||
#
|
||||
# # Check if the CryFS command was successful
|
||||
# if [ $? -eq 0 ]; then
|
||||
# echo "CryFS volume unlocked successfully."
|
||||
# logseq
|
||||
# cryfs-unmount "$MOUNT_POINT"
|
||||
# else
|
||||
# echo "Failed to unlock the CryFS volume."
|
||||
# exit 1
|
||||
# fi
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
# Variables
|
||||
DB_PATH="/home/greg/Nextcloud2/Backups/keepass.kdbx"
|
||||
ENTRY_NAME="logseq"
|
||||
VAULT_LOCATION="/home/greg/.cryfs/logseq"
|
||||
MOUNT_POINT="/home/greg/cryfs/logseq" # Change this to your CryFS mount point
|
||||
|
||||
# Retrieve the password from the KeePassXC database using zenity
|
||||
KEEPASS_PASSWORD=$(zenity --password --title="Cumseq" --text="Enter the password for the KeePass database:")
|
||||
|
||||
# Check if the user canceled the dialog
|
||||
if [ $? -ne 0 ]; then
|
||||
notify-send "Password retrieval canceled."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CREDENTIALS=$(keepassxc-cli show -s "$DB_PATH" "$ENTRY_NAME" <<< "$KEEPASS_PASSWORD")
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
notify-send "KeePassXC error" "Was the master password correct?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PASSWORD=$(echo "$CREDENTIALS" | grep 'Password:' | cut -d ' ' -f 2)
|
||||
|
||||
# Unlock the CryFS volume
|
||||
cryfs "$VAULT_LOCATION" "$MOUNT_POINT" <<< "$PASSWORD"
|
||||
|
||||
# Check if the CryFS command was successful
|
||||
if [ $? -eq 0 ]; then
|
||||
notify-send "Success" "CryFS volume unlocked successfully."
|
||||
logseq
|
||||
cryfs-unmount "$MOUNT_POINT"
|
||||
noity-send "Loseq session finished" "CryFS volume will now be unmounted."
|
||||
exit 0
|
||||
else
|
||||
notify-send "Error" "Failed to unlock the CryFS volume."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
224
bspwm/toggle-monitor-grayscale.sh
Executable file
224
bspwm/toggle-monitor-grayscale.sh
Executable file
@@ -0,0 +1,224 @@
|
||||
#!/bin/bash
|
||||
|
||||
# should also work with compositor=compton, untested
|
||||
compositor=picom
|
||||
|
||||
function usage {
|
||||
|
||||
bin=$(basename $0)
|
||||
|
||||
echo
|
||||
echo "Toggle monitors between color and grayscale mode."
|
||||
echo
|
||||
echo "$bin [$compositor|nvidia|ddc|auto]"
|
||||
echo "$bin $compositor [$compositor args]"
|
||||
echo "$bin nvidia [nv mon]"
|
||||
echo "$bin ddc [ddc mon]"
|
||||
echo
|
||||
echo "$compositor: use a GLX shader to set grayscale"
|
||||
echo "nvidia: use NVIDIA proprietary driver Digital Vibrance setting to set grayscale"
|
||||
echo "ddc: use DDC/CI monitor protocol to set the monitor saturation to 0 (grayscale) if supported by monitor"
|
||||
echo "auto: use $compositor if running, otherwise nvidia if available, otherwise ddc if available"
|
||||
echo
|
||||
echo "$compositor args: in $compositor mode, optional $compositor parameters"
|
||||
echo
|
||||
echo "nv mon: in nvidia mode, an optional monitor name as enumerated by xrandr."
|
||||
echo " if unspecified, apply to all monitors managed by the NVIDIA driver"
|
||||
echo "ddc mon: in ddc mode, optional ddcutil options to identify the monitor. See 'man ddcutil'"
|
||||
echo " if unspecified, apply to the first monitor detected by ddcutil"
|
||||
echo "if invoked with no argument, auto is used."
|
||||
echo
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
function toggle_nvidia {
|
||||
|
||||
dpy=$1
|
||||
|
||||
value=$(nvidia-settings -t -q DigitalVibrance)
|
||||
|
||||
# set a value in ]-1024..0[ range to desaturate colors instead of full grayscale
|
||||
# -1024 => full grayscale
|
||||
desaturate_value=-1024
|
||||
|
||||
if (( value == $desaturate_value )); then
|
||||
value=0
|
||||
toggle_mode="color"
|
||||
else
|
||||
value=$desaturate_value
|
||||
toggle_mode="grayscale"
|
||||
fi
|
||||
|
||||
if [ -n "$dpy" ]; then
|
||||
param="[DPY:$dpy]/DigitalVibrance"
|
||||
else
|
||||
param="DigitalVibrance"
|
||||
fi
|
||||
|
||||
nvidia-settings -a ${param}=${value} > /dev/null
|
||||
}
|
||||
|
||||
function toggle_compositor {
|
||||
|
||||
|
||||
if $compositor --help | grep legacy-backends > /dev/null; then
|
||||
use_experimental_backends=1;
|
||||
grep_string="window-shader-fg"
|
||||
else
|
||||
use_experimental_backends=0;
|
||||
grep_string="glx-fshader-win"
|
||||
fi
|
||||
|
||||
if pgrep -a -x $compositor | grep $grep_string > /dev/null; then
|
||||
pkill -x $compositor
|
||||
sleep 1
|
||||
$compositor $* -b
|
||||
toggle_mode="color"
|
||||
else
|
||||
pkill -x $compositor
|
||||
sleep 1
|
||||
|
||||
if (( $use_experimental_backends == 1 )); then
|
||||
|
||||
tmpfile=$(mktemp)
|
||||
trap 'rm -f "${tmpfile}"' EXIT
|
||||
|
||||
cat > ${tmpfile} <<EOF
|
||||
#version 330
|
||||
in vec2 texcoord;
|
||||
|
||||
uniform sampler2D tex;
|
||||
uniform float opacity;
|
||||
|
||||
vec4 default_post_processing(vec4 c);
|
||||
|
||||
vec4 window_shader() {
|
||||
vec4 c = default_post_processing(texelFetch(tex, ivec2(texcoord), 0));
|
||||
float y = dot(c.rgb, vec3(0.2126, 0.7152, 0.0722));
|
||||
c = opacity*vec4(y, y, y, c.a);
|
||||
return c;
|
||||
}
|
||||
EOF
|
||||
|
||||
$compositor $* -b --backend glx --window-shader-fg ${tmpfile} 2> /dev/null
|
||||
|
||||
else
|
||||
|
||||
shader='uniform sampler2D tex; uniform float opacity; void main() { vec4 c = texture2D(tex, gl_TexCoord[0].xy); float y = dot(c.rgb, vec3(0.2126, 0.7152, 0.0722)); gl_FragColor = opacity*vec4(y, y, y, c.a); }'
|
||||
$compositor $* -b --backend glx --glx-fshader-win "${shader}" 2> /dev/null
|
||||
|
||||
fi
|
||||
|
||||
|
||||
toggle_mode="grayscale"
|
||||
fi
|
||||
}
|
||||
|
||||
function toggle_ddc {
|
||||
|
||||
out=($(ddcutil $* getvcp 8a -t))
|
||||
|
||||
if (( $? != 0 )); then
|
||||
echo "ddc: this monitor does not support saturation control"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# out array:
|
||||
#
|
||||
# VCP 8A C 100 200
|
||||
# | |
|
||||
# cur max
|
||||
|
||||
if (( ${#out[@]} != 5 )); then
|
||||
echo "ddc: unexpected output getting current saturation state"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cur_saturation=${out[3]}
|
||||
max_saturation=${out[4]}
|
||||
|
||||
# set a value in ]0..max/2[ range to desaturate colors instead of full grayscale
|
||||
# 0 => full grayscale
|
||||
desaturate_value=0
|
||||
|
||||
if (( cur_saturation == desaturate_value )); then
|
||||
new_saturation=$(( max_saturation / 2 )) # nominal saturation
|
||||
toggle_mode="color"
|
||||
else
|
||||
new_saturation=$desaturate_value
|
||||
toggle_mode="grayscale"
|
||||
fi
|
||||
|
||||
ddcutil $* setvcp 8a $new_saturation
|
||||
}
|
||||
|
||||
mode=$1
|
||||
|
||||
case $mode in
|
||||
|
||||
--help|-h)
|
||||
usage
|
||||
;;
|
||||
|
||||
$compositor)
|
||||
if ! pgrep -x $compositor > /dev/null; then
|
||||
echo "$compositor is not running"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
nvidia)
|
||||
if ! which nvidia-settings &> /dev/null; then
|
||||
echo "nvidia-settings is not installed"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
ddc)
|
||||
if ! which ddcutil &> /dev/null; then
|
||||
echo "ddcutil is not installed"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
[ -z "$mode" ] && mode=auto
|
||||
|
||||
if [ "$mode" = "auto" ]; then
|
||||
|
||||
if pgrep -x $compositor > /dev/null; then
|
||||
mode=$compositor
|
||||
elif which nvidia-settings &> /dev/null; then
|
||||
mode=nvidia
|
||||
elif which ddcutil &> /dev/null; then
|
||||
mode=ddc
|
||||
else
|
||||
echo "neither $compositor is running, nor nvidia-settings installed, nor ddcutil installed"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
usage
|
||||
fi
|
||||
|
||||
esac
|
||||
|
||||
# pass eventual remaining arguments to toggle_* function
|
||||
if (( $# > 0 )); then
|
||||
shift
|
||||
fi
|
||||
|
||||
if [ "$mode" = "nvidia" ]; then
|
||||
toggle_nvidia $*
|
||||
elif [ "$mode" = "$compositor" ]; then
|
||||
toggle_compositor $*
|
||||
else
|
||||
toggle_ddc $*
|
||||
fi
|
||||
|
||||
if (( $? == 0 )); then
|
||||
echo "$mode: set to $toggle_mode"
|
||||
else
|
||||
echo "$mode: toggle failed"
|
||||
fi
|
||||
|
||||
|
||||
8
bspwm/toggle-picom.sh
Executable file
8
bspwm/toggle-picom.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
pid=$(pgrep -x picom)
|
||||
if [ -z "$pid" ]; then
|
||||
picom -b
|
||||
else
|
||||
kill $pid
|
||||
fi
|
||||
7
bspwm/touchpad.sh
Executable file
7
bspwm/touchpad.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
i#!/bin/bash
|
||||
|
||||
if [ "$(xinput list-props 13 | grep "Device Enabled" | awk '{print $NF}')" -eq 0 ]; then
|
||||
xinput enable 13
|
||||
else
|
||||
xinput disable 13
|
||||
fi
|
||||
Reference in New Issue
Block a user