Skip to content

Instantly share code, notes, and snippets.

@Alexander-Mages
Created August 7, 2021 21:43
Show Gist options
  • Save Alexander-Mages/ddf8f0488112294652e7e9982d9c9089 to your computer and use it in GitHub Desktop.
Save Alexander-Mages/ddf8f0488112294652e7e9982d9c9089 to your computer and use it in GitHub Desktop.
dotfiles
#!/bin/bash
# Usage:
# bartermapp [arg1] [arg2]
# arg1: terminal program to run
# arg2: number of times do apply additional
# x offset defined by xinterval
# Dependencies:
# tdrop
xoffset=0
xinterval=0
yoffset=37
width=852
height=850
terminal=urxvt
x=$(expr $xoffset + $xinterval \* $2 - $xinterval)
tdrop -a -w $width -h $height -x $x -y $yoffset -n $2 -f "-c stna -e bash -c 'bspc node -g sticky && $1'" $terminal &>/dev/null
tval=$(~/.config/polybar/scripts/taskbar/control-tab.sh $2)
if [ $tval == 0 ]; then
echo "%{F#666 B#1e1e20} $2%{F- B-}%{B#1e1e20} $3 %{B-}"
else
echo "%{F#666 B#2f2f34} $2%{F- B-}%{B#2f2f34} $3 %{B-}"
fi
#!/bin/bash
opentab=$1
tnum=1
open=$(awk -v lnum="$tnum" 'NR==lnum{ print $1 }' /dev/shm/polybar-tabs)
if [[ $tnum != $opentab && $open == 1 ]]; then
polybar-msg hook ranger 1
fi
tnum=2
open=$(awk -v lnum="$tnum" 'NR==lnum{ print $1 }' /dev/shm/polybar-tabs)
if [[ $tnum != $opentab && $open == 1 ]]; then
polybar-msg hook calcurse 1
fi
tnum=3
open=$(awk -v lnum="$tnum" 'NR==lnum{ print $1 }' /dev/shm/polybar-tabs)
if [[ $tnum != $opentab && $open == 1 ]]; then
polybar-msg hook notes 1
fi
tnum=4
open=$(awk -v lnum="$tnum" 'NR==lnum{ print $1 }' /dev/shm/polybar-tabs)
if [[ $tnum != $opentab && $open == 1 ]]; then
polybar-msg hook timer 1
fi
tnum=5
open=$(awk -v lnum="$tnum" 'NR==lnum{ print $1 }' /dev/shm/polybar-tabs)
if [[ $tnum != $opentab && $open == 1 ]]; then
polybar-msg hook email 1
fi
tnum=6
open=$(awk -v lnum="$tnum" 'NR==lnum{ print $1 }' /dev/shm/polybar-tabs)
if [[ $tnum != $opentab && $open == 1 ]]; then
polybar-msg hook htop 1
fi
[colors]
background = #aa000000
blue = #342fd4
nord = #81a1c1
light_blue = #4540c9
green = #a0c980
purple = #c882e7
orange = #d08770
gray = #676E95
red = #ec7279
yellow = #ECBE7B
[settings]
screenchange-reload = true
format-padding = 1
[bar/example]
width = 100%
height = 32
radius = 6.0
border-size = 4
fixed-center = true
enable-ipc = true
background = ${colors.background}
line-size = 2
padding-left = 0
padding-right = 0
font-0 = JetBrainsMono Nerd Font:style=Bold:pixelsize=11;3
font-1 = JetBrainsMono Nerd Font:size=18;5
font-2 = Material Design Icons:style=Bold:size=13;3
font-3 = unifont:fontformat=truetype:size=13:antialias=true;
modules-left = calcurse email ranger htop
modules-center = bspwm
modules-right = eth wlan memory cpu pulseaudio date time powermenu
tray-position = right
tray-padding = 2
wm-restack = bspwm
override-redirect = true
cursor-click = pointer
cursor-scroll = ns-resize
[module/bspwm]
type = internal/bspwm
pin-workspaces = true
inline-mode = true
format = <label-state>
label-focused = 
label-focused-foreground = ${colors.blue}
label-focused-padding = 1
label-occupied = 
label-occupied-foreground= ${colors.gray}
label-occupied-padding = 1
label-empty = 
label-empty-foreground = ${colors.grey}
label-empty-padding = 1
[module/memory]
type = custom/script
internal = 2
format-prefix = "﬙"
format-foreground = ${colors.yellow}
exec = ~/.local/bin/statusbar/memory
click-left = ~/.local/bin/statusbar/memory --popup
[module/cpu]
#type = internal/cpu
#interval = 0.5
#format-font = 1
#format = %{O8}<label>%{O20}
#format-foreground = ${colors.nord}
#label-font = 2
#label = %percentage%%{O5}
type = internal/cpu
interval = 1
format-prefix = " "
format-foreground = ${colors.nord}
label = %percentage%%
[module/powermenu]
type = custom/menu
content-foreground = ${colors.red}
menu-0-0 = %{F#ff7575}%{F-}
menu-0-0-exec = systemctl poweroff
menu-0-1 = %{F#ffbc75}%{F-}
menu-0-1-exec = bspc quit
menu-0-2 = %{F#fff945}勒%{F-}
menu-0-2-exec = systemctl reboot
menu-0-3 = %{F#00bcf5}鈴%{F-}%{O15}
menu-0-3-exec = systemctl suspend
label-open = %{O10}
label-close = %{F#ff8c8c}%{F-}
label-separator = %{O5}%{O5}
[module/wlan]
type = internal/network
interface = wlan0
interval = 1
format-connected = <label-connected>%{T2}
label-connected = %downspeed:9%
label-connected-font = 1
format-connected-foreground = #ffe252
#type = internal/network
#interface = net1
#interval = 3.0
##format-connected = "<ramp-signal> <label-connected>"
#format-connected-foreground = ${colors.foreground}
#format-connected-background = ${colors.background}
#label-connected = %essid% |  %downspeed:1:10%  %upspeed:1:10%
#label-connected-background = ${colors.background}
#format-disconnected-prefix = "睊 "
#format-disconnected-prefix-foreground = ${colors.green}
#format-disconnected-prefix-background = ${colors.background}
#format-disconnected-foreground = ${colors.foreground}
#format-disconnected-background = ${colors.background}
#format-disconnected = No-Wifi
#ramp-signal-0 = 直
#ramp-signal-foreground = ${colors.green}
#ramp-signal-background = ${colors.background}
[module/eth]
type = internal/network
interface = eth0
interval = 2
format-connected = ﯱ<label-connected>%{O20}
label-connected = %downspeed:9%
label-connected-font = 2
format-connected-foreground = #ffe252
#type = internal/network
#interface = eno1
#interval = 1.0
#accumulate-stats = true
#format-eth-padding = 1
#format-connected = "<ramp-signal> <label-connected>"
#format-connected-background = #8fbcbb
#format-connected-padding = 1
#label-connected = ↓%downspeed% | ↑%upspeed%
#format-disconnected-prefix = "睊"
#format-disconnected-background = #8fbcbb
#ramp-signal-0 = 直
[module/date]
type = internal/date
interval = 5
date = " %h %d %a"
date-alt = " %Y-%m-%d"
format-foreground= ${colors.light_blue}
label = %date%
[module/time]
type = internal/date
interval = 1
time = " %I:%M %p"
time-alt = " %H:%M:%S"
format-foreground = ${colors.yellow}
label = %time%
[module/pulseaudio]
type = internal/pulseaudio
sink = alsa_output.pci-0000_07_00.6.analog-stereo
use-ui-max = true
interval = 5
format-volume = <ramp-volume> <label-volume>
format-volume-foreground = ${colors.purple}
format-muted = <label-muted>
format-muted-prefix = 婢
format-muted-foreground = ${colors.red}
format-muted-underline = ${colors.red}
label-volume = %percentage%%
label-muted = " Muted"
ramp-volume-0 = 奄
ramp-volume-1 = 奔
ramp-volume-2 = 墳
#Modules for drop-down menu
#[module/calcurse]
#type = custom/ipc
#hook-0 = bartermapp calcurse 1 
#hook-1 = echo "%{F#666 B#1e1e20} 1%{F- B-}%{B#1e1e20}  %{B-}"
#click-left = polybar-msg hook calcurse 1 && closetabs 1
#initial = 2
#[module/ranger]
#type = custom/ipc
#hook-0 = bartermapp ranger 2 
#hook-1 = echo "%{F#666 B#1e1e20} 2%{F- B-}%{B#1e1e20}  %{B-}"
#click-left = polybar-msg hook ranger 1 && closetabs 2
#initial = 2
#[module/email]
#type = custom/ipc
#hook-0 = bartermapp mutt 3 
#hook-1 = echo "%{F#666 B#1e1e20} 3%{F- B-}%{B#1e1e20}  %{B-}"
#click-left = polybar-msg hook email 1 && closetabs 3
#initial = 2
#[module/htop]
#type = custom/ipc
#hook-0 = bartermapp htop 4 
#hook-1 = echo "%{F#666 B#1e1e20} 4%{F- B-}%{B#1e1e20}  %{B-}"
#click-left = polybar-msg hook htop 1 && closetabs 4
#initial = 2
[module/ranger]
type = custom/text
content = %{F#666}2%{F-} 
click-left = bartermapp ranger 1
content-underline = ${xrdb:color2}
[module/email]
type = custom/text
content = %{F#666}3%{F-} 
click-left = bartermapp mutt 2
content-underline = ${xrdb:color5}
[module/htop]
type = custom/text
content = %{F#666}4%{F-} 
click-left = bartermapp htop 3
content-underline = ${xrdb:color4}
[module/calcurse]
type = custom/text
content = %{F#666}1%{F-} 
content-underline = ${xrdb:color3}
click-left = bartermapp calcurse 4
cat control-tab.sh
linenum=$1
tabval=$(awk -v lnum="$linenum" 'NR==lnum{ print $1 }' /dev/shm/polybar-tabs)
if [ $tabval == 0 ]; then
sed -i "${linenum}s/./1/" /dev/shm/polybar-tabs
tabval=1
else
sed -i "${linenum}s/./0/" /dev/shm/polybar-tabs
tabval=0
fi
echo $tabval
linenum=$1
tabval=$(awk -v lnum="$linenum" 'NR==lnum{ print $1 }' /dev/shm/polybar-tabs)
if [ $tabval == 0 ]; then
sed -i "${linenum}s/./1/" /dev/shm/polybar-tabs
tabval=1
else
sed -i "${linenum}s/./0/" /dev/shm/polybar-tabs
tabval=0
fi
echo $tabval
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment