summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/launcher8
-rwxr-xr-xscripts/mpc_picker35
-rwxr-xr-xscripts/toggle-mic.sh4
-rwxr-xr-xscripts/xrandr.sh35
4 files changed, 76 insertions, 6 deletions
diff --git a/scripts/launcher b/scripts/launcher
new file mode 100755
index 0000000..85b679d
--- /dev/null
+++ b/scripts/launcher
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+rasi="$HOME/.config/rofi/launcher.rasi"
+
+## Run
+rofi \
+ -show drun \
+ -theme $rasi
diff --git a/scripts/mpc_picker b/scripts/mpc_picker
index 3758b0a..0477d46 100755
--- a/scripts/mpc_picker
+++ b/scripts/mpc_picker
@@ -1,6 +1,29 @@
-#!/bin/sh
-selected=$(mpc -f "%title%[\t\t%artist%][\t\t%album%]\t\t%file%" listall | dmenu -i -p mpd)
-[ "$selected" == "" ] && exit
-file=$(printf "%s\n" "$selected" | rev | cut -f1 -d' ' | rev)
-echo "$file"
-mpc insert "$file"
+#!/usr/bin/dash
+format="<b>%title%</b>\t%artist%\t%album%\t%file%"
+
+columns="$(mpc -f "$format" listall \
+ | column -t -s' ' \
+ -C title,width=10,trunc \
+ -C artist,width=10,trunc \
+ -C album,width=10,trunc \
+ -C file \
+ | sed 's/&/&amp;/g'
+)"
+
+np=$(printf "%s" "$columns" | grep "$(mpc -f '%title%' current)" | head -1)
+echo "$np"
+selected=$(
+ printf "%s" "$columns" | rofi -dmenu -i \
+ -multi-select \
+ -markup-rows \
+ -p " " \
+ -ballot-selected-str " " \
+ -ballot-unselected-str " " \
+ -select "$np"
+ )
+[ -z "$selected" ] && exit
+echo "$selected" | while read -r option; do
+ file=$(printf "%s\n" "$option" | awk -F' ' '{print $NF}' | sed 's/^\s*//g')
+ echo ${file}
+ mpc insert "$file"
+done
diff --git a/scripts/toggle-mic.sh b/scripts/toggle-mic.sh
new file mode 100755
index 0000000..d3e3244
--- /dev/null
+++ b/scripts/toggle-mic.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+SOURCE=1
+pactl list sources | grep -qi 'Mute: yes' && pactl set-source-mute $SOURCE false || pactl set-source-mute $SOURCE true
+
diff --git a/scripts/xrandr.sh b/scripts/xrandr.sh
new file mode 100755
index 0000000..1827cd7
--- /dev/null
+++ b/scripts/xrandr.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+all=$(xrandr | grep "connected" | cut -d' ' -f1 | paste -s -d' ')
+available=$(xrandr | grep " connected" | cut -d' ' -f1 | paste -s -d' ')
+set -- $available
+
+printf "connected: "
+printf "%s " $available
+printf "\n"
+
+printf "all: "
+printf "%s " $all
+printf "\n"
+
+if [ "$1" == "eDP1" ]; then
+ # this is a laptop so awesome!
+
+ if [ "$#" != "1" ]; then
+ # ensure the main one is turned on yeah
+ xrandr --output eDP1 --mode 1920x1080 --pos 0x0 --rotate normal
+
+ # put the non main one to the left (assume its +1920 because im lazy)
+ xrandr --output "$2" --primary --mode 2560x1440 --pos 1920x0 --rotate normal
+ else
+ # ensure the main one is turned on yeah
+ xrandr --output eDP1 --primary --mode 1920x1080 --pos 0x0 --rotate normal
+ fi
+ #disconnect all the rest i think
+ for x in $all; do
+ echo disconnecting $x
+ case $available in
+ *"$x"*) ;;
+ *) xrandr --output "$x" --off
+ esac
+ done
+fi