Browse Source

Migrated from github

Thomas Kandler 3 years ago
commit
9e6bd24758
2 changed files with 421 additions and 0 deletions
  1. 290
    0
      README.md
  2. 131
    0
      lockscreen.sh

+ 290
- 0
README.md View File

@@ -0,0 +1,290 @@
1
+# Crunchbang configs
2
+
3
+## Conky
4
+
5
+	background no
6
+	use_xft yes
7
+	xftfont Bitstream Vera Sans Mono:size=9
8
+	xftalpha 0.8
9
+	update_interval 1.0
10
+	total_run_times 0
11
+	own_window yes
12
+	own_window_type desktop
13
+	own_window_transparent yes
14
+	own_window_colour black
15
+	own_window_hints undecorated,skip_pager,skip_taskbar
16
+	double_buffer yes
17
+	minimum_size 260 5
18
+	draw_shades yes
19
+	draw_outline no
20
+	draw_borders no
21
+	draw_graph_borders no
22
+	stippled_borders 0
23
+	border_margin 4
24
+	border_width 0
25
+	default_color white
26
+	default_shade_color black
27
+	default_outline_color black
28
+	alignment top_left
29
+	gap_x 12
30
+	gap_y 12
31
+	no_buffers yes
32
+	uppercase no
33
+	cpu_avg_samples 1
34
+	net_avg_samples 1
35
+	override_utf8_locale no
36
+	use_spacer yes
37
+	alignment top_right
38
+	gap_x 12
39
+	gap_y 56
40
+	 
41
+	TEXT
42
+	${font Verdana:style=Bold:size=16}${color #ffffff}${alignc}${time %a %d. %b %k:%M}
43
+	$font$color${alignc} ${tztime Africa/Casablanca  %H:%M} MA | ${tztime Asia/Tokyo  %H:%M} JA
44
+	${color #ffffff}$stippled_hr
45
+	${color lightgrey}Processes:$color $processes  ${color grey}Running:$color $running_processes ${color lightgrey}Up:$color $uptime_short
46
+	 
47
+	${color #ffffff}CPU: $cpu% ${cpubar}
48
+	${color}Name                  PID     CPU%    MEM%
49
+	${font Monospace:size=8}${color lightgrey}${top name 1}     ${top pid 1}  ${top cpu 1}  ${top mem 1}
50
+	${color lightgrey}${top name 2}     ${top pid 2}  ${top cpu 2}  ${top mem 2}
51
+	${color lightgrey}${top name 3}     ${top pid 3}  ${top cpu 3}  ${top mem 3}
52
+	${cpugraph 48,300 ffffff ffffff}
53
+	 
54
+	$font${color #ffffff}RAM: $mem/$memmax - $memperc% ${membar}
55
+	${color lightgrey}Swap: $swap/$swapmax - $swapperc% ${swapbar}
56
+	${color}Name                  PID     CPU%    MEM%
57
+	${font Monospace:size=8}${color lightgrey}${top_mem name 1}     ${top_mem pid 1}  ${top_mem cpu 1}  ${top_mem mem 1}
58
+	${color lightgrey}${top_mem name 2}     ${top_mem pid 2}  ${top_mem cpu 2}  ${top_mem mem 2}
59
+	${color lightgrey}${top_mem name 3}     ${top_mem pid 3}  ${top_mem cpu 3}  ${top_mem mem 3}
60
+	${memgraph 48,300 ffffff ffffff}
61
+	 
62
+	${color lightgrey}$stippled_hr
63
+	${color lightgrey}Down:$color ${downspeed wlan0} ${color lightgrey} ${offset 80}Up:$color ${upspeed wlan0}
64
+	${downspeedgraph wlan0 32,120 ffffff ffffff} ${offset 50} ${upspeedgraph wlan0 32,120 ffffff ffffff}
65
+	Downloaded${alignr}${totaldown wlan0}
66
+	Uploaded${alignr}${totalup wlan0}
67
+	$font${color #ffffff}$stippled_hr
68
+	${color lightgrey}hda:  ${fs_used /}/${fs_size /}  ${fs_bar /}
69
+	 
70
+	${color lightgrey}S H O R T C U T    K E Y S
71
+	$font${color #ffffff}$stippled_hr
72
+	Alt+F2$alignr Run Dialog
73
+	Alt+F3$alignr Alt Menu
74
+	Super+Space$alignr Main Menu
75
+	Super+Tab$alignr Client Menu
76
+	Super+e$alignr Editor
77
+	Super+w$alignr Web Browser
78
+	Super+h$alignr Task Manager
79
+	Super+v$alignr Volume Control
80
+	
81
+## tint2
82
+
83
+	# Clock
84
+	time1_format = %R - %b %d
85
+
86
+## set-resolution.sh
87
+
88
+	#!/bin/bash
89
+	xrandr --output VGA1 --mode 1920x1080
90
+	xrandr --output LVDS1 --mode 1280x800
91
+	xrandr --output VGA1 --right-of LVDS1
92
+	killall conky
93
+	sleep 5
94
+	conky
95
+
96
+## i3 
97
+
98
+	# This file has been auto-generated by i3-config-wizard(1).
99
+	# It will not be overwritten, so edit it as you like.
100
+	#
101
+	# Should you change your keyboard layout some time, delete
102
+	# this file and re-run i3-config-wizard(1).
103
+	#
104
+
105
+	# i3 config file (v4)
106
+	#
107
+	# Please see http://i3wm.org/docs/userguide.html for a complete reference!
108
+
109
+	set $mod Mod4
110
+
111
+	# Font for window titles. Will also be used by the bar unless a different font
112
+	# is used in the bar {} block below.
113
+	font pango:monospace 8
114
+
115
+	# This font is widely installed, provides lots of unicode glyphs, right-to-left
116
+	# text rendering and scalability on retina/hidpi displays (thanks to pango).
117
+	#font pango:DejaVu Sans Mono 8
118
+
119
+	# Before i3 v4.8, we used to recommend this one as the default:
120
+	# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
121
+	# The font above is very space-efficient, that is, it looks good, sharp and
122
+	# clear in small sizes. However, its unicode glyph coverage is limited, the old
123
+	# X core fonts rendering does not support right-to-left and this being a bitmap
124
+	# font, it doesn’t scale on retina/hidpi displays.
125
+
126
+	# Use Mouse+$mod to drag floating windows to their wanted position
127
+	floating_modifier $mod
128
+
129
+	# start a terminal
130
+	bindsym $mod+Return exec i3-sensible-terminal
131
+
132
+	# kill focused window
133
+	bindsym $mod+Shift+q kill
134
+
135
+	# start dmenu (a program launcher)
136
+	bindsym $mod+d exec dmenu_run
137
+	# There also is the (new) i3-dmenu-desktop which only displays applications
138
+	# shipping a .desktop file. It is a wrapper around dmenu, so you need that
139
+	# installed.
140
+	# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop
141
+
142
+	# change focus
143
+	bindsym $mod+j focus left
144
+	bindsym $mod+k focus down
145
+	bindsym $mod+l focus up
146
+	bindsym $mod+odiaeresis focus right
147
+
148
+	# alternatively, you can use the cursor keys:
149
+	bindsym $mod+Left focus left
150
+	bindsym $mod+Down focus down
151
+	bindsym $mod+Up focus up
152
+	bindsym $mod+Right focus right
153
+
154
+	# move focused window
155
+	bindsym $mod+Shift+j move left
156
+	bindsym $mod+Shift+k move down
157
+	bindsym $mod+Shift+l move up
158
+	bindsym $mod+Shift+odiaeresis move right
159
+
160
+	# alternatively, you can use the cursor keys:
161
+	bindsym $mod+Shift+Left move left
162
+	bindsym $mod+Shift+Down move down
163
+	bindsym $mod+Shift+Up move up
164
+	bindsym $mod+Shift+Right move right
165
+
166
+	# split in horizontal orientation
167
+	bindsym $mod+h split h
168
+
169
+	# split in vertical orientation
170
+	bindsym $mod+v split v
171
+
172
+	# enter fullscreen mode for the focused container
173
+	bindsym $mod+f fullscreen toggle
174
+
175
+	# change container layout (stacked, tabbed, toggle split)
176
+	bindsym $mod+s layout stacking
177
+	bindsym $mod+w layout tabbed
178
+	bindsym $mod+e layout toggle split
179
+
180
+	# toggle tiling / floating
181
+	bindsym $mod+Shift+space floating toggle
182
+
183
+	# change focus between tiling / floating windows
184
+	bindsym $mod+space focus mode_toggle
185
+
186
+	# focus the parent container
187
+	bindsym $mod+a focus parent
188
+
189
+	# focus the child container
190
+	#bindsym $mod+d focus child
191
+
192
+	# switch to workspace
193
+	bindsym $mod+1 workspace 1
194
+	bindsym $mod+2 workspace 2
195
+	bindsym $mod+3 workspace 3
196
+	bindsym $mod+4 workspace 4
197
+	bindsym $mod+5 workspace 5
198
+	bindsym $mod+6 workspace 6
199
+	bindsym $mod+7 workspace 7
200
+	bindsym $mod+8 workspace 8
201
+	bindsym $mod+9 workspace 9
202
+	bindsym $mod+0 workspace 10
203
+
204
+	# move focused container to workspace
205
+	bindsym $mod+Shift+1 move container to workspace 1
206
+	bindsym $mod+Shift+2 move container to workspace 2
207
+	bindsym $mod+Shift+3 move container to workspace 3
208
+	bindsym $mod+Shift+4 move container to workspace 4
209
+	bindsym $mod+Shift+5 move container to workspace 5
210
+	bindsym $mod+Shift+6 move container to workspace 6
211
+	bindsym $mod+Shift+7 move container to workspace 7
212
+	bindsym $mod+Shift+8 move container to workspace 8
213
+	bindsym $mod+Shift+9 move container to workspace 9
214
+	bindsym $mod+Shift+0 move container to workspace 10
215
+
216
+	# reload the configuration file
217
+	bindsym $mod+Shift+c reload
218
+	# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
219
+	bindsym $mod+Shift+r restart
220
+	# exit i3 (logs you out of your X session)
221
+	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'"
222
+
223
+	# resize window (you can also use the mouse for that)
224
+	mode "resize" {
225
+		# These bindings trigger as soon as you enter the resize mode
226
+
227
+		# Pressing left will shrink the window’s width.
228
+		# Pressing right will grow the window’s width.
229
+		# Pressing up will shrink the window’s height.
230
+		# Pressing down will grow the window’s height.
231
+		bindsym j resize shrink width 10 px or 10 ppt
232
+		bindsym k resize grow height 10 px or 10 ppt
233
+		bindsym l resize shrink height 10 px or 10 ppt
234
+		bindsym odiaeresis resize grow width 10 px or 10 ppt
235
+
236
+		# same bindings, but for the arrow keys
237
+		bindsym Left resize shrink width 10 px or 10 ppt
238
+		bindsym Down resize grow height 10 px or 10 ppt
239
+		bindsym Up resize shrink height 10 px or 10 ppt
240
+		bindsym Right resize grow width 10 px or 10 ppt
241
+
242
+		# back to normal: Enter or Escape
243
+		bindsym Return mode "default"
244
+		bindsym Escape mode "default"
245
+	}
246
+
247
+	bindsym $mod+r mode "resize"
248
+
249
+	# Start i3bar to display a workspace bar (plus the system information i3status
250
+	# finds out, if available)
251
+	#bar {
252
+	#        status_command i3status
253
+	#        tray_output primary
254
+	#}
255
+
256
+	# set wallpaper
257
+	exec --no-startup-id feh --bg-fill /home/thomas/tmp/bg.jpg 
258
+
259
+	# make programs look nice :)
260
+	exec --no-startup-id gnome-settings-daemon
261
+
262
+	# nice terminal
263
+	exec --no-startup-id guake
264
+
265
+	# nice colors
266
+
267
+	# class                 border  backgr. text    indicator
268
+	client.focused          #3c3836 #32302f #fabd2f #fabd2f
269
+	client.focused_inactive #3c3836 #504945 #d5c4a1 #504945
270
+	client.unfocused        #3c3836 #504945 #d5c4a1 #504945
271
+	client.urgent           #7c6f64 #fabd2f #3c3836 #fabd2f
272
+
273
+	# $i3-background
274
+	exec_always --no-startup-id xsetroot -solid '#3c3836'
275
+
276
+	bar {
277
+	    status_command i3blocks
278
+	colors {
279
+		background #504945
280
+		statusline #d5c4a1
281
+		separator #3c3836 
282
+		focused_workspace #3c3836 #32302f #fabd2f
283
+		active_workspace #3c3836 #504945 #d5c4a1
284
+		inactive_workspace #3c3836 #504945 #d5c4a1
285
+		urgent_workspace   #7c6f64 #fabd2f #3c3836
286
+	}
287
+	}
288
+
289
+	bindsym $mod+Shift+x exec $HOME/bin/lockscreen/lockscreen.sh -p -t ""
290
+	exec $HOME/bin/lockscreen/lockscreen.sh

+ 131
- 0
lockscreen.sh View File

@@ -0,0 +1,131 @@
1
+#!/usr/bin/env bash
2
+# Author: Dolores Portalatin <hello@doloresportalatin.info>
3
+# Dependencies: imagemagick, i3lock-color-git, scrot, wmctrl (optional)
4
+set -o errexit -o noclobber -o nounset
5
+
6
+# get path where the script is located to find the lock icon
7
+scriptpath=$(readlink -f -- "$0")
8
+scriptpath=${scriptpath%/*}
9
+
10
+hue=(-level "0%,100%,0.6")
11
+effect=(-filter Gaussian -resize 20% -define "filter:sigma=1.5" -resize 500.5%)
12
+# default system sans-serif font
13
+font=$(convert -list font | awk "{ a[NR] = \$2 } /family: $(fc-match sans -f "%{family}\n")/ { print a[NR-1]; exit }")
14
+image=$(mktemp --suffix=.png)
15
+shot=(import -window root)
16
+desktop=""
17
+i3lock_cmd=(i3lock -i "$image")
18
+shot_custom=false
19
+
20
+options="Options:
21
+    -h, --help       This help menu.
22
+
23
+    -d, --desktop    Attempt to minimize all windows before locking.
24
+
25
+    -g, --greyscale  Set background to greyscale instead of color.
26
+
27
+    -p, --pixelate   Pixelate the background instead of blur, runs faster.
28
+
29
+    -f <fontname>, --font <fontname>  Set a custom font.
30
+
31
+    -t <text>, --text <text> Set a custom text prompt.
32
+
33
+    -l, --listfonts  Display a list of possible fonts for use with -f/--font.
34
+                     Note: this option will not lock the screen, it displays
35
+                     the list and exits immediately.
36
+
37
+    -n, --nofork     Do not fork i3lock after starting.
38
+
39
+    --               Must be last option. Set command to use for taking a
40
+                     screenshot. Default is 'import -window root'. Using 'scrot'
41
+                     or 'maim' will increase script speed and allow setting
42
+                     custom flags like having a delay."
43
+
44
+# move pipefail down as for some reason "convert -list font" returns 1
45
+set -o pipefail
46
+trap 'rm -f "$image"' EXIT
47
+temp="$(getopt -o :hdnpglt:f: -l desktop,help,listfonts,nofork,pixelate,greyscale,text:,font: --name "$0" -- "$@")"
48
+eval set -- "$temp"
49
+
50
+# l10n support
51
+text="Type password to unlock"
52
+case "${LANG:-}" in
53
+    de_* ) text="Bitte Passwort eingeben" ;; # Deutsch
54
+    da_* ) text="Indtast adgangskode" ;; # Danish
55
+    en_* ) text="Type password to unlock" ;; # English
56
+    es_* ) text="Ingrese su contraseña" ;; # Española
57
+    fr_* ) text="Entrez votre mot de passe" ;; # Français
58
+    id_* ) text="Masukkan kata sandi Anda" ;; # Bahasa Indonesia
59
+    it_* ) text="Inserisci la password" ;; # Italian
60
+    lv_* ) text="Ievadi paroli" ;; # Latvian
61
+    pl_* ) text="Podaj hasło" ;; # Polish
62
+    pt_* ) text="Digite a senha para desbloquear" ;; # Português
63
+    ru_* ) text="Введите пароль" ;; # Russian
64
+    * ) text="Type password to unlock" ;; # Default to English
65
+esac
66
+
67
+while true ; do
68
+    case "$1" in
69
+        -h|--help)
70
+            printf "Usage: %s [options]\n\n%s\n\n" "${0##*/}" "$options"; exit 1 ;;
71
+        -d|--desktop) desktop=$(command -V wmctrl) ; shift ;;
72
+        -g|--greyscale) hue=(-level "0%,100%,0.6" -set colorspace Gray -separate -average) ; shift ;;
73
+        -p|--pixelate) effect=(-scale 10% -scale 1000%) ; shift ;;
74
+        -f|--font)
75
+            case "$2" in
76
+                "") shift 2 ;;
77
+                *) font=$2 ; shift 2 ;;
78
+            esac ;;
79
+        -t|--text) text=$2 ; shift 2 ;;
80
+        -l|--listfonts)
81
+	    convert -list font | awk -F: '/Font: / { print $2 }' | sort -du | command -- ${PAGER:-less}
82
+	    exit 0 ;;
83
+	-n|--nofork) i3lock_cmd+=(--nofork) ; shift ;;
84
+        --) shift; shot_custom=true; break ;;
85
+        *) echo "error" ; exit 1 ;;
86
+    esac
87
+done
88
+
89
+if "$shot_custom" && [[ $# -gt 0 ]]; then
90
+    shot=("$@");
91
+fi
92
+
93
+command -- "${shot[@]}" "$image"
94
+
95
+value="60" #brightness value to compare to
96
+
97
+color=$(convert "$image" -gravity center -crop 100x100+0+0 +repage -colorspace hsb \
98
+    -resize 1x1 txt:- | awk -F '[%$]' 'NR==2{gsub(",",""); printf "%.0f\n", $(NF-1)}');
99
+
100
+if [[ $color -gt $value ]]; then #white background image and black text
101
+    bw="black"
102
+    icon="$scriptpath/icons/lockdark.png"
103
+    param=("--textcolor=00000000" "--insidecolor=0000001c" "--ringcolor=0000003e" \
104
+        "--linecolor=00000000" "--keyhlcolor=ffffff80" "--ringvercolor=ffffff00" \
105
+        "--separatorcolor=22222260" "--insidevercolor=ffffff1c" \
106
+        "--ringwrongcolor=ffffff55" "--insidewrongcolor=ffffff1c")
107
+else #black
108
+    bw="white"
109
+    icon="$scriptpath/icons/lock.png"
110
+    param=("--textcolor=ffffff00" "--insidecolor=ffffff1c" "--ringcolor=ffffff3e" \
111
+        "--linecolor=ffffff00" "--keyhlcolor=00000080" "--ringvercolor=00000000" \
112
+        "--separatorcolor=22222260" "--insidevercolor=0000001c" \
113
+        "--ringwrongcolor=00000055" "--insidewrongcolor=0000001c")
114
+fi
115
+
116
+convert "$image" "${hue[@]}" "${effect[@]}" -font "$font" -pointsize 26 -fill "$bw" -gravity center \
117
+    -annotate +0+160 "$text" "$icon" -gravity center -composite "$image"
118
+
119
+# If invoked with -d/--desktop, we'll attempt to minimize all windows (ie. show
120
+# the desktop) before locking.
121
+${desktop} ${desktop:+-k on}
122
+
123
+# try to use i3lock with prepared parameters
124
+if ! "${i3lock_cmd[@]}" "${param[@]}" >/dev/null 2>&1; then
125
+    # We have failed, lets get back to stock one
126
+    "${i3lock_cmd[@]}"
127
+fi
128
+
129
+# As above, if we were passed -d/--desktop, we'll attempt to restore all windows
130
+# after unlocking.
131
+${desktop} ${desktop:+-k off}