summaryrefslogtreecommitdiffstats
path: root/rc.org
blob: 45ef4a863eae02716289efc1aeccb01ebe9fc72d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
#+title: rc.org
#+property: header-args :comments no :mkdirp yes :results silent

* About

This org file contains the configuration files of pretty much every
program I use. The files are tangled (i.e. exported, or derived) from
this file using =org-babel=.

Note: This file is best viewed inside Emacs with org mode.

* Configs

This section contains the configuration files (dotfiles) of various
programs I use besides GNU Emacs.

** Fontconfig
:PROPERTIES:
:header-args+: :tangle ~/.config/fontconfig/fonts.conf
:END:

#+begin_src xml
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
 <match target="font">
  <edit mode="assign" name="rgba">
   <const>rgb</const>
  </edit>
 </match>
 <match target="font">
  <edit mode="assign" name="hinting">
   <bool>true</bool>
  </edit>
 </match>
 <match target="font">
  <edit mode="assign" name="hintstyle">
   <const>hintslight</const>
  </edit>
 </match>
 <match target="font">
  <edit mode="assign" name="antialias">
   <bool>true</bool>
  </edit>
 </match>
 <match target="font">
  <edit mode="assign" name="lcdfilter">
   <const>lcddefault</const>
  </edit>
 </match>
 <dir>~/.fonts</dir>

 <!-- Use Liberation Sans for Helvetica (instead of Nimbus Sans) -->
 <alias binding="same">
  <family>Helvetica</family>
  <prefer>
   <family>Liberation Sans</family>
  </prefer>
</alias>
</fontconfig>
#+end_src

** getmail
:PROPERTIES:
:header-args+: :tangle ~/.config/getmail/getmailrc
:END:

#+begin_src conf
[retriever]
type = SimplePOP3SSLRetriever
server = fencepost.gnu.org
username = bandali
password_command = ("gpg", "--no-tty", "-q", "-d", "/home/bandali/.passwd/gnu.gpg")
port = 995
use_apop = True

[destination]
type = Maildir
path = ~/mail/gnu.local/bandali/mail/

# [destination]
# type = MDA_external
# path = /usr/lib/dovecot/deliver
# arguments = ('-e', '-f', '%(sender)', '-d', 'bandali@gnu.local')

[options]
read_all = false
delete_after = 1
# delete = true
received = false
delivered_to = false
#+end_src

** Git

*** config
:PROPERTIES:
:header-args+: :tangle ~/.config/git/config
:END:

#+begin_src conf
[user]
	name = Amin Bandali
	email = bandali@gnu.org
	signingkey = BE6273738E616D6D1B3A08E8A21A020248816103

[commit]
	gpgsign = true

# [format]
# 	signoff = true

[core]
	autocrlf = input  # CRLF -> LF on commit
	editor = emacsclient -t
	pager = "less"

[mailmap]
	file = ~/.config/git/mailmap

[alias]
	git = !exec git	 # handle nested git calls, e.g. git git status
	aliases = config --get-regexp '^alias\\.'
	a = add
	s = status
	sl = status --long
	c = checkout
	cb = checkout -b
	b = branch
	r = rebase
	p = pull
	pr = pull --rebase
	ps = push
	psf = push --force
	nmam = "!f() { notmuch show --format=raw $1 | git am -; }; f"
	nmam3 = "!f() { notmuch show --format=raw $1 | git am -3 -; }; f"

[color]
	ui = auto
[color "status"]
	added = green bold
	changed = red bold
	untracked = red bold
[color "branch"]
	current = green bold
	remote = magenta bold
[color "diff"]
	new = green bold
	old = red bold

# [status]
# 	# showUntrackedFiles = all
# 	short=true
# 	branch=true

[github]
	user = notbandali

[sendemail]
	smtpuser = bandali
	smtpserver = fencepost.gnu.org
	smtpserverport = 587
	smtpencryption = tls
	annotate = yes

[transfer]
	fsckObjects = true
#+end_src

*** ignore
:PROPERTIES:
:header-args+: :tangle ~/.config/git/ignore
:END:

#+begin_src conf
*.orig
*.py[co]
*.sublime-workspace
*~
.DS_Store
*.elc
*-autoloads.el
TAGS
#+end_src

*** mailmap
:PROPERTIES:
:header-args+: :tangle ~/.config/git/mailmap
:END:

#+begin_src conf
<bandali@gnu.org> <mab@gnu.org>
<bandali@gnu.org> <amin@gnu.org>
<bandali@gnu.org> <aminb@gnu.org>
<bandali@gnu.org> <amin@aminb.org>
<bandali@gnu.org> <me@aminb.org>
#+end_src

** GnuPG
:PROPERTIES:
:header-args+: :tangle ~/.gnupg/gpg-agent.conf
:END:

#+begin_src conf
default-cache-ttl 43200
max-cache-ttl 86400

default-cache-ttl-ssh 43200
max-cache-ttl-ssh 86400

pinentry-program /home/bandali/.guix-profile/bin/pinentry-emacs
allow-emacs-pinentry
allow-loopback-pinentry
#+end_src

** GTK

*** GTK+ 2
:PROPERTIES:
:header-args+: :tangle ~/.gtkrc-2.0
:END:

#+begin_src conf
gtk-theme-name="Xfce"
# gtk-icon-theme-name="elementary Xfce darker"
gtk-font-name="Roboto 10"
# gtk-font-name="Source Code Variable 10"
gtk-menu-images=0
# gtk-key-theme-name = "Emacs"
#+end_src

*** GTK+ 3
:PROPERTIES:
:header-args+: :tangle ~/.config/gtk-3.0/settings.ini
:END:

#+begin_src conf
[Settings]
gtk-icon-theme-name = Adwaita
# gtk-theme-name = Adwaita

gtk-theme-name = Xfce
# gtk-theme-name = Arc-Darker
# gtk-theme-name = Numix-ArchBlue

gtk-font-name = Roboto 10
# gtk-font-name = Source Code Variable Medium 10
# gtk-key-theme-name = Emacs
#+end_src

** Guix

*** Channels
:PROPERTIES:
:header-args+: :tangle ~/.config/guix/channels.scm
:END:

#+begin_src scheme
(list (channel
       (name 'guix)        ; https://git.savannah.gnu.org/git/guix.git
       (url "file:///home/bandali/src/git/guix"))
      (channel
       (name 'guix-bandali)  ; https://git.sr.ht/~bandali/guix-bandali
       (url "file:///home/bandali/src/git/guix-bandali")))
#+end_src

*** Profile manifests

To install/update the packages of the default profile, use
#+begin_example
guix package -m $MY_GUIX_MANIFESTS/main.scm
#+end_example
and for other profiles, use
#+begin_example
guix package -m $MY_GUIX_MANIFESTS/name.scm -p $MY_GUIX_PROFILES/name/name
#+end_example
where =name= is the name of the profile (e.g. =doc=, =media=, ...).

**** doc
:PROPERTIES:
:header-args+: :tangle ~/.config/guix/manifest/doc.scm
:END:

#+begin_src scheme
(specifications->manifest
  '("libreoffice"
    "texlive-amsfonts"
    "texlive-base"
    "texlive-latex-listings"
    ;; "texlive-palatino"
    "texlive-xcolor"
))
#+end_src

**** main
:PROPERTIES:
:header-args+: :tangle ~/.config/guix/manifest/main.scm
:END:

#+begin_src scheme
(specifications->manifest
  '("alsa-utils"
    "bash-completion"
    "cpufrequtils"
    "cpupower"
    "cvs"
    "dunst"
    "emacs"
    "emacs-alert"
    "emacs-amx"
    "emacs-async"
    "emacs-biblio-git"
    "emacs-boxquote"
    "emacs-company"
    "emacs-company-ebdb"
    "emacs-crux"
    "emacs-dash"
    "emacs-debbugs"
    "emacs-diff-hl"
    "emacs-dmenu"
    "emacs-doom-themes"
    "emacs-ebdb"
    "emacs-emmet-mode"
    ;; "emacs-emojify"
    "emacs-erc-hl-nicks"
    "emacs-erc-scrolltoplace"
    "emacs-eshell-up"
    "emacs-exec-path-from-shell"
    "emacs-expand-region"
    "emacs-exwm"
    "emacs-exwm-edit"
    "emacs-flycheck"
    "emacs-geiser"
    ;; "emacs-gnus-harvest"
    "emacs-guix"
    "emacs-helpful"
    "emacs-hl-todo"
    "emacs-ivy"
    "emacs-magit"
    "emacs-message-x"
    "emacs-minions"
    ;; "emacs-multi-term"
    "emacs-multiple-cursors"
    "emacs-mwim"
    ;; "emacs-next"
    ;; "emacs-next-delight"
    "emacs-no-littering"
    "emacs-org"
    "emacs-org-contrib"
    "emacs-org-ref"
    "emacs-orgalist"
    "emacs-page-break-lines"
    "emacs-pass"
    "emacs-pinentry"
    "emacs-projectile"
    "emacs-shrink-path-git"
    "emacs-smart-mode-line"
    "emacs-typo"
    "emacs-unkillable-scratch"
    "emacs-use-package"
    "emacs-web-mode"
    "emacs-which-key"
    "emacs-yasnippet"
    "emacs-znc-git"
    "font-adobe-source-code-pro"
    "font-gnu-freefont-ttf"
    "font-google-roboto"
    "font-liberation"
    "font-linuxlibertine"
    "font-sil-gentium"
    "font-tex-gyre"
    ;; "font-ubuntu"
    "font-vazir"
    "getmail"
    "gettext"
    "git"
    "git:send-email"
    "gnupg"
    "guile"
    "haunt"
    "htop"
    "hunspell"
    "hunspell-dict-en-ca"
    "hunspell-dict-en-us"
    "isync"
    "light"
    "msmtp"
    "ncdu"
    "notmuch"
    "openjdk"
    "openssh"
    "openssl"
    "pass-otp"
    "password-store"
    "pasystray"
    "pinentry-emacs"
    "poppler"                           ; for 'pdffonts'
    "rofi"
    "rofi-pass"
    "rsync"
    "rxvt-unicode"
    "screen"
    "scrot"
    "setxkbmap"
    "strace"
    "thinkfan"
    "unzip"
    "wget"
    "xdg-user-dirs"
    ;; "xkbcomp"
    "xmodmap"
    "xrdb"
    "xset"
    "xsetroot"))
