about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorazahi <azahi@teknik.io>2018-10-13 14:12:30 +0300
committerazahi <azahi@teknik.io>2018-10-13 14:12:30 +0300
commit8e20389ce238d979e6cb9253643bc181d698f5a9 (patch)
treed777052e5ac411cfa79de596ecc99d7d596705d8 /scripts
parentRework Custom (diff)
Huge update, yet again
Move to ~/.xmonad
Completely redo directory structure
Remove Test.hs with xmonad-ng-test because it breaks cabal
Add headers for new files
Add proper "copyright" entries and mention upstream xmonad developers
Other minor fixes
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/mpc-play-pause.sh8
-rwxr-xr-xscripts/nsp-console.sh8
-rwxr-xr-xscripts/screenlock.sh7
-rwxr-xr-xscripts/toggle-compton.sh8
-rwxr-xr-xscripts/toggle-redshift.sh9
-rwxr-xr-xscripts/toggle-touchpad.sh11
-rwxr-xr-xscripts/toggle-trackpoint.sh11
-rwxr-xr-xscripts/xmobar/fcitx.sh16
-rwxr-xr-xscripts/xshot-select-upload.sh7
-rwxr-xr-xscripts/xshot-select.sh5
-rwxr-xr-xscripts/xshot-upload.sh7
-rwxr-xr-xscripts/xshot.sh5
12 files changed, 102 insertions, 0 deletions
diff --git a/scripts/mpc-play-pause.sh b/scripts/mpc-play-pause.sh
new file mode 100755
index 0000000..3fb4f3b
--- /dev/null
+++ b/scripts/mpc-play-pause.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+if mpc | grep -q "playing"
+then
+    mpc --no-status pause
+else
+    mpc --no-status play
+fi
diff --git a/scripts/nsp-console.sh b/scripts/nsp-console.sh
new file mode 100755
index 0000000..5d19f46
--- /dev/null
+++ b/scripts/nsp-console.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+if tmux list-sessions | grep -q "scratchpad"
+then
+    tmux attach-session -t "scratchpad"
+else
+    tmux new-session -s "scratchpad" -n "scratchpad" -c "${HOME}"
+fi
diff --git a/scripts/screenlock.sh b/scripts/screenlock.sh
new file mode 100755
index 0000000..28dbe0c
--- /dev/null
+++ b/scripts/screenlock.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+i3lock \
+    --no-unlock-indicator \
+    --image "${HOME}/pictures/wallpapers/mill-lock.png" \
+    --pointer default \
+    --ignore-empty-password
diff --git a/scripts/toggle-compton.sh b/scripts/toggle-compton.sh
new file mode 100755
index 0000000..91ebc4d
--- /dev/null
+++ b/scripts/toggle-compton.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+if [[ $(pgrep 'compton') ]]
+then
+    pkill "compton"
+else
+    compton -b --config "${XDG_CONFIG_HOME}/compton.conf"
+fi
diff --git a/scripts/toggle-redshift.sh b/scripts/toggle-redshift.sh
new file mode 100755
index 0000000..8ba6b60
--- /dev/null
+++ b/scripts/toggle-redshift.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+
+if [[ $(pgrep 'redshift') ]]
+then
+    pkill "redshift"
+else
+    redshift -c "${XDG_CONFIG_HOME}/redshift.conf" &
+    disown redshift
+fi
diff --git a/scripts/toggle-touchpad.sh b/scripts/toggle-touchpad.sh
new file mode 100755
index 0000000..5a30528
--- /dev/null
+++ b/scripts/toggle-touchpad.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+ID=$(xinput list | grep -Eo 'TouchPad\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}')
+STATE=$(xinput list-props "$ID" | awk '/Device Enabled/ {print $4}')
+
+if [ "$STATE" -eq 1 ]
+then
+    xinput disable "$ID"
+else
+    xinput enable "$ID"
+fi
diff --git a/scripts/toggle-trackpoint.sh b/scripts/toggle-trackpoint.sh
new file mode 100755
index 0000000..b0b3501
--- /dev/null
+++ b/scripts/toggle-trackpoint.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+ID=$(xinput list | grep -Eo 'TrackPoint\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}')
+STATE=$(xinput list-props "$ID" | awk '/Device Enabled/ {print $4}')
+
+if [ "$STATE" -eq 1 ]
+then
+    xinput disable "$ID"
+else
+    xinput enable "$ID"
+fi
diff --git a/scripts/xmobar/fcitx.sh b/scripts/xmobar/fcitx.sh
new file mode 100755
index 0000000..ddf1826
--- /dev/null
+++ b/scripts/xmobar/fcitx.sh
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+
+status="$(fcitx-remote)"
+set out
+
+if   [[ "$status" = 0 ]]
+then
+    out="Off"
+elif [[ "$status" = 1 ]]
+then
+    out="Disabled"
+else 
+    out="Enabled"
+fi
+
+echo -e "$out"
diff --git a/scripts/xshot-select-upload.sh b/scripts/xshot-select-upload.sh
new file mode 100755
index 0000000..e846800
--- /dev/null
+++ b/scripts/xshot-select-upload.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+PIC="${HOME}/pictures/screenshots/$(date +%Y-%m-%d_%H-%M-%S).png"
+
+maim --format=png --hidecursor --quality 8 --select "${PIC}" && \
+    curl --form "file=@${PIC}" "https://0x0.st" | \
+    xclip -quiet
diff --git a/scripts/xshot-select.sh b/scripts/xshot-select.sh
new file mode 100755
index 0000000..53ad782
--- /dev/null
+++ b/scripts/xshot-select.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+PIC="${HOME}/pictures/screenshots/$(date +%Y-%m-%d_%H-%M-%S).png"
+
+maim --format=png --hidecursor --quality 8 --select "${PIC}"
diff --git a/scripts/xshot-upload.sh b/scripts/xshot-upload.sh
new file mode 100755
index 0000000..91c23f4
--- /dev/null
+++ b/scripts/xshot-upload.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+PIC="${HOME}/pictures/screenshots/$(date +%Y-%m-%d_%H-%M-%S).png"
+
+maim --format=png --hidecursor --quality 8 "${PIC}" && \
+    curl --form "file=@${PIC}" "https://0x0.st" | \
+    xclip -quiet
diff --git a/scripts/xshot.sh b/scripts/xshot.sh
new file mode 100755
index 0000000..d7984e3
--- /dev/null
+++ b/scripts/xshot.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+PIC="${HOME}/pictures/screenshots/$(date +%Y-%m-%d_%H-%M-%S).png"
+
+maim --format=png --hidecursor --quality 8 "${PIC}"

Consider giving Nix/NixOS a try! <3