From ca72a8c5d014ff45d5b7164414257e94af6437d5 Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Thu, 4 Jul 2019 14:39:04 -0700 Subject: [PATCH 01/23] more flexible script finally(full of bashisms tho) --- bright | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bright b/bright index 72ae7a2..6f82d41 100755 --- a/bright +++ b/bright @@ -1,6 +1,11 @@ #!/bin/bash -# Script to siimply change the brightness +# Changes brightness through dmenu (because il ike my eyes) level=$(echo "$(seq 1 100)" | dmenu -i -p 'Brightnesss from 1-100') -percentage=$(echo "$level/100" | bc -l | head -c 4) +[ -z "$level" ] && exit 0 +percentage=$(echo "scale=2;" "$level/100" | bc -l) [ -z "$percentage" ] && exit 0 -xrandr --output eDP-1 --brightness $percentage + +screens="$(xrandr | grep ' connected' | awk '{print $1}')" +for scr in $screens;do + xrandr --output "$scr" --brightness $percentage +done From 3263c27f3fd8f76004271ce346044a6aa19ec781 Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Thu, 4 Jul 2019 14:44:53 -0700 Subject: [PATCH 02/23] readme --- readme.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 readme.md diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..ef8d272 --- /dev/null +++ b/readme.md @@ -0,0 +1,9 @@ +# What is this? + +A collection of shell scripts that I use with dmenu to make my life easier. + +Right now most of them are filled with basisms but thats slowly changing overtime. + +# I have a cool script too can I contribute it here? + +Of course! Submit a merge request or just email the file/file to my email `alejandros714@protonmail.com`. From b8d26ee9e315be961fb0913a6fedbe6d9f317286 Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Thu, 4 Jul 2019 14:47:07 -0700 Subject: [PATCH 03/23] helpful link <3 --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index ef8d272..566f207 100644 --- a/readme.md +++ b/readme.md @@ -6,4 +6,4 @@ Right now most of them are filled with basisms but thats slowly changing overtim # I have a cool script too can I contribute it here? -Of course! Submit a merge request or just email the file/file to my email `alejandros714@protonmail.com`. +Of course! [Submit a merge request](https://docs.gitlab.com/ee/gitlab-basics/add-merge-request.html) or just email the file/file to my email `alejandros714@protonmail.com`. From 30c2d617665cd20cbe1978043d26315dbef2ceb8 Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Thu, 4 Jul 2019 14:52:05 -0700 Subject: [PATCH 04/23] removed pointless file --- add-projector | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100755 add-projector diff --git a/add-projector b/add-projector deleted file mode 100755 index fc4c539..0000000 --- a/add-projector +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -# In case you've ever needed to setup - -output=$(xrandr|grep ' connected'|awk '{print $1}' | \ - dmenu -i -p 'Device to attach') -[ -z "$output" ] && exit 0 - -# Now we pick out where this goes -side=$(printf 'left-of\nright-of\nabove\nbelow' | \ - dmenu -i -p 'Side') -[ -z "$side" ] && exit 0 - -# Just echo for demonstrative purposes -echo "xrandr --output $output --auto --$side eDP-1" From 7d04fee57a4e847dd1ca6defd17b8881a64b1977 Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Thu, 4 Jul 2019 15:34:59 -0700 Subject: [PATCH 05/23] meme commit --- sndt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sndt b/sndt index 73078b4..6fbc5ca 100755 --- a/sndt +++ b/sndt @@ -1,3 +1,3 @@ #!/bin/bash -# Shut off all sounds coming from alsa +# Shut off all sounds coming from alsa (called when locking from lock script" amixer -q -D pulse sset Master toggle From 833a31158b6dc6ec19d17d11a46242d7049e6eb6 Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Thu, 4 Jul 2019 21:13:58 -0700 Subject: [PATCH 06/23] removal of screens done --- proj | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/proj b/proj index 1fb0225..c614bc5 100755 --- a/proj +++ b/proj @@ -15,12 +15,17 @@ then dmenu -i -p 'Pick side'` if [ -z "$side" ]; then exit 0; fi - echo 'xrandr --output $out --auto $side eDP-1' - xrandr --output $out --auto --$side eDP-1 + echo "xrandr --output $out --auto $side eDP-1" + xrandr --output $out --auto --$side DVI-I-1 else + # Get the display we want to remove out=`xrandr | grep ' connected' | awk '{print $1}' | \ dmenu -i -p 'Device to dettach'` if [ -z "$out" ]; then exit 0; fi + + # Remove that device from xrandr + echo "xrandr --output $out --off" + xrandr --output $out --off exit 0 fi From 4f0b227f08ae847375347131dcbeb2ccea3cd2a0 Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Thu, 4 Jul 2019 21:23:56 -0700 Subject: [PATCH 07/23] updated to be shorter and dash compliant --- bread | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/bread b/bread index 0434987..466ccce 100755 --- a/bread +++ b/bread @@ -1,9 +1,6 @@ #!/bin/bash -book=$(ls $HOME/Books/ | dmenu -i -l 15) -if [ -z "$book" ] +book=`ls $HOME/Books/ | dmenu -i -l 15` +if [ ! -z "$book" ] then - exit 0 -else zathura "$HOME/Books/$book" fi -#zathura "$HOME/Books/$book" From f3b2f371d12cc70c44f22c0190acddfdb22be3f3 Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Thu, 4 Jul 2019 21:49:29 -0700 Subject: [PATCH 08/23] todo section and a nice default for bright which let's it be used automatically --- bright | 11 +++++++++++ readme.md | 13 ++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/bright b/bright index 6f82d41..2abe77d 100755 --- a/bright +++ b/bright @@ -1,4 +1,15 @@ #!/bin/bash +# this part is only used for startup scripts mainly +if [ ! -z "$1" ] +then + screens="$(xrandr | grep ' connected' | awk '{print $1}')" + for s in $screens; do + xrandr --output "$s" --brightness "0.7" + echo xrandr --output "$s" --brightness "0.7" + done + exit 0 +fi + # Changes brightness through dmenu (because il ike my eyes) level=$(echo "$(seq 1 100)" | dmenu -i -p 'Brightnesss from 1-100') [ -z "$level" ] && exit 0 diff --git a/readme.md b/readme.md index 566f207..1e64294 100644 --- a/readme.md +++ b/readme.md @@ -4,6 +4,17 @@ A collection of shell scripts that I use with dmenu to make my life easier. Right now most of them are filled with basisms but thats slowly changing overtime. -# I have a cool script too can I contribute it here? +## I have a cool script too can I contribute it here? Of course! [Submit a merge request](https://docs.gitlab.com/ee/gitlab-basics/add-merge-request.html) or just email the file/file to my email `alejandros714@protonmail.com`. + +## TODO + +Scale 0-5 +: 0 = High priority +: 5 = Low priority + +bright +: Remove some bashism that the script is heavily reliant on + + From af900724318b2b9f5448ba622b3188eea6255d0a Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Thu, 4 Jul 2019 21:55:54 -0700 Subject: [PATCH 09/23] removed flufff changed /bin/bash to /bin/sh and updated todo's --- readme.md | 7 +++++++ sndt | 2 +- usbm | 9 --------- 3 files changed, 8 insertions(+), 10 deletions(-) delete mode 100755 usbm diff --git a/readme.md b/readme.md index 1e64294..bc224cb 100644 --- a/readme.md +++ b/readme.md @@ -17,4 +17,11 @@ Scale 0-5 bright : Remove some bashism that the script is heavily reliant on +usbm +: Actually finishing the userland mount script +wed +: Remove bashism's from wifi enabler/disabler + +ytdl +: Remove bashism's from ytdl script diff --git a/sndt b/sndt index 6fbc5ca..e693517 100755 --- a/sndt +++ b/sndt @@ -1,3 +1,3 @@ -#!/bin/bash +#!/bin/sh # Shut off all sounds coming from alsa (called when locking from lock script" amixer -q -D pulse sset Master toggle diff --git a/usbm b/usbm deleted file mode 100755 index d2a40f0..0000000 --- a/usbm +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -# Mounting script for usb drives for use in dmenu -mountable=$(lsblk -lp | grep "part $" | awk '{print $1, $4 }') -[ -z "$mountable" ] && exit 0 -usb=$(echo "$mountable" |\ - dmenu -i -l 5 -p "Which usb drive should we mount?" |\ - awk '{print $1}') -mkdir -p ~/.mntpts -mount $(basename $usb) ~/.mntpts/$(basename $usb) From 37729b232b04a274a924df53009e9cb111782ae9 Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Thu, 4 Jul 2019 21:58:28 -0700 Subject: [PATCH 10/23] formatting fix --- readme.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/readme.md b/readme.md index bc224cb..6702fc0 100644 --- a/readme.md +++ b/readme.md @@ -11,17 +11,22 @@ Of course! [Submit a merge request](https://docs.gitlab.com/ee/gitlab-basics/add ## TODO Scale 0-5 -: 0 = High priority -: 5 = Low priority + +* 0 = High priority +* 5 = Low priority bright -: Remove some bashism that the script is heavily reliant on + +* Remove some bashism that the script is heavily reliant on usbm -: Actually finishing the userland mount script + +* Actually finishing the userland mount script wed -: Remove bashism's from wifi enabler/disabler + +* Remove bashism's from wifi enabler/disabler ytdl -: Remove bashism's from ytdl script + +* Remove bashism's from ytdl script From 8d911e1b372e8e0d73b67cdd4c173cd83e9192c6 Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Thu, 4 Jul 2019 22:04:31 -0700 Subject: [PATCH 11/23] removed random file xd --- yes | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 yes diff --git a/yes b/yes deleted file mode 100644 index 2d57af2..0000000 --- a/yes +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -ls $HOME/Books/ | dmenu -l 15 | zathura From 4803d9bf78dada0e4fe4f7602ce042422d55fc3c Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Fri, 5 Jul 2019 01:03:08 -0700 Subject: [PATCH 12/23] updated to posix compliance --- ytdl | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/ytdl b/ytdl index e5de5da..2c28b82 100755 --- a/ytdl +++ b/ytdl @@ -1,8 +1,18 @@ -#!/bin/bash -dir=$(find ~/Music/ -maxdepth 1 -type d | dmenu -i -p "Pick a directory") -url="$(echo '' | dmenu -p 'Enter a url')" -[ -z "$url" ] && exit 0 -youtube-dl --extract-audio \ +#!/bin/sh +dir=`for d in ~/Music/*;do + if [ -d "$d" ] + then + basename "$d" + fi +done | dmenu -i -l 10 -p 'Pick a directory'` +echo ~/Music/$dir +if [ -z "$dir" ]; then exit; fi + +url=`echo '' | dmenu -p 'Enter a url'` +if [ -z "$url" ]; then exit; fi + +# youtube-dl constantly breaks so --verbose is here for your pleasure +youtube-dl --extract-audio --verbose \ --audio-format mp3 \ - -o "$dir/%(title)s.%(ext)s" \ - $url + -o "~/Music/$dir/%(title)s.%(ext)s" \ + "$url" From 6c804e57a4fab3a3d9d894a1db3039569babcc79 Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Fri, 5 Jul 2019 12:53:08 -0700 Subject: [PATCH 13/23] bright --- bright | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/bright b/bright index 2abe77d..11c1ea5 100755 --- a/bright +++ b/bright @@ -2,7 +2,7 @@ # this part is only used for startup scripts mainly if [ ! -z "$1" ] then - screens="$(xrandr | grep ' connected' | awk '{print $1}')" + screens="`xrandr | grep ' connected' | awk '{print $1}'`" for s in $screens; do xrandr --output "$s" --brightness "0.7" echo xrandr --output "$s" --brightness "0.7" @@ -10,13 +10,14 @@ then exit 0 fi -# Changes brightness through dmenu (because il ike my eyes) -level=$(echo "$(seq 1 100)" | dmenu -i -p 'Brightnesss from 1-100') -[ -z "$level" ] && exit 0 -percentage=$(echo "scale=2;" "$level/100" | bc -l) -[ -z "$percentage" ] && exit 0 +# Changes brightness through dmenu (because i like my eyes) +level=`seq 1 100 | dmenu -i -p 'Brightnesss from 1-100'` +if [ -z "$level" ]; then exit; fi -screens="$(xrandr | grep ' connected' | awk '{print $1}')" +percentage=`echo "scale=2;" "$level/100" | bc -l` +if [ -z "$percentage" ]; then exit; fi + +screens="`xrandr | grep ' connected' | awk '{print $1}'`" for scr in $screens;do xrandr --output "$scr" --brightness $percentage done From 6de10846e6a8710eff81be941a9f0260542c9dbc Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Fri, 5 Jul 2019 12:57:15 -0700 Subject: [PATCH 14/23] fixed some todo's bashism things --- readme.md | 12 +----------- wed | 5 +++-- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/readme.md b/readme.md index 6702fc0..1fece4e 100644 --- a/readme.md +++ b/readme.md @@ -15,18 +15,8 @@ Scale 0-5 * 0 = High priority * 5 = Low priority -bright -* Remove some bashism that the script is heavily reliant on - -usbm +usbm 0 * Actually finishing the userland mount script -wed - -* Remove bashism's from wifi enabler/disabler - -ytdl - -* Remove bashism's from ytdl script diff --git a/wed b/wed index a3af57e..1cc2a70 100755 --- a/wed +++ b/wed @@ -1,4 +1,5 @@ #!/bin/bash -choice=$(printf "on\noff" | dmenu -i -p "Wifi $(nmcli r w)") -[ -z "$choice" ] && exit 0 +stat=`nmcli r w` +choice=`printf "on\noff" | dmenu -i -p "Wifi $stat"` +if [ -z "$choice" ]; then exit;fi nmcli r w $choice From 6c34743c373c072341507ba85670e5bbcf8b146e Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Fri, 5 Jul 2019 14:17:10 -0700 Subject: [PATCH 15/23] mildly working usb mount script --- usm | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) mode change 100644 => 100755 usm diff --git a/usm b/usm old mode 100644 new mode 100755 index 4101253..8066f69 --- a/usm +++ b/usm @@ -1,10 +1,27 @@ #!/bin/sh # pick out the drive but not sda because thats the main drive choice=`lsblk -lp | \ - grep 'disk $' | awk '{print $1, $4}' | grep -v 'sda' | \ - dmenu -i -p 'Drive to mount'` + grep 'disk ' | \ + awk '{print $1, $4}' | \ + dmenu -i -p 'Drive to (un)mount'` +if [ -z "$choice" ]; then exit; fi + +# Check if it's already mounted / something was even picked dev=`echo $choice | awk '{print $1}'` -if [ -z "$dev" ];then exit 0;fi -# Finally we can mount the thing -mkdir -p "/mnt/`basename $dev`" -mount "$dev" "$name" +name="`basename $dev`" +if [ -z "$dev" ]; then exit; fi +if grep -qs "$dev" /proc/mounts; +then + # unmount the drive + umount "~/.mounts/$name" + rm -d "~/.mounts/$name" + # check if we still need the .mounts directory or nah + if [ "`ls ~/.mounts/`" ] + then + rm -d ~/.mounts/ + fi +else + # Finally we can mount the thing + mkdir -p "~/.mounts/$name" + mount "$dev" "~/.mounts/$name" +fi From 24ade1af71d5a68daf70d6a9cd7736ec8fea97cf Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Fri, 5 Jul 2019 14:18:50 -0700 Subject: [PATCH 16/23] updated todo's --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 1fece4e..45fc018 100644 --- a/readme.md +++ b/readme.md @@ -19,4 +19,4 @@ Scale 0-5 usbm 0 * Actually finishing the userland mount script - +* Remove necessity for root From 188996e6377745b81158760016a27de0e3775ed7 Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Fri, 19 Jul 2019 20:01:03 -0700 Subject: [PATCH 17/23] meme script --- distro | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 distro diff --git a/distro b/distro new file mode 100755 index 0000000..55f5ae7 --- /dev/null +++ b/distro @@ -0,0 +1,41 @@ +#!/bin/sh +# Wanna look cool in desktop threads? here you go + +red='\033[1;31m' +green='\033[0;32m' +white='\033[1;37m' +nc='\033[0m' +clear +echo ' ..ooo. + .888888888. + 88"P""T"T888 8o' +echo " o8o ${red}8.8\"8 88o.\"8o${nc} 8o" +echo " 88 . ${red}o88o8 8 88.\"8${nc} 88P\"o" +echo " 88 o8 ${red}88 oo.8 888 8${nc} 888 88" +echo " 88 88 ${red}88o888\" 88\"${nc} o888 88" +echo " 88.\"8o.${red}\"T88P.88\"${nc}. 88888 88" +echo " 888.\"888.${red}\"88P\"${nc}.o8 8888 888" +echo ' "888o"8888oo8888 o888 o8P" + "8888.""888P"P.888".88P + "88888ooo 888P".o888 + ""8P"".oooooo8888P + .oo888ooo. 8888NICK8P8 +o88888"888"88o. "8888"".88 .oo888oo.. + 8888" "88 88888. 88".o88888888"888. + "8888o.""o 88"88o. o8".888"888"88 "88P + T888C.oo. "8."8"8 o8"o888 o88" ".=888" + 88888888o "8 8 8 .8 .8"88 8"".o888o8P + "8888C.o8o 8 8 8" 8 o" ...o"""8888 + "88888888 " 8 .8 8 88888888888" + "8888888o .8o=" o8o..o(8oo88" + "888" 88" 888888888"" + o8P "888""" + ...oo88' + +# Now some diagnostic shit idk man +#echo "Packages installed: ${red}`dpkg --get-selections | grep -v deinstall | wc -l`${nc} +echo "Distro: ${green}`uname -v | awk '{print $3}'`${nc} +Kernel: ${white}`uname -o`${nc}" +echo "=|:^) Art: https://www.asciiart.eu/plants/flowers =|:^)" +scrot + From ac2594dc0f02d08bef0cd1fb4082143e18055865 Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Sat, 20 Jul 2019 19:09:20 -0700 Subject: [PATCH 18/23] dwm status line and lame script --- bruh | 8 +++ dwm-stat/.gitignore | 1 + dwm-stat/Makefile | 8 +++ dwm-stat/status.c | 123 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 140 insertions(+) create mode 100755 bruh create mode 100644 dwm-stat/.gitignore create mode 100644 dwm-stat/Makefile create mode 100644 dwm-stat/status.c diff --git a/bruh b/bruh new file mode 100755 index 0000000..32ce003 --- /dev/null +++ b/bruh @@ -0,0 +1,8 @@ +#!/bin/sh +# This is only here because my xserver is rarted +# in other words i setup my own rice every login by hand :( +newbg +bright 60 +compton -b + + diff --git a/dwm-stat/.gitignore b/dwm-stat/.gitignore new file mode 100644 index 0000000..ecd951a --- /dev/null +++ b/dwm-stat/.gitignore @@ -0,0 +1 @@ +statline diff --git a/dwm-stat/Makefile b/dwm-stat/Makefile new file mode 100644 index 0000000..87d0b39 --- /dev/null +++ b/dwm-stat/Makefile @@ -0,0 +1,8 @@ +stat: + gcc -o statline status.c -O2 -s -lX11 + +clean: + rm -f statline + +install: + ln -s $(shell pwd)/statline /usr/bin/statline diff --git a/dwm-stat/status.c b/dwm-stat/status.c new file mode 100644 index 0000000..bce3cbb --- /dev/null +++ b/dwm-stat/status.c @@ -0,0 +1,123 @@ +// statline by shockrah +// Inspired by barM +// barM is a great tool but formats information in a really ugly fashion +// This version mainly aims to ve a visual overhaul of both code and output over barM +// Dependancies: cat grep awk + +// Define these however you like +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BASIC_MSG "/comfy/ o clock | " +#define TIME_FORMAT "%I:%M%p - %d %b %Y" + +#define TIME_DELAY 3 +#define MAXSTR 1024 + +#define MEM_BREAD_SIZE 32 +#define STD_IO + +// `man date` should give you some more info on what the format specs do +// This format give the form ยป 05:13 PM - 20 Jul 2019 +static char* +date_time(void) +{ + static char date[MAXSTR]; + time_t now = time(0); + + strftime(date, sizeof(date), TIME_FORMAT, localtime(&now)); + return date; +} + +char* +ram_usage(void) +{ + struct sysinfo info; + sysinfo(&info); + static char buf[MAXSTR]; + long sum; + + // TODO: fix the Lazily reading through /proc/meminfo + FILE* res = popen("cat /proc/meminfo | grep -e ^Cached -e Buffers -e Slab | awk '{print $2}'", "r"); + if(res) { + sum = 0; + while(fgets(buf, sizeof(buf)-1, res) != NULL) { + sum += atoi(buf); + } + sum *= 1000; // KB to B + } + double used = (info.totalram - info.freeram - sum) / 1000000000.; + double total = info.totalram / 1000000000.; + + snprintf(buf, sizeof(buf), "%.2f G/ %.1f G", used, total); + return buf; +} + +static char* +cpu_usage(void) +{ + return "CPU Usage Placeholder"; +} + +static void +XSetRoot(char* name) +{ + Display *display; + + if (( display = XOpenDisplay(0x0)) == NULL ) { + fprintf(stderr, "[barM] cannot open display!\n"); + exit(1); + } + + XStoreName(display, DefaultRootWindow(display), name); + XSync(display, 0); + + XCloseDisplay(display); +} + +int +main(void) +{ + // Here you can put the functions you create as they should be executed from here + static char* (*func_table[])(void) = { + ram_usage, + date_time, + }; + + char stat_output[MAXSTR]; + // First things that don't need updating like ever + int base_len = snprintf(stat_output, sizeof(stat_output), BASIC_MSG); + char* base_offset = stat_output + base_len; + + // Make sure we didn't go past the end of our buffer + if(base_offset >= sizeof(stat_output)+stat_output) { + XSetRoot(stat_output); + return 1; + } + // Now the regularly updated stuff like date/time cpu usage etc. + int len; + for(;;) { + int remainder = sizeof(stat_output) - base_len; // starting position for 'dynamic text' + char* tmp_base_ptr = base_offset; + for(int i = 0; i < sizeof(func_table)/sizeof(func_table[0]); ++i) { + if(tmp_base_ptr > (stat_output+MAXSTR)) { + break; + } + + int written = snprintf(tmp_base_ptr, remainder, "%s | ", func_table[i]()); + tmp_base_ptr += written; + remainder -= written; + } + + XSetRoot(stat_output); + sleep(TIME_DELAY); + } + return 0; +} From a2d4fe7219b50561e442b52259bee85fa0c8f25b Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Sat, 20 Jul 2019 19:11:21 -0700 Subject: [PATCH 19/23] nearly forgot to close pipe in status line --- dwm-stat/status.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dwm-stat/status.c b/dwm-stat/status.c index bce3cbb..9be2f86 100644 --- a/dwm-stat/status.c +++ b/dwm-stat/status.c @@ -57,6 +57,7 @@ ram_usage(void) double total = info.totalram / 1000000000.; snprintf(buf, sizeof(buf), "%.2f G/ %.1f G", used, total); + pclose(res); return buf; } From 88b3d3da482611ddbc6f8d1804606eab0540219d Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Sat, 20 Jul 2019 19:25:31 -0700 Subject: [PATCH 20/23] longer delay --- dwm-stat/status.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dwm-stat/status.c b/dwm-stat/status.c index 9be2f86..97cc212 100644 --- a/dwm-stat/status.c +++ b/dwm-stat/status.c @@ -18,7 +18,7 @@ #define BASIC_MSG "/comfy/ o clock | " #define TIME_FORMAT "%I:%M%p - %d %b %Y" -#define TIME_DELAY 3 +#define TIME_DELAY 5 #define MAXSTR 1024 #define MEM_BREAD_SIZE 32 From fa2706769ecbfc81d23c087daf0873d9af89aacb Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Sat, 3 Aug 2019 18:50:14 -0700 Subject: [PATCH 21/23] animated wallpaper script --- newbga | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 newbga diff --git a/newbga b/newbga new file mode 100755 index 0000000..fb49c59 --- /dev/null +++ b/newbga @@ -0,0 +1,36 @@ +#!/bin/sh +# Shoutout to mitchweaver on gitgub for the script as a useful base for this one +# Link to exact script: https://github.com/mitchweaver/bin/blob/master/mpv/mpvbg +# There's lots of good scripts in that repository so check them all out + +pkill -9 xwinwrap +cacheFile="${HOME}/.cache/mpvbg.pid" +base="/home/shockrah/Pictures/VPapes" + +# Pic two random video papes +pape1=`ls "${HOME}/Pictures/VPapes" | shuf | head -n 1` +pape2=`ls "${HOME}/Pictures/VPapes" | shuf | head -n 1` +while "$pape1" = "$pape2" +do + pape2=`ls "${HOME}/Pictures/VPapes" | shuf | head -n 1` +done + +mpv="mpv --wid WID --no-config --keepaspect=no --loop \ + --no-border --vd-lavc-fast --x11-bypass-compositor=no \ + --gapless-audio=yes --vo=x11 --hwdec=auto \ + --x11-name=mpvbg" + +# store our pid here so we can avoid killing our background later +# Example: $ kill $(pgrep mpv | grep -v $(pgrep -P $(cat ${HOME}/.cache/mpvbg.pid))) +# --- Here we are killing "all mpvs, except with THIS PID" +# --- This lets us kill a video we're watching, without stopping our desktop background! + + +# First monitor +xwinwrap -g 1920x1080 -ni -fdt -sh rectangle -un -b -nf -ov -- $mpv "$base/$pape1" & > /dev/null 2>&1 & +echo $! > ${HOME}/.cache/mpvbg.pid +# Second monitor +xwinwrap -g 1920x1080+1920+0 -ni -fdt -sh rectangle -un -b -nf -ov -- $mpv "$base/$pape2" & > /dev/null 2>&1 & +echo $! >> ${HOME}/.cache/mpvbg.pid + + From 8142d4bd4dfa896795e14ff8cc9b15fae048c471 Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Tue, 13 Aug 2019 02:58:56 -0700 Subject: [PATCH 22/23] power command to replace the systemctl thing --- power | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 power diff --git a/power b/power new file mode 100755 index 0000000..9512bcb --- /dev/null +++ b/power @@ -0,0 +1,17 @@ +#!/bin/sh + +off() { + systemctl poweroff +} +reboot() { + systemctl reboot +} + +opt=`printf 'Off\nReboot' | dmenu -i -p 'Power option'` +if [ -z "$opt"]; then exit 0;fi +if [ "$opt" = "Off" ] +then + off +else + reboot +fi From dc5cd96f974036f563ffd6c70b75ddd242d56fa1 Mon Sep 17 00:00:00 2001 From: shockrah Date: Sun, 25 Aug 2019 21:03:36 -0700 Subject: [PATCH 23/23] added safety to newga and sleep delay to distro script --- distro | 2 +- newbga | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/distro b/distro index 55f5ae7..fa64336 100755 --- a/distro +++ b/distro @@ -37,5 +37,5 @@ o88888"888"88o. "8888"".88 .oo888oo.. echo "Distro: ${green}`uname -v | awk '{print $3}'`${nc} Kernel: ${white}`uname -o`${nc}" echo "=|:^) Art: https://www.asciiart.eu/plants/flowers =|:^)" -scrot +sleep 1 diff --git a/newbga b/newbga index fb49c59..110f8d9 100755 --- a/newbga +++ b/newbga @@ -29,6 +29,13 @@ mpv="mpv --wid WID --no-config --keepaspect=no --loop \ # First monitor xwinwrap -g 1920x1080 -ni -fdt -sh rectangle -un -b -nf -ov -- $mpv "$base/$pape1" & > /dev/null 2>&1 & echo $! > ${HOME}/.cache/mpvbg.pid + +# Quick check if we even have a second monitor at all +c=`xrandr | grep ' connected' | wc -l` +if $c = "1" +then + exit +fi # Second monitor xwinwrap -g 1920x1080+1920+0 -ni -fdt -sh rectangle -un -b -nf -ov -- $mpv "$base/$pape2" & > /dev/null 2>&1 & echo $! >> ${HOME}/.cache/mpvbg.pid