From 6a498b98cac0d4c43e87dfeb2bcdded8b0284ecd Mon Sep 17 00:00:00 2001 From: "Dr. Amr Osman" Date: Tue, 5 Mar 2019 17:19:18 +0200 Subject: [PATCH] Fork --- .config/compton.conf | 42 +++++++++++++ .config/i3/config | 114 +++++++++++++++++++++++++++------- .scripts/SCRIPTS.md | 2 +- .scripts/i3cmds/camtoggle | 2 +- .scripts/i3cmds/displayselect | 4 +- .scripts/i3cmds/myCloud | 15 +++++ .scripts/i3cmds/mycloudoff | 10 +++ .scripts/i3cmds/umountMyCloud | 2 + .scripts/i3cmds/vifmimg | 53 ++++++++++++++++ .scripts/i3cmds/vifmrun | 15 +++++ .scripts/statusbar/battery | 32 +++++----- .scripts/statusbar/brightness | 10 +++ .scripts/statusbar/layswitch | 21 +++++++ .scripts/statusbar/mailbox | 3 +- .scripts/statusbar/mycloud | 8 +++ .scripts/statusbar/popupgrade | 1 + .scripts/statusbar/weather | 2 +- .scripts/tools/ifinstalled | 2 +- .scripts/tools/lockr | 3 + .scripts/tools/note | 8 +++ .scripts/tools/remaps | 6 +- .scripts/tools/setbg | 2 +- 22 files changed, 308 insertions(+), 49 deletions(-) create mode 100644 .config/compton.conf create mode 100755 .scripts/i3cmds/myCloud create mode 100755 .scripts/i3cmds/mycloudoff create mode 100755 .scripts/i3cmds/umountMyCloud create mode 100755 .scripts/i3cmds/vifmimg create mode 100755 .scripts/i3cmds/vifmrun create mode 100755 .scripts/statusbar/brightness create mode 100755 .scripts/statusbar/layswitch create mode 100755 .scripts/statusbar/mycloud create mode 100755 .scripts/tools/lockr create mode 100755 .scripts/tools/note diff --git a/.config/compton.conf b/.config/compton.conf new file mode 100644 index 00000000..cc25fdb4 --- /dev/null +++ b/.config/compton.conf @@ -0,0 +1,42 @@ +# basic configuration + +backend = "glx"; +glx-no-stencil = true; +vsync = "opengl-swc" + +glx-swap-method = 1; +xrender-sync-fence = true; +mark-ovredir-focused = true; +inactive-opacity = 0.9 +opacity = 0.9; +# transparancy settings for i3 +opacity-rule = [ + "0:_NET_WM_STATE@:32a *= +'_NET_WM_STATE_HIDDEN'" +]; + +shadow-exclude = [ +"name = 'Notification'", +"name *= 'compton'", +"class_g = 'Firefox'", +"class_g = 'Conky'", +"class_g = 'Vlc'", +"class_g = 'tor-browser-en'" +]; + +fade-exclude = [ +"class_g = 'Firefox'", +"class_g = 'tor-browser-en'" +]; + +focus-exclude = [ +"class_g = 'Firefox'", +"class_g = 'tor-browser-en'" +]; + +opacity-exclude = [ +"class_g = 'Firefox'" +"class_g = 'tor-browser-en'" +"class_g = 'mpv'" +"class_g = 'mpvfloat'" +]; diff --git a/.config/i3/config b/.config/i3/config index 46effce1..bc01975d 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -19,9 +19,11 @@ # #---Basic Definitions---# # # Needed for i3-gaps -for_window [class="^.*"] border pixel 2 -gaps inner 15 -gaps outer 15 +#new_window normal +for_window [class="^.*"] border pixel 3 +for_window [class="mpv"] floating enable +gaps inner 5 +gaps outer 5 set $term --no-startup-id $TERMINAL set $mod Mod4 set $stoprec --no-startup-id dmenurecord kill @@ -29,6 +31,7 @@ set $shutdown sudo -A shutdown -h now set $reboot sudo -A reboot set $netrefresh --no-startup-id sudo -A systemctl restart NetworkManager set $hibernate sudo -A systemctl suspend +floating_modifier $mod # #---Dropdown Windows---# # @@ -44,6 +47,9 @@ for_window [instance="dropdown_dropdowncalc"] border pixel 2 for_window [instance="dropdown_*"] move position center # #---Starting External Scripts---# # +#lock +exec --no-startup-id lockr +#-e -f -c 1d2021 # mpd startup exec --no-startup-id mpd # Setting the background: @@ -51,7 +57,8 @@ exec --no-startup-id setbg # Starts dunst for notifications: exec --no-startup-id dunst # Composite manager: -exec --no-startup-id xcompmgr +exec --no-startup-id compton --config ~/.config/compton.conf -b +#exec --no-startup-id xcompmgr # Runs the key remapping scripts exec --no-startup-id remaps # Unclutter makes the mouse invisible after a brief period @@ -60,9 +67,50 @@ exec --no-startup-id unclutter exec_always --no-startup-id mpdupdate # Podboat automatic queue and download exec_always --no-startup-id podentr +# project to HDMI +exec_always --no-startup-id /usr/bin/project2HDMI & +# start bluetooth +#exec_always --no-startup-id /usr/bin/blueman-manager & +#set bilang +exec_always --no-startup-id setxkbmap -layout fi,ara & + +# Set Xresources colors: +set_from_resource $darkblack color0 #000000 +set_from_resource $black color8 #000000 +set_from_resource $darkred color1 #000000 +set_from_resource $red color9 #000000 +set_from_resource $darkgreen color2 #000000 +set_from_resource $green color10 #000000 +set_from_resource $darkyellow color3 #000000 +set_from_resource $yellow color11 #000000 +set_from_resource $darkblue color4 #000000 +set_from_resource $blue color12 #000000 +set_from_resource $darkmagenta color5 #000000 +set_from_resource $magenta color13 #000000 +set_from_resource $darkcyan color6 #000000 +set_from_resource $cyan color14 #000000 +set_from_resource $darkwhite color7 #000000 +set_from_resource $white color15 #000000 +set $transparent #00000000 + +# BORDER BACKGROUND TEXT INDICATOR CHILD_BORDER +client.focused $red $red $magenta $darkmagenta $darkblue +client.unfocused $transparent $blue $white $darkblue $darkblack +client.focused_inactive $transparent $blue $white $darkblue $darkblack +client.urgent $darkred $darkred $black $darkred $darkred +client.background $black bar { - font pango:mono 10 + font pango:Ubuntu 9 + colors { + background $darkblack + statusline $darkwhite + separator $cyan + focused_workspace $blue $darkblue $darkblack + active_workspace $blue $blue $darkwhite + inactive_workspace $darkblack $darkblack $white + urgent_workspace $darkblack $darkblack $white + } status_command i3blocks position top mode dock @@ -72,46 +120,53 @@ bar { # #---Basic Bindings---# # bindsym $mod+Return exec $term bindsym $mod+Shift+Return exec --no-startup-id samedir +#bindsym $mod+section exec $term + + bindsym $mod+Shift+space floating toggle bindsym $mod+space focus mode_toggle -bindsym $mod+Escape workspace prev -bindsym $mod+Shift+Escape exec --no-startup-id prompt "Exit i3?" "i3-msg exit" +#bindsym $mod+Escape workspace prev +#bindsym $mod+Shift+Escape exec --no-startup-id prompt "Exit i3?" "i3-msg exit" +bindsym $mod+Shift+Escape exec --no-startup-id prompt "Shutdown computer?" "$shutdown" + # bindsym $mod+BackSpace bindsym $mod+Shift+BackSpace exec --no-startup-id prompt "Reboot computer?" "$reboot" -bindsym $mod+grave exec --no-startup-id dmenuunicode +bindsym $mod+u exec --no-startup-id dmenuunicode ##bindsym $mod+asciitilde #STOP/HIDE EVERYTHING: bindsym $mod+Shift+Delete exec --no-startup-id lmc truemute ; exec --no-startup-id lmc pause ; exec --no-startup-id pauseallmpv; workspace 0; exec $term -e htop ; exec $term -e $FILE # Show selection: -bindsym $mod+Insert exec --no-startup-id showclip -bindsym $mod+Pause exec --no-startup-id xcqr +bindsym $mod+Shift+Home exec --no-startup-id showclip +bindsym $mod+Shift+End exec --no-startup-id xcqr # #---Letter Key Bindings---# # bindsym $mod+q [con_id="__focused__" instance="^(?!dropdown_).*$"] kill bindsym $mod+Shift+q [con_id="__focused__" instance="^(?!dropdown_).*$"] kill -bindsym $mod+w exec $term -e nmtui -bindsym $mod+Shift+w exec --no-startup-id $BROWSER +bindsym $mod+Shift+w exec $term -e nmtui +bindsym $mod+w exec --no-startup-id $BROWSER +bindsym $mod+Ctrl+w exec --no-startup-id tor-browser-en bindsym $mod+e exec $term -e neomutt && pkill -RTMIN+12 i3blocks bindsym $mod+Shift+e exec --no-startup-id tutorialvids bindsym $mod+r exec $term -e $FILE -bindsym $mod+Shift+r exec --no-startup-id winresize +bindsym $mod+Ctrl+r exec --no-startup-id winresize +bindsym $mod+Shift+r exec $term -e vifmrun bindsym $mod+t split toggle bindsym $mod+Shift+t gaps inner current set 15; gaps outer current set 15 -bindsym $mod+y exec $term -e calcurse -D ~/.config/calcurse +bindsym $mod+y exec $term -e calcurse bindsym $mod+Shift+y exec --no-startup-id i3resize left -bindsym $mod+u exec --no-startup-id ddspawn tmuxdd +#bindsym $mod+u exec --no-startup-id ddspawn tmuxdd bindsym $mod+Shift+u exec --no-startup-id i3resize down bindsym $mod+i exec $term -e htop @@ -157,7 +212,8 @@ bindsym $mod+Shift+l move right 30 bindsym $mod+z gaps outer current plus 5 bindsym $mod+Shift+z gaps outer current minus 5 -bindsym $mod+x exec --no-startup-id mpc pause; exec --no-startup-id pauseallmpv ; exec --no-startup-id i3lock -e -f -c 1d2021 +bindsym $mod+x exec --no-startup-id mpc pause; exec --no-startup-id pauseallmpv ; exec --no-startup-id lockr +#-e -f -c 1d2021 bindsym $mod+Shift+x exec --no-startup-id prompt "Shutdown computer?" "$shutdown" bindsym $mod+c exec --no-startup-id freealf @@ -177,9 +233,9 @@ bindsym $mod+Shift+m exec --no-startup-id lmc mute # #---Workspace Bindings---# # bindsym $mod+Home workspace $ws1 -bindsym $mod+Shift+Home move container to workspace $ws1 +#bindsym $mod+Shift+Home move container to workspace $ws1 bindsym $mod+End workspace $ws10 -bindsym $mod+Shift+End move container to workspace $ws10 +#bindsym $mod+Shift+End move container to workspace $ws10 bindsym $mod+Prior workspace prev bindsym $mod+Shift+Prior move container to workspace prev bindsym $mod+Next workspace next @@ -256,7 +312,9 @@ bindsym $mod+F8 exec --no-startup-id ~/.config/mutt/etc/mailsync.sh bindsym $mod+F9 exec --no-startup-id dmenumount bindsym $mod+F10 exec --no-startup-id dmenuumount bindsym $mod+F11 exec --no-startup-id ducksearch -bindsym $mod+F12 exec $term -e nmtui +#bindsym $mod+F12 exec $term -e nmtui +bindsym $mod+F12 exec --no-startup-id clipmenu -i -fn Ubuntu:size=10 -nb '#002b36' -nf '#839496' -sb '#073642' -sf '#93a1a1' +bindsym $mod+Shift+F9 exec --no-startup-id myCloud && pkill -RTMIN+17 i3blocks # #---Arrow Keys---# # bindsym $mod+Left focus left @@ -292,7 +350,7 @@ bindsym Shift+Print exec --no-startup-id maimpick bindsym $mod+Print exec --no-startup-id dmenurecord bindsym $mod+Scroll_Lock exec --no-startup-id "killall screenkey || screenkey" bindsym $mod+Delete exec $stoprec -bindsym XF86Launch1 exec --no-startup-id xset dpms force off +bindsym $mod+BackSpace exec --no-startup-id xset dpms force off # #---Extra XF86 Keys---# # # These are the extra media keys that some keyboards have. @@ -303,13 +361,13 @@ bindsym Control+XF86AudioLowerVolume exec --no-startup-id lmc down 1 bindsym XF86AudioRaiseVolume exec --no-startup-id lmc up 5 bindsym Shift+XF86AudioRaiseVolume exec --no-startup-id lmc up 10 bindsym Control+XF86AudioRaiseVolume exec --no-startup-id lmc up 1 -bindsym XF86PowerOff exec --no-startup-id prompt "Shutdown computer?" "$shutdown" +#bindsym XF86PowerOff exec --no-startup-id prompt "Shutdown computer?" "$shutdown" ##bindsym XF86Copy exec ##bindsym XF86Open exec ##bindsym XF86Paste exec ##bindsym XF86Cut exec ##bindsym XF86MenuKB exec -bindsym XF86Calculator exec --no-startup-id ddspawn dropdowncalc -f mono:pixelsize=24 +bindsym XF86Calculator exec $term -e R -q --no-save ##bindsym XF86Sleep This binding is typically mapped by systemd automatically. ##bindsym XF86WakeUp exec bindsym XF86Explorer exec $term -e $FILE @@ -363,8 +421,8 @@ bindsym XF86Search exec $BROWSER https://duckduckgo.com ##bindsym XF86Finance exec ##bindsym XF86Game exec bindsym XF86Shop exec $BROWSER https://ebay.com -bindsym XF86MonBrightnessDown exec --no-startup-id xbacklight -dec 15 -bindsym XF86MonBrightnessUp exec --no-startup-id xbacklight -inc 15 +bindsym XF86MonBrightnessDown exec --no-startup-id xbacklight -dec 5 && pkill -RTMIN+16 i3blocks +bindsym XF86MonBrightnessUp exec --no-startup-id xbacklight -inc 5 && pkill -RTMIN+16 i3blocks bindsym XF86AudioMedia exec --no-startup-id $term -e ncmpcpp bindsym XF86Display exec --no-startup-id displayselect #bindsym XF86KbdLightOnOff exec @@ -377,3 +435,11 @@ bindsym XF86Documents exec $term -e $FILE ~/Documents ##bindsym XF86Battery exec ##bindsym XF86Bluetooth exec bindsym XF86WLAN exec $netrefresh +bindsym $mod+period exec /usr/lib/virtualbox/VirtualBoxVM --comment 'w7litex86' --startvm '{196d2f4b-8a17-44fb-b05f-4a20cc87a212}' + +#/usr/lib/virtualbox/VirtualBoxVM --comment 'w7litex86' --startvm '{196d2f4b-8a17-44fb-b05f-4a20cc87a212}'" + +exec_always --no-startup-id notify-send -i ~/.scripts/pix/larbs.png 'Welcome to LARBS: Press Super+F1 for the manual.' -t 10000 + + +bindsym $mod+section exec --no-startup-id xkblayout-state set +1 && pkill -RTMIN+17 i3blocks diff --git a/.scripts/SCRIPTS.md b/.scripts/SCRIPTS.md index a99e35e3..34bb01bb 100644 --- a/.scripts/SCRIPTS.md +++ b/.scripts/SCRIPTS.md @@ -54,7 +54,7 @@ in vim or another program. - `opout` -- "Open output", opens the corresponding `.pdf` file if run on a `.md`, `.tex` or `.rmd` file, or if given an `.html` file, will open it in the browser. Bound to `p` in my vim config to reveal typical output. - `pauseallmpv` -- Pauses all mpv instances by sending the `,` key to each. Used by several scripts, but can be used alone as well. It will not pause an audio only mpv instance. If you know how to add a hack to do this, feel free to PR it or email me an addition. - `remaps` -- Remaps capslock to escape when pressed and super/mod when held. Maps the menu key to super as well. Runs the US international keyboard setup. If you want another keyboard setup, edit this fine. -- `shortcuts` -- For updating bash and ranger shortcuts. Reads `~/.config/bmdirs` and `~/.config/bmfiles` for pairs of keypresses and directories and files, then autoproduces bash aliases and ranger shortcuts for them which output to `~/.config/shortcutrc` and `~/.config/ranger/shortcuts.conf` respectively. These are read automatically by my bash and ranger configs. You don't have to run this script manually though, as it's run by vim whenever you edit one of the `~/.bm*` files. +- `shortcuts` -- For updating bash and ranger shortcuts. Reads `~/.key_directories` and `~/.key_files` for pairs of keypresses and directories and files, then autoproduces bash aliases and ranger shortcuts for them which output to `~/.shortcuts` and `~/.config/ranger/shortcuts.conf` respectively. These are read automatically by my bash and ranger configs. You don't have to run this script manually though, as it's run by vim whenever you edit one of the `~/.key_*` files. - `speedvid` -- Speed up a given video file (`$1`) by a given ammount (`$2`). - `tpb` -- Search Pirate Bay for the certain search terms given as arguments. - `texclear` -- Remove all `.tex` related build files. This is run by my vim when I stop editing any `.tex` file. diff --git a/.scripts/i3cmds/camtoggle b/.scripts/i3cmds/camtoggle index 05679c0c..eac7c9e1 100755 --- a/.scripts/i3cmds/camtoggle +++ b/.scripts/i3cmds/camtoggle @@ -1,2 +1,2 @@ #!/bin/sh -pkill -f /dev/video || mpv --no-osc --no-input-default-bindings --input-conf=/dev/null --geometry=-0-0 --autofit=30% --title="mpvfloat" /dev/video0 +pkill -f /dev/video || mpv --no-osc --no-input-default-bindings --input-conf=/dev/null --geometry=-0-0 --autofit=15% --title="mpvfloat" /dev/video0 diff --git a/.scripts/i3cmds/displayselect b/.scripts/i3cmds/displayselect index e5260142..8ea5327c 100755 --- a/.scripts/i3cmds/displayselect +++ b/.scripts/i3cmds/displayselect @@ -36,7 +36,7 @@ twoscreen() { # If multi-monitor is selected and there are two screens. secondary=$(echo "$screens" | grep -v "$primary") direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?") xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0 - fi +fi } morescreen() { # If multi-monitor is selected and there are more than two screens. @@ -65,7 +65,7 @@ chosen=$(printf "%s\\nmulti-monitor\\nmanual selection" "$screens" | dmenu -i -p case "$chosen" in "manual selection") arandr ; exit ;; "multi-monitor") multimon ;; - *) xrandr --output "$chosen" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "$chosen" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ') ;; + *) xrandr --output "$chosen" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "$chosen" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ');; esac setbg # Fix background if screen size/arangement has changed. diff --git a/.scripts/i3cmds/myCloud b/.scripts/i3cmds/myCloud new file mode 100755 index 00000000..6213c783 --- /dev/null +++ b/.scripts/i3cmds/myCloud @@ -0,0 +1,15 @@ +#!/bin/bash +if [ $(mount | grep -c ~/MyCloud) != 1 ] +then + echo "12345" | sshfs root@192.168.1.3:/opt/MyCloud ~/MyCloud -o idmap=user,uid=1000,gid=1000,password_stdin,reconnect,allow_other,default_permissions,cache=yes,kernel_cache,no_readahead,reconnect,ServerAliveInterval=15,ServerAliveCountMax=3,compression=no && notify-send "MyCloudDisk was mounted successfuly" || notify-send "MyCloudDisk was not mounted" + +else + fusermount -u ~/MyCloud && notify-send "MyCloudDisk was unmounted successfuly" || notify-send "Unmount Failed" +fi + +if [ $(mount | grep -c ~/MyCloud) == 1 ] +then + echo 😄 +else + echo 😞 +fi diff --git a/.scripts/i3cmds/mycloudoff b/.scripts/i3cmds/mycloudoff new file mode 100755 index 00000000..5f573cbf --- /dev/null +++ b/.scripts/i3cmds/mycloudoff @@ -0,0 +1,10 @@ +#!/bin/sh +ask() { \ + case $(printf "Yes\\nNo" | dmenu -i -p "Are you sure?") in + Yes) sshpass -p 12345 ssh root@192.168.1.3 PowerOff;; + No) echo "!";; + esac + } + +ask + diff --git a/.scripts/i3cmds/umountMyCloud b/.scripts/i3cmds/umountMyCloud new file mode 100755 index 00000000..da9c4406 --- /dev/null +++ b/.scripts/i3cmds/umountMyCloud @@ -0,0 +1,2 @@ +#!/bin/bash +fusermount -u ~/MyCloud && notify-send "MyCloudDisk was unmounted successfuly" || notify-send "Unmount Failed" diff --git a/.scripts/i3cmds/vifmimg b/.scripts/i3cmds/vifmimg new file mode 100755 index 00000000..e5d8763a --- /dev/null +++ b/.scripts/i3cmds/vifmimg @@ -0,0 +1,53 @@ +#!/usr/bin/env bash +readonly ID_PREVIEW="preview" + +#AUTO_REMOVE="yes" +# By enabling this option the script will remove the preview file after it is drawn +# and by doing so the preview will always be up-to-date with the file. +# This however, requires more CPU and therefore affects the overall performance. + +if [ -e "$FIFO_UEBERZUG" ]; then + if [[ "$1" == "draw" ]]; then + declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" + [x]="$2" [y]="$3" [width]="$4" [height]="$5" \ + [path]="${PWD}/$6") \ + > "$FIFO_UEBERZUG" + + elif [[ "$1" == "videopreview" ]]; then + echo -e "Loading preview..\nFile: $6" + [[ ! -d "/tmp${PWD}/$6/" ]] && mkdir -p "/tmp${PWD}/$6/" + [[ ! -f "/tmp${PWD}/$6.png" ]] && ffmpegthumbnailer -i "${PWD}/$6" -o "/tmp${PWD}/$6.png" -s 0 -q 10 + declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" + [x]="$2" [y]="$3" [width]="$4" [height]="$5" \ + [path]="/tmp${PWD}/$6.png") \ + > "$FIFO_UEBERZUG" + + elif [[ "$1" == "gifpreview" ]]; then + echo -e "Loading preview..\nFile: $6" + [[ ! -d "/tmp${PWD}/$6/" ]] && mkdir -p "/tmp${PWD}/$6/" && convert -coalesce "${PWD}/$6" "/tmp${PWD}/$6/$6.png" + for frame in $(ls -1 /tmp${PWD}/$6/$6*.png | sort -V); do + declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" + [x]="$2" [y]="$3" [width]="$4" [height]="$5" \ + [path]="$frame") \ + > "$FIFO_UEBERZUG" + # Sleep between frames to make the animation smooth. + sleep .07 + done + + elif [[ "$1" == "pdfpreview" ]]; then + echo -e "Loading preview..\nFile: $6" + [[ ! -d "/tmp${PWD}/$6/" ]] && mkdir -p "/tmp${PWD}/$6/" + [[ ! -f "/tmp${PWD}/$6.png" ]] && pdftoppm -png -singlefile "$6" "/tmp${PWD}/$6" + declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" + [x]="$2" [y]="$3" [width]="$4" [height]="$5" \ + [path]="/tmp${PWD}/$6.png") \ + > "$FIFO_UEBERZUG" + + elif [[ "$1" == "clear" ]]; then + declare -p -A cmd=([action]=remove [identifier]="$ID_PREVIEW") \ + > "$FIFO_UEBERZUG" + [[ ! -z $AUTO_REMOVE ]] && [[ -f "/tmp${PWD}/$6.png" ]] && rm -f "/tmp${PWD}/$6.png" + [[ ! -z $AUTO_REMOVE ]] && [[ -d "/tmp${PWD}/$6/" ]] && rm -rf "/tmp${PWD}/$6/" + + fi +fi diff --git a/.scripts/i3cmds/vifmrun b/.scripts/i3cmds/vifmrun new file mode 100755 index 00000000..9eda32a9 --- /dev/null +++ b/.scripts/i3cmds/vifmrun @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +export FIFO_UEBERZUG="/tmp/vifm-ueberzug-${PPID}" + +function cleanup { + rm "$FIFO_UEBERZUG" 2>/dev/null + pkill -P $$ 2>/dev/null +} + +rm "$FIFO_UEBERZUG" 2>/dev/null +mkfifo "$FIFO_UEBERZUG" +trap cleanup EXIT +tail --follow "$FIFO_UEBERZUG" | ueberzug layer --silent --parser bash & + +vifm +cleanup diff --git a/.scripts/statusbar/battery b/.scripts/statusbar/battery index e5f6ec79..49c2e9f6 100755 --- a/.scripts/statusbar/battery +++ b/.scripts/statusbar/battery @@ -1,33 +1,37 @@ #!/bin/sh # Give a battery name (e.g. BAT0) as an argument. +#if [ $1=="BAT0" ]; then +# battery=$(acpi | grep -i 'Battery 0') +#else +# battery=$(acpi | grep -i 'Battery 1') +#fi +battery="$(acpi -i)" + +# get xresources colors +for x in "$(xrdb -query | sed "s/.*\./export /g;s/:\s*/=\"/g;s/$/\"/g")"; do eval "$x"; done + + case $BLOCK_BUTTON in - 3) pgrep -x dunst >/dev/null && notify-send "🔋 Battery module: -🔋: discharging -🛑: not charging -♻: stagnant charge -🔌: charging -⚡: charged -❗: battery very low! -- Text color reflects charge left" ;; + 1) pgrep -x dunst >/dev/null && notify-send "${battery}";; esac capacity=$(cat /sys/class/power_supply/"$1"/capacity) || exit status=$(cat /sys/class/power_supply/"$1"/status) if [ "$capacity" -ge 75 ]; then - color="#00ff00" + color="$color10" elif [ "$capacity" -ge 50 ]; then - color="#ffffff" + color="$color15" elif [ "$capacity" -ge 25 ]; then - color="#ffff00" + color="$color11" else - color="#ff0000" + color="$color9" warn="❗" fi [ -z $warn ] && warn=" " -[ "$status" = "Charging" ] && color="#ffffff" +[ "$status" = "Charging" ] && color="$color15" -printf "%s%s%s" "$color" "$(echo "$status" | sed -e "s/,//;s/Discharging/🔋/;s/Not Charging/🛑/;s/Charging/🔌/;s/Unknown/♻️/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g")" "$warn" "$(echo "$capacity" | sed -e 's/$/%/')" +printf "%s%s%s" "$color" "$(echo "$status" | sed -e "s/,//g;s/Discharging/🔋/;s/Charging/🔌/;s/Unknown/♻️/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g")" "$warn" "$(echo "$capacity" | sed -e 's/$/%/')" diff --git a/.scripts/statusbar/brightness b/.scripts/statusbar/brightness new file mode 100755 index 00000000..00ee97d5 --- /dev/null +++ b/.scripts/statusbar/brightness @@ -0,0 +1,10 @@ +#!/bin/sh + +icon="🔆" + +case $BLOCK_BUTTON in + 4) xbacklight -inc 4 ;; + 5) xbacklight -dec 4 ;; +esac + +printf "%s %s%%\\n" "$icon" "$(echo "$(xbacklight -get)*100/100" | bc)" diff --git a/.scripts/statusbar/layswitch b/.scripts/statusbar/layswitch new file mode 100755 index 00000000..1cec6a0b --- /dev/null +++ b/.scripts/statusbar/layswitch @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +case $BLOCK_BUTTON in + 1) xkblayout-state set +1 ;; +esac + +LNG=$(xkblayout-state print %s | awk '{print toupper($0)}') + +case $LNG in + "FI") + #CLR=\#00FF00 ;; # green + LNG=🇫🇮;; + "ARA") + #CLR=\#FF0000 ;; # red + LNG=🇪🇬;; + *) + CLR=\#FFFFFF ;; # all others default-white +esac + +echo "$LNG" +echo "$LNG" +#echo "$CLR" diff --git a/.scripts/statusbar/mailbox b/.scripts/statusbar/mailbox index 0c5ccbe6..bb72c5d9 100755 --- a/.scripts/statusbar/mailbox +++ b/.scripts/statusbar/mailbox @@ -14,4 +14,5 @@ case $BLOCK_BUTTON in - Middle click syncs mail" ;; esac -echo "$(du -a ~/.mail/*/INBOX/new/* 2>/dev/null | sed -n '$=')$(cat /tmp/imapsyncicon 2>/dev/null)" +echo "$(du -a ~/.mail/*/INBOX/new/* 2>/dev/null | sed -n '$=')$(cat ~/.config/mutt/.dl 2>/dev/null)" + diff --git a/.scripts/statusbar/mycloud b/.scripts/statusbar/mycloud new file mode 100755 index 00000000..2f564bf8 --- /dev/null +++ b/.scripts/statusbar/mycloud @@ -0,0 +1,8 @@ +#!/bin/bash +if [ $(mount | grep -c ~/MyCloud) == 1 ] +then + echo 💾 +else + echo "" +fi + diff --git a/.scripts/statusbar/popupgrade b/.scripts/statusbar/popupgrade index 83035c34..739fcb79 100755 --- a/.scripts/statusbar/popupgrade +++ b/.scripts/statusbar/popupgrade @@ -3,6 +3,7 @@ printf "Beginning upgrade.\\n" yay -Syu +pacman -Qu | wc -l > ~/.pacupgrnum pkill -RTMIN+8 i3blocks printf "\\nUpgrade complete.\\nPress to exit window.\\n\\n" diff --git a/.scripts/statusbar/weather b/.scripts/statusbar/weather index f3699ee0..7eeccf20 100755 --- a/.scripts/statusbar/weather +++ b/.scripts/statusbar/weather @@ -1,5 +1,5 @@ #!/bin/sh -[ "$(stat -c %y /tmp/weatherreport | awk '{print $1}')" != "$(date '+%Y-%m-%d')" ] && getforecast +[ "$(stat -c %y /tmp/weatherreport | awk '{print $1}')" != "$(date '+%Y-%m-%d')" ] && getforecast Damietta case $BLOCK_BUTTON in 1) $TERMINAL -e less -S /tmp/weatherreport ;; diff --git a/.scripts/tools/ifinstalled b/.scripts/tools/ifinstalled index 0305f4fb..bbaaf115 100755 --- a/.scripts/tools/ifinstalled +++ b/.scripts/tools/ifinstalled @@ -1,3 +1,3 @@ #!/bin/sh # If $1 command is not available, error code and notify. -command -v "$1" >/dev/null || { notify-send "📦 $1 must be installed for this function." && exit 1 ;} +command -v "$1" >/dev/null || { notify-send -i "$PIX/larbs.svg" "$1 must be installed for this function." && exit 1 ;} diff --git a/.scripts/tools/lockr b/.scripts/tools/lockr new file mode 100755 index 00000000..1458d762 --- /dev/null +++ b/.scripts/tools/lockr @@ -0,0 +1,3 @@ +#!/bin/bash +#i3lock-fancy -f Comic-Sans-MS -- scrot -z +i3lock-fancy -b=25x5 diff --git a/.scripts/tools/note b/.scripts/tools/note new file mode 100755 index 00000000..09186eac --- /dev/null +++ b/.scripts/tools/note @@ -0,0 +1,8 @@ +#!/bin/sh +# This is a general notification command for my own ease. +# $1 should be a message +# $2 is an optional image for notify-send +# Echos content on terminal and if dunst is running, shows notification. + +[ -z "$2" ] || img="-i $2" +echo "$1" && pgrep -x dunst >/dev/null && notify-send $img "$1" diff --git a/.scripts/tools/remaps b/.scripts/tools/remaps index df7d6c91..aa18dbda 100755 --- a/.scripts/tools/remaps +++ b/.scripts/tools/remaps @@ -3,8 +3,8 @@ # Increase key speed via a rate change xset r rate 300 50 # Map the caps lock key to super... -setxkbmap -option caps:super +#setxkbmap -option caps:super # But when it is pressed only once, treat it as escape. -killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape' +#killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape' # Map the menu button to right super as well. -xmodmap -e 'keycode 135 = Super_R' +#xmodmap -e 'keycode 135 = Super_R' diff --git a/.scripts/tools/setbg b/.scripts/tools/setbg index 950ae7c6..f74ceace 100755 --- a/.scripts/tools/setbg +++ b/.scripts/tools/setbg @@ -1,4 +1,4 @@ #!/bin/sh # Sets the background. If given an argument, will set file as background. [ ! -z "$1" ] && cp "$1" ~/.config/wall.png && notify-send -i "$HOME/.config/wall.png" "Wallpaper changed." -xwallpaper --zoom ~/.config/wall.png +xwallpaper --stretch ~/.config/wall.png