From b477ab4923f88c90c655a9540ddafcc98ebdfd8c Mon Sep 17 00:00:00 2001 From: Mateja Date: Sun, 7 Feb 2021 11:45:03 +0100 Subject: Move and rename scripts. --- .local/bin/mpd_show.sh | 6 ++++++ .local/bin/unmount_usb.sh | 11 +++++++++++ scripts/mpd_show | 6 ------ scripts/unmount-usb | 11 ----------- 4 files changed, 17 insertions(+), 17 deletions(-) create mode 100755 .local/bin/mpd_show.sh create mode 100755 .local/bin/unmount_usb.sh delete mode 100755 scripts/mpd_show delete mode 100755 scripts/unmount-usb diff --git a/.local/bin/mpd_show.sh b/.local/bin/mpd_show.sh new file mode 100755 index 0000000..8d14a1d --- /dev/null +++ b/.local/bin/mpd_show.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +raw="$(mpc)" +song=$(echo "$raw" | sed -n '1p') +time=$(echo "$raw" | sed -n '2p') +notify-send "$song" "$time" diff --git a/.local/bin/unmount_usb.sh b/.local/bin/unmount_usb.sh new file mode 100755 index 0000000..c90dde4 --- /dev/null +++ b/.local/bin/unmount_usb.sh @@ -0,0 +1,11 @@ +#!/bin/bash +options=$(lsblk | grep /media/$USER | rev | cut -d ' ' -f 1 | rev) +[ -n "$options" ] && opt_num=$(echo "$options" | wc -l) || opt_num=0 +if [ $opt_num == 0 ]; then + notify-send "Nothing mounted!" +elif [ $opt_num == 1 ]; then + udiskie-umount "$options" +else + unmount_device=$(echo "$options" | dmenu -p "What device you want to unmount?") + [[ ! -z "$unmount_device" ]] && udiskie-umount "$unmount_device" +fi diff --git a/scripts/mpd_show b/scripts/mpd_show deleted file mode 100755 index 8d14a1d..0000000 --- a/scripts/mpd_show +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -raw="$(mpc)" -song=$(echo "$raw" | sed -n '1p') -time=$(echo "$raw" | sed -n '2p') -notify-send "$song" "$time" diff --git a/scripts/unmount-usb b/scripts/unmount-usb deleted file mode 100755 index c90dde4..0000000 --- a/scripts/unmount-usb +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -options=$(lsblk | grep /media/$USER | rev | cut -d ' ' -f 1 | rev) -[ -n "$options" ] && opt_num=$(echo "$options" | wc -l) || opt_num=0 -if [ $opt_num == 0 ]; then - notify-send "Nothing mounted!" -elif [ $opt_num == 1 ]; then - udiskie-umount "$options" -else - unmount_device=$(echo "$options" | dmenu -p "What device you want to unmount?") - [[ ! -z "$unmount_device" ]] && udiskie-umount "$unmount_device" -fi -- cgit v1.2.3 From acf84fbee3389b0f83ced148ef08f996f81ca3d7 Mon Sep 17 00:00:00 2001 From: Mateja Date: Sun, 7 Feb 2021 11:54:58 +0100 Subject: Use `#!/usr/bin/env bash` --- .local/bin/mpd_show.sh | 2 +- .local/bin/unmount_usb.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.local/bin/mpd_show.sh b/.local/bin/mpd_show.sh index 8d14a1d..1d0629a 100755 --- a/.local/bin/mpd_show.sh +++ b/.local/bin/mpd_show.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash raw="$(mpc)" song=$(echo "$raw" | sed -n '1p') diff --git a/.local/bin/unmount_usb.sh b/.local/bin/unmount_usb.sh index c90dde4..764365c 100755 --- a/.local/bin/unmount_usb.sh +++ b/.local/bin/unmount_usb.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#!/usr/bin/env bash + options=$(lsblk | grep /media/$USER | rev | cut -d ' ' -f 1 | rev) [ -n "$options" ] && opt_num=$(echo "$options" | wc -l) || opt_num=0 if [ $opt_num == 0 ]; then -- cgit v1.2.3 From 0359b6d6c629557475b6ae6235426821a02364db Mon Sep 17 00:00:00 2001 From: Mateja Date: Sun, 7 Feb 2021 12:17:45 +0100 Subject: Update README. --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c54ceb7..b1f55d5 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,9 @@ Configuration files for programs I use and used to use, including some helper sc ## Helper scripts: -- mpd_show: Show currently playing song in pop-up. -- unmount-usb: Unmount currently mounted USB drive or one selected from list of currently mounted USB drives. +- mpd_show.sh: Show currently playing song in pop-up. +- unmount_usb.sh: Unmount currently mounted USB drive or one selected from list of currently mounted USB drives. +- save_notification.sh: Save notifications to `/tmp/notifications`. ## Note on Neovim! -- cgit v1.2.3 From 4f351301891746161bae7b848cb2cfd518fb62c4 Mon Sep 17 00:00:00 2001 From: Mateja Date: Sun, 7 Feb 2021 12:19:57 +0100 Subject: Update PATH. --- .bashrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bashrc b/.bashrc index 0a1eafa..43d1bfa 100644 --- a/.bashrc +++ b/.bashrc @@ -114,7 +114,7 @@ if ! shopt -oq posix; then fi fi -PATH=$PATH:/home/$USER/stuff/scripts +PATH=$PATH:/home/$USER/.local/bin/ export EDITOR='nvim' export VISUAL='nvim' -- cgit v1.2.3 From 3621cc09ea17c771d9c99d684d1e9bafc69fb222 Mon Sep 17 00:00:00 2001 From: Mateja Date: Sun, 7 Feb 2021 12:32:27 +0100 Subject: Update config files. --- .config/i3/config | 2 +- .config/qtile/config.py | 4 ++-- .xmonad/xmonad.hs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.config/i3/config b/.config/i3/config index 7c002d1..6a5e3ce 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -14,7 +14,7 @@ bindsym $mod+apostrophe exec amixer -q sset Master 5%- bindsym $mod+p exec amixer -q sset Master toggle bindsym $mod+m exec scrot -ze 'mv $f ~/screenshots/' -bindsym $mod+u exec ~/scripts/unmount-usb +bindsym $mod+u exec ~/.local/bin/unmount_usb.sh #END floating_modifier $mod diff --git a/.config/qtile/config.py b/.config/qtile/config.py index 501d807..aa3abcc 100644 --- a/.config/qtile/config.py +++ b/.config/qtile/config.py @@ -28,13 +28,13 @@ keys = [ desc="Toggle mute"), # Programs... - Key([mod], "e", lazy.spawn("bash -c ~/stuff/scripts/unmount-usb"), + Key([mod], "e", lazy.spawn("bash -c ~/.local/bin/unmount_usb.sh"), desc="Eject USB"), Key([mod, "control"], "p", lazy.spawn("scrot -ze 'mv $f ~/stuff/pictures/screenshots/'"), desc="Take a screenshot"), Key([mod], "x", lazy.spawn("mpc toggle"), desc="Pause/Resume MPD playback"), - Key([mod, "shift"], "x", lazy.spawn("bash -c ~/stuff/scripts/mpd_show"), + Key([mod, "shift"], "x", lazy.spawn("bash -c ~/.local/bin/mpd_show.sh"), desc="Display song."), Key([mod], "z", lazy.spawn("mpc next"), desc="MPD next song"), diff --git a/.xmonad/xmonad.hs b/.xmonad/xmonad.hs index cf2f262..e151dd9 100644 --- a/.xmonad/xmonad.hs +++ b/.xmonad/xmonad.hs @@ -86,7 +86,7 @@ myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $ , ((modm, xK_bracketleft), spawn "amixer -q sset Master 5%+") , ((modm, xK_apostrophe), spawn "amixer -q sset Master 5%-") , ((modm, xK_semicolon), spawn "amixer -q sset Master toggle") - , ((modm, xK_u ), spawn "~/stuff/scripts/unmount-usb") + , ((modm, xK_u ), spawn "~/.local/bin/unmount_usb.sh") , ((modm, xK_s ), spawn "scrot -ze 'mv $f ~/stuff/pictures/screenshots/'") -- my keybindings stop ----------------------------------------------- -- cgit v1.2.3