summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2023-10-09 17:42:22 +0100
committerdavidovski <david@davidovski.xyz>2023-10-09 17:42:22 +0100
commit02a4a3a4c1e6116158b807674709f26933ac5b10 (patch)
tree84f325f6e8ed2a6ccc618ebb358cea8f1faa95e9 /scripts
parent051ed527f64b0d7f400f76244b3d63a7ac98bb70 (diff)
Add desktop background
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/bg.sh4
-rwxr-xr-xscripts/calculator2
-rwxr-xr-xscripts/calendar2
-rwxr-xr-xscripts/cinema.sh2
-rwxr-xr-xscripts/ddc-switch-inputs2
-rwxr-xr-xscripts/gamma.sh4
-rwxr-xr-xscripts/powermenu2
-rwxr-xr-xscripts/primary-display.sh3
-rwxr-xr-xscripts/record_window.sh8
-rwxr-xr-xscripts/tablet5
-rwxr-xr-xscripts/toggle-mute.sh4
11 files changed, 25 insertions, 13 deletions
diff --git a/scripts/bg.sh b/scripts/bg.sh
index 34a1196..06793e9 100755
--- a/scripts/bg.sh
+++ b/scripts/bg.sh
@@ -1,4 +1,8 @@
#!/bin/sh
+
+feh --bg-fill ~/.config/bg.png
+exit
+
setbg="feh --force-aliasing --bg-tile "
image=~/.config/bg.gif
diff --git a/scripts/calculator b/scripts/calculator
index f092fd8..31998cc 100755
--- a/scripts/calculator
+++ b/scripts/calculator
@@ -1,2 +1,2 @@
#!/bin/sh
-bspc rule -a \* -o state=floating && $TERMINAL -e bc -liq
+bspc rule -a \* -o state=floating && $TERMINAL -e bc -l
diff --git a/scripts/calendar b/scripts/calendar
new file mode 100755
index 0000000..2836170
--- /dev/null
+++ b/scripts/calendar
@@ -0,0 +1,2 @@
+#!/bin/sh
+bspc rule -a \* -o state=floating && $TERMINAL -e sh -c "cal $(date +%Y); read"
diff --git a/scripts/cinema.sh b/scripts/cinema.sh
index 5352a6e..c0e2938 100755
--- a/scripts/cinema.sh
+++ b/scripts/cinema.sh
@@ -1,3 +1,3 @@
#!/bin/sh
-MAIN_DP=DP-1;
+MAIN_DP=$($HOME/.scripts/primary-display.sh);
v=$(xrandr --current --verbose | grep "Brightness" | cut -f2 -d " " | tr '\n' '*' | rev | cut -c 2- | rev | sed -e "s/$/==1/" | bc -l | grep -q 0 && echo 1 || echo 0); xrandr | grep " connected" | cut -f1 -d " " | while read -r line; do echo $line | grep -q $MAIN_DP && : || xrandr --output $line --brightness $v; done
diff --git a/scripts/ddc-switch-inputs b/scripts/ddc-switch-inputs
index 8f10c65..9bd3682 100755
--- a/scripts/ddc-switch-inputs
+++ b/scripts/ddc-switch-inputs
@@ -15,5 +15,5 @@ case $1 in
;;
esac
-ddcutil --bus=13 setvcp 60 ${OUT[0]} &
+ddcutil --bus=12 setvcp 60 ${OUT[0]} &
wait
diff --git a/scripts/gamma.sh b/scripts/gamma.sh
index 796b561..8de1b80 100755
--- a/scripts/gamma.sh
+++ b/scripts/gamma.sh
@@ -1,10 +1,10 @@
#!/bin/bash
-MAIN_DP=eDP1;
+MAIN_DP=$($HOME/.scripts/primary-display.sh);
v=$1
if [ $# -ne 0 ]; then
xrandr --output $MAIN_DP --gamma $(paste -d" " <(xrandr | grep " connected" | cut -f1 -d " ") <(xrandr --current --verbose | grep "Gamma" | cut -f7 -d" " | cut -f1 -d":" | xargs -I % echo "1/%") | grep $MAIN_DP | cut -d" " -f2 | xargs -I % echo "%*$v" | bc -l)
else
- xrandr --output $MAIN_DP --gamma 1
+ xrandr --output $MAIN_DP --gamma 1.1
fi
diff --git a/scripts/powermenu b/scripts/powermenu
index 917f369..2ce5901 100755
--- a/scripts/powermenu
+++ b/scripts/powermenu
@@ -1,3 +1,3 @@
#!/bin/sh
-printf "%s\n" "pm-suspend" "pm-hibernate" "reboot" "poweroff" | rofi -dmenu -p "power" | xargs -r
+printf "pm-suspend reboot poweroff" | rofi -dmenu -p "power" | xargs -r
diff --git a/scripts/primary-display.sh b/scripts/primary-display.sh
new file mode 100755
index 0000000..310cfb6
--- /dev/null
+++ b/scripts/primary-display.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+xrandr | awk '/ primary / {print $1}'
+
diff --git a/scripts/record_window.sh b/scripts/record_window.sh
index f3cf452..841b756 100755
--- a/scripts/record_window.sh
+++ b/scripts/record_window.sh
@@ -9,13 +9,11 @@ width=$(cat $info | grep Width | cut -d' ' -f4)
height=$(cat $info | grep Height | cut -d' ' -f4)
size="${width}x${height}"
-x=$(cat $info | grep "Absolute upper-left X" | cut -d' ' -f7)
-y=$(cat $info | grep "Absolute upper-left Y" | cut -d' ' -f7)
-position="+$x,$y"
+position=+$(echo $geom | cut -d'+' -f2- | sed "s/+/,/g")
-filename=$(date +"%F_%T.mp4")
+filename=$(date +"$HOME/pics/screenshot/%F_%T.mp4")
echo $size and $position
-ffmpeg -y -f x11grab -video_size $size -i "$position" $filename
+ffmpeg -y -f x11grab -video_size $size -i $position $filename
rm $info
diff --git a/scripts/tablet b/scripts/tablet
index 009395a..7e91a55 100755
--- a/scripts/tablet
+++ b/scripts/tablet
@@ -22,11 +22,12 @@ tablet_ratio = (lambda s: float(s[0]) / float(s[1]))(sys.argv[4].split(":")) if
screens = [
(0, 0, 1920, 1080),
+ (1920, 0, 2560, 1440),
]
#TODO find this with xrandr
-target = screens[0]
+target = screens[1]
#Physical offset of the selected screen
offsetx = target[0]
@@ -34,7 +35,7 @@ offsety = target[1]
#Size of the full screen areas
sh = 1080
-sw = 1920
+sw = 1920 + 2560
#TODO calculate using list of screens
#Aspect ratio of the tablet, to avoid weird scaling problems
diff --git a/scripts/toggle-mute.sh b/scripts/toggle-mute.sh
new file mode 100755
index 0000000..3d08f26
--- /dev/null
+++ b/scripts/toggle-mute.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+#
+pactl list sources | grep -qi 'Mute: yes' && pactl set-source-mute 0 false || pactl set-source-mute 0 true
+