Move .i3 and diskhealth into modules
This commit is contained in:
12
.gitmodules
vendored
12
.gitmodules
vendored
@@ -1,6 +1,6 @@
|
||||
[submodule ".i3/lemonbar"]
|
||||
path = .i3/lemonbar
|
||||
url = https://isabeljake.duckdns.org/gitea/kuba/lemonbar.git
|
||||
[submodule "Pictures/Wallpapers"]
|
||||
path = Pictures/Wallpapers
|
||||
url = https://isabeljake.duckdns.org/gitea/kuba/wallpapers.git
|
||||
[submodule "scripts/healthy-disk-usage"]
|
||||
path = scripts/healthy-disk-usage
|
||||
url = https://isabeljake.duckdns.org/gitea/kuba/healthy-disk-usage.git
|
||||
[submodule ".i3"]
|
||||
path = .i3
|
||||
url = https://isabeljake.duckdns.org/gitea/kuba/i3-config.git
|
||||
|
||||
1
.i3
Submodule
1
.i3
Submodule
Submodule .i3 added at 61862671ba
@@ -1,13 +0,0 @@
|
||||
sleep 2
|
||||
nextcloud &
|
||||
volnoti &
|
||||
conky -c ~/.conky/arch/.conkyrc-arch &
|
||||
conky -c ~/.conky/gmail/.conkyrc-gmail &
|
||||
conky -c ~/.conky/weather/.conkyrc-weather1 &
|
||||
conky -c ~/.conky/weather/.conkyrc-weather2 &
|
||||
conky -c ~/.conky/music/.conkyrc-music &
|
||||
python ~/.conky/music/playerctl_listen.py &
|
||||
sh ~/.conky/music/launcher.sh &
|
||||
source ~/.python-venv.kuba/bin/activate
|
||||
python ~/.i3/lemonbar/i3_lemonbar_launcher.py --debug >> /tmp/kuba_lemonbar_launcher.log &
|
||||
compton -b # --config=/home/kuba/.compton.conf
|
||||
158
.i3/base.config
158
.i3/base.config
@@ -1,158 +0,0 @@
|
||||
# General setup
|
||||
####
|
||||
|
||||
set $mod Mod4
|
||||
set $TERMINAL terminator --profile=nord
|
||||
|
||||
font pango:FontAwesome 11
|
||||
|
||||
# Use Mouse+$mod to drag floating windows to their wanted position
|
||||
floating_modifier $mod
|
||||
|
||||
focus_follows_mouse no
|
||||
mouse_warping none
|
||||
workspace_auto_back_and_forth yes
|
||||
#force_display_urgency_hint 500 ms
|
||||
|
||||
#
|
||||
#
|
||||
# Key bindings
|
||||
####
|
||||
|
||||
# start a terminal
|
||||
bindsym $mod+Return exec $TERMINAL
|
||||
|
||||
# kill focused window
|
||||
bindsym $mod+Shift+q kill
|
||||
|
||||
# start dmenu (a program launcher)
|
||||
bindsym $mod+d exec dmenu_run
|
||||
bindsym $mod+Shift+d exec --no-startup-id i3-dmenu-desktop
|
||||
|
||||
# change focus
|
||||
bindsym $mod+h focus left
|
||||
bindsym $mod+j focus down
|
||||
bindsym $mod+k focus up
|
||||
bindsym $mod+l focus right
|
||||
|
||||
# alternatively, you can use the cursor keys:
|
||||
bindsym $mod+Left focus left
|
||||
bindsym $mod+Down focus down
|
||||
bindsym $mod+Up focus up
|
||||
bindsym $mod+Right focus right
|
||||
|
||||
# move focused window
|
||||
bindsym $mod+Shift+h move left
|
||||
bindsym $mod+Shift+j move down
|
||||
bindsym $mod+Shift+k move up
|
||||
bindsym $mod+Shift+l move right
|
||||
|
||||
# alternatively, you can use the cursor keys:
|
||||
bindsym $mod+Shift+Left move left
|
||||
bindsym $mod+Shift+Down move down
|
||||
bindsym $mod+Shift+Up move up
|
||||
bindsym $mod+Shift+Right move right
|
||||
|
||||
# split in horizontal orientation
|
||||
bindsym $mod+g split h
|
||||
|
||||
# split in vertical orientation
|
||||
bindsym $mod+v split v
|
||||
|
||||
# enter fullscreen mode for the focused container
|
||||
bindsym $mod+f fullscreen toggle
|
||||
|
||||
# change container layout (stacked, tabbed, toggle split)
|
||||
bindsym $mod+s layout stacking
|
||||
bindsym $mod+w layout tabbed
|
||||
bindsym $mod+e layout toggle split
|
||||
|
||||
# toggle tiling / floating
|
||||
bindsym $mod+Shift+space floating toggle
|
||||
|
||||
# change focus between tiling / floating windows
|
||||
bindsym $mod+Shift+Return focus mode_toggle
|
||||
|
||||
# focus the parent container
|
||||
bindsym $mod+a focus parent
|
||||
|
||||
# focus the child container
|
||||
#bindsym $mod+d focus child
|
||||
|
||||
# switch to workspace
|
||||
bindsym $mod+1 workspace number $w1
|
||||
bindsym $mod+2 workspace number $w2
|
||||
bindsym $mod+3 workspace number $w3
|
||||
bindsym $mod+4 workspace number $w4
|
||||
bindsym $mod+5 workspace number $w5
|
||||
bindsym $mod+6 workspace number $w6
|
||||
bindsym $mod+7 workspace number $w7
|
||||
bindsym $mod+8 workspace number $w8
|
||||
bindsym $mod+9 workspace number $w9
|
||||
bindsym $mod+0 workspace number $w10
|
||||
|
||||
# move focused container to workspace
|
||||
bindsym $mod+Shift+1 move container to workspace number $w1
|
||||
bindsym $mod+Shift+2 move container to workspace number $w2
|
||||
bindsym $mod+Shift+3 move container to workspace number $w3
|
||||
bindsym $mod+Shift+4 move container to workspace number $w4
|
||||
bindsym $mod+Shift+5 move container to workspace number $w5
|
||||
bindsym $mod+Shift+6 move container to workspace number $w6
|
||||
bindsym $mod+Shift+7 move container to workspace number $w7
|
||||
bindsym $mod+Shift+8 move container to workspace number $w8
|
||||
bindsym $mod+Shift+9 move container to workspace number $w9
|
||||
bindsym $mod+Shift+0 move container to workspace number $w10
|
||||
|
||||
bindsym $mod+o move workspace to output right
|
||||
|
||||
# reload the configuration file
|
||||
bindsym $mod+Shift+c reload
|
||||
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
|
||||
bindsym $mod+Shift+r restart
|
||||
# exit i3 (logs you out of your X session)
|
||||
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
|
||||
|
||||
#
|
||||
#
|
||||
# Define modes
|
||||
####
|
||||
|
||||
set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown
|
||||
mode "$mode_system" {
|
||||
bindsym l exec --no-startup-id .i3/i3exit.sh lock, mode "default"
|
||||
bindsym e exec --no-startup-id .i3/i3exit.sh logout, mode "default"
|
||||
bindsym s exec --no-startup-id .i3/i3exit.sh suspend, mode "default"
|
||||
bindsym h exec --no-startup-id .i3/i3exit.sh hibernate, mode "default"
|
||||
bindsym r exec --no-startup-id .i3/i3exit.sh reboot, mode "default"
|
||||
bindsym Shift+s exec --no-startup-id .i3/i3exit.sh shutdown, mode "default"
|
||||
|
||||
# back to normal: Enter or Escape
|
||||
bindsym Return mode "default"; exec sh .i3/lemonbar/set_mode.sh mode normal
|
||||
bindsym Escape mode "default"; exec sh .i3/lemonbar/set_mode.sh mode normal
|
||||
}
|
||||
|
||||
# resize window (you can also use the mouse for that)
|
||||
mode "resize" {
|
||||
# These bindings trigger as soon as you enter the resize mode
|
||||
|
||||
# Pressing left will shrink the window’s width.
|
||||
# Pressing right will grow the window’s width.
|
||||
# Pressing up will shrink the window’s height.
|
||||
# Pressing down will grow the window’s height.
|
||||
bindsym h resize shrink width 10 px or 10 ppt
|
||||
bindsym k resize grow height 10 px or 10 ppt
|
||||
bindsym j resize shrink height 10 px or 10 ppt
|
||||
bindsym l resize grow width 10 px or 10 ppt
|
||||
|
||||
# same bindings, but for the arrow keys
|
||||
bindsym Left resize shrink width 10 px or 10 ppt
|
||||
bindsym Up resize grow height 10 px or 10 ppt
|
||||
bindsym Down resize shrink height 10 px or 10 ppt
|
||||
bindsym Right resize grow width 10 px or 10 ppt
|
||||
|
||||
# back to normal: Enter or Escape
|
||||
bindsym Return mode "default"
|
||||
bindsym Escape mode "default"
|
||||
}
|
||||
|
||||
bindsym $mod+r mode "resize"
|
||||
114
.i3/home.config
114
.i3/home.config
@@ -1,114 +0,0 @@
|
||||
set $w1 1 main
|
||||
set $w2 2 web
|
||||
set $w3 3 mu
|
||||
set $w4 4 work
|
||||
set $w5 5 terms
|
||||
set $w6 6 stats
|
||||
set $w7 7
|
||||
set $w8 8
|
||||
set $w9 9
|
||||
set $w10 10 games
|
||||
|
||||
set $below_barY 24
|
||||
#set $volX 1400
|
||||
#set $brX 1485
|
||||
#set $calX 1650
|
||||
set $htopX 400
|
||||
set $pavuX 800
|
||||
|
||||
for_window [class="Terminator"] border pixel 0
|
||||
for_window [class="YADWIN"] floating enable
|
||||
for_window [class="FLOAT_PAVU"] floating enable
|
||||
for_window [class="FLOAT_PAVU"] resize set 800 540
|
||||
for_window [class="FLOAT_PAVU"] border pixel 3
|
||||
for_window [class="FLOAT_PAVU"] move absolute position $pavuX px $below_barY px
|
||||
for_window [class="FLOAT_TERM"] floating enable
|
||||
for_window [class="FLOAT_TERM"] move absolute position $htopX px $below_barY px
|
||||
for_window [class="FLOAT_TERM"] border pixel 3
|
||||
for_window [title="Memory"] floating enable
|
||||
for_window [class="Matplotlib"] floating enable
|
||||
for_window [class="Chromium"] border pixel 0
|
||||
for_window [class="^.*"] border pixel 0
|
||||
for_window [window_type="toolbar"] border pixel 3
|
||||
for_window [window_type="splash"] border pixel 3
|
||||
for_window [window_type="dialog"] border pixel 3
|
||||
for_window [window_type="utility"] border pixel 3
|
||||
for_window [window_role="pop-up"] floating enable
|
||||
for_window [title="VMD 1.9.3 OpenGL Display"] floating enable
|
||||
for_window [title="Terminator Preferences"] floating enable
|
||||
for_window [title="Figure *"] floating enable
|
||||
#for_window [title="VMD"] floating enable
|
||||
|
||||
assign [class="firefox"] → $w2
|
||||
assign [class="Chromium"] → $w2
|
||||
assign [class="libreoffice*"] → $w4
|
||||
assign [class="soffice*"] → $w4
|
||||
assign [class="MATLAB*"] → $w4
|
||||
assign [window_role="ranger"] → $w1
|
||||
assign [window_role="terms"] → $w5
|
||||
assign [window_role="stats"] → $w6
|
||||
assign [class="Minecraft*"] → $w10
|
||||
assign [title="Feed The Beast Launcher*"] → $w10
|
||||
#Spotify bug, assign doesn't work
|
||||
for_window [class="Spotify"] move to workspace $w3
|
||||
|
||||
# Gaps settings
|
||||
####
|
||||
|
||||
gaps inner 0
|
||||
gaps outer 0
|
||||
|
||||
workspace 1 gaps inner 10
|
||||
workspace 4 gaps inner 10
|
||||
workspace 5 gaps inner 10
|
||||
workspace 6 gaps inner 60
|
||||
|
||||
# Multimedia Bindings
|
||||
####
|
||||
|
||||
# pulse audio volume control
|
||||
bindsym XF86AudioRaiseVolume exec ~/.i3/scripts/level.sh -v up
|
||||
bindsym XF86AudioLowerVolume exec ~/.i3/scripts/level.sh -v down
|
||||
bindsym XF86AudioMute exec ~/.i3/scripts/level.sh -v toggle
|
||||
bindsym XF86MonBrightnessUp exec ~/.i3/scripts/level.sh -b up
|
||||
bindsym XF86MonBrightnessDown exec ~/.i3/scripts/level.sh -b down
|
||||
bindsym $mod+F8 exec playerctl play-pause
|
||||
bindsym $mod+F9 exec playerctl next
|
||||
bindsym $mod+F7 exec playerctl previous
|
||||
bindsym XF86AudioPlay exec playerctl play
|
||||
bindsym XF86AudioPause exec playerctl pause
|
||||
bindsym XF86AudioNext exec playerctl next
|
||||
bindsym XF86AudioPrevious exec playerctl previous
|
||||
|
||||
bindsym Print exec scrot '%Y-%m-%d-%T_$wx$h_scrot.png' -e 'mv $f ~/Pictures/screenshots/'
|
||||
bindsym Shift + Print exec scrot -s '%Y-%m-%d-%T_$wx$h_scrot.png' -e 'mv $f ~/Pictures/screenshots/'
|
||||
|
||||
bindsym $mod+space exec sh ~/.i3/scripts/lang.sh next
|
||||
|
||||
# Exiting
|
||||
####
|
||||
|
||||
bindsym XF86Sleep exec sh ~/.i3/i3exit.sh lock
|
||||
bindsym XF86PowerOff mode "$mode_system"; exec sh .i3/lemonbar/set_mode.sh mode power
|
||||
|
||||
|
||||
|
||||
####
|
||||
# layout settings
|
||||
####
|
||||
bindsym $mod+u exec feh --bg-scale /home/kuba/Pictures/Wallpapers/AxEcN\ -\ Imgur.jpg
|
||||
#exec compton -b
|
||||
#workspace 1 main
|
||||
exec --no-startup-id $TERMINAL --role "ranger" -x ranger
|
||||
|
||||
#exec --no-startup-id i3-msg 'workspace 5 terms"
|
||||
exec --no-startup-id $TERMINAL --role "terms"
|
||||
exec --no-startup-id $TERMINAL --role "terms"
|
||||
|
||||
#workspace 6 stats;
|
||||
exec --no-startup-id i3-msg 'append_layout /home/kuba/.i3/workspace_6.json; rename workspace to "6 stats"'
|
||||
#Set appropriate background image before starting conkys
|
||||
exec --no-startup-id feh --bg-scale /home/kuba/Pictures/Wallpapers/6_stats
|
||||
|
||||
#Start conky's in .i3/.autostart
|
||||
exec sh ~/.i3/.autostart
|
||||
@@ -1,46 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
lock() {
|
||||
# Credit: https://github.com/petvas/i3lock-blur
|
||||
# TODO Handle several screens
|
||||
TMPBG=/tmp/screen_locked.png
|
||||
LOCK=~/.i3/lock.png
|
||||
RES=$(xrandr | grep 'current' | sed -E 's/.*current\s([0-9]+)\sx\s([0-9]+).*/\1x\2/')
|
||||
|
||||
#ffmpeg -f x11grab -video_size $RES -y -i $DISPLAY -i $LOCK -filter_complex \
|
||||
# "boxblur=5:1,overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2" \
|
||||
# -vframes 1 $TMPBG -loglevel quiet
|
||||
ffmpeg -f x11grab -video_size $RES -y -i $DISPLAY -filter_complex \
|
||||
"boxblur=5:1" -vframes 1 $TMPBG -loglevel quiet
|
||||
i3lock -i $TMPBG
|
||||
rm $TMPBG
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
lock)
|
||||
lock
|
||||
;;
|
||||
logout)
|
||||
i3-msg exit
|
||||
;;
|
||||
suspend)
|
||||
lock && sudo pm-suspend
|
||||
;;
|
||||
lidclose)
|
||||
lock && sudo pm-suspend
|
||||
;;
|
||||
hibernate)
|
||||
lock && sudo pm-hibernate
|
||||
;;
|
||||
reboot)
|
||||
systemctl reboot
|
||||
;;
|
||||
shutdown)
|
||||
systemctl poweroff
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {lock|logout|suspend|hibernate|reboot|shutdown}"
|
||||
exit 2
|
||||
esac
|
||||
|
||||
exit 0
|
||||
Submodule .i3/lemonbar deleted from c03598c5b2
BIN
.i3/lock.png
BIN
.i3/lock.png
Binary file not shown.
|
Before Width: | Height: | Size: 13 KiB |
@@ -1,32 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Launches a yad window to change the brightness (or volume, not in use)
|
||||
panel_fifo="/tmp/i3_lemonbar1_${USER}"
|
||||
panel_commands="/tmp/i3_lemonbar2_${USER}"
|
||||
|
||||
if [ "$1" == "-b" ]; then
|
||||
CLASS="YADWINBR"
|
||||
ICON='☼'
|
||||
COLOR='yellow'
|
||||
elif [ "$1" == "-v" ]; then
|
||||
CLASS="YADWINV"
|
||||
ICON='🔈'
|
||||
COLOR='white'
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
LEVEL=$(bc <<< "scale=0; $(brillo -G)/1")
|
||||
[[ "$3" == "-t" ]] && TIMER="--timeout=1"
|
||||
|
||||
declare -a YADARGS=("--sticky" "--undecorated" "--on-top" "--class=$CLASS"
|
||||
"--scale" "--text='<span color=\"$COLOR\" font=\"20\">$ICON</span>'"
|
||||
"--value" "$LEVEL" "--no-buttons"
|
||||
"--geometry=15x150" "--vertical" "--text-align" "center" "$TIMER" "--print-partial")
|
||||
YARGS=${YADARGS[@]}
|
||||
|
||||
FIFO="$2"
|
||||
|
||||
(echo "kill_unfocus $BASHPID" > $FIFO; exec sh -c "yad $YARGS") | \
|
||||
while read out; do
|
||||
~/.i3/scripts/level.sh -b set $out
|
||||
done
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/sh
|
||||
STATUS=`xset q | awk '{for (I=1;I<=NF;I++) if ($I == "DPMS" && $(I+1) == "is") {print $(I+2)};}'`
|
||||
if [ "$STATUS" == "Enabled" ]; then
|
||||
xset -dpms
|
||||
yad --timeout 1 --text "<span font=\"20\">DPMS Disabled</span>" --no-buttons --sticky --on-top
|
||||
else
|
||||
xset dpms
|
||||
yad --timeout 1 --text "<span font=\"20\">DPMS Enabled</span>" --no-buttons --sticky --on-top
|
||||
fi
|
||||
@@ -1,34 +0,0 @@
|
||||
#!/bin/bash
|
||||
panel_fifo="/tmp/i3_lemonbar1_${USER}"
|
||||
panel_commands="/tmp/i3_lemonbar2_${USER}"
|
||||
|
||||
function show(){
|
||||
setxkbmap -print | grep xkb_symbols | awk '{print $4}' | awk -F"+" '{print $2}'
|
||||
}
|
||||
if [ $# -lt 1 ]; then
|
||||
echo LANG$(show)
|
||||
fi
|
||||
if [ "$1" == "next" ]; then
|
||||
cur=$(show)
|
||||
next='se'
|
||||
if [ "$cur" == "se" ]; then
|
||||
next='pl'
|
||||
fi
|
||||
setxkbmap $next
|
||||
if [ -e $panel_fifo ]; then
|
||||
echo -e "LANG$next" > "${panel_fifo}"
|
||||
fi
|
||||
if [ -e $panel_commands ]; then
|
||||
echo -e "setlang $next" > "${panel_commands}"
|
||||
fi
|
||||
elif [ "$1" == "qset" ]; then
|
||||
next=$2
|
||||
setxkbmap $next
|
||||
if [ -e $panel_fifo ]; then
|
||||
echo -e "LANG$next" > "${panel_fifo}"
|
||||
fi
|
||||
elif [ "$1" == "show" ]; then
|
||||
show
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/bin/bash
|
||||
panel_fifo="/tmp/i3_lemonbar1_${USER}"
|
||||
panel_commands="/tmp/i3_lemonbar2_${USER}"
|
||||
|
||||
if [[ "$1" == "-b" ]]; then
|
||||
icon="-s /usr/share/pixmaps/volnoti/display-brightness-symbolic.svg"
|
||||
if [[ "$2" == "up" ]]; then
|
||||
level=$(brillo -A 5 -u 100000; brillo)
|
||||
elif [[ "$2" == "down" ]]; then
|
||||
level=$(brillo -U 5 -u 100000; brillo)
|
||||
elif [[ "$2" == "set" ]]; then
|
||||
level=$(brillo -S $3; brillo)
|
||||
fi
|
||||
echo "BRIGHT$level" > $panel_fifo
|
||||
elif [[ "$1" == "-v" ]]; then
|
||||
if [[ "$2" == "up" ]]; then
|
||||
amixer -q set Master 5%+
|
||||
elif [[ "$2" == "down" ]]; then
|
||||
amixer -q set Master 5%-
|
||||
elif [[ "$2" == "toggle" ]]; then
|
||||
amixer -q set Master toggle
|
||||
fi
|
||||
level=$(~/.i3/lemonbar/get_vol.sh)
|
||||
if [[ "$level" == "MUTE" ]]; then
|
||||
level="-m"
|
||||
elif [[ "$level" == "NONE" ]]; then
|
||||
echo "Missing"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$2" != "set" ]]; then
|
||||
volnoti-show $icon $level
|
||||
fi
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
[[ "$1" == "up" ]] && amixer set Master 5%+
|
||||
[[ "$1" == "down" ]] && amixer set Master 5%-
|
||||
[[ "$1" == "mute" ]] && amixer sset Master toggle
|
||||
|
||||
VOL=$(amixer get Master | grep 'Front Left:' | cut -c 31-33)
|
||||
[[ $(amixer get Master | grep "\[off\]") ]] && sudo -u kuba volnoti-show -m $VOL && exit
|
||||
sudo -u kuba volnoti-show $VOL
|
||||
@@ -1,127 +0,0 @@
|
||||
{
|
||||
"layout": "splith",
|
||||
"nodes": [
|
||||
{
|
||||
"border": "normal",
|
||||
"floating": "auto_off",
|
||||
"layout": "splitv",
|
||||
"percent": 0.65,
|
||||
"type": "con",
|
||||
"nodes": [
|
||||
{
|
||||
"border": "normal",
|
||||
"floating": "auto_off",
|
||||
"layout": "splith",
|
||||
"percent": 0.5,
|
||||
"type": "con",
|
||||
"nodes": [
|
||||
{
|
||||
"border": "none",
|
||||
"current_border_width": 2,
|
||||
"floating": "auto_off",
|
||||
"geometry": {
|
||||
"height": 10,
|
||||
"width": 10,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"name": "Conky (kuba-Arch)",
|
||||
"percent": 1,
|
||||
"swallows": [
|
||||
{
|
||||
"class": "Conky-arch"
|
||||
}
|
||||
],
|
||||
"type": "con"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"border": "none",
|
||||
"current_border_width": 2,
|
||||
"floating": "auto_off",
|
||||
"geometry": {
|
||||
"height": 434,
|
||||
"width": 722,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"name": "Conky (kuba-Arch)",
|
||||
"percent": 0.5,
|
||||
"swallows": [
|
||||
{
|
||||
"class": "Conky-gmail"
|
||||
}
|
||||
],
|
||||
"type": "con"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"border": "normal",
|
||||
"floating": "auto_off",
|
||||
"layout": "splitv",
|
||||
"percent": 0.35,
|
||||
"type": "con",
|
||||
"nodes": [
|
||||
{
|
||||
"border": "none",
|
||||
"current_border_width": 2,
|
||||
"floating": "auto_off",
|
||||
"geometry": {
|
||||
"height": 32,
|
||||
"width": 32,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"name": "Conky (kuba-Arch)",
|
||||
"percent": 0.20,
|
||||
"swallows": [
|
||||
{
|
||||
"class": "Conky-weather"
|
||||
}
|
||||
],
|
||||
"type": "con"
|
||||
},
|
||||
{
|
||||
"border": "none",
|
||||
"current_border_width": 2,
|
||||
"floating": "auto_off",
|
||||
"geometry": {
|
||||
"height": 32,
|
||||
"width": 32,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"name": "Conky (kuba-Arch)",
|
||||
"percent": 0.20,
|
||||
"swallows": [
|
||||
{
|
||||
"class": "Conky-weather"
|
||||
}
|
||||
],
|
||||
"type": "con"
|
||||
},
|
||||
{
|
||||
"border": "none",
|
||||
"current_border_width": 2,
|
||||
"floating": "auto_off",
|
||||
"geometry": {
|
||||
"height": 10,
|
||||
"width": 10,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"name": "Conky (kuba-Arch)",
|
||||
"percent": 0.60,
|
||||
"swallows": [
|
||||
{
|
||||
"class": "Conky-music"
|
||||
}
|
||||
],
|
||||
"type": "con"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -18,5 +18,5 @@ elif [ "`hostname`" = "JakubArch" ] && [ -f ~/.i3/work.config ]; then
|
||||
fi
|
||||
|
||||
#exec i3 -c $i3config -V >> ~/${WM}.log 2>&1
|
||||
sh ~/scripts/displays.sh auto
|
||||
sh ~/.i3/scripts/displays.sh auto
|
||||
exec i3 -c $i3config
|
||||
|
||||
Submodule Pictures/Wallpapers deleted from 6eb63d5a8d
6
scripts/.directory
Executable file
6
scripts/.directory
Executable file
@@ -0,0 +1,6 @@
|
||||
[Dolphin]
|
||||
Timestamp=2014,5,7,20,54,5
|
||||
Version=3
|
||||
|
||||
[Settings]
|
||||
HiddenFilesShown=true
|
||||
@@ -1,43 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
function primary() {
|
||||
xrandr | grep primary | awk '{print $1}'
|
||||
}
|
||||
|
||||
displays=$(xrandr --listactivemonitors | grep -v Monitors | awk '{print $NF}')
|
||||
case "$1" in
|
||||
"auto")
|
||||
echo "$displays" | while read display; do
|
||||
xrandr --output $display --auto
|
||||
done
|
||||
;;
|
||||
"connected")
|
||||
echo "$displays"
|
||||
;;
|
||||
"lemonbar")
|
||||
echo "DISP ${displays[@]}" | sed "s/ /:/g"
|
||||
;;
|
||||
*)
|
||||
# -F Fix strings, -x exactly, -q quiet
|
||||
if echo "$displays" | grep -Fqx "$1"; then
|
||||
case "$2" in
|
||||
"off")
|
||||
action="--off"
|
||||
;;
|
||||
"mirror")
|
||||
action="--same-as $(primary)"
|
||||
;;
|
||||
"left")
|
||||
action="--left-of $(primary) --auto"
|
||||
;;
|
||||
"right")
|
||||
action="--right-of $(primary) --auto"
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
xrandr --output $1 $action
|
||||
fi
|
||||
esac
|
||||
|
||||
1140
scripts/health/du.c
1140
scripts/health/du.c
File diff suppressed because it is too large
Load Diff
@@ -1,220 +0,0 @@
|
||||
#define DEBUG
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fts.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "health.h"
|
||||
#include "utils.h"
|
||||
|
||||
//ustring ok_str = NEW_USTRING("OK");
|
||||
//ustring warn_str = NEW_USTRING("WARN");
|
||||
//ustring arrow_str = NEW_USTRING("├─");
|
||||
//ustring arrow_last_str = NEW_USTRING("└─");
|
||||
ustring ok_str = {.str = "OK", .bytes = strlen("OK") };
|
||||
ustring warn_str = {.str = "WARN ☠", .bytes = strlen("WARN ☠")};
|
||||
ustring arrow_str = {.str = "├─", .bytes = strlen("├─")};
|
||||
ustring arrow_last_str = {.str ="└─", .bytes = strlen("└─")};
|
||||
|
||||
// fts_path doesn't append trailing slash
|
||||
struct dir_status top_dir_var[] = {
|
||||
WATCH_DIR("/var/cache", "1.5G"),
|
||||
WATCH_DIR("/var/log", "0.5G")
|
||||
};
|
||||
|
||||
struct dir_status top_dir_home[] = {
|
||||
WATCH_DIR("/home/kuba/.cache", "3G"),
|
||||
WATCH_DIR("/home/kuba/Downloads", "1G")
|
||||
};
|
||||
|
||||
struct dir_status top_dir_usr[] = {
|
||||
WATCH_DIR("/usr/local", "5G"),
|
||||
WATCH_DIR("/usr/lib", "5G"),
|
||||
WATCH_DIR("/usr/share", "5G"),
|
||||
WATCH_DIR("/usr/bin", "1G")
|
||||
};
|
||||
|
||||
struct dir_status watched_dirs[] = {
|
||||
WATCH_DIR_SUBS("/var", "2.5G", top_dir_var),
|
||||
WATCH_DIR_SUBS("/home/kuba", "20G", top_dir_home),
|
||||
WATCH_DIR_SUBS("/usr", "15G", top_dir_usr),
|
||||
WATCH_DIR("/boot", "80M"),
|
||||
WATCH_DIR("/etc", "20M"),
|
||||
WATCH_DIR("/root", "10M"),
|
||||
WATCH_DIR("/run", "10M"),
|
||||
WATCH_DIR("/srv", "1M"),
|
||||
WATCH_DIR("/opt", "1G")
|
||||
};
|
||||
|
||||
int main(int argc, char* const argv[])
|
||||
{
|
||||
INIT_USTRING(ok_str);
|
||||
INIT_USTRING(warn_str);
|
||||
INIT_USTRING(arrow_str);
|
||||
INIT_USTRING(arrow_last_str);
|
||||
// Traverse top directories and do some nice formatting
|
||||
char buf[80];
|
||||
for (int i = 0; i < sizeof(watched_dirs)/sizeof(struct dir_status); i++){
|
||||
struct dir_status *dir = watched_dirs + i;
|
||||
disk_usage(dir);
|
||||
|
||||
format_directory_entry(buf, dir, 0, 0);
|
||||
}
|
||||
exit(0);
|
||||
|
||||
if (argc<2)
|
||||
{
|
||||
printf("Usage: %s <path-spec>\n", argv[0]);
|
||||
exit(255);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//Maybe just remove this, the effect is not noticable
|
||||
off_t traverse_nochildren(FTS *file_system, const short dir_level)
|
||||
{
|
||||
FTSENT *node = NULL;
|
||||
struct stat *st = NULL;
|
||||
off_t tot_size = 0;
|
||||
|
||||
while( (node = fts_read(file_system)) != NULL)
|
||||
{
|
||||
// Add to size
|
||||
st = node->fts_statp;
|
||||
if (st) tot_size += (off_t) 512*st->st_blocks;
|
||||
else debug("st null pointer, skipping\n");
|
||||
|
||||
if (node->fts_info == FTS_DP)
|
||||
{
|
||||
indent_debug(node->fts_level);
|
||||
debug("Exiting %s\n", node->fts_path);
|
||||
// Directory being visited in post-order. Only action is to
|
||||
// return if back at the starting level
|
||||
if (node->fts_level == dir_level) return tot_size;
|
||||
}
|
||||
}
|
||||
return 0;// This is bad
|
||||
}
|
||||
|
||||
void traverse_children(FTS *file_system, struct dir_status *dir, const short dir_level)
|
||||
{
|
||||
FTSENT *node = NULL;
|
||||
struct stat *st = NULL;
|
||||
off_t tot_size = 0;
|
||||
|
||||
top_loop:while( (node = fts_read(file_system)) != NULL)
|
||||
{
|
||||
//indent_debug(node->fts_level);
|
||||
//debug("%s\n", node->fts_name);
|
||||
if (node->fts_info == FTS_D)
|
||||
{
|
||||
if(strcmp(node->fts_path, dir->path) == 0) {
|
||||
continue; // Do nothing
|
||||
}
|
||||
indent_debug(node->fts_level);
|
||||
debug("Entering %s\n", node->fts_path);
|
||||
// Directory being visited in pre-order. Do not count size except
|
||||
// after returning from a recursion step. Determine if the current
|
||||
// node is one of the children.
|
||||
for (int i = 0; i < dir->n_children; i++) {
|
||||
struct dir_status *sub_dir = dir->children+i;
|
||||
if(strcmp(node->fts_path, sub_dir->path) == 0){
|
||||
// Entering one of the child-directories
|
||||
indent_debug(node->fts_level);
|
||||
debug("Entering special %s\n", node->fts_path);
|
||||
traverse_children(file_system, sub_dir, node->fts_level);
|
||||
tot_size += sub_dir->size;
|
||||
goto top_loop;
|
||||
}
|
||||
}
|
||||
// Child directory not in list, call traverse_nochildren instead
|
||||
tot_size += traverse_nochildren(file_system, node->fts_level);
|
||||
continue; // Does the same as goto above
|
||||
}
|
||||
|
||||
// Add to size
|
||||
st = node->fts_statp;
|
||||
if (st) tot_size += (off_t) 512*st->st_blocks;
|
||||
else debug("st null pointer, skipping\n");
|
||||
|
||||
if (node->fts_info == FTS_DP)
|
||||
{
|
||||
indent_debug(node->fts_level);
|
||||
debug("Exiting %s\n", node->fts_path);
|
||||
// Directory being visited in post-order. Only action is to save
|
||||
// size and return if back at the starting level
|
||||
if (node->fts_level == dir_level){
|
||||
dir->size = tot_size;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int disk_usage(struct dir_status *top_dir)
|
||||
{
|
||||
char *paths[] = { top_dir->path, NULL};
|
||||
FTS* file_system = NULL;
|
||||
|
||||
file_system = fts_open(paths, FTS_PHYSICAL, NULL);
|
||||
|
||||
if (file_system == NULL) return 1;
|
||||
|
||||
traverse_children(file_system, top_dir, 0);
|
||||
|
||||
fts_close(file_system);
|
||||
return 0;
|
||||
}
|
||||
|
||||
const int max_length = 60;
|
||||
const int max_path_length = 40;
|
||||
void format_directory_entry(char *buf, struct dir_status *dir, int level, int last_subdir)
|
||||
{
|
||||
int n = 0; //Keeps track of where in buffer we are
|
||||
int delta_n = 0; // Keeps track of how much shorter the string appears
|
||||
// than the number of bytes
|
||||
|
||||
// First fill with apropriate amount of spaces and └ or ├ charcters
|
||||
if (level > 0) {
|
||||
ustring *arr = last_subdir?&arrow_last_str:&arrow_str;
|
||||
|
||||
n = 4*level - arr->chars;
|
||||
delta_n += arr->chars - arr->bytes;
|
||||
memset(buf, ' ', n);
|
||||
strncpy(buf+n, arr->str, arr->bytes);
|
||||
n += arr->bytes;
|
||||
}
|
||||
|
||||
// Path and size
|
||||
n += snprintf(buf + n, max_path_length, "%s -- ", dir->path);
|
||||
n += pretty_bytes(buf + n, dir->size);
|
||||
memset(buf + n, ' ', max_length - n); // max_length - n for simplicity
|
||||
|
||||
// Right-justify WARN or OK status
|
||||
ustring *ok = directory_ok(dir->size, dir->warn_at)?&ok_str:&warn_str;
|
||||
delta_n += ok->chars - ok->bytes;
|
||||
snprintf(buf + max_length - ok->bytes - 2 - delta_n, ok->bytes+2
|
||||
, "%s\n", ok->str);// 2 leaves space for \n and null
|
||||
printf("%s", buf);
|
||||
|
||||
// Loop through children
|
||||
for (int i = 0; i < dir->n_children; i++){
|
||||
int last = (i == dir->n_children - 1);
|
||||
format_directory_entry(buf, dir->children + i, (level + 1), last);
|
||||
}
|
||||
|
||||
if(level == 0) printf("\n");
|
||||
}
|
||||
int directory_ok(off_t size, char *warn_at){
|
||||
off_t warn = pretty_bytes_to_num(warn_at);
|
||||
return size < warn;
|
||||
}
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
#ifndef HEALTH_H
|
||||
#define HEALTH_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "utils.h"
|
||||
|
||||
/*
|
||||
* path - Path of the directory without trailing slash
|
||||
* warn_at - How large is the directory allowed to be before a warning is
|
||||
* issued. In human readable form (see utils.c:pretty_bytes)
|
||||
* children - List of all watched sub-directories
|
||||
* n_children - Number of elements in children
|
||||
* size - Size of directory, this is filled in by disk_usage()
|
||||
*/
|
||||
struct dir_status {
|
||||
char * const path;
|
||||
char * const warn_at;
|
||||
struct dir_status *children;
|
||||
int n_children;
|
||||
off_t size;
|
||||
};
|
||||
|
||||
#define WATCH_DIR(pth,wrn) {.path = pth, .warn_at = wrn, .n_children=0, .size=0}
|
||||
#define WATCH_DIR_SUBS(pth,wrn,subs) {.path = pth, .warn_at = wrn, .size=0 \
|
||||
, .children=subs, .n_children=sizeof(subs)/sizeof(struct dir_status)}
|
||||
|
||||
off_t traverse_nochildren(FTS *file_system, const short dir_level);
|
||||
void traverse_children(FTS *file_system, struct dir_status *dir, const short dir_level);
|
||||
int disk_usage(struct dir_status *top_dir);
|
||||
|
||||
//ustring ok_ustr = {.str = "OK", .bytes = 2, .chars = 2};
|
||||
//NEW_USTRING(ok_str, "OK");
|
||||
//NEW_USTRING(warn_str, "WARN");
|
||||
//NEW_USTRING(arrow_str, "├─");
|
||||
//NEW_USTRING(arrow_last_str,"└─");
|
||||
//INIT_USTRING(ok_str);
|
||||
//INIT_USTRING(warn_str);
|
||||
//INIT_USTRING(arrow_str);
|
||||
//INIT_USTRING(arrow_last_str);
|
||||
void format_directory_entry(char *buf, struct dir_status *dir, int level, int last_subdir);
|
||||
int directory_ok(off_t size, char *warn_at);
|
||||
|
||||
#endif
|
||||
@@ -1,24 +0,0 @@
|
||||
CFLAGS = -Wall
|
||||
LDFLAGS = -lm
|
||||
CC = gcc
|
||||
|
||||
default: health
|
||||
|
||||
optim: CFLAGS += -O3
|
||||
optim: health
|
||||
|
||||
debug: CFLAGS += -g
|
||||
debug: health
|
||||
|
||||
OBJECTS=health.o utils.o
|
||||
health: $(OBJECTS)
|
||||
$(CC) $(CFLAGS) -o health $(OBJECTS) $(LDFLAGS)
|
||||
|
||||
health.o: health.c health.h
|
||||
$(CC) $(CFLAGS) -c health.c
|
||||
|
||||
utils.o: utils.c utils.h
|
||||
$(CC) $(CFLAGS) -c utils.c
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
@@ -1,87 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
|
||||
void indent(int i)
|
||||
{
|
||||
for (; i > 0; i--) printf(" ");
|
||||
}
|
||||
|
||||
|
||||
// Prints to the provided buffer a nice number of bytes (KB, MB, GB, etc)
|
||||
// Returns bytes written
|
||||
int pretty_bytes(char* buf, long long bytes)
|
||||
{
|
||||
const char* suffixes[7];
|
||||
suffixes[0] = "B";
|
||||
suffixes[1] = "KB";
|
||||
suffixes[2] = "MB";
|
||||
suffixes[3] = "GB";
|
||||
suffixes[4] = "TB";
|
||||
suffixes[5] = "PB";
|
||||
suffixes[6] = "EB";
|
||||
uint s = 0; // which suffix to use
|
||||
double count = bytes;
|
||||
while (count >= 1024 && s < 7)
|
||||
{
|
||||
s++;
|
||||
count /= 1024;
|
||||
}
|
||||
if (count - floor(count) == 0.0)
|
||||
return sprintf(buf, "%d %s", (int)count, suffixes[s]);
|
||||
else
|
||||
return sprintf(buf, "%.1f %s", count, suffixes[s]);
|
||||
}
|
||||
|
||||
long long pretty_bytes_to_num(char* buf)
|
||||
{
|
||||
// First letter of suffix in order
|
||||
const char suffixes[7] = {'B', 'K', 'M', 'G', 'T', 'P', 'E'};
|
||||
char suffix;
|
||||
float fnum;
|
||||
long long num = 1;
|
||||
int n;
|
||||
|
||||
errno = 0;
|
||||
n = sscanf(buf,"%f%c", &fnum, &suffix);
|
||||
if (n == 2) {
|
||||
//TODO error handling
|
||||
} else if (errno != 0) {
|
||||
perror("scanf");
|
||||
} else {
|
||||
fprintf(stderr, "No matching characters\n");
|
||||
}
|
||||
|
||||
for (int s=0;s<sizeof(suffixes); s++){
|
||||
if (suffix == suffixes[s]) break;
|
||||
num *= 1024;
|
||||
}
|
||||
|
||||
return (long long )(num*fnum);
|
||||
}
|
||||
|
||||
size_t utf8len(const char *s)
|
||||
{
|
||||
size_t len = 0;
|
||||
for (; *s; ++s) if ((*s & 0xC0) != 0x80) ++len;
|
||||
return len;
|
||||
}
|
||||
|
||||
void debug(const char *format, ...){
|
||||
#ifdef DEBUG
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vprintf(format, args);
|
||||
va_end(args);
|
||||
#endif
|
||||
}
|
||||
|
||||
void indent_debug(int i){
|
||||
#ifdef DEBUG
|
||||
indent(i);
|
||||
#endif
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
#ifndef UTILS_H
|
||||
#define UTILS_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
|
||||
size_t utf8len(const char *s);
|
||||
|
||||
typedef struct {
|
||||
const char *str;
|
||||
const size_t bytes;
|
||||
size_t chars;
|
||||
} ustring;
|
||||
|
||||
|
||||
#define NEW_USTRING(string) {.str = string, .bytes = strlen(string)}//; varname.chars=utf8len(string)}
|
||||
#define INIT_USTRING(varname) (varname).chars = utf8len(varname.str)
|
||||
|
||||
long long pretty_bytes_to_num(char* buf);
|
||||
int pretty_bytes(char* buf, long long bytes);
|
||||
void debug(const char *format, ...);
|
||||
void indent (int i);
|
||||
void indent_debug (int i);
|
||||
|
||||
#endif
|
||||
1
scripts/healthy-disk-usage
Submodule
1
scripts/healthy-disk-usage
Submodule
Submodule scripts/healthy-disk-usage added at 41fb87beb7
@@ -1,24 +0,0 @@
|
||||
#!/bin/bash
|
||||
#function get_index(){
|
||||
# for i in "${!xra_out[@]}"; do
|
||||
# if [[ "${xra_out[$i]}" = "$value" ]]; then
|
||||
# echo "${i}";
|
||||
# break
|
||||
# fi
|
||||
# done
|
||||
#}
|
||||
#xra_out=($(xrandr | grep ' connected' | awk '{print $1}'))
|
||||
#in=($@)
|
||||
#for i in `seq 0 2 ${#in[@]}`; do
|
||||
# value="${in[$i]}"
|
||||
# idx=$(get_index)
|
||||
# if [ ! -z "$idx" ]; then
|
||||
# screen_idx="$idx"
|
||||
# #"${xra_out[$idx-1]}"
|
||||
# paths[${screen_idx%:}]="--bg-scale ${in[$i+1]}"
|
||||
# fi
|
||||
#done
|
||||
##echo "${paths[@]}"
|
||||
#str=`printf -v var "%s\n" "${System[@]}"`
|
||||
#sh -c "feh ${paths[@]}"
|
||||
feh --bg-scale "$@"
|
||||
Reference in New Issue
Block a user