summaryrefslogtreecommitdiff
path: root/scripts/gui
diff options
context:
space:
mode:
authorSuleyman Farajli <suleyman@farajli.net>2025-10-26 22:23:31 +0400
committerSuleyman Farajli <suleyman@farajli.net>2025-10-26 22:23:31 +0400
commitcb78290f31886fb1f9a5e7c2a764dda55a459e50 (patch)
tree72a2df0645405658d8590d4b8d7d87f1e099f596 /scripts/gui
parentf8d1bfbd0f27e0763cf75fcda58d010e346515ab (diff)
chore: split script installation into CLI and GUI sections
Diffstat (limited to 'scripts/gui')
-rwxr-xr-xscripts/gui/br42
-rwxr-xr-xscripts/gui/nsend32
-rwxr-xr-xscripts/gui/qw41
-rwxr-xr-xscripts/gui/shot56
-rwxr-xr-xscripts/gui/swall68
5 files changed, 239 insertions, 0 deletions
diff --git a/scripts/gui/br b/scripts/gui/br
new file mode 100755
index 0000000..0fd6dc5
--- /dev/null
+++ b/scripts/gui/br
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+. slib
+
+help() {
+cat << EOF
+${0}: Open links from bookmarks through dmenu
+options:
+[link] Open link
+ -h Print this message and exit
+
+NOTE: bookmarks file is located at ~/.config/sites/bookmarks
+EOF
+
+exit 0
+}
+
+alias dmenucmd="dmenu -bw 1 -c -g 1 -l 25"
+
+[ -z "${BROWSER}" ] && browser="qutebrowser" || browser="${BROWSER}"
+
+if [ "${#}" -eq 0 ]; then
+
+ # FIXME: Use XDG_CONFIG
+ link_file="${HOME}/.config"/sites/bookmarks.txt
+
+ check_program "dmenu"
+
+ [ -z "${XDG_HOME_CONFIG}" ] || link_file="${XDG_HOME_CONFIG}"/sites/bookmarks.txt
+ [ -e "${link_file}" ] || err "Couldn't find bookmarks file"
+
+ link=$(< "${link_file}" dmenucmd)
+
+ [ -z "${link}" ] || "${browser}" "${link}"
+
+elif [ "${#}" -eq 1 ]; then
+ [ "${1}" = "-h" ] && help
+
+ "${browser}" "${1}"
+else
+ invalid_use
+fi
diff --git a/scripts/gui/nsend b/scripts/gui/nsend
new file mode 100755
index 0000000..80e1764
--- /dev/null
+++ b/scripts/gui/nsend
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+. slib
+
+help() {
+cat << EOF
+${0}: Wrapper script to send notifications
+options:
+ -s [Name] [Msg] Send Msg with Name
+ -s [Msg] Send Msg Without Name
+ -h Print this message and exit
+EOF
+
+exit 0
+}
+
+check_program "notify-send" "libnotify must be installed"
+
+case "${1}" in
+"-s")
+ [ "${#}" -gt 3 ] && invalid_use
+
+ shift
+ eval $(printf 'notify-send "%s" "%s"' "${1}" "${2}")
+
+ exit 0
+;;
+"-h") help ;;
+
+*) invalid_use ;;
+
+esac
diff --git a/scripts/gui/qw b/scripts/gui/qw
new file mode 100755
index 0000000..1199227
--- /dev/null
+++ b/scripts/gui/qw
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+. slib
+
+help() {
+cat << EOF
+${0}: Qemu Wrapper, very simple script for abriviating \
+verbose qemu commands and options
+options:
+ -c create an Image.img with 10G space
+ -r [input.iso] run input.iso
+ -x [input.qcow2] run input.qcow2
+EOF
+
+exit 0
+}
+
+check_program "qemu-img"
+check_program "qemu-system-x86_64"
+
+[ $# != 2 ] && [ $# != 1 ] && invalid_use
+
+while getopts "cr:x:h" option ;do
+ case "${option}" in
+ c) run "qemu-img create -f qcow2 Image.img 10G" ;;
+
+ x) run "qemu-system-x86_64 -drive file=${OPTARG},format=qcow2 -enable-kvm -cpu host -smp 2 -m 2048 -net nic -net user -display sdl" ;;
+
+ r)
+ run "qemu-system-x86_64 -enable-kvm -cdrom ${OPTARG} \
+ -boot menu=on -drive file=Image.img -m 4G"
+ ;;
+ h) help ;;
+
+ *) invalid_use -h ;;
+
+ esac
+done
+
+# Unreachable
+invalid_use
diff --git a/scripts/gui/shot b/scripts/gui/shot
new file mode 100755
index 0000000..7404943
--- /dev/null
+++ b/scripts/gui/shot
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+. slib
+
+help() {
+cat << EOF
+${0}: Wrapper script to take screenshots
+options:
+ -d [File] Write to File
+ -s Select the area with the cursor
+ -h Print this message and exit
+
+NOTE: save directory is ~/pics/screenshot
+EOF
+
+exit 0
+}
+
+check_program "scrot"
+
+default_dir="${HOME}"/pics/screenshot
+
+s_flg=""
+while getopts "d:sh" option; do
+ case "${option}" in
+ d) input="${OPTARG}" ;;
+
+ s) s_flg="1" ;;
+
+ h) help ;;
+
+ *) invalid_use -h ;;
+
+ esac
+done
+
+shift $((OPTIND - 1))
+
+[ ${#} != 0 ] && invalid_use
+
+[ -z "${input}" ] && input="${default_dir}"
+
+outfile="${input}"
+
+[ -d "${input}" ] && outfile="${input}/$(date '+%b%d::%H%M%S').png"
+
+if [ ! -e "$(dirname "${outfile}")" ]; then
+ mkdir -p "$(dirname "${outfile}")" > /dev/null 2>&1 \
+ || err "Failed to create directory"
+fi
+
+if [ "${s_flg}" = "1" ]; then
+ run "scrot -zs ${outfile}" "${outfile}"
+else
+ run "scrot -z ${outfile}" "${outfile}"
+fi
diff --git a/scripts/gui/swall b/scripts/gui/swall
new file mode 100755
index 0000000..8e5ffb6
--- /dev/null
+++ b/scripts/gui/swall
@@ -0,0 +1,68 @@
+#!/bin/sh
+
+. slib
+
+help() {
+cat << EOF
+${0}: Wrapper script to set wallpapers
+options:
+ -d [File] Select a wallpaper or a directory
+ -c Remove the current wallpaper
+ -h Print this message and exit
+
+NOTE: default directory is ~/.config/wallpapers
+EOF
+
+exit 0
+}
+
+check_program "xwallpaper"
+
+if [ "${#}" = 0 ]; then
+ #FIXME: use XDG_CONFIG
+ input="${HOME}/.config/wallpapers"
+elif [ "${#}" != 1 ] && [ "${#}" != 2 ]; then
+ invalid_use
+fi
+
+while getopts "hcd:" option; do
+ case "${option}" in
+ c)
+ #FIXME: use `run` function
+ killall picom
+ xwallpaper --clear
+ picom &
+ exit 0
+ ;;
+
+ d) input="${OPTARG}" ;;
+
+ h) help ;;
+
+ *) invalid_use -h ;;
+
+ esac
+done
+
+shift $((OPTIND - 1))
+
+[ "${#}" != 0 ] && invalid_use
+
+if [ -n "${input}" ]; then
+ case $(file -L -b --mime-type "${input}") in
+ image/*) image="${input}" ;;
+
+ inode/directory) waldir="${input}" ;;
+
+ *) err "Couldn't read given file" ;;
+ esac
+fi
+
+if [ -n "${waldir}" ]; then
+ image=$(find "${waldir}" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' 2>/dev/null \
+ | shuf -n 1 )
+fi
+
+[ -z "${image}" ] && err "No image file found"
+
+run "xwallpaper --zoom ${image}" "${image}"