#+end_src

**** media
:PROPERTIES:
:header-args+: :tangle ~/.config/guix/manifest/media.scm
:END:

#+begin_src scheme
(specifications->manifest
  '("audacity"
    "gimp"
    "inkscape"
    "mpv"
    "youtube-dl"))
#+end_src

**** web
:PROPERTIES:
:header-args+: :tangle ~/.config/guix/manifest/web.scm
:END:

#+begin_src scheme
(specifications->manifest
  '("icecat"
    "rtv"))
#+end_src

*** Systems

**** chaman
:PROPERTIES:
:header-args+: :tangle ~/.config/guix/system/chaman.scm
:END:

#+begin_src scheme
(use-modules (gnu)
             (gnu packages certs)       ; for nss-certs
             (gnu packages emacs-xyz)   ; for exwm
             (gnu packages linux))      ; for powertop
(use-service-modules admin desktop mail networking pm ssh xorg)

(operating-system
 (host-name "chaman")
 (locale "en_CA.utf8")
 (timezone "Canada/Eastern")
 (keyboard-layout
  (keyboard-layout "us" "basic"))
 (bootloader
  (bootloader-configuration
   (bootloader grub-bootloader)
   (target "/dev/sda")
   (keyboard-layout keyboard-layout)))
 (mapped-devices
  (list (mapped-device
         (source
          (uuid "283da85e-2c84-47e6-a8ca-20f4e8efb806"))
         (target "groot")
         (type luks-device-mapping))
        (mapped-device
         (source
          (uuid "017ddebc-c2c3-4a0a-bda4-d47ec0bc67f0"))
         (target "data")
         (type luks-device-mapping))))
 (file-systems
  (cons* (file-system
          (mount-point "/")
          (device "/dev/mapper/groot")
          (type "ext4")
          (dependencies mapped-devices))
         (file-system
          (mount-point "/data")
          (device "/dev/mapper/data")
          (type "ext4")
          (dependencies mapped-devices))
         %base-file-systems))
 (users
  (cons* (user-account
          (name "bandali")
          (group "users")
          (home-directory "/home/bandali")
          (supplementary-groups
           '("wheel" "netdev" "audio" "video")))
         %base-user-accounts))
 (packages
  (cons* nss-certs
         emacs-exwm
         %base-packages))
 (services
  (cons*
   (service xfce-desktop-service-type)
   (set-xorg-configuration
    (xorg-configuration
     (keyboard-layout keyboard-layout)))
   (dovecot-service
    #:config
    (dovecot-configuration
     ;; (log-path "/dev/stderr")
     (protocols (list (protocol-configuration
                       (name "imap"))))
     (ssl? "no")
     (listen '("127.0.0.1"))
     (disable-plaintext-auth? #f)
     (auth-mechanisms '("plain"))
     (postmaster-address "bandali@gnu.local")
     (mail-location "maildir:/home/bandali/mail/%d/%n/mail")
     (userdbs (list (userdb-configuration
                     (driver "static")
                     (args (list "uid=bandali" "gid=users" "home=/home/bandali/mail/%d/%n")))))
     (passdbs (list (passdb-configuration
                     (driver "passwd-file")
                     (args (list "/data/dovecot-passwd")))))))
   (service rottlog-service-type)
   (service thermald-service-type)
   (service tlp-service-type
            (tlp-configuration
             (cpu-boost-on-ac? #t)
             (sound-power-save-on-bat 0)
             (sound-power-save-controller? #f)
             ;; (usb-blacklist "0e8f:00a8") ;for some reason doesn't seem to work
             (usb-autosuspend? #f)))
   (simple-service 'my-powertop-auto-tune activation-service-type
                   #~(zero? (system* #$(file-append powertop "/sbin/powertop")
                                     "--auto-tune")))
   (simple-service 'light-udev-rules udev-service-type (list light))
   %desktop-services)))
#+end_src

** isync
:PROPERTIES:
:header-args+: :tangle ~/.config/isync/mbsyncrc
:END:

#+begin_src conf
# Global defaults
CopyArrivalDate yes
Create Both
Expunge Both

######
IMAPAccount shemshak
Host mail.shemshak.org
User amin@shemshak.org
PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/shemshak.gpg"
SSLType IMAPS

IMAPStore shemshak-remote
Account shemshak

IMAPAccount shemshak-local
Host 127.0.0.1
Port 143
User amin@shemshak.local
PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/shemshak-local.gpg"
SSLType None

IMAPStore shemshak-local
Account shemshak-local

Channel shemshak
Master :shemshak-remote:
Slave :shemshak-local:
Patterns *

######
IMAPAccount gnub
Host mail.shemshak.org
User gnu@bandali.eu.org
PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/gnub.gpg"
SSLType IMAPS

IMAPStore gnub-remote
Account gnub

IMAPAccount gnub-local
Host 127.0.0.1
Port 143
User bandali@gnu.local
PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/gnub-local.gpg"
SSLType None

IMAPStore gnub-local
Account gnub-local

Channel gnub
Master :gnub-remote:
Slave :gnub-local:
Patterns *

######
IMAPAccount uwaterloo
Host connect.uwaterloo.ca
User abandali
PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/uwaterloo.gpg"
SSLType IMAPS

IMAPStore uwaterloo-remote
Account uwaterloo

IMAPAccount uwaterloo-local
Host 127.0.0.1
Port 143
User abandali@uw.local
PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/uwaterloo-local.gpg"
SSLType None

IMAPStore uwaterloo-local
Account uwaterloo-local

Channel uwaterloo
Master :uwaterloo-remote:
Slave :uwaterloo-local:
Patterns *

######
IMAPAccount csclub
Host mail.csclub.uwaterloo.ca
User abandali
PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/csclub.gpg"
SSLType IMAPS

IMAPStore csclub-remote
Account csclub

IMAPAccount csclub-local
Host 127.0.0.1
Port 143
User abandali@csc.uw.local
PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/csclub-local.gpg"
SSLType None

IMAPStore csclub-local
Account csclub-local

Channel csclub
Master :csclub-remote:
Slave :csclub-local:
Patterns *
#+end_src

** Latexmk
:PROPERTIES:
:header-args+: :tangle ~/.config/latexmk/latexmkrc
:END:

#+begin_src conf
$pdf_previewer = "start zathura %O %S";
$clean_ext = "aux out";

# $pdf_update_method = 4;
# $pdf_update_command = "zathura %O %S";

# Synctex allows one to jump to from the PDF in Zathura to the source in Emacs
# by Ctrl+click in the PDF.
# Tell latexmk to use Zathura as a previewer, and run emacsclient as the Synctex
# editor.
# $pdf_previewer = 'exec zathura --synctex-forward -x \'emacsclient --no-wait +%{line} %{input}\' %O %S';
#+end_src

** mpd
:PROPERTIES:
:header-args+: :tangle ~/.config/mpd/mpd.conf
:END:

#+begin_src conf
# An example configuration file for MPD.
# Read the user manual for documentation: http://www.musicpd.org/doc/user/


# Files and directories #######################################################
#
# This setting controls the top directory which MPD will search to discover the
# available audio files and add them to the daemon's online database. This 
# setting defaults to the XDG directory, otherwise the music directory will be
# be disabled and audio files will only be accepted over ipc socket (using
# file:// protocol) or streaming files over an accepted protocol.
#
music_directory		"~/usr/music"
#
# This setting sets the MPD internal playlist directory. The purpose of this
# directory is storage for playlists created by MPD. The server will use 
# playlist files not created by the server but only if they are in the MPD
# format. This setting defaults to playlist saving being disabled.
#
playlist_directory		"~/.mpd/playlists"
#
# This setting sets the location of the MPD database. This file is used to
# load the database at server start up and store the database while the 
# server is not up. This setting defaults to disabled which will allow
# MPD to accept files over ipc socket (using file:// protocol) or streaming
# files over an accepted protocol.
#
db_file			"~/.mpd/database"
# 
# These settings are the locations for the daemon log files for the daemon.
# These logs are great for troubleshooting, depending on your log_level
# settings.
#
# The special value "syslog" makes MPD use the local syslog daemon. This
# setting defaults to logging to syslog, otherwise logging is disabled.
#
log_file			"~/.mpd/log"
#
# This setting sets the location of the file which stores the process ID
# for use of mpd --kill and some init scripts. This setting is disabled by
# default and the pid file will not be stored.
#
pid_file			"~/.mpd/pid"
#
# This setting sets the location of the file which contains information about
# most variables to get MPD back into the same general shape it was in before
# it was brought down. This setting is disabled by default and the server 
# state will be reset on server start up.
#
state_file			"~/.mpd/state"
#
# The location of the sticker database.  This is a database which
# manages dynamic information attached to songs.
#
sticker_file			"~/.mpd/sticker.sql"
#
###############################################################################


# General music daemon options ################################################
#
# This setting specifies the user that MPD will run as. MPD should never run as
# root and you may use this setting to make MPD change its user ID after
# initialization. This setting is disabled by default and MPD is run as the
# current user.
#
#user				"nobody"
#
# This setting specifies the group that MPD will run as. If not specified
# primary group of user specified with "user" setting will be used (if set).
# This is useful if MPD needs to be a member of group such as "audio" to
# have permission to use sound card.
#
#group				"nogroup"
#
# This setting sets the address for the daemon to listen on. Careful attention
# should be paid if this is assigned to anything other then the default, any.
# This setting can deny access to control of the daemon. Not effective if
# systemd socket activiation is in use.
#
# For network
#bind_to_address		"any"
#
# And for Unix Socket
#bind_to_address		"~/.mpd/socket"
#
# This setting is the TCP port that is desired for the daemon to get assigned
# to.
#
#port				"6600"
#
# This setting controls the type of information which is logged. Available 
# setting arguments are "default", "secure" or "verbose". The "verbose" setting
# argument is recommended for troubleshooting, though can quickly stretch
# available resources on limited hardware storage.
#
#log_level			"default"
#
# If you have a problem with your MP3s ending abruptly it is recommended that 
# you set this argument to "no" to attempt to fix the problem. If this solves
# the problem, it is highly recommended to fix the MP3 files with vbrfix
# (available from <http://www.willwap.co.uk/Programs/vbrfix.php>), at which
# point gapless MP3 playback can be enabled.
#
#gapless_mp3_playback			"yes"
#
# Setting "restore_paused" to "yes" puts MPD into pause mode instead
# of starting playback after startup.
#
#restore_paused "no"
#
# This setting enables MPD to create playlists in a format usable by other
# music players.
#
#save_absolute_paths_in_playlists	"no"
#
# This setting defines a list of tag types that will be extracted during the
# audio file discovery process. The complete list of possible values can be
# found in the user manual.
#metadata_to_use	"artist,album,title,track,name,genre,date,composer,performer,disc"
#
# This setting enables automatic update of MPD's database when files in 
# music_directory are changed.
#
#auto_update	"yes"
#
# Limit the depth of the directories being watched, 0 means only watch
# the music directory itself.  There is no limit by default.
#
#auto_update_depth "3"
#
###############################################################################


# Symbolic link behavior ######################################################
#
# If this setting is set to "yes", MPD will discover audio files by following 
# symbolic links outside of the configured music_directory.
#
#follow_outside_symlinks	"yes"
#
# If this setting is set to "yes", MPD will discover audio files by following
# symbolic links inside of the configured music_directory.
#
#follow_inside_symlinks		"yes"
#
###############################################################################


# Zeroconf / Avahi Service Discovery ##########################################
#
# If this setting is set to "yes", service information will be published with
# Zeroconf / Avahi.
#
#zeroconf_enabled		"yes"
#
# The argument to this setting will be the Zeroconf / Avahi unique name for
# this MPD server on the network.
#
#zeroconf_name			"Music Player"
#
###############################################################################


# Permissions #################################################################
#
# If this setting is set, MPD will require password authorization. The password
# setting can be specified multiple times for different password profiles.
#
#password                        "password@read,add,control,admin"
#
# This setting specifies the permissions a user has who has not yet logged in. 
#
#default_permissions             "read,add,control,admin"
#
###############################################################################


# Database #######################################################################
#

#database {
#       plugin "proxy"
#       host "other.mpd.host"
#       port "6600"
#}

# Input #######################################################################
#

input {
        plugin "curl"
#       proxy "proxy.isp.com:8080"
#       proxy_user "user"
#       proxy_password "password"
}

#
###############################################################################

# Audio Output ################################################################
#

audio_output {
    type    "pulse"
    name    "pulse audio"
}

audio_output {
    type    "fifo"
    name    "my_fifo"
    path    "/tmp/mpd.fifo"
    format  "44100:16:2"
}

# MPD supports various audio output types, as well as playing through multiple 
# audio outputs at the same time, through multiple audio_output settings 
# blocks. Setting this block is optional, though the server will only attempt
# autodetection for one sound card.
#
# An example of an ALSA output:
#
#audio_output {
#	type		"alsa"
#	name		"My ALSA Device"
##	device		"hw:0,0"	# optional
##	mixer_type      "hardware"	# optional
##	mixer_device	"default"	# optional
##	mixer_control	"PCM"		# optional
##	mixer_index	"0"		# optional
#}
#
# An example of an OSS output:
#
#audio_output {
#	type		"oss"
#	name		"My OSS Device"
##	device		"/dev/dsp"	# optional
##	mixer_type      "hardware"	# optional
##	mixer_device	"/dev/mixer"	# optional
##	mixer_control	"PCM"		# optional
#}
#
# An example of a shout output (for streaming to Icecast):
#
#audio_output {
#	type		"shout"
#	encoder		"vorbis"		# optional
#	name		"My Shout Stream"
#	host		"localhost"
#	port		"8000"
#	mount		"/mpd.ogg"
#	password	"hackme"
#	quality		"5.0"
#	bitrate		"128"
#	format		"44100:16:1"
##	protocol	"icecast2"		# optional
##	user		"source"		# optional
##	description	"My Stream Description"	# optional
##	url		"http://example.com"	# optional
##	genre		"jazz"			# optional
##	public		"no"			# optional
##	timeout		"2"			# optional
##	mixer_type      "software"		# optional
#}
#
# An example of a recorder output:
#
#audio_output {
#	type		"recorder"
#	name		"My recorder"
#	encoder		"vorbis"		# optional, vorbis or lame
#	path		"/var/lib/mpd/recorder/mpd.ogg"
##	quality		"5.0"			# do not define if bitrate is defined
#	bitrate		"128"			# do not define if quality is defined
#	format		"44100:16:1"
#}
#
# An example of a httpd output (built-in HTTP streaming server):
#
#audio_output {
#	type		"httpd"
#	name		"My HTTP Stream"
#	encoder		"vorbis"		# optional, vorbis or lame
#	port		"8000"
#	bind_to_address	"0.0.0.0"		# optional, IPv4 or IPv6
##	quality		"5.0"			# do not define if bitrate is defined
#	bitrate		"128"			# do not define if quality is defined
#	format		"44100:16:1"
#	max_clients	"0"			# optional 0=no limit
#}
#
# An example of a pulseaudio output (streaming to a remote pulseaudio server)
#
#audio_output {
#	type		"pulse"
#	name		"My Pulse Output"
##	server		"remote_server"		# optional
##	sink		"remote_server_sink"	# optional
#}
#
# An example of a winmm output (Windows multimedia API).
#
#audio_output {
#	type		"winmm"
#	name		"My WinMM output"
##	device		"Digital Audio (S/PDIF) (High Definition Audio Device)" # optional
#		or
##	device		"0"		# optional
##	mixer_type	"hardware"	# optional
#}
#
# An example of an openal output.
#
#audio_output {
#	type		"openal"
#	name		"My OpenAL output"
##	device		"Digital Audio (S/PDIF) (High Definition Audio Device)" # optional
#}
#
# An example of an sndio output.
#
#audio_output {
#	type		"sndio"
#	name		"sndio output"
#	mixer_type	"software"
#}
#
# An example of an OS X output:
#
#audio_output {
#	type		"osx"
#	name		"My OS X Device"
##	device		"Built-in Output"	# optional
##	channel_map      "-1,-1,0,1"	# optional
#}
#
## Example "pipe" output:
#
#audio_output {
#	type		"pipe"
#	name		"my pipe"
#	command		"aplay -f cd 2>/dev/null"
## Or if you're want to use AudioCompress
#	command		"AudioCompress -m | aplay -f cd 2>/dev/null"
## Or to send raw PCM stream through PCM:
#	command		"nc example.org 8765"
#	format		"44100:16:2"
#}
#
## An example of a null output (for no audio output):
#
#audio_output {
#	type		"null"
#	name		"My Null Output"
#	mixer_type      "none"			# optional
#}
#
###############################################################################


# Normalization automatic volume adjustments ##################################
#
# This setting specifies the type of ReplayGain to use. This setting can have
# the argument "off", "album", "track" or "auto". "auto" is a special mode that
# chooses between "track" and "album" depending on the current state of
# random playback. If random playback is enabled then "track" mode is used.
# See <http://www.replaygain.org> for more details about ReplayGain.
# This setting is off by default.
#
#replaygain			"album"
#
# This setting sets the pre-amp used for files that have ReplayGain tags. By
# default this setting is disabled.
#
#replaygain_preamp		"0"
#
# This setting sets the pre-amp used for files that do NOT have ReplayGain tags.
# By default this setting is disabled.
#
#replaygain_missing_preamp	"0"
#
# This setting enables or disables ReplayGain limiting.
# MPD calculates actual amplification based on the ReplayGain tags
# and replaygain_preamp / replaygain_missing_preamp setting.
# If replaygain_limit is enabled MPD will never amplify audio signal
# above its original level. If replaygain_limit is disabled such amplification
# might occur. By default this setting is enabled.
#
#replaygain_limit		"yes"
#
# This setting enables on-the-fly normalization volume adjustment. This will
# result in the volume of all playing audio to be adjusted so the output has 
# equal "loudness". This setting is disabled by default.
#
#volume_normalization		"no"
#
###############################################################################

# Character Encoding ##########################################################
#
# If file or directory names do not display correctly for your locale then you 
# may need to modify this setting.
#
#filesystem_charset		"UTF-8"
#
###############################################################################
#+end_src

** msmtp
:PROPERTIES:
:header-args+: :tangle ~/.config/msmtp/config
:END:

#+begin_src conf
# Set default values for all following accounts.
defaults
port 587
tls on
auth on
#tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile ~/.msmtp.log

account shemshak
host mail.shemshak.org
# use `msmtp -a shemshak --serverinfo --tls --tls-certcheck=off --tls-fingerprint=` to get the current fingerprint
tls_fingerprint 01:6F:1B:92:0A:E8:47:35:62:80:DD:17:F5:9A:9D:26:7D:59:E2:EC:69:67:36:69:2F:58:8C:89:57:66:F6:B1
tls_starttls on
from amin@shemshak.org
user amin@shemshak.org
passwordeval gpg --no-tty -q -d ~/.passwd/shemshak.gpg

account aminb : shemshak
from amin@aminb.org
account bndl : shemshak
from amin@bndl.org

account gnu
host fencepost.gnu.org
# use `msmtp -a gnu --serverinfo --tls --tls-certcheck=off --tls-fingerprint=` to get the current fingerprint
tls_fingerprint A5:E9:14:9F:46:3E:8E:0F:09:8C:5D:21:C2:BE:DE:77:BE:8B:E7:82:6C:56:78:0C:62:CA:46:D7:18:FE:33:05
tls_starttls on
from bandali@gnu.org
user bandali
passwordeval gpg --no-tty -q -d ~/.passwd/gnu.gpg

account gnu-mab : gnu
from mab@gnu.org
account gnu-aminb : gnu
from aminb@gnu.org
account gnu-amin : gnu
from amin@gnu.org

account uwaterloo
host connect.uwaterloo.ca
tls_starttls on
from abandali@uwaterloo.ca
user abandali
passwordeval gpg --no-tty -q -d ~/.passwd/uwaterloo.gpg
tls_trust_file /etc/ssl/certs/ca-certificates.crt

account uwaterloo-friendly : uwaterloo
from bandali@uwaterloo.ca

account csclub
host mail.csclub.uwaterloo.ca
tls_starttls on
from abandali@csclub.uwaterloo.ca
user abandali
passwordeval gpg --no-tty -q -d ~/.passwd/csclub.gpg
tls_trust_file /etc/ssl/certs/ca-certificates.crt

account csclub-friendly : csclub
from bandali@csclub.uwaterloo.ca

# Set a default account
account default : shemshak
#+end_src

** Readline
:PROPERTIES:
:header-args+: :tangle ~/.config/readline/inputrc
:END:

#+begin_src conf
set enable-bracketed-paste on

set colored-stats on
set colored-completion-prefix on
set completion-ignore-case on
set menu-complete-display-prefix on
set page-completions off
set show-all-if-ambiguous on
set show-all-if-unmodified on
set visible-stats on

TAB: menu-complete
"\e[Z": menu-complete-backward

"\e[A": history-search-backward
"\e[B": history-search-forward
#+end_src

** rofi
:PROPERTIES:
:header-args+: :tangle ~/.config/rofi/config
:END:

#+begin_src conf
! rofi.font: Ubuntu Mono 13
! rofi.font: Inconsolata 16
! rofi.font: Iosevka 13
! rofi.font: Source Code Pro 11
rofi.font: Source Code Pro 10.5
rofi.modi: run,window
! rofi.width: 640
rofi.width: 600
!rofi.location: 2
!rofi.yoffset: 200
rofi.monitor: -1
!rofi.lines: 10

rofi.theme: ~/.guix-profile/share/rofi/themes/gruvbox-light-hard.rasi
#+end_src

** rofi-pass
:PROPERTIES:
:header-args+: :tangle ~/.config/rofi-pass/config
:END:

#+begin_src conf
# permanently set alternative root dir
# root=/path/to/root

# rofi command. Make sure to have "$@" as last argument
_rofi () {
    #rofi -no-auto-select -kb-accept-entry "!Return" -i -no-levenshtein-sort "$@"
    rofi -i -no-auto-select -kb-accept-entry "!Return" "$@"
}

# xdotool needs the keyboard layout to be set using setxkbmap
# You can do this in your autostart scripts (e.g. xinitrc)

# If for some reason, you cannot do this, you can set the command here.
# and set fix_layout to true
fix_layout=false

layout_cmd () {
  setxkbmap us
}

# fields to be used
URL_field='url'
USERNAME_field='user'
AUTOTYPE_field='autotype'

# delay to be used for :delay keyword
delay=2

## Programs to be used
# Editor
EDITOR='gvim -f'

# Browser
BROWSER='chromium'

## Misc settings

default_do='menu' # menu, autotype, copyPass, typeUser, typePass, copyUser, copyUrl, viewEntry, typeMenu, actionMenu, copyMenu, openUrl
auto_enter='false'
notify='false'
default_autotype='user :tab pass'

# color of the help messages
# leave empty for autodetection
help_color="#4872FF"

# Clipboard settings
# Possible options: primary, clipboard, both
clip=primary

# Options for generating new password entries
# default_user is also used for password files that have no user field.
default_user=aminb
default_user2=bandali
password_length=30

# Custom Keybindings
#autotype="Alt+1"
autotype="Alt+m"
type_user="Alt+2"
type_pass="Alt+3"
open_url="Alt+4"
copy_name="Alt+u"
copy_url="Alt+l"
copy_pass="Alt+p"
show="Alt+o"
copy_entry="Alt+2"
type_entry="Alt+1"
copy_menu="Alt+c"
action_menu="Alt+a"
type_menu="Alt+t"
help="Alt+h"
switch="Alt+x"
insert_pass="Alt+n"
#+end_src

** Screen
:PROPERTIES:
:header-args+: :tangle ~/.config/screen/screenrc
:END:

#+begin_src screen
startup_message off
caption always "%{= kc}GNU Screen $USER@%H (load: %l)%-28=%{= .m}%D %d.%m.%Y %0c"
#+end_src

** Shell

*** GNU Bash
:PROPERTIES:
:header-args+: :tangle ~/.bashrc
:END:

#+begin_src bash
# Bash initialization for interactive non-login shells and
# for remote shells (info "(bash) Bash Startup Files").

# Export 'SHELL' to child processes.  Programs such as 'screen'
# honor it and otherwise use /bin/sh.
export SHELL

if [[ $- != *i* ]]
then
    # We are being invoked from a non-interactive shell.  If this
    # is an SSH session (as in "ssh host command"), source
    # /etc/profile so we get PATH and other essential variables.
    [[ -n "$SSH_CLIENT" ]] && source /etc/profile

    # Don't do anything else.
    return
fi

if [ -n "$IS_GUIX_SYSTEM" ]; then
    # Source the system-wide file.
    source /etc/bashrc
fi

# from https://unix.stackexchange.com/a/55935
b_prompt() {
    cwd=$(sed -e "s:$HOME:~:" -e "s:\(\.\?[^/]\)[^/]*/:\1/:g" <<<$PWD)
    printf $cwd
}

if [ $(id -u) == "0" ]; then
    PS1='`printf "\[\e[1;31m\]\$\[\e[00m\]"` '
else
    PS1='\$ '
fi
PS1="\u@\h:\w/`[ -n "$GUIX_ENVIRONMENT" ] && printf \" [env]\"`\n$PS1"

# set terminal title
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: $(b_prompt)\007"'

# i-beam cursor
# echo -e "\033[5 q"              # blinking
echo -e "\033[6 q"              # non-blinking

# various bash tweaks
# append to the history file, don't overwrite it
shopt -s histappend
shopt -s cmdhist
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=
HISTFILESIZE=
# don't put duplicate lines or lines starting with space in the
# history.
HISTCONTROL=ignoreboth
# ignore a few very common commands and don't add them to history
HISTIGNORE='ls:l:s:g:[bf]g:history'
HISTTIMEFORMAT='%F %T '
stty stop ""

# aliases
alias ls='ls -p --color=auto'
alias l='ls -lh'                # long format and human-readable sizes
alias ll='l -A'                 # long format, all files
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias mpv="mpv --ytdl-format mp4"
alias mv="mv -iv"
alias cp="cp -iv"
alias mbsync='mbsync -c "$XDG_CONFIG_HOME"/isync/mbsyncrc'
alias getmail='getmail --getmaildir "$XDG_CONFIG_HOME"/getmail --rcfile getmailrc'
alias m="mbsync csclub; mbsync uwaterloo; mbsync shemshak; mbsync gnub"
alias best="youtube-dl -f best"
alias e="$EDITOR"
alias se="SUDO_EDITOR=\"emacsclient\" sudo -e"

aur() {
   cd ~/usr/builds
   [ -d ${1} ] || git clone https://aur.archlinux.org/${1}.git
   cd ${1}
}

function t {
  cd $(mktemp -d /tmp/$1.XXXX)
}

# separate alias definitions file, if exists
if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (not needed if already
# enabled in /etc/bash.bashrc and if /etc/profile sources
# /etc/bash.bashrc).
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi

# source Guix shell config dirs, for vte.sh and bash completions
GUIX_PROFILES=("${HOME}/.guix-profile"
               "${HOME}/.config/guix/current")
for profile in "${GUIX_PROFILES[@]}"; do
    for dir in "${profile}/etc/bash_completion.d" "${profile}/etc/profile.d"; do
        if [ -d "${dir}" ]; then
            for f in "${dir}"/*; do
                . $f
            done
        fi
    done
done
#+end_src

*** profile
:PROPERTIES:
:header-args+: :tangle ~/.profile
:END:

#+begin_src sh
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.

# source host-specific profile
if [ -f "$HOME/.config/profiles/$(hostname)" ]; then
    . "$HOME/.config/profiles/$(hostname)"
fi

export EDITOR="emacsclient -nw"
export VISUAL="emcl"

PATH="$HOME/usr/local/bin:$HOME/.local/bin:$PATH"
PATH="$HOME/.cabal/bin:$HOME/.cargo/bin:$HOME/.elan/bin:$PATH"
if [ -z "$IS_GUIX_SYSTEM" ]; then
    PATH="$HOME/.config/guix/current/bin${PATH:+:}$PATH"
    INFOPATH="$HOME/.config/guix/current/share/info${INFOPATH:+:}$INFOPATH"
    export GUIX_LOCPATH="$HOME/.guix-profile/lib/locale"
fi
export PATH
export INFOPATH

export MY_GUIX_MANIFESTS="$HOME/.config/guix/manifest"
export MY_GUIX_PROFILES="$HOME/.config/guix/profile"

export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"

if [ -f "$HOME/.config/user-dirs.dirs" ]; then
    set -a
    . "$HOME/.config/user-dirs.dirs"
    set +a
fi

export INPUTRC="$XDG_CONFIG_HOME"/readline/inputrc
export SCREENRC="$XDG_CONFIG_HOME"/screen/screenrc

export MAILDIR="$HOME/mail"
export CVS_RSH="ssh"

if [ -x "$(command -v go)" ]; then
    export GOPATH="$HOME/src/go"
    export PATH="$GOPATH/bin:$PATH"
fi

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
	. "$HOME/.bashrc"
    fi
fi

if [ -z "$IS_GUIX_SYSTEM" ]; then
    # if guix is installed
    if [ -x "$(command -v guix)" ]; then
        SSL_CERT_DIR="$HOME/.guix-profile/etc/ssl/certs"
        if [ -d "$SSL_CERT_DIR" -o -h "$SSL_CERT_DIR" ]; then
            export SSL_CERT_DIR
            export SSL_CERT_FILE="$HOME/.guix-profile/etc/ssl/certs/ca-certificates.crt"
        else
            printf "it seems you forgot to \`guix install nss-certs\'\n"
        fi
        GUIX_PROFILE="$HOME/.guix-profile"
        . "$GUIX_PROFILE/etc/profile"
        unset XDG_DATA_DIRS
    fi
fi

for p in $MY_GUIX_PROFILES/*; do
    profile=$p/$(basename "$p")
    if [ -f "$profile"/etc/profile ]; then
        GUIX_PROFILE="$profile"
        . "$GUIX_PROFILE"/etc/profile
    fi
    unset profile
done

# start an ssh-agent (with guix's openssh)
if [ -z "$IS_GUIX_SYSTEM" ]; then
    if ! pgrep -u "$USER" ssh-agent > /dev/null; then
        ssh-agent > ~/.ssh-agent-thing
    fi
    if [[ ! "$SSH_AUTH_SOCK" ]]; then
        eval "$(<~/.ssh-agent-thing)"
    fi
fi

# footenote: when on a foreign distro and using Xfce, don't forget to
# disable its auto-start of gpg- and ssh-agent, by issuing
#     xfconf-query -c xfce4-session -p /startup/ssh-agent/enabled -n -t bool -s false
#     xfconf-query -c xfce4-session -p /startup/gpg-agent/enabled -n -t bool -s false
# see https://docs.xfce.org/xfce/xfce4-session/advanced#ssh_and_gpg_agents
# also, MATE does something similar with gnome-keyring-daemon:
# http://william.shallum.net/random-notes/disabling-gnome-keyring-daemon-ssh-agent-on-mate-desktop
#+end_src

*** per-host profiles

Host-specific profiles, sourced from =~/.profile=.  Each
=~/.config/profiles/HOST= file will be sourced on the machine with
=hostname= of =HOST=.

**** chaman
:PROPERTIES:
:header-args+: :tangle ~/.config/profiles/chaman
:END:

#+begin_src sh
export IS_GUIX_SYSTEM=true

if [ -x "$(command -v xinput)" ]; then
   xinput --set-prop "TPPS/2 IBM TrackPoint" 'libinput Accel Speed' -0.4
fi

setxkbmap \
    -layout us,ir \
    -option ctrl:nocaps \
    -option grp:shifts_toggle

xmodmap -e "keysym Menu = Super_R"

xsetroot -cursor_name left_ptr
xset r rate 200 45
xset b off
#+end_src

**** darrud
:PROPERTIES:
:header-args+: :tangle ~/.config/profiles/darrud
:END:

#+begin_src sh
export INFOPATH="$HOME/usr/local/share/info${INFOPATH:+:}$INFOPATH"
#+end_src

**** langa
:PROPERTIES:
:header-args+: :tangle ~/.config/profiles/langa
:END:

#+begin_src sh
export XDG_DATA_DIRS="/usr/share/mate:/usr/local/share/:/usr/share/"
#+end_src

** redshift
:PROPERTIES:
:header-args+: :tangle ~/.config/redshift.conf :comments none
:END:

#+begin_src conf
; Global settings for redshift
[redshift]
; Set the day and night screen temperatures (Neutral is 6500K)
;temp-day=5700
;temp-night=3500

;temp-day=6500
temp-day=6200
;temp-night=4800
;temp-night=5000
;temp-night=4500
temp-night=4000

; Enable/Disable a smooth transition between day and night
; 0 will cause a direct change from day to night screen temperature.
; 1 will gradually increase or decrease the screen temperature.
transition=1

; Set the screen brightness. Default is 1.0.
;brightness=0.9
; It is also possible to use different settings for day and night
; since version 1.8.
;brightness-day=0.7
;brightness-night=0.4
; Set the screen gamma (for all colors, or each color channel
; individually)
;gamma=0.8
;gamma=1.0
;gamma=0.8:0.7:0.8
; This can also be set individually for day and night since
; version 1.10.
;gamma-day=0.8:0.7:0.8
;gamma-night=0.6

; Set the location-provider: 'geoclue2' or 'manual'
; type 'redshift -l list' to see possible values.
; The location provider settings are in a different section.
;location-provider=manual
location-provider=geoclue2

; Set the adjustment-method: 'randr', 'vidmode'
; type 'redshift -m list' to see all possible values.
; 'randr' is the preferred method, 'vidmode' is an older API.
; but works in some cases when 'randr' does not.
; The adjustment method settings are in a different section.
adjustment-method=randr

; Configuration of the location-provider:
; type 'redshift -l PROVIDER:help' to see the settings.
; ex: 'redshift -l manual:help'
; Keep in mind that longitudes west of Greenwich (e.g. the Americas)
; are negative numbers.
;[manual]
;lat=48.1
;lon=11.6

; Configuration of the adjustment-method
; type 'redshift -m METHOD:help' to see the settings.
; ex: 'redshift -m randr:help'
; In this example, randr is configured to adjust screen 1.
; Note that the numbering starts from 0, so this is actually the
; second screen. If this option is not specified, Redshift will try
; to adjust _all_ screens.
;[randr]
;screen=1
#+end_src

** signature
:PROPERTIES:
:header-args+: :tangle ~/.signature
:END:

My email signature.

#+begin_src
Amin Bandali
Free Software activist | GNU maintainer & webmaster
GPG: BE62 7373 8E61 6D6D 1B3A  08E8 A21A 0202 4881 6103
https://bandali.eu.org
#+end_src

** systemd

Keep boot messages on tty1 (see [[https://wiki.archlinux.org/index.php/getty#Have_boot_messages_stay_on_tty1][here]])

#+begin_src conf :tangle /sudo::/etc/systemd/system/getty@tty1.service.d/noclear.conf
[Service]
TTYVTDisallocate=no
#+end_src

** TLP

*** darrud

#+begin_src conf :tangle (when (and (eq system-type 'gnu/linux) (string= (system-name) "darrud")) "/sudo::/etc/default/tlp")
# ------------------------------------------------------------------------------
# tlp - Parameters for power saving
# See full explanation: http://linrunner.de/en/tlp/docs/tlp-configuration.html

# Hint: some features are disabled by default, remove the leading # to enable
# them.

# Set to 0 to disable, 1 to enable TLP.
TLP_ENABLE=1

# Operation mode when no power supply can be detected: AC, BAT.
# Concerns some desktop and embedded hardware only.
TLP_DEFAULT_MODE=AC

# Operation mode select: 0=depend on power source, 1=always use TLP_DEFAULT_MODE
# Hint: use in conjunction with TLP_DEFAULT_MODE=BAT for BAT settings on AC.
TLP_PERSISTENT_DEFAULT=0

# Seconds laptop mode has to wait after the disk goes idle before doing a sync.
# Non-zero value enables, zero disables laptop mode.
DISK_IDLE_SECS_ON_AC=0
DISK_IDLE_SECS_ON_BAT=2

# Dirty page values (timeouts in secs).
MAX_LOST_WORK_SECS_ON_AC=15
MAX_LOST_WORK_SECS_ON_BAT=60

# Hint: CPU parameters below are disabled by default, remove the leading #
# to enable them, otherwise kernel default values are used.

# Select a CPU frequency scaling governor.
# Intel Core i processor with intel_pstate driver:
#   powersave(*), performance.
# Older hardware with acpi-cpufreq driver:
#   ondemand(*), powersave, performance, conservative, schedutil.
# (*) is recommended.
# Hint: use tlp-stat -p to show the active driver and available governors.
# Important:
#   powersave for intel_pstate and ondemand for acpi-cpufreq are power
#   efficient for *almost all* workloads and therefore kernel and most
#   distributions have chosen them as defaults. If you still want to change,
#   you should know what you're doing! You *must* disable your distribution's
#   governor settings or conflicts will occur.
#CPU_SCALING_GOVERNOR_ON_AC=powersave
#CPU_SCALING_GOVERNOR_ON_BAT=powersave
CPU_SCALING_GOVERNOR_ON_AC=conservative
CPU_SCALING_GOVERNOR_ON_BAT=conservative

# Set the min/max frequency available for the scaling governor.
# Possible values strongly depend on your CPU. For available frequencies see
# the output of tlp-stat -p.
#CPU_SCALING_MIN_FREQ_ON_AC=0
#CPU_SCALING_MAX_FREQ_ON_AC=0
#CPU_SCALING_MIN_FREQ_ON_BAT=0
#CPU_SCALING_MAX_FREQ_ON_BAT=0

# Set energy performance hints (HWP) for Intel P-state governor:
#   performance, balance_performance, default, balance_power, power
# Values are given in order of increasing power saving.
# Note: Intel Skylake or newer CPU and Kernel >= 4.10 required.
CPU_HWP_ON_AC=balance_performance
CPU_HWP_ON_BAT=balance_power

# Set Intel P-state performance: 0..100 (%).
# Limit the max/min P-state to control the power dissipation of the CPU.
# Values are stated as a percentage of the available performance.
# Requires an Intel Core i processor with intel_pstate driver.
#CPU_MIN_PERF_ON_AC=0
#CPU_MAX_PERF_ON_AC=100
#CPU_MIN_PERF_ON_BAT=0
#CPU_MAX_PERF_ON_BAT=30

# Set the CPU "turbo boost" feature: 0=disable, 1=allow
# Requires an Intel Core i processor.
# Important:
# - This may conflict with your distribution's governor settings
# - A value of 1 does *not* activate boosting, it just allows it
#CPU_BOOST_ON_AC=1
#CPU_BOOST_ON_BAT=0

# Minimize number of used CPU cores/hyper-threads under light load conditions:
#   0=disable, 1=enable.
SCHED_POWERSAVE_ON_AC=0
SCHED_POWERSAVE_ON_BAT=1

# Kernel NMI Watchdog:
#   0=disable (default, saves power), 1=enable (for kernel debugging only).
NMI_WATCHDOG=0

# Change CPU voltages aka "undervolting" - Kernel with PHC patch required.
# Frequency voltage pairs are written to:
#   /sys/devices/system/cpu/cpu0/cpufreq/phc_controls
# CAUTION: only use this, if you thoroughly understand what you are doing!
#PHC_CONTROLS="F:V F:V F:V F:V"

# Set CPU performance versus energy savings policy:
#   performance, balance-performance, default, balance-power, power.
# Values are given in order of increasing power saving.
# Requires kernel module msr and x86_energy_perf_policy from linux-tools.
ENERGY_PERF_POLICY_ON_AC=performance
ENERGY_PERF_POLICY_ON_BAT=balance-power

# Disk devices; separate multiple devices with spaces (default: sda).
# Devices can be specified by disk ID also (lookup with: tlp diskid).
DISK_DEVICES="sda sdb"

# Disk advanced power management level: 1..254, 255 (max saving, min, off).
# Levels 1..127 may spin down the disk; 255 allowable on most drives.
# Separate values for multiple disks with spaces. Use the special value 'keep'
# to keep the hardware default for the particular disk.
DISK_APM_LEVEL_ON_AC="254 254"
DISK_APM_LEVEL_ON_BAT="128 128"

# Hard disk spin down timeout:
#   0:        spin down disabled
#   1..240:   timeouts from 5s to 20min (in units of 5s)
#   241..251: timeouts from 30min to 5.5 hours (in units of 30min)
# See 'man hdparm' for details.
# Separate values for multiple disks with spaces. Use the special value 'keep'
# to keep the hardware default for the particular disk.
#DISK_SPINDOWN_TIMEOUT_ON_AC="0 0"
#DISK_SPINDOWN_TIMEOUT_ON_BAT="0 0"

# Select IO scheduler for the disk devices: cfq, deadline, noop (Default: cfq).
# Separate values for multiple disks with spaces. Use the special value 'keep'
# to keep the kernel default scheduler for the particular disk.
#DISK_IOSCHED="cfq cfq"

# AHCI link power management (ALPM) for disk devices:
#   min_power, med_power_with_dipm(*), medium_power, max_performance.
# (*) Kernel >= 4.15 required, then recommended.
# Multiple values separated with spaces are tried sequentially until success.
SATA_LINKPWR_ON_AC="med_power_with_dipm max_performance"
SATA_LINKPWR_ON_BAT="med_power_with_dipm min_power"

# Exclude host devices from AHCI link power management.
# Separate multiple hosts with spaces.
#SATA_LINKPWR_BLACKLIST="host1"

# Runtime Power Management for AHCI host and disks devices:
#   on=disable, auto=enable.
# EXPERIMENTAL ** WARNING: auto will most likely cause system lockups/data loss.
#AHCI_RUNTIME_PM_ON_AC=on
#AHCI_RUNTIME_PM_ON_BAT=on

# Seconds of inactivity before disk is suspended.
AHCI_RUNTIME_PM_TIMEOUT=15

# PCI Express Active State Power Management (PCIe ASPM):
#   default, performance, powersave.
PCIE_ASPM_ON_AC=performance
PCIE_ASPM_ON_BAT=powersave

# Radeon graphics clock speed (profile method): low, mid, high, auto, default;
# auto = mid on BAT, high on AC; default = use hardware defaults.
RADEON_POWER_PROFILE_ON_AC=high
RADEON_POWER_PROFILE_ON_BAT=low

# Radeon dynamic power management method (DPM): battery, performance.
RADEON_DPM_STATE_ON_AC=performance
RADEON_DPM_STATE_ON_BAT=battery

# Radeon DPM performance level: auto, low, high; auto is recommended.
RADEON_DPM_PERF_LEVEL_ON_AC=auto
RADEON_DPM_PERF_LEVEL_ON_BAT=auto

# WiFi power saving mode: on=enable, off=disable; not supported by all adapters.
WIFI_PWR_ON_AC=off
WIFI_PWR_ON_BAT=on

# Disable wake on LAN: Y/N.
WOL_DISABLE=Y

# Enable audio power saving for Intel HDA, AC97 devices (timeout in secs).
# A value of 0 disables, >=1 enables power saving (recommended: 1).
SOUND_POWER_SAVE_ON_AC=0
SOUND_POWER_SAVE_ON_BAT=0

# Disable controller too (HDA only): Y/N.
SOUND_POWER_SAVE_CONTROLLER=N

# Power off optical drive in UltraBay/MediaBay: 0=disable, 1=enable.
# Drive can be powered on again by releasing (and reinserting) the eject lever
# or by pressing the disc eject button on newer models.
# Note: an UltraBay/MediaBay hard disk is never powered off.
BAY_POWEROFF_ON_AC=0
BAY_POWEROFF_ON_BAT=0
# Optical drive device to power off (default sr0).
BAY_DEVICE="sr0"

# Runtime Power Management for PCI(e) bus devices: on=disable, auto=enable.
RUNTIME_PM_ON_AC=on
RUNTIME_PM_ON_BAT=auto

# Exclude PCI(e) device adresses the following list from Runtime PM
# (separate with spaces). Use lspci to get the adresses (1st column).
#RUNTIME_PM_BLACKLIST="bb:dd.f 11:22.3 44:55.6"
RUNTIME_PM_BLACKLIST="01:00.0"

# Exclude PCI(e) devices assigned to the listed drivers from Runtime PM.
# Default when unconfigured is "amdgpu nouveau nvidia radeon" which
# prevents accidential power-on of dGPU in hybrid graphics setups.
# Use "" to disable the feature completely.
# Separate multiple drivers with spaces.
#RUNTIME_PM_DRIVER_BLACKLIST="amdgpu nouveau nvidia radeon"

# Set to 0 to disable, 1 to enable USB autosuspend feature.
USB_AUTOSUSPEND=1

# Exclude listed devices from USB autosuspend (separate with spaces).
# Use lsusb to get the ids.
# Note: input devices (usbhid) are excluded automatically
#USB_BLACKLIST="1111:2222 3333:4444"

# Bluetooth devices are excluded from USB autosuspend:
#   0=do not exclude, 1=exclude.
USB_BLACKLIST_BTUSB=0

# Phone devices are excluded from USB autosuspend:
#   0=do not exclude, 1=exclude (enable charging).
USB_BLACKLIST_PHONE=0

# Printers are excluded from USB autosuspend:
#   0=do not exclude, 1=exclude.
USB_BLACKLIST_PRINTER=1

# WWAN devices are excluded from USB autosuspend:
#   0=do not exclude, 1=exclude.
USB_BLACKLIST_WWAN=1

# Include listed devices into USB autosuspend even if already excluded
# by the blacklists above (separate with spaces).
# Use lsusb to get the ids.
#USB_WHITELIST="1111:2222 3333:4444"

# Set to 1 to disable autosuspend before shutdown, 0 to do nothing
# (workaround for USB devices that cause shutdown problems).
#USB_AUTOSUSPEND_DISABLE_ON_SHUTDOWN=1

# Restore radio device state (Bluetooth, WiFi, WWAN) from previous shutdown
# on system startup: 0=disable, 1=enable.
# Hint: the parameters DEVICES_TO_DISABLE/ENABLE_ON_STARTUP/SHUTDOWN below
#   are ignored when this is enabled!
#RESTORE_DEVICE_STATE_ON_STARTUP=0
RESTORE_DEVICE_STATE_ON_STARTUP=1

# Radio devices to disable on startup: bluetooth, wifi, wwan.
# Separate multiple devices with spaces.
#DEVICES_TO_DISABLE_ON_STARTUP="bluetooth wifi wwan"

# Radio devices to enable on startup: bluetooth, wifi, wwan.
# Separate multiple devices with spaces.
#DEVICES_TO_ENABLE_ON_STARTUP="wifi"

# Radio devices to disable on shutdown: bluetooth, wifi, wwan.
# (workaround for devices that are blocking shutdown).
#DEVICES_TO_DISABLE_ON_SHUTDOWN="bluetooth wifi wwan"

# Radio devices to enable on shutdown: bluetooth, wifi, wwan.
# (to prevent other operating systems from missing radios).
#DEVICES_TO_ENABLE_ON_SHUTDOWN="wwan"

# Radio devices to enable on AC: bluetooth, wifi, wwan.
#DEVICES_TO_ENABLE_ON_AC="bluetooth wifi wwan"

# Radio devices to disable on battery: bluetooth, wifi, wwan.
#DEVICES_TO_DISABLE_ON_BAT="bluetooth wifi wwan"

# Radio devices to disable on battery when not in use (not connected):
#   bluetooth, wifi, wwan.
#DEVICES_TO_DISABLE_ON_BAT_NOT_IN_USE="bluetooth wifi wwan"

# Battery charge thresholds (ThinkPad only, tp-smapi or acpi-call kernel module
# required). Charging starts when the remaining capacity falls below the
# START_CHARGE_THRESH value and stops when exceeding the STOP_CHARGE_THRESH value.
# Main / Internal battery (values in %)
#START_CHARGE_THRESH_BAT0=75
#STOP_CHARGE_THRESH_BAT0=80
# Ultrabay / Slice / Replaceable battery (values in %)
#START_CHARGE_THRESH_BAT1=75
#STOP_CHARGE_THRESH_BAT1=80

# Restore charge thresholds when AC is unplugged: 0=disable, 1=enable.
#RESTORE_THRESHOLDS_ON_BAT=1

# ------------------------------------------------------------------------------
# tlp-rdw - Parameters for the radio device wizard
# Possible devices: bluetooth, wifi, wwan.

# Hints:
# - Parameters are disabled by default, remove the leading # to enable them
# - Separate multiple radio devices with spaces

# Radio devices to disable on connect.
#DEVICES_TO_DISABLE_ON_LAN_CONNECT="wifi wwan"
#DEVICES_TO_DISABLE_ON_WIFI_CONNECT="wwan"
#DEVICES_TO_DISABLE_ON_WWAN_CONNECT="wifi"

# Radio devices to enable on disconnect.
#DEVICES_TO_ENABLE_ON_LAN_DISCONNECT="wifi wwan"
#DEVICES_TO_ENABLE_ON_WIFI_DISCONNECT=""
#DEVICES_TO_ENABLE_ON_WWAN_DISCONNECT=""

# Radio devices to enable/disable when docked.
#DEVICES_TO_ENABLE_ON_DOCK=""
#DEVICES_TO_DISABLE_ON_DOCK=""

# Radio devices to enable/disable when undocked.
#DEVICES_TO_ENABLE_ON_UNDOCK="wifi"
#DEVICES_TO_DISABLE_ON_UNDOCK=""
#+end_src

** Tridactyl
:PROPERTIES:
:header-args+: :tangle ~/.config/tridactyl/tridactylrc
:END:

#+begin_src conf
bind n scrollline 2
bind p scrollline -2

bind 0 scrollto 0 x
bind - scrollto 100 x

bind P tabprev
bind N tabnext

bind d scrollpage 0.5
bind u scrollpage -0.5
unbind <C-d>
unbind <C-u>

bind x tabclose
bind X undo
bind <C-S> stop

bind gd tabduplicate
bind gw tabdetach

bind O fillcmdline bmarks

bind ;<Space> fillcmdline_notrail

unbind <C-f>

set hintfiltermode vimperator-reflow
set hintnames numeric
set urlparenttrailingslash false

set browser abrowser
" set newtab https://bandali.eu.org

seturl warrior.uwaterloo.ca noiframe true

" autocmd DocStart www.reddit.com js tri.excmds.urlmodify("-t", "www", "old")
#+end_src

** X

*** xinit
:PROPERTIES:
:header-args+: :tangle ~/.xinitrc
:END:

#+begin_src sh
[ -f ~/.Xresources ] && xrdb -merge ~/.Xresources
#+end_src

*** X resources

#+begin_src conf-xdefaults :tangle (when (eq system-type 'gnu/linux) "~/.Xresources")
#include ".Xresources.d/fonts"
#include ".Xresources.d/emacs"
#include ".Xresources.d/rxvt-unicode"
#+end_src

**** emacs
:PROPERTIES:
:header-args+: :tangle (when (eq system-type 'gnu/linux) "~/.Xresources.d/emacs")
:END:

#+begin_src conf-xdefaults
Emacs.menuBar: off
Emacs.toolBar: off
Emacs.verticalScrollBars: off
Emacs.cursorBlink: off
Emacs.FontBackend: xft,x
! Emacs.font: Ubuntu Mono-12
! Emacs.font: Triplicate T4C-11
! Emacs.font: Ubuntu Mono-10.5
! Emacs.font: Ubuntu Mono-12
! Emacs.font: Iosevka-11

! Emacs.font: Fira Mono:size=15
! Emacs.font: DejaVu Sans Mono:size=15
! Emacs.font: Inconsolata:size=17
! Emacs.font: Inconsolata:size=16
! Emacs.font: Inconsolata LGC:size=14
! Emacs.font: Source Code Pro Medium-10.5
Emacs.font: Source Code Pro Medium:size=14
! Emacs.font: Ubuntu Mono:size=16
! Emacs.font: Iosevka:size=16
#+end_src

**** fonts
:PROPERTIES:
:header-args+: :tangle (when (eq system-type 'gnu/linux) "~/.Xresources.d/fonts")
:END:

#+begin_src conf-xdefaults
Xft.lcdfilter: lcddefault
Xft.antialias: true
Xft.autohint: 0
Xft.hinting: true
Xft.hintstyle: hintslight
! Xft.hintstyle: hintfull
Xft.rgba: rgb
Xft.dpi: 96
#+end_src

**** rxvt-unicode
:PROPERTIES:
:header-args+: :tangle (when (eq system-type 'gnu/linux) "~/.Xresources.d/rxvt-unicode")
:END:

#+begin_src conf-xdefaults
! Font
URxvt.font:             xft:source code pro:pixelsize=14:antialias=true:hinting=true, xft:dejavu sans mono:pixelsize=15:antialias=true:hinting=true
URxvt.boldFont:         xft:source code pro:semibold:pixelsize=14:antialias=true:hinting=true:bold, xft:dejavu sans mono:pixelsize=15:antialias=true:hinting=true:bold
URxvt.italicFont:       xft:source code pro:italic:pixelsize=14:antialias=true:hinting=true:italic, xft:dejavu sans mono:pixelsize=15:antialias=true:hinting=true:italic
URxvt.bolditalicFont:   xft:source code pro:semibold:italic:pixelsize=14:antialias=true:hinting=true:bold:italic, xft:dejavu sans mono:pixelsize=15:antialias=true:hinting=true:bolditalic

URxvt.xftAntialias:     true
URxvt.letterSpace:      -1

!URxvt.depth:                0
!URxvt.loginShell:           true
!URxvt*buffered:             false
URxvt.saveLines:            100000
URxvt.internalBorder:       3
URxvt.lineSpace:            0
URxvt.scrollBar:            false
URxvt.scrollStyle:          rxvt
URxvt*scrollTtyOutput:      false
URxvt*scrollWithBuffer:     true
URxvt*scrollTtyKeypress:    true
URxvt.keysym.Shift-Up:      command:\033]720;1\007
URxvt.keysym.Shift-Down:    command:\033]721;1\007

URxvt.perl-ext-common:      default,clipboard,url-select,keyboard-select
URxvt.url-select.launcher:  firefox
URxvt.url-select.underline: true
URxvt.keysym.M-u:           perl:url-select:select_next
URxvt.keysym.M-Escape:      perl:keyboard-select:activate
URxvt.keysym.M-s:           perl:keyboard-select:search
URxvt.url-launcher:         /usr/bin/abrowser
URxvt.matcher.button:       1
! URxvt.iso14755:             false
! URxvt.iso14755_53:          false
! URxvt.keysym.M-c:           perl:clipboard:copy
! URxvt.keysym.M-v:           perl:clipboard:paste
URxvt.keysym.M-c:           eval:selection_to_clipboard
URxvt.keysym.M-v:           eval:paste_clipboard
URxvt.keysym.C-A-V:         perl:clipboard:paste_escaped
! URxvt.keysym.Shift-Control-C: eval:selection_to_clipboard
! URxvt.keysym.Shift-Control-V: eval:paste_clipboard
URxvt.keysym.C-Up:          font-size:increase
URxvt.keysym.C-Down:        font-size:decrease
URxvt.keysym.C-S-Up:        font-size:incglobal
URxvt.keysym.C-S-Down:      font-size:decglobal
URxvt.keysym.C-equal:       font-size:reset
!URxvt.keysym.C-question:   font-size:show

!URxvt.iconFile:             /usr/share/icons/elementary-xfce/apps/48/terminal.png

!urxvt*foreground: white
!urxvt*background: black

!*color0:  #2E3436
!*color1:  #a40000
!*color2:  #4E9A06
!*color3:  #C4A000
!*color4:  #3465A4
!*color5:  #75507B
!*color6:  #ce5c00
!*color7:  #babdb9
!*color8:  #555753
!*color9:  #EF2929
!*color10: #8AE234
!*color11: #FCE94F
!*color12: #729FCF
!*color13: #AD7FA8
!*color14: #fcaf3e
!*color15: #EEEEEC

!URxvt.foreground: #C8C8C8
!URxvt.background: #FFFFFF

!! black
!*color0:  #2E3436
!*color8:  #555753
!! red
!*color1:  #a40000
!*color9:  #EF2929
!! green
!*color2:  #4E9A06
!*color10: #8AE234
!! yellow
!*color3:  #C4A000
!*color11: #FCE94F
!! blue
!*color4:  #3465A4
!*color12: #729FCF
!! purple
!*color5:  #75507B
!*color13: #AD7FA8
!! orange (replaces cyan)
!*color6:  #ce5c00
!*color14: #fcaf3e
!! white
!*color7:  #babdb9
!*color15: #EEEEEC


! ! Solarized
! ! Base16 Solarized Light
! ! Scheme: Ethan Schoonover (http://ethanschoonover.com/solarized)

! #define base00 #fdf6e3
! #define base01 #eee8d5
! #define base02 #93a1a1
! #define base03 #839496
! #define base04 #657b83
! #define base05 #586e75
! #define base06 #073642
! #define base07 #002b36
! #define base08 #dc322f
! #define base09 #cb4b16
! #define base0A #b58900
! #define base0B #859900
! #define base0C #2aa198
! #define base0D #268bd2
! #define base0E #6c71c4
! #define base0F #d33682

! *foreground:   base05
! #ifdef background_opacity
! *background:   [background_opacity]base00
! #else
! *background:   base00
! #endif
! *cursorColor:  base05

! *color0:       base00
! *color1:       base08
! *color2:       base0B
! *color3:       base0A
! *color4:       base0D
! *color5:       base0E
! *color6:       base0C
! *color7:       base05

! *color8:       base03
! *color9:       base08
! *color10:      base0B
! *color11:      base0A
! *color12:      base0D
! *color13:      base0E
! *color14:      base0C
! *color15:      base07

! ! Note: colors beyond 15 might not be loaded (e.g., xterm, urxvt),
! ! use 'shell' template to set these if necessary
! *color16:      base09
! *color17:      base0F
! *color18:      base01
! *color19:      base02
! *color20:      base04
! *color21:      base06


! Tango colour theme for rxvt-unicode
URxvt.background: #FFFFFF
URxvt.foreground: #000000

! Black
URxvt.color0: #2E3436
URxvt.color8: #757773

! Red
URxvt.color1: #CC0000
URxvt.color9: #EF2929

! Green
URxvt.color2: #4E9A06
URxvt.color10: #8AE234

! Yellow
URxvt.color3: #C4A000
URxvt.color11: #FCE94F

! Blue
URxvt.color4: #3465A4
URxvt.color12: #729FCF

! Magenta
URxvt.color5: #75507B
URxvt.color13: #AD7FA8

!! Cyan
!URxvt.color6: #06989A
!URxvt.color14: #34E2E2
! orange (replaces cyan)
,,*color6:  #ce5c00
,,*color14: #fcaf3e

! White
URxvt.color7: #D3D7CF
URxvt.color15: #EEEEEC
#+end_src

*** ~/.xsession
:PROPERTIES:
:header-args+: :tangle ~/.xsession :tangle-mode (identity #o755)
:END:

For custom session on Debian.  See https://wiki.debian.org/Xsession.

#+begin_src sh
if [ -f "$HOME/.xinitrc" ]; then
	. "$HOME/.xinitrc"
fi

[ -f "/usr/lib/x86_64-linux-gnu/xfce4/notifyd/xfce4-notifyd" ] && /usr/lib/x86_64-linux-gnu/xfce4/notifyd/xfce4-notifyd &
[ -x "$(command -v light-locker)" ] && light-locker --lock-on-suspend &
[ -x "$(command -v pasystray)" ] && pasystray -a &
[ -x "$(command -v nm-applet)" ] && nm-applet &
[ -x "$(command -v compton)" ] && compton &
[ -x "$(command -v dunst)" ] && dunst &
[ -x "$(command -v emacs)" ] && exec ssh-agent exwm -ib 0
#+end_src

*** ~/.xsessionrc
:PROPERTIES:
:header-args+: :tangle ~/.xsessionrc
:END:

#+begin_src sh
if [ -f "$HOME/.profile" ]; then . "$HOME/.profile"; fi
#+end_src

** XDG
:PROPERTIES:
:header-args+: :tangle ~/.config/user-dirs.dirs
:END:

#+begin_src conf
XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOCUMENTS_DIR="$HOME/usr/doc"
XDG_DOWNLOAD_DIR="$HOME/usr/dl"
XDG_MUSIC_DIR="$HOME/usr/music"
XDG_PICTURES_DIR="$HOME/usr/pic"
XDG_PUBLICSHARE_DIR="$HOME/usr/pub"
XDG_TEMPLATES_DIR="$HOME/usr/temp"
XDG_VIDEOS_DIR="$HOME/usr/vid"
#+end_src

** zathura
:PROPERTIES:
:header-args+: :tangle ~/.config/zathura/zathurarc
:END:

#+begin_src conf
set smooth-scroll true
set selection-clipboard clipboard
set zoom-step 05
set default-bg "#272727"
set statusbar-bg "#272727"
set inputbar-bg "#373737"
set window-title-basename true
set statusbar-home-tilde true

map <Return> scroll down
map <A-Return> scroll up

map H jumplist backward
map L jumplist forward

map [normal] i toggle_index
map [index] i toggle_index
map [index] q toggle_index
#+end_src

* Scripts

This section contains various useful scripts including ones used by
the programs above.  For instance, =toggle-tablet= for switching to
and from tablet mode on my X220T, =toggle-presentation-mode= for
toggling Xfce's presentation mode which keeps the screen awake, and
=rofi-light= a small utility that uses [[https://github.com/DaveDavenport/rofi][rofi]] to ask and [[https://github.com/haikarainen/light][light]] to set an
exact brightness value.

** battery-percentage-time
:PROPERTIES:
:header-args+: :tangle ~/.local/bin/battery-percentage-time :shebang "#!/bin/sh"
:END:

#+begin_src sh :tangle no
dbus_send() {
	label=$1
	dbus-send --print-reply=literal --system \
		--dest=org.freedesktop.UPower \
		/org/freedesktop/UPower/devices/battery_BAT0 \
		org.freedesktop.DBus.Properties.Get \
		string:org.freedesktop.UPower.Device \
		string:"${label}" | awk '{print $3}'
}

perc=$(dbus_send 'Percentage')
state=$(dbus_send 'State')

if [ "$state" -eq 2 ]; then  # Discharging
	secs=$(dbus_send 'TimeToEmpty')
elif [ "$state" -eq 1 ]; then  # Charging
	secs=$(dbus_send 'TimeToFull')
fi

printf '%s%%%%%2dh%02dm \n' "$perc" $((secs / 3600)) $((secs % 3600 / 60))
#+end_src

** emcl
:PROPERTIES:
:header-args+: :tangle ~/.local/bin/emcl :shebang "#!/bin/sh"
:END:

#+begin_src sh
exec emacsclient --alternate-editor="" -c "$@"
#+end_src

** my-i3status
:PROPERTIES:
:header-args+: :tangle ~/.local/bin/my-i3status :shebang "#!/usr/bin/env python2"
:END:

#+begin_src python
# -*- coding: utf-8 -*-

# This script is a simple wrapper which prefixes each i3status line with custom
# information. It is based on:
# https://github.com/i3/i3status/blob/master/contrib/wrapper.py
#
# In ~/.i3status.conf, add the following line:
#     output_format = "i3bar"
# in the 'general' section.
# Then, in ~/.config/i3/config or ~/.config/sway/config add:
#     status_command i3status | my-i3status.py
# in the 'bar' section.  Make sure my-i3status.py is in $PATH.
#
# © 2012 Valentin Haenel <valentin.haenel@gmx.de>
# © 2018 Amin Bandali <bandali@gnu.org>
#
# This program is free software. It comes without any warranty, to the extent
# permitted by applicable law. You can redistribute it and/or modify it under
# the terms of the Do What The Fuck You Want To Public License (WTFPL), Version
# 2, as published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more
# details.

import sys
import json
import os

def get_nosleep():
    """ Return true if ~/.nosleep exists. """
    return os.path.isfile(os.path.expanduser("~/.nosleep"))

def print_line(message):
    """ Non-buffered printing to stdout. """
    sys.stdout.write(message + '\n')
    sys.stdout.flush()

def read_line():
    """ Interrupted respecting reader for stdin. """
    # try reading a line, removing any extra whitespace
    try:
        line = sys.stdin.readline().strip()
        # i3status sends EOF, or an empty line
        if not line:
            sys.exit(3)
        return line
    # exit on ctrl-c
    except KeyboardInterrupt:
        sys.exit()

if __name__ == '__main__':
    # Skip the first line which contains the version header.
    print_line(read_line())

    # The second line contains the start of the infinite array.
    print_line(read_line())

    while True:
        line, prefix = read_line(), ''
        # ignore comma at start of lines
        if line.startswith(','):
            line, prefix = line[1:], ','

        if get_nosleep():
            j = json.loads(line)
            # insert information into the start of the json, but could be anywhere
            j.insert(0, {'full_text' : '•', 'name' : 'nosleep'})
            # and echo back new encoded json
            print_line(prefix+json.dumps(j))
        else:
            print_line(prefix+line)
#+end_src

** rofi-light
:PROPERTIES:
:header-args+: :tangle ~/.local/bin/rofi-light :shebang "#!/bin/sh"
:END:

#+begin_src sh
cur=$(light -G)
val=$(rofi -dmenu -mesg "light    $cur" -p "light -S " -l 0 -width 12)
[ -n "$val" ] && light -S "$val"
#+end_src

** rofi-remmina
:PROPERTIES:
:header-args+: :tangle ~/.local/bin/rofi-remmina :shebang "#!/usr/bin/env python2"
:END:

#+begin_src python
import ConfigParser
import os
from subprocess import Popen, PIPE

remmina_dir = os.path.expanduser("~/.local/share/remmina")

fdict = dict()

for f in os.listdir(remmina_dir):
    fp = os.path.join(remmina_dir, f)
    c = ConfigParser.ConfigParser()
    c.read(fp)
    n = c.get('remmina', 'name')
    fdict[n] = fp

lines = max(min(15, len(fdict)), 1);
width = len(max(fdict.keys(), key=len))
rofi = Popen(["rofi", "-i", "-dmenu", \
              "-l", str(lines), "-width", str(width), \
              "-p", "connection"], stdout=PIPE, stdin=PIPE)
selected = rofi.communicate("\n" \
                            .join(fdict.keys()) \
                            .encode("utf-8"))[0] \
               .decode("utf-8") \
               .strip()
rofi.wait()

r = Popen(["remmina", "-c", fdict[selected]])
r.wait()
#+end_src

** toggle-presentation-mode
:PROPERTIES:
:header-args+: :tangle ~/.local/bin/toggle-presentation-mode :shebang "#!/bin/sh"
:END:

#+begin_src sh
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -T
#+end_src

** toggle-tablet
:PROPERTIES:
:header-args+: :tangle ~/.local/bin/toggle-tablet :shebang "#!/bin/sh"
:END:

#+begin_src sh
# This script toggles between a 'normal' mode and a 'tablet' mode, doing
# a few things:

# - rotates the screen using =xrandr=, so that rotating the physical
#   display of my X220t would have the laptop's battery on the right
#   hand side,
# - enables touch screen,
# - properly rotates the stylus pen and touch screen pointers, and
# - toggles between RGB and Vertical BGR sub-pixel order.

case $(xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation) in
    0)  # Screen is not rotated, we should rotate it right (90°)
        xrandr -o 3
        xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation -s 1
        xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Device_Enabled -s 1
        xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Wacom_Rotation -s 1
        xfconf-query -c xsettings -p /Xft/RGBA -s vbgr
        ;;
    1)  # Currently top is rotated right, we should set it normal (0°)
        xrandr -o 0
        xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation -s 0
        xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Wacom_Rotation -s 0
        xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Device_Enabled -s 0
        xfconf-query -c xsettings -p /Xft/RGBA -s rgb
        ;;
    ,*)
        echo "Unknown result from 'xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation'" >&2
        exit 1
        ;;
esac
#+end_src

** volume-info
:PROPERTIES:
:header-args+: :tangle ~/.local/bin/volume-info :shebang "#!/bin/sh"
:END:

#+begin_src sh
cur_vol=$(pamixer --get-volume)

if [ $(pamixer --get-mute) = true ]; then
  printf 'mt \n' "$cur_vol"
else
  printf '%02d \n' "$cur_vol"
fi
#+end_src

** zathura-sync
:PROPERTIES:
:header-args+: :tangle ~/.local/bin/zathura-sync :shebang "#!/bin/sh"
:END:

#+begin_src sh
pos="$1"
pdffile="$2"
zathura --synctex-forward "$pos" "$pdffile" || \
    (
    zathura -x "emacsclient --eval '(progn (switch-to-buffer (file-name-nondirectory \"%{input}\")) (goto-line %{line}))'" "$pdffile" &
    sleep 1; zathura --synctex-forward "$pos" "$pdffile" )
#+end_src