aboutsummaryrefslogtreecommitdiff
path: root/linux/home/.local/bin
diff options
context:
space:
mode:
Diffstat (limited to 'linux/home/.local/bin')
-rwxr-xr-xlinux/home/.local/bin/control-center31
-rwxr-xr-xlinux/home/.local/bin/ewwbin0 -> 22225024 bytes
-rwxr-xr-xlinux/home/.local/bin/ffmpeg24
-rwxr-xr-xlinux/home/.local/bin/nitrogen63
-rwxr-xr-xlinux/home/.local/bin/notification-center26
-rwxr-xr-xlinux/home/.local/bin/xcolor-pick31
6 files changed, 175 insertions, 0 deletions
diff --git a/linux/home/.local/bin/control-center b/linux/home/.local/bin/control-center
new file mode 100755
index 0000000..d0b3320
--- /dev/null
+++ b/linux/home/.local/bin/control-center
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+LOCK_FILE="$HOME/.cache/eww-control-center.lock"
+EWW_BIN="$HOME/.local/bin/eww"
+ACTIVE_PLAYERS=$(playerctl -l | head -n 1)
+
+run() {
+ ${EWW_BIN} open control-center
+ sleep 0.2
+ xdo raise -N eww-bar
+ ${EWW_BIN} update ccenter=true
+
+ sleep 1 && [[ ! -z "$ACTIVE_PLAYERS" ]] && ${EWW_BIN} update mp=true
+}
+
+# Run eww daemon if not running
+if [[ ! `pidof eww` ]]; then
+ ${EWW_BIN} daemon
+ sleep 1
+else
+ if [[ ! -f "$LOCK_FILE" ]]; then
+ touch "$LOCK_FILE"
+ run
+ else
+ [[ ! -z "$ACTIVE_PLAYERS" ]] && ${EWW_BIN} update mp=false && sleep 0.4
+ ${EWW_BIN} update ccenter=false
+ sleep 0.6
+ ${EWW_BIN} close control-center
+ rm "$LOCK_FILE"
+ fi
+fi
diff --git a/linux/home/.local/bin/eww b/linux/home/.local/bin/eww
new file mode 100755
index 0000000..585d6d2
--- /dev/null
+++ b/linux/home/.local/bin/eww
Binary files differ
diff --git a/linux/home/.local/bin/ffmpeg b/linux/home/.local/bin/ffmpeg
new file mode 100755
index 0000000..2258fbd
--- /dev/null
+++ b/linux/home/.local/bin/ffmpeg
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+# audio
+A="$(pactl list sources | grep 'analog.*monitor' | awk '{print $2}')"
+# screen size
+S="$(xdpyinfo | grep dimensions | awk '{print $2}')"
+# file name
+N="$(date +"%m-%d-%Y_%I:%M%p").mp4"
+
+# Desktop audio + screen recording
+ffmpeg \
+-s "$S" -r 25 -f x11grab -i :0.0+0,0 \
+-ac 2 ~/"$N"
+
+# ffmpeg can output high quality GIF. Before you start it is always recommended to use a recent version: download or compile.
+
+# ffmpeg -ss 30 -t 3 -i input.mp4 -vf "fps=10,scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 output.gif
+
+# This example will skip the first 30 seconds (-ss 30) of the input and create a 3 second output (-t 3).
+# fps filter sets the frame rate. A rate of 10 frames per second is used in the example.
+# scale filter will resize the output to 320 pixels wide and automatically determine the height while preserving the aspect ratio. The lanczos scaling algorithm is used in this example.
+# palettegen and paletteuse filters will generate and use a custom palette generated from your input. These filters have many options, so refer to the links for a list of all available options and values. Also see the Advanced options section below.
+# split filter will allow everything to be done in one command and avoids having to create a temporary PNG file of the palette.
+# Control looping with -loop output option but the values are confusing. A value of 0 is infinite looping, -1 is no looping, and 1 will loop once meaning it will play twice. So a value of 10 will cause the GIF to play 11 times.
diff --git a/linux/home/.local/bin/nitrogen b/linux/home/.local/bin/nitrogen
new file mode 100755
index 0000000..b8afe27
--- /dev/null
+++ b/linux/home/.local/bin/nitrogen
@@ -0,0 +1,63 @@
+#!/usr/bin/env bash
+
+# Wrapper for nitrogen setting the freedesktop.org AccountsService/BackgroundFile so LightDM wallpaper is synced.
+# Inspired by <https://rafaelc.org/posts/sync-wm-wallpaper-with-lightdm-on-linux-mint/>
+
+key_value_retriever() {
+ KEY="${1}"
+ if [[ -z "$KEY" ]]; then
+ printf "ERROR: KEY should not be empty\n"
+ return
+ fi
+ FILE="${2}"
+ if [[ ! -f "$FILE" ]]; then
+ printf "ERROR: Cannot find FILE: %s\n" "$FILE"
+ return
+ fi
+ VALUE_VARNAME="${3}"
+ if [[ -z "$VALUE_VARNAME" ]]; then
+ printf "ERROR: VALUE_VARNAME should not be empty\n"
+ return
+ fi
+ MATCH=$(grep -m1 "^[[:space:]]*${KEY}=" "$FILE")
+ INDEX_OF_FIRST_EQUAL=$(expr index "$MATCH" =)
+ VALUE="${MATCH:${INDEX_OF_FIRST_EQUAL}}"
+ export "$VALUE_VARNAME"="$VALUE"
+}
+
+/usr/bin/nitrogen "$@"
+if [[ "${1:-}" == "--restore" ]]; then
+ exit $?
+fi
+
+NITROGEN_BG_SAVED_CFG_FILE="${HOME}/.config/nitrogen/bg-saved.cfg"
+if [[ ! -f "$NITROGEN_BG_SAVED_CFG_FILE" ]]; then
+ printf "!ERROR! Cannot find NITROGEN_BG_SAVED_CFG_FILE[%s]\n" "$NITROGEN_BG_SAVED_CFG_FILE" 1>&2
+ exit 1
+fi
+
+key_value_retriever "file" "$NITROGEN_BG_SAVED_CFG_FILE" "NITROGEN_BG_SAVED_CFG_FIRST_BACKGROUND_FILE"
+
+if [[ -z "$NITROGEN_BG_SAVED_CFG_FIRST_BACKGROUND_FILE" ]]; then
+ printf "!ERROR! Cannot retrieve NITROGEN_BG_SAVED_CFG_FIRST_BACKGROUND_FILE from NITROGEN_BG_SAVED_CFG_FILE[%s]\n" "NITROGEN_BG_SAVED_CFG_FIRST_BACKGROUND_FILE" 1>&2
+ exit 1
+fi
+
+if [[ ! -f "$NITROGEN_BG_SAVED_CFG_FIRST_BACKGROUND_FILE" ]]; then
+ printf "!ERROR! Cannot find NITROGEN_BG_SAVED_CFG_FIRST_BACKGROUND_FILE[%s]\n" "$NITROGEN_BG_SAVED_CFG_FIRST_BACKGROUND_FILE" 1>&2
+ exit 1
+fi
+
+printf "Setting nitrogen background into freedesktop.org AccountsService...\n"
+printf "NITROGEN_BG_SAVED_CFG_FIRST_BACKGROUND_FILE[%s]\n" "$NITROGEN_BG_SAVED_CFG_FIRST_BACKGROUND_FILE"
+
+"$HOME"/.scripts/lockscreen-wallpaper &
+dbus-send \
+ --print-reply \
+ --system \
+ --dest=org.freedesktop.Accounts \
+ /org/freedesktop/Accounts/User"$(id -u)" \
+ org.freedesktop.DBus.Properties.Set \
+ string:org.freedesktop.DisplayManager.AccountsService \
+ string:BackgroundFile \
+ variant:string:"$NITROGEN_BG_SAVED_CFG_FIRST_BACKGROUND_FILE"
diff --git a/linux/home/.local/bin/notification-center b/linux/home/.local/bin/notification-center
new file mode 100755
index 0000000..d785628
--- /dev/null
+++ b/linux/home/.local/bin/notification-center
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+LOCK_FILE="$HOME/.cache/eww-notification-center.lock"
+EWW_BIN="$HOME/.local/bin/eww"
+
+run() {
+ "$EWW_BIN" open notification-center
+ sleep 0.2
+ "$EWW_BIN" update noticenter=true
+}
+
+# Run eww daemon if not running
+if [[ ! $(pidof eww) ]]; then
+ "$EWW_BIN" daemon
+ sleep 1
+else
+ if [[ ! -f "$LOCK_FILE" ]]; then
+ touch "$LOCK_FILE"
+ run
+ else
+ "$EWW_BIN" update noticenter=false
+ sleep 0.8
+ "$EWW_BIN" close notification-center
+ rm "$LOCK_FILE"
+ fi
+fi
diff --git a/linux/home/.local/bin/xcolor-pick b/linux/home/.local/bin/xcolor-pick
new file mode 100755
index 0000000..459246f
--- /dev/null
+++ b/linux/home/.local/bin/xcolor-pick
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+
+# ██╗ ██╗ ██████╗ ██████╗ ██╗ ██████╗ ██████╗
+# ╚██╗██╔╝██╔════╝██╔═══██╗██║ ██╔═══██╗██╔══██╗
+# ╚███╔╝ ██║ ██║ ██║██║ ██║ ██║██████╔╝
+# ██╔██╗ ██║ ██║ ██║██║ ██║ ██║██╔══██╗
+# ██╔╝ ██╗╚██████╗╚██████╔╝███████╗╚██████╔╝██║ ██║
+# ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝
+# color picker for X.
+# Simple Script To Pick Color Quickly Using Gpick.
+# Created By: rxyhn.
+
+TEMP_DIR=/tmp/xcolor
+MSG=${XDG_CACHE_HOME:-$HOME/.cache}/xcolor.msg
+
+EXPIRE_TIME=5000
+
+main() {
+
+ HEX_COLOR=$(gpick -pso --no-newline)
+ mkdir -p $TEMP_DIR
+ HEX="${HEX_COLOR#\#}"
+ FNAME="$TEMP_DIR/$HEX.png"
+ convert -size 100x100 xc:"$HEX_COLOR" "$FNAME"
+ COLOR_CODE="$HEX_COLOR"
+
+ printf %s "$COLOR_CODE" | xclip -sel c
+ notify-send -a XColor "$COLOR_CODE" --icon="$FNAME" --expire-time="$EXPIRE_TIME"
+}
+
+main