From 06174dbafaa324c1d3885e7e2f25e279cc328a6c Mon Sep 17 00:00:00 2001 From: Cheri Date: Tue, 14 Dec 2021 14:35:25 +0200 Subject: [PATCH] migrate stuff from dmenu to rofi ig --- bin/monitor_layout.sh | 99 +++++++++++++++++++++++++++++++++++++++++++ sxhkd/sxhkdrc | 10 ++--- 2 files changed, 104 insertions(+), 5 deletions(-) create mode 100755 bin/monitor_layout.sh diff --git a/bin/monitor_layout.sh b/bin/monitor_layout.sh new file mode 100755 index 0000000..e51b3bb --- /dev/null +++ b/bin/monitor_layout.sh @@ -0,0 +1,99 @@ +#!/bin/bash + +XRANDR=$(which xrandr) + +MONITORS=( $( ${XRANDR} | awk '( $2 == "connected" ){ print $1 }' ) ) + + +NUM_MONITORS=${#MONITORS[@]} + +TITLES=() +COMMANDS=() + + +function gen_xrandr_only() +{ + selected=$1 + + cmd="xrandr --output ${MONITORS[$selected]} --auto " + + for entry in $(seq 0 $((${NUM_MONITORS}-1))) + do + if [ $selected != $entry ] + then + cmd="$cmd --output ${MONITORS[$entry]} --off" + fi + done + + echo $cmd +} + + + +declare -i index=0 +TILES[$index]="Cancel" +COMMANDS[$index]="true" +index+=1 + + +for entry in $(seq 0 $((${NUM_MONITORS}-1))) +do + TILES[$index]="Only ${MONITORS[$entry]}" + COMMANDS[$index]=$(gen_xrandr_only $entry) + index+=1 +done + +## +# Dual screen options +## +for entry_a in $(seq 0 $((${NUM_MONITORS}-1))) +do + for entry_b in $(seq 0 $((${NUM_MONITORS}-1))) + do + if [ $entry_a != $entry_b ] + then + TILES[$index]="Dual Screen ${MONITORS[$entry_a]} -> ${MONITORS[$entry_b]}" + COMMANDS[$index]="xrandr --output ${MONITORS[$entry_a]} --auto \ + --output ${MONITORS[$entry_b]} --auto --left-of ${MONITORS[$entry_a]}" + + index+=1 + fi + done +done + + +## +# Clone monitors +## +for entry_a in $(seq 0 $((${NUM_MONITORS}-1))) +do + for entry_b in $(seq 0 $((${NUM_MONITORS}-1))) + do + if [ $entry_a != $entry_b ] + then + TILES[$index]="Clone Screen ${MONITORS[$entry_a]} -> ${MONITORS[$entry_b]}" + COMMANDS[$index]="xrandr --output ${MONITORS[$entry_a]} --auto \ + --output ${MONITORS[$entry_b]} --auto --same-as ${MONITORS[$entry_a]}" + + index+=1 + fi + done +done + + +## +# Generate entries, where first is key. +## +function gen_entries() +{ + for a in $(seq 0 $(( ${#TILES[@]} -1 ))) + do + echo $a ${TILES[a]} + done +} + +# Call menu +SEL=$( gen_entries | rofi -dmenu -p "Monitor Setup:" -a 0 -no-custom | awk '{print $1}' ) + +# Call xrandr +$( ${COMMANDS[$SEL]} ) diff --git a/sxhkd/sxhkdrc b/sxhkd/sxhkdrc index cd5b242..a2a0bba 100644 --- a/sxhkd/sxhkdrc +++ b/sxhkd/sxhkdrc @@ -51,8 +51,8 @@ super + ctrl + alt + m # ROFI run menu super + d - ~/.config/rofi/launchers/misc/launcher.sh - #rofi -show run + rofi -show drun + #dmenu_run # kaomoji picker lol ctrl + alt + k dmenukaomoji @@ -63,11 +63,11 @@ super + alt + c # dmenu display selector super + p - ~/.config/bspwm/display.sh + display_selector.sh #dmenu wacom area set -super + w - ~/.config/bspwm/wacom.sh +#super + w + #~/.config/bspwm/wacom.sh #Take a screenshot Print