Compare commits

...

82 Commits

Author SHA1 Message Date
b39eac91a5 Fix battery widget charging/discharging state and use direct io instead of cat command 2021-07-18 16:45:12 +02:00
2d79eb8a5e Fix battery widget layout 2021-07-18 16:33:59 +02:00
ecbf661115 Refresh battery list on change checked every 2s (configurable) 2021-07-18 16:04:07 +02:00
00533c13f6 Add support for coarse representation of battery capacity, refactor battery widget for multiple battery display
https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-power
2021-07-18 15:36:09 +02:00
e36d42dfeb Merge pull request 'Fixed battery widget opening missing file' (#1) from lucastarche/simple-awesome:develop into develop
Reviewed-on: https://eternae.ink/ashpie/simple-awesome/pulls/1
2021-07-04 16:25:21 +02:00
Lucas Hernán Tarche
16772da504 Added fileExists() 2021-07-04 10:10:25 -03:00
Lucas Hernán Tarche
7ed0fc7522 Fixed battery widget opening missing file 2021-07-03 16:41:03 -03:00
662a816dd0 default config: update lock command for i3lock-color update 2021-05-31 10:50:51 +02:00
957452c55b Make sure fullscreen clients get a correct fullscreen geometry
Co-authored-by: Mițca Dumitru <dumitru0mitca@gmail.com>
2021-05-15 20:07:32 +02:00
6e94e368ed keyboard_layout.lua: quote command argument 2021-04-08 12:45:16 +02:00
fbc13ab63f media_control.lua: make volume management fully async 2021-04-08 12:45:10 +02:00
5961d734b5 Don't ignore wallpaper aspect ratio 2021-02-21 19:30:58 +01:00
93a3caf5a4 Add hotkey to manually toggle titlebar
Co-authored-by: Arkhist <peyrille.benjamin@gmail.com>
2021-02-17 11:41:17 +01:00
4b93a05fa5 Fix hotkey collision 2021-02-17 11:41:11 +01:00
c8409703e1 Update author name and README.md todo list
Co-authored-by: Arkhist <peyrille.benjamin@gmail.com>
2021-02-17 11:41:06 +01:00
3908cb4058 Hide titlebar for clients that request so
Co-authored-by: Arkhist <peyrille.benjamin@gmail.com>
2021-02-17 11:40:54 +01:00
f3b9ffcaf9 Revert "Disable titlebars on dialogs"
This reverts commit e689f17a56.
2021-02-17 11:40:49 +01:00
37a94eb5ed Add trailing new line to config.lua and theme.lua 2020-12-31 13:30:28 +01:00
e3cbb2f987 Power menu: add sleep, hybrid sleep and hibernate buttons 2020-12-31 13:30:19 +01:00
80ba6a0aa9 Fix tiled clients swapping with non tiling and/or maximized clients 2020-10-02 19:19:51 +02:00
809531b189 Merge remote-tracking branch 'origin/develop' into develop 2020-10-02 18:51:24 +02:00
a609640435 Battery widget: don't show usb device battery 2020-10-02 18:49:20 +02:00
a29cf9e2b6 Support disabling volume control 2020-10-02 18:38:44 +02:00
9ea205e39c Make main menu icon configurable and add nice default 2020-10-02 18:38:14 +02:00
e689f17a56 Disable titlebars on dialogs 2020-10-02 18:33:27 +02:00
2e0dc4f268 Make tiling shortcuts practical in tiled mode 2020-10-02 18:27:40 +02:00
422c078458 Add basic backlight brightness control without ui feedback 2020-07-22 17:07:53 +02:00
755eb1acc4 Fix hotkey collision with super + space 2020-04-21 12:11:58 +02:00
eaccc4b0df Fix maximized windows' geometry being slightly off screen when loading/reloading 2020-04-13 05:21:51 +02:00
97e8188a1a media_control.lua: fix isMuted function not working on some devices 2020-04-12 14:59:17 +02:00
f56403f0bf Increase support for audio controls and add config for soundcard and parameter choice 2020-03-28 19:48:04 +01:00
Arkhist
6198fa4148 Add hide status bar hotkey Mod+P 2020-02-16 15:00:49 +01:00
c26403057c Actually use the config.awesome.autofocus setting 2020-02-15 18:47:03 +01:00
e5d7c9a578 Add configurable custom hotkeys 2020-02-15 18:45:55 +01:00
abacea8562 Update todolist 2020-01-30 04:07:19 +01:00
7d07722ec4 Windows title bar rework
Margins, title alignment, button icons...
2020-01-30 04:04:52 +01:00
a4fd9ef389 Make icons white by default and add setting for power menu icons color 2020-01-30 00:57:08 +01:00
3edb60eeb0 Slightly improve window open mode (floating/tiled) 2020-01-29 23:43:03 +01:00
d88d0188e7 Make start button run rofi with drun 2019-11-17 07:21:41 +01:00
90d8d45efb Make default rofi run with drun and add alternative shortcut to run with run 2019-11-17 07:18:36 +01:00
0a240358f8 Add more todos 2019-10-07 13:27:07 +02:00
3c6e2d3843 Add battery percentage widget 2019-10-07 13:10:22 +02:00
b8aff62b38 Add tiling shortcuts to move windows between entire screens 2019-09-28 12:59:41 +02:00
366811bd37 Change the volume osd design to something less invasive 2019-08-27 23:39:14 +02:00
41e377b06c Add screen locking hotkey + config and default to i3lock-color (i3lock) 2019-08-17 14:57:19 +02:00
12668472f8 Update keyboard layout widget and small improvements 2019-08-13 23:58:50 +02:00
3aa412a73f Big refactor to make simple awesome a lua module 2019-08-13 23:03:08 +02:00
a0fee14577 rc.lua: move window tiling layouts to config 2019-08-13 22:05:01 +02:00
6d26491560 rc.lua: Move some keys and apps auto start to config 2019-08-13 22:04:36 +02:00
c9c5755a26 system resources widget: Make screens it appears on configurable 2019-08-11 23:12:37 +02:00
64d7e9a7b0 Add system resources monitor widget on screen n° 2019-08-11 23:06:36 +02:00
635d4822b4 config: Add parameter for notification timeout delay 2019-08-11 23:05:33 +02:00
77797f8caf Add README todo, some comments and a small code cleanup 2019-08-11 23:04:23 +02:00
c6d65d7ead Add auto starting screenshot utility (configurable) 2019-07-25 17:21:34 +02:00
58e6624a5a Set floating windows layout by default 2019-07-25 16:29:01 +02:00
64041db6c4 Enable support for mute media key 2019-07-25 16:26:28 +02:00
a57fc53a27 Fix audio level control not working on some configs 2019-07-25 16:12:05 +02:00
2e93a077d0 Fix minimized window tasklist bg color 2019-07-25 15:51:16 +02:00
afce173903 Fix leave menu shutdown and reboot 2019-07-24 14:27:10 +02:00
93009fb6cb Add custom default wallpaper 2019-07-24 12:07:58 +02:00
db7c6760ac Add volume control with media keys and a beautiful osd, and update notifications design 2019-07-24 11:33:57 +02:00
df229f65dc Update config & theme lifecycle 2019-07-24 11:32:27 +02:00
fdd6143bec If nm-applet is present on system, run it 2019-07-24 07:33:35 +02:00
cff3debfdb Add media control support with playerctl or default to dbus on Spotify 2019-07-24 07:08:20 +02:00
6c82d8fefc Remove borders and bring back native awesome tiling 2019-07-23 18:36:37 +02:00
Arkhist
701012fb4b Merge branch 'develop' of https://gitlab.com/ArisuOngaku/simple-awesome into develop 2019-07-23 17:30:48 +02:00
Arkhist
b274ce9c2b Add shutdown menu 2019-07-23 17:30:45 +02:00
cf05f22778 UX fix on tasklist focus color 2019-07-23 17:28:43 +02:00
f5fa804540 Design improvements on tasklist, wibar and colors 2019-07-23 17:26:48 +02:00
4fa6d66d84 Update default rofi theme and apply it to rofi's window mode 2019-07-23 16:35:30 +02:00
Arkhist
ae8d2e940b Add rofi config folder 2019-07-23 16:01:17 +02:00
Arkhist
0e7d2f32ba Merge branch 'develop' of https://gitlab.com/ArisuOngaku/simple-awesome into develop 2019-07-23 15:38:05 +02:00
Arkhist
50483f49f9 Add support for run menus and window switchers 2019-07-23 15:38:02 +02:00
d65438528c Move terminal setting to our config file 2019-07-23 15:36:39 +02:00
cabc1bf081 Fix keybindings help and add minimize keybinding 2019-07-23 15:32:39 +02:00
5d3b7a08fa Add rudimentary user config file (and default content) 2019-07-23 15:20:27 +02:00
863060f825 Merge remote-tracking branch 'origin/develop' into develop 2019-07-23 15:09:22 +02:00
cf390176f1 Make maximization compatible with tiling & add toggle maximization 2019-07-23 15:08:55 +02:00
Arkhist
8a657be32f Grayscale color scheme 2019-07-23 15:06:08 +02:00
Arkhist
3ae20fda42 Add screenshot key 2019-07-23 14:47:16 +02:00
ec08bfe121 Make basic tiling work and move this module's code to a dedicated file 2019-07-23 14:44:20 +02:00
Arkhist
95e1567423 Add kbdlayout system (Alt-Shift to switch layout) 2019-07-23 14:31:57 +02:00
33 changed files with 2245 additions and 770 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# IDEs
.idea/

View File

@ -1,3 +1,38 @@
# Simple Awesome
As simple as it sounds
(not yet though)
(not yet though)
## Dependencies
By default, Simple Awesome uses
- `rofi` - launch bar / window switcher
- `flameshot` - screenshot utility
- `alsa-utils` - amixer command provider (media keys volume control)
## Optional dependencies
- `playerctl` - enables global media control. If not present on your system, only Spotify will work.
- `network-manager-applet` (`nm-applet`) - network control "widget" **for `NetworkManager` only**. If present on your system, we will automatically run it.
- `i3lock-color` - lock your screen in a simple and elegant way
## To do
- Add a sound volume control widget
- Add a media control widget
- Manage workspaces
- Improve "leave menu"'s design
- Modify "start menu", make everything work
- Make "start menu" and "leave menu" not sticky (they currently stay open and focus even when clicking outside)
- Replace the os menu with a custom widget
- Add backlight media keys to xbacklight command functionnality
- Add icon to the battery widget
## Interesting resources
- https://github.com/manilarome/the-glorious-dotfiles/tree/master/config/awesome/gnawesome/module
## ashpie personal todo
- Add aliases to rofi https://github.com/davatorium/rofi/issues/97

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-save"><path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"></path><polyline points="17 21 17 13 7 13 7 21"></polyline><polyline points="7 3 7 8 15 8"></polyline></svg>

After

Width:  |  Height:  |  Size: 392 B

1
assets/icons/lock.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-lock"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>

After

Width:  |  Height:  |  Size: 313 B

1
assets/icons/log-out.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-log-out"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path><polyline points="16 17 21 12 16 7"></polyline><line x1="21" y1="12" x2="9" y2="12"></line></svg>

After

Width:  |  Height:  |  Size: 359 B

View File

@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="200mm"
height="200mm"
viewBox="0 0 200 200"
version="1.1"
id="svg8"
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
sodipodi:docname="material-tux-dark-keen.svg">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.90994277"
inkscape:cx="350.2857"
inkscape:cy="319.39102"
inkscape:document-units="mm"
inkscape:current-layer="g4606"
showgrid="false"
showguides="true"
inkscape:window-width="1872"
inkscape:window-height="1048"
inkscape:window-x="48"
inkscape:window-y="32"
inkscape:window-maximized="1"
inkscape:guide-bbox="true" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-97)">
<g
id="g4606"
transform="translate(1.2336293,-3.4952828)">
<g
id="g1038">
<path
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:6.49421787;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 177.68794,190.49937 c 0,0 -23.16838,2.65138 -31.05505,15.09883 -7.49484,11.82901 -4.47112,26.4529 1.14862,38.9909 3.2725,7.30115 11.56881,21.00378 15.03749,25.9265 -63.810227,46.8337 -117.576888,14.31775 -131.174319,-2.62231 14.773827,-76.91215 38.345043,-96.27794 48.002553,-89.89777"
id="path4549"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cssccc" />
<path
style="fill:#ffd36e;fill-opacity:1;stroke:none;stroke-width:0.35318846px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 72.966091,291.28148 c -9.960689,-26.58036 -13.102884,-67.10418 5.187039,-74.43775 9.698358,-3.88868 15.252637,15.12855 63.74841,-7.15623 l 6.97249,-10.4788 -79.685525,-25.30246 c 0,0 -30.380104,47.79352 -30.380104,48.81586 0,1.02231 15.190054,61.59486 15.190054,61.59486 z"
id="path4568"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cscccscc" />
<path
style="fill:#084652;fill-opacity:1;stroke:#fafafa;stroke-width:6.41012049;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 67.238694,289.74799 c -23.8047,-6.55993 -46.249369,-29.82674 -52.833985,-43.76809 2.004366,-74.88295 33.9284,-130.54634 84.459151,-129.25976 21.18364,0.53936 40.72217,20.75812 45.59435,42.74654 13.96298,6.36408 30.0146,16.35315 33.22973,31.03269 0,0 -24.32318,5.73913 -55.41643,13.62922 -27.513585,6.98174 -43.524411,-10.71689 -48.918666,-15.89018 -27.679288,31.60014 -18.72897,82.70382 -6.11415,101.50958"
id="path4549-6"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccsccscc" />
<ellipse
ry="12.049064"
rx="11.739654"
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:6.41012049;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4566"
cx="94.961777"
cy="163.04408" />
<ellipse
id="path3713"
cx="98.821571"
cy="200.23102"
rx="95.124596"
ry="95.331467"
style="fill:none;fill-opacity:0.01459853;stroke:#fafafa;stroke-width:9.56445503;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
style="fill:none;fill-opacity:1;stroke:#fafafa;stroke-width:6.41012049;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 177.68794,190.49937 c 0,0 -23.16836,2.65138 -31.05505,15.09883 -7.49484,11.82901 -4.47111,26.4529 1.14862,38.9909 3.2725,7.30115 11.56881,21.00378 15.03751,25.9265"
id="path4549-7"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cssc" />
<path
style="fill:none;fill-opacity:1;stroke:none;stroke-width:2.46286368;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 160.35487,260.46959 c -8.73636,-14.46535 -12.08935,-21.83387 -14.05306,-30.88291 -0.77619,-3.57682 -0.91281,-10.2595 -0.27432,-13.41916 1.20607,-5.96848 3.7719,-10.28683 8.04737,-13.54389 4.38528,-3.34071 8.2707,-4.92463 17.60237,-7.17576 4.00918,-0.96716 7.51698,-1.88347 7.79511,-2.03624 0.76419,-0.41977 1.47314,-1.79115 1.47419,-2.85166 3.5e-4,-0.51988 -0.29202,-1.90001 -0.65007,-3.06696 -3.30372,-10.76747 -12.60687,-19.94411 -28.64811,-28.25856 l -4.27288,-2.21471 -1.15247,-3.58707 c -2.93221,-9.12646 -9.16248,-19.1435 -15.96767,-25.67288 -8.11036,-7.78165 -16.78281,-12.37263 -26.36006,-13.95438 -2.93998,-0.48556 -10.008106,-0.55299 -13.847615,-0.13212 -24.511662,2.68693 -45.105718,18.61829 -59.313524,45.88437 -8.742284,16.77725 -14.784353,37.52759 -17.743688,60.93733 -0.345221,2.73089 -0.636242,5.08861 -0.646708,5.2394 -0.08749,1.26027 -2.262982,-8.43633 -2.9775641,-13.2716 C 8.6837983,207.84548 8.4241047,197.59887 8.8634618,192.6276 10.732949,171.47452 19.499128,152.34313 34.26758,137.18544 c 6.939605,-7.12251 14.633873,-12.85026 23.152331,-17.23502 32.769034,-16.86743 72.245249,-12.23818 100.186499,11.74856 15.96925,13.70912 26.8817,33.13934 30.28713,53.92788 1.62806,9.93852 1.53733,21.10462 -0.25023,30.79743 -1.61232,8.74257 -4.96793,18.43916 -8.96202,25.89719 -4.0573,7.57609 -8.09244,13.22716 -14.32734,20.06497 l -1.70926,1.87455 z"
id="path4589"
inkscape:connector-curvature="0" />
<path
style="fill:none;fill-opacity:1;stroke:none;stroke-width:2.46286368;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 160.35487,260.46959 c -8.73636,-14.46535 -12.08935,-21.83387 -14.05306,-30.88291 -0.77619,-3.57682 -0.91281,-10.2595 -0.27432,-13.41916 1.20607,-5.96848 3.7719,-10.28683 8.04737,-13.54389 4.38528,-3.34071 8.2707,-4.92463 17.60237,-7.17576 4.00918,-0.96716 7.51698,-1.88347 7.79511,-2.03624 0.76419,-0.41977 1.47314,-1.79115 1.47419,-2.85166 3.5e-4,-0.51988 -0.29202,-1.90001 -0.65007,-3.06696 -3.30372,-10.76747 -12.60687,-19.94411 -28.64811,-28.25856 l -4.27288,-2.21471 -1.15247,-3.58707 c -2.93221,-9.12646 -9.16248,-19.1435 -15.96767,-25.67288 -8.11036,-7.78165 -16.78281,-12.37263 -26.36006,-13.95438 -2.93998,-0.48556 -10.008106,-0.55299 -13.847615,-0.13212 -24.511662,2.68693 -45.105718,18.61829 -59.313524,45.88437 -8.742284,16.77725 -14.784353,37.52759 -17.743688,60.93733 -0.345221,2.73089 -0.636242,5.08861 -0.646708,5.2394 -0.08749,1.26027 -2.262982,-8.43633 -2.9775641,-13.2716 C 8.6837983,207.84548 8.4241047,197.59887 8.8634618,192.6276 10.732949,171.47452 19.499128,152.34313 34.26758,137.18544 c 6.939605,-7.12251 14.633873,-12.85026 23.152331,-17.23502 32.769034,-16.86743 72.245249,-12.23818 100.186499,11.74856 15.96925,13.70912 26.8817,33.13934 30.28713,53.92788 1.62806,9.93852 1.53733,21.10462 -0.25023,30.79743 -1.61232,8.74257 -4.96793,18.43916 -8.96202,25.89719 -4.0573,7.57609 -8.09244,13.22716 -14.32734,20.06497 l -1.70926,1.87455 z"
id="path4591"
inkscape:connector-curvature="0" />
<rect
style="fill:#ab5e5e;fill-opacity:1;stroke:none;stroke-width:3.44800925;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4595"
width="1.0836483"
height="0.27805224"
x="193.94614"
y="113.36066" />
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-maximize"><path d="M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"></path></svg>

After

Width:  |  Height:  |  Size: 323 B

1
assets/icons/minus.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-minus"><line x1="5" y1="12" x2="19" y2="12"></line></svg>

After

Width:  |  Height:  |  Size: 253 B

1
assets/icons/power.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-power"><path d="M18.36 6.64a9 9 0 1 1-12.73 0"></path><line x1="12" y1="2" x2="12" y2="12"></line></svg>

After

Width:  |  Height:  |  Size: 300 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-refresh-cw"><polyline points="23 4 23 10 17 10"></polyline><polyline points="1 20 1 14 7 14"></polyline><path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"></path></svg>

After

Width:  |  Height:  |  Size: 392 B

1
assets/icons/sleep.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-pause"><rect x="6" y="4" width="4" height="16"></rect><rect x="14" y="4" width="4" height="16"></rect></svg>

After

Width:  |  Height:  |  Size: 312 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-minimize"><path d="M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3"></path></svg>

After

Width:  |  Height:  |  Size: 323 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-volume-1"><polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"></polygon><path d="M15.54 8.46a5 5 0 0 1 0 7.07"></path></svg>

After

Width:  |  Height:  |  Size: 320 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-volume-2"><polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"></polygon><path d="M19.07 4.93a10 10 0 0 1 0 14.14M15.54 8.46a5 5 0 0 1 0 7.07"></path></svg>

After

Width:  |  Height:  |  Size: 351 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-volume-x"><polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"></polygon><line x1="23" y1="9" x2="17" y2="15"></line><line x1="17" y1="9" x2="23" y2="15"></line></svg>

After

Width:  |  Height:  |  Size: 362 B

1
assets/icons/volume.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-volume"><polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"></polygon></svg>

After

Width:  |  Height:  |  Size: 272 B

1
assets/icons/x.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-x"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>

After

Width:  |  Height:  |  Size: 291 B

View File

@ -0,0 +1,140 @@
/**
* A floating box version of the paper theme.
*
* User: Qball
* Copyright: Dave Davenport
*/
* {
background: #222222;
active-background: #0005;
active-background-selected: #fff1;
text: #eeeeee;
blue: #0000FF;
black: #000000;
grey: #eeeeee;
spacing: 2;
background-color: #00000000;
border-color: #fff2;
anchor: north;
location: center;
highlight: bold #fff;
}
#window {
transparency: "screenshot";
background-color: #00000000;
border: 0;
padding: 0% 0% 1em 0%;
x-offset: 0;
y-offset: -10%;
}
#mainbox {
padding: 0px;
border: 0;
spacing: 1%;
}
#message {
border: 2px;
padding: 1em;
background-color: @background;
text-color: @text;
}
#textbox normal {
text-color: @text;
padding: 0;
border: 0;
}
#listview {
fixed-height: 1;
border: 2px;
padding: 1em;
reverse: false;
columns: 1;
background-color: @background;
}
#element {
border: 0;
padding: 2px;
}
#element normal.normal {
text-color: @text;
background-color: @background;
}
#element normal.urgent {
text-color: @text;
background-color: @background;
}
#element normal.active {
text-color: @text;
background-color: @active-background;
}
#element selected.normal {
text-color: @text;
background-color: #fff1;
}
#element selected.urgent {
text-color: @text;
background-color: @background;
}
#element selected.active {
text-color: @text;
background-color: @active-background-selected;
}
#element alternate.normal {
text-color: @text;
background-color: @background;
}
#element alternate.urgent {
text-color: @text;
background-color: @background;
}
#element alternate.active {
text-color: @text;
background-color: @active-background;
}
#scrollbar {
border: 0;
padding: 0;
}
#inputbar {
spacing: 0;
border: 2px;
padding: 0.5em 1em;
background-color: @background;
index: 0;
}
#inputbar normal {
foreground-color: @text;
background-color: @background;
}
#mode-switcher {
border: 2px;
padding: 0.5em 1em;
background-color: @background;
index: 10;
}
#button selected {
text-color: @text;
}
#inputbar {
children: [ prompt,textbox-prompt-colon,entry,case-indicator ];
}
#prompt {
text-color: @text;
}
#entry {
text-color: @text;
}
#case-indicator {
text-color: @text;
}
#textbox-prompt-colon {
expand: false;
str: ":";
margin: 0px 0.3em 0em 0em ;
text-color: @text;
}

3
config.lua Normal file
View File

@ -0,0 +1,3 @@
local config = require("default_config")
return config

215
default_config.lua Normal file
View File

@ -0,0 +1,215 @@
-- Default configuration file
-- This file will be overridden on update.
-- Copy to `~/.config/awesome/config.lua` to avoid losing your changes.
local awful = require("awful")
local naughty = require("naughty")
local config = {}
--
-- Awesome WM
--
config.awesome = {
-- Enable window autofocus on mouse hover
autofocus = true,
-- Enable hotkeys help widget for VIM and other apps
-- when client with a matching name is opened:
hotkeys_popup = true,
-- Application launcher
application_launcher_check = "rofi -version",
application_launcher = "rofi -show drun -modi drun -show-icons -config " .. awful.util.getdir("config") .. "/assets/rofi/themes/paper-float.rasi",
application_launcher_cmd = "rofi -show run -config " .. awful.util.getdir("config") .. "/assets/rofi/themes/paper-float.rasi",
-- Screen locker
lock_command = "i3lock --blur=5 -f -k --time-color=ffffffff --date-color=ffffffff --indicator --ring-color=aaaaaaaa",
-- lock_command = "xscreensaver-command -lock",
-- Terminal
terminal = "terminator",
-- Window tiling
tiling = {
-- Available window layouts - order matters
layouts = {
awful.layout.suit.floating,
awful.layout.suit.tile,
awful.layout.suit.tile.left,
awful.layout.suit.tile.bottom,
awful.layout.suit.tile.top,
-- awful.layout.suit.fair,
-- awful.layout.suit.fair.horizontal,
-- awful.layout.suit.spiral,
-- awful.layout.suit.spiral.dwindle,
-- awful.layout.suit.max,
-- awful.layout.suit.max.fullscreen,
-- awful.layout.suit.magnifier,
-- awful.layout.suit.corner.nw,
-- awful.layout.suit.corner.ne,
-- awful.layout.suit.corner.sw,
-- awful.layout.suit.corner.se,
},
},
}
-- Default text editor
config.awesome.editor = os.getenv("EDITOR") or "nano"
-- config.awesome.editor = "vi"
-- config.awesome.editor = "code"
-- Default text editor command
config.awesome.editor_cmd = config.awesome.terminal .. " -e " .. config.awesome.editor
--
-- Keys / Hotkeys / Shortcuts
--
-- To disable a shortcut, simply remove it (tip: comment it out with a leading "--")
--
config.keys = {
-- Main modifier key for meta hotkeys like moving windows or locking the session
-- Usually, Mod4 is the key with a logo between Control and Alt.
modkey = "Mod4",
}
-- Hotkeys globally available (through the entire OS, regardless of what's focused)
config.keys.global_keys = {
-- Application launcher
launcher = { { config.keys.modkey }, "space", },
launcher_cmd = { { "Ctrl", config.keys.modkey }, "space", },
-- Screen locker
lock_screen = { { config.keys.modkey }, "l" },
--
-- Media and volume controls
-- See media_control.lua
--
media_control = {
-- Raise volume
raiseVolume = { {}, "XF86AudioRaiseVolume" },
-- Lower volume
lowerVolume = { {}, "XF86AudioLowerVolume" },
-- Toggle mute
toggleMute = { {}, "XF86AudioMute" },
-- Toggle Play / Pause
playPause = { {}, "XF86AudioPlay" },
-- Next track
nextTrack = { {}, "XF86AudioNext" },
-- Previous track
previousTrack = { {}, "XF86AudioPrev" },
-- Brightness up
brightnessUp = { {}, "XF86MonBrightnessUp" },
-- Brightness down
brightnessDown = { {}, "XF86MonBrightnessDown" },
},
-- Keyboard layout
keyboard_layout = {
-- Switch between layouts
switch = { { "Mod1" }, "Shift_L" },
-- Switch between layouts (alternative)
switch_alt = { { "Shift" }, "Alt_L" },
}
}
-- Custom global hotkeys
config.keys.custom_keys = {
-- Example:
-- {
-- hotkey = {
-- { config.keys.modkey, },
-- "t"
-- },
-- action = function()
-- awful.spawn('terminator')
-- end,
-- identity = { description = "open terminator", group = "utilities" }
-- }
};
--
-- Audio
--
config.audio = {
card = '-D pulse',
device = 'Master',
};
--
-- Widgets
--
config.widgets = {
-- Keyboard layout widget
keyboard_layout = {
enabled = true,
layouts = { "fr", "us" },
layout_switch_command = "setxkbmap",
},
-- Enable/disable the system resources monitoring widget
system_resources = {
bars = {
enabled = true,
screens = { 1, 2 },
refresh_interval = 1.5, -- In seconds
},
battery = {
enabled = true,
screens = { 1, 2 },
refresh_interval = 15, -- In seconds
list_refresh_interval = 2, -- In seconds
precision = 0, -- How many decimals
},
},
}
--
-- Auto start custom applications
--
config.autostart = {
-- Network manager widget
{
"nm-applet --help", -- Verification command that will be checked before spawning the next command
"nm-applet", -- The app
},
-- Screenshot utility
"flameshot",
}
-- Theme
-- Change to gears.filesystem.get_themes_dir() .. "default/theme.lua" to use default awesome theme
config.theme = awful.util.getdir("config") .. "/theme.lua"
-- Screenshot utility
config.screenshot_utility_command = "flameshot gui"
-- Run menu
config.windowSwitcher = "rofi -show window -config " .. awful.util.getdir("config") .. "/assets/rofi/themes/paper-float.rasi"
-- Media control
config.volume_osd_timeout = 2
-- Awesome tweaks
naughty.config.defaults.timeout = 15
return config

205
default_theme.lua Normal file
View File

@ -0,0 +1,205 @@
---------------------------
-- Default awesome theme --
---------------------------
local awful = require("awful")
local naughty = require("naughty")
local gears = require("gears")
local theme_assets = require("beautiful.theme_assets")
local xresources = require("beautiful.xresources")
local dpi = xresources.apply_dpi
local gfs = require("gears.filesystem")
local themes_path = gfs.get_themes_dir()
local simple_awesome_path = awful.util.getdir("config")
local theme = {}
theme.font = "sans 12"
theme.bg_normal = "#222222"
theme.bg_focus = "#282828"
theme.bg_urgent = "#bf221c"
theme.bg_minimize = "#111111"
theme.bg_systray = theme.bg_normal
theme.fg_normal = "#aaaaaa"
theme.fg_focus = "#ffffff"
theme.fg_urgent = "#ffffff"
theme.fg_minimize = "#ffffff"
theme.useless_gap = dpi(8)
theme.border_width = dpi(0)
theme.border_normal = "#555555"
theme.border_focus = "#555555"
theme.border_marked = "#91231c"
-- Tasklist
theme.tasklist_bg_focus = theme.bg_minimize
theme.tasklist_bg_minimize = theme.bg_normal
-- Notifications
naughty.config.padding = dpi(8)
naughty.config.defaults.position = "top_right"
naughty.config.defaults.margin = dpi(16)
naughty.config.defaults.border_width = dpi(0)
naughty.config.presets.critical.bg = "#e82922"
theme.notification_shape = function(cr, width, height)
return gears.shape.rounded_rect(cr, width, height, 5)
end
theme.notification_margin = dpi(16)
theme.notification_width = dpi(512)
theme.notification_border_color = theme.border_focus
theme.notification_border_width = dpi(0)
theme.notification_bg = theme.bg_focus
theme.notification_fg = theme.fg_focus
-- Hotkeys (awesome help menu)
theme.hotkeys_border_color = theme.border_normal
-- System resources widget
theme.system_resources_widget_bar_bg = theme.bg_focus
theme.system_resources_widget_bar_color = "#ffffff"
theme.system_resources_widget_border_color = theme.fg_normal
theme.system_resources_widget_border_width = 1
theme.system_resources_widget_bar_width = dpi(8)
theme.system_resources_widget_bar_margin = dpi(2)
theme.system_resources_widget_bar_shape = function(cr, width, height)
return gears.shape.rounded_rect (cr, width, height, 2)
end
theme.system_resources_widget_battery_margin = theme.system_resources_widget_bar_width
-- There are other variable sets
-- overriding the default one when
-- defined, the sets are:
-- taglist_[bg|fg]_[focus|urgent|occupied|empty|volatile]
-- tasklist_[bg|fg]_[focus|urgent]
-- titlebar_[bg|fg]_[normal|focus]
-- tooltip_[font|opacity|fg_color|bg_color|border_width|border_color]
-- mouse_finder_[color|timeout|animate_timeout|radius|factor]
-- prompt_[fg|bg|fg_cursor|bg_cursor|font]
-- hotkeys_[bg|fg|border_width|border_color|shape|opacity|modifiers_fg|label_bg|label_fg|group_margin|font|description_font]
-- Example:
--theme.taglist_bg_focus = "#ff0000"
-- Generate taglist squares:
local taglist_square_size = dpi(8)
theme.taglist_squares_sel = theme_assets.taglist_squares_sel(
taglist_square_size, theme.fg_normal
)
theme.taglist_squares_unsel = theme_assets.taglist_squares_unsel(
taglist_square_size, theme.fg_normal
)
-- Variables set for theming notifications:
-- notification_font
-- notification_[bg|fg]
-- notification_[width|height|margin]
-- notification_[border_color|border_width|shape|opacity]
-- Variables set for theming the menu:
-- menu_[bg|fg]_[normal|focus]
-- menu_[border_color|border_width]
theme.menu_submenu_icon = themes_path.."default/submenu.png"
theme.menu_height = dpi(32)
theme.menu_width = dpi(256)
-- You can add as many variables as
-- you wish and access them by using
-- beautiful.variable in your rc.lua
--theme.bg_widget = "#cc0000"
-- Define the image to load
theme.titlebar_close_button_normal = simple_awesome_path .. "/assets/icons/x.svg"
theme.titlebar_close_button_focus = theme.titlebar_close_button_normal
theme.titlebar_close_button_hover_bg_color = '#800'
theme.titlebar_maximized_button_normal_inactive = simple_awesome_path .. "/assets/icons/maximize.svg"
theme.titlebar_maximized_button_focus_inactive = theme.titlebar_maximized_button_normal_inactive
theme.titlebar_maximized_button_normal_active = simple_awesome_path .. "/assets/icons/unmaximize.svg"
theme.titlebar_maximized_button_focus_active = theme.titlebar_maximized_button_normal_active
theme.titlebar_maximized_button_hover_bg_color = '#555'
theme.titlebar_minimize_button_normal = simple_awesome_path .. "/assets/icons/minus.svg"
theme.titlebar_minimize_button_focus = theme.titlebar_minimize_button_normal
theme.titlebar_minimize_button_hover_bg_color = '#555'
theme.titlebar_ontop_button_normal_inactive = themes_path.."default/titlebar/ontop_normal_inactive.png"
theme.titlebar_ontop_button_focus_inactive = theme.titlebar_ontop_button_normal_inactive
theme.titlebar_ontop_button_normal_active = themes_path.."default/titlebar/ontop_normal_active.png"
theme.titlebar_ontop_button_focus_active = theme.titlebar_ontop_button_normal_active
theme.titlebar_ontop_button_hover_bg_color = '#555'
theme.titlebar_floating_button_normal_inactive = themes_path.."default/titlebar/floating_normal_inactive.png"
theme.titlebar_floating_button_focus_inactive = theme.titlebar_floating_button_normal_inactive
theme.titlebar_floating_button_normal_active = themes_path.."default/titlebar/floating_normal_active.png"
theme.titlebar_floating_button_focus_active = theme.titlebar_floating_button_normal_active
theme.titlebar_floating_button_hover_bg_color = '#555'
theme.wallpaper = simple_awesome_path.."/assets/art/default_wallpaper.png"
-- You can use your own layout icons like this:
theme.layout_fairh = themes_path.."default/layouts/fairhw.png"
theme.layout_fairv = themes_path.."default/layouts/fairvw.png"
theme.layout_floating = themes_path.."default/layouts/floatingw.png"
theme.layout_magnifier = themes_path.."default/layouts/magnifierw.png"
theme.layout_max = themes_path.."default/layouts/maxw.png"
theme.layout_fullscreen = themes_path.."default/layouts/fullscreenw.png"
theme.layout_tilebottom = themes_path.."default/layouts/tilebottomw.png"
theme.layout_tileleft = themes_path.."default/layouts/tileleftw.png"
theme.layout_tile = themes_path.."default/layouts/tilew.png"
theme.layout_tiletop = themes_path.."default/layouts/tiletopw.png"
theme.layout_spiral = themes_path.."default/layouts/spiralw.png"
theme.layout_dwindle = themes_path.."default/layouts/dwindlew.png"
theme.layout_cornernw = themes_path.."default/layouts/cornernww.png"
theme.layout_cornerne = themes_path.."default/layouts/cornernew.png"
theme.layout_cornersw = themes_path.."default/layouts/cornersww.png"
theme.layout_cornerse = themes_path.."default/layouts/cornersew.png"
-- Generate Awesome icon:
theme.start_menu_icon = simple_awesome_path .. "/assets/icons/material-tux-dark-keen.svg"
theme.awesome_icon = theme_assets.awesome_icon(
theme.menu_height, theme.bg_focus, theme.fg_focus
)
-- Define the icon theme for application icons. If not set then the icons
-- from /usr/share/icons and /usr/share/icons/hicolor will be used.
theme.icon_theme = nil
-- Volume OSD
theme.volume_osd_width = dpi(48)
theme.volume_osd_bar_height = dpi(196)
theme.volume_osd_padding = dpi(8)
theme.volume_osd_shape = function(cr, width, height)
return gears.shape.rounded_rect(cr, width, height, 5)
end
theme.volume_osd_position = function(screen_width, screen_height, osd_width, osd_height)
return {
dpi(8),
theme.menu_height + dpi(8)
}
end
theme.volume_osd_bg = theme.bg_normal
theme.volume_osd_border_color = theme.border_normal
theme.volume_osd_border_width = dpi(0)
theme.volume_osd_progress_bg = theme.bg_minimize
theme.volume_osd_progress_color = "#ffffff"
theme.volume_osd_progress_color_muted = "#555555"
theme.volume_osd_progress_border_color = theme.volume_osd_border_color
theme.volume_osd_progress_border_width = dpi(0)
theme.volume_osd_image_color = "#ffffff"
theme.volume_osd_icon_0 = simple_awesome_path .. "/assets/icons/volume-x.svg"
theme.volume_osd_icon_1 = simple_awesome_path .. "/assets/icons/volume.svg"
theme.volume_osd_icon_2 = simple_awesome_path .. "/assets/icons/volume-1.svg"
theme.volume_osd_icon_3 = simple_awesome_path .. "/assets/icons/volume-2.svg"
-- Power Menu
theme.power_menu_icon_color = "#ffffff"
return theme
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

631
rc.lua
View File

@ -1,626 +1,5 @@
-- If LuaRocks is installed, make sure that packages installed through it are
-- found (e.g. lgi). If LuaRocks is not installed, do nothing.
pcall(require, "luarocks.loader")
-- DEBUG
local inspect = require("inspect")
-- Standard awesome library
local gears = require("gears")
local awful = require("awful")
require("awful.autofocus")
-- Widget and layout library
local wibox = require("wibox")
-- Theme handling library
local beautiful = require("beautiful")
-- Notification library
local naughty = require("naughty")
local menubar = require("menubar")
local hotkeys_popup = require("awful.hotkeys_popup")
-- Enable hotkeys help widget for VIM and other apps
-- when client with a matching name is opened:
require("awful.hotkeys_popup.keys")
-- {{{ Error handling
-- Check if awesome encountered an error during startup and fell back to
-- another config (This code will only ever execute for the fallback config)
if awesome.startup_errors then
naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, there were errors during startup!",
text = awesome.startup_errors })
end
-- Handle runtime errors after startup
do
local in_error = false
awesome.connect_signal("debug::error", function (err)
-- Make sure we don't go into an endless error loop
if in_error then return end
in_error = true
naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, an error happened!",
text = tostring(err) })
in_error = false
end)
end
-- }}}
-- {{{ Variable definitions
-- Themes define colours, icons, font and wallpapers.
beautiful.init(awful.util.getdir("config") .. "/theme.lua")
-- This is used later as the default terminal and editor to run.
terminal = "terminator"
editor = os.getenv("EDITOR") or "nano"
editor_cmd = terminal .. " -e " .. editor
-- Default modkey.
-- Usually, Mod4 is the key with a logo between Control and Alt.
-- If you do not like this or do not have such a key,
-- I suggest you to remap Mod4 to another key using xmodmap or other tools.
-- However, you can use another modifier like Mod1, but it may interact with others.
modkey = "Mod4"
-- Table of layouts to cover with awful.layout.inc, order matters.
awful.layout.layouts = {
awful.layout.suit.floating,
awful.layout.suit.tile,
-- awful.layout.suit.tile.left,
-- awful.layout.suit.tile.bottom,
-- awful.layout.suit.tile.top,
-- awful.layout.suit.fair,
-- awful.layout.suit.fair.horizontal,
-- awful.layout.suit.spiral,
-- awful.layout.suit.spiral.dwindle,
-- awful.layout.suit.max,
-- awful.layout.suit.max.fullscreen,
-- awful.layout.suit.magnifier,
-- awful.layout.suit.corner.nw,
-- awful.layout.suit.corner.ne,
-- awful.layout.suit.corner.sw,
-- awful.layout.suit.corner.se,
}
-- }}}
-- {{{ Menu
-- Create a launcher widget and a main menu
myawesomemenu = {
{ "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end },
{ "manual", terminal .. " -e man awesome" },
{ "edit config", editor_cmd .. " " .. awesome.conffile },
{ "restart", awesome.restart },
{ "quit", function() awesome.quit() end },
}
mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
{ "open terminal", terminal }
}
})
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
menu = mymainmenu })
-- Menubar configuration
menubar.utils.terminal = terminal -- Set the terminal for applications that require it
-- }}}
-- Keyboard map indicator and switcher
mykeyboardlayout = awful.widget.keyboardlayout()
-- {{{ Wibar
-- Create a textclock widget
mytextclock = wibox.widget.textclock()
-- Create a wibox for each screen and add it
local taglist_buttons = gears.table.join(
awful.button({ }, 1, function(t) t:view_only() end),
awful.button({ modkey }, 1, function(t)
if client.focus then
client.focus:move_to_tag(t)
end
end),
awful.button({ }, 3, awful.tag.viewtoggle),
awful.button({ modkey }, 3, function(t)
if client.focus then
client.focus:toggle_tag(t)
end
end),
awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end),
awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end)
)
local tasklist_buttons = gears.table.join(
awful.button({ }, 1, function (c)
if c == client.focus then
c.minimized = true
else
c:emit_signal(
"request::activate",
"tasklist",
{raise = true}
)
end
end),
awful.button({ }, 3, function()
awful.menu.client_list({ theme = { width = 250 } })
end),
awful.button({ }, 4, function ()
awful.client.focus.byidx(1)
end),
awful.button({ }, 5, function ()
awful.client.focus.byidx(-1)
end))
local function set_wallpaper(s)
-- Wallpaper
if beautiful.wallpaper then
local wallpaper = beautiful.wallpaper
-- If wallpaper is a function, call it with the screen
if type(wallpaper) == "function" then
wallpaper = wallpaper(s)
end
gears.wallpaper.maximized(wallpaper, s, true)
end
end
-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
screen.connect_signal("property::geometry", set_wallpaper)
awful.screen.connect_for_each_screen(function(s)
-- Wallpaper
set_wallpaper(s)
-- Each screen has its own tag table.
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1])
-- Create a promptbox for each screen
s.mypromptbox = awful.widget.prompt()
-- Create an imagebox widget which will contain an icon indicating which layout we're using.
-- We need one layoutbox per screen.
s.mylayoutbox = awful.widget.layoutbox(s)
s.mylayoutbox:buttons(gears.table.join(
awful.button({ }, 1, function () awful.layout.inc( 1) end),
awful.button({ }, 3, function () awful.layout.inc(-1) end),
awful.button({ }, 4, function () awful.layout.inc( 1) end),
awful.button({ }, 5, function () awful.layout.inc(-1) end)))
-- Create a taglist widget
s.mytaglist = awful.widget.taglist {
screen = s,
filter = awful.widget.taglist.filter.all,
buttons = taglist_buttons
}
-- Create a tasklist widget
s.mytasklist = awful.widget.tasklist {
screen = s,
filter = awful.widget.tasklist.filter.currenttags,
buttons = tasklist_buttons
}
-- Create the wibox
s.mywibox = awful.wibar({ position = "top", screen = s })
-- Add widgets to the wibox
s.mywibox:setup {
layout = wibox.layout.align.horizontal,
{ -- Left widgets
layout = wibox.layout.fixed.horizontal,
mylauncher,
s.mytaglist,
s.mypromptbox,
},
s.mytasklist, -- Middle widget
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
mykeyboardlayout,
wibox.widget.systray(),
mytextclock,
s.mylayoutbox,
},
}
end)
-- }}}
-- {{{ Mouse bindings
root.buttons(gears.table.join(
awful.button({ }, 3, function () mymainmenu:toggle() end),
awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev)
))
-- }}}
-- Tiling functions
local leftGeo = function(parent)
local f = awful.placement.scale
+ awful.placement.left
+ awful.placement['maximize_vertically']
return f(client.focus, {honor_workarea=true, to_percent = 0.5, parent = parent})
end
local rightGeo = function(parent)
local f = awful.placement.scale
+ awful.placement.right
+ awful.placement['maximize_vertically']
return f(client.focus, {honor_workarea=true, to_percent = 0.5, parent = parent})
end
local isTiled = function(client, geometry)
naughty.notify({title="debug", description="h=" .. client.height .. "-" .. geometry.height .. ", x=" .. client.x .. "-" .. geometry.x .. ", y=" .. client.y .. "-" .. geometry.y })
return client.height == geometry.height and client.x == geometry.x and client.y == geometry.y
end
-- {{{ Key bindings
globalkeys = gears.table.join(
awful.key({ modkey, }, "s", hotkeys_popup.show_help,
{description="show help", group="awesome"}),
-- awful.key({ modkey, }, "Left", awful.tag.viewprev,
-- {description = "view previous", group = "tag"}),
-- awful.key({ modkey, }, "Right", awful.tag.viewnext,
-- {description = "view next", group = "tag"}),
-- tiling
awful.key({modkey,}, "Right",
function (c)
local targetGeo = rightGeo(client.parent)
if isTiled(client, targetGeo) then
local newScreen = awful.screen.get_next_in_direction(client.parent, "right")
client.geometry = leftGeo(newScreen)
else
client.geometry = targetGeo
end
end,
{description = "Move right", group = "window_tiling"}
),
awful.key({modkey,}, "Left",
function ()
local targetGeo = leftGeo(client.parent)
if isTiled(client, targetGeo) then
local newScreen = awful.screen.get_next_in_direction(client.parent, "left")
client.geometry = rightGeo(newScreen)
else
client.geometry = targetGeo
end
end,
{description = "Move left", group = "window_tiling"}
),
awful.key({modkey,}, "Up",
function ()
local axis = 'vertically'
local f = awful.placement.scale
+ (axis and awful.placement['maximize'] or nil)
client.geometry = f(client.focus, {honor_workarea=true, to_percent = 0.5})
client.position = "maximized"
end,
{description = "Move left", group = "window_tiling"}
),
awful.key({ modkey, }, "Escape", awful.tag.history.restore,
{description = "go back", group = "tag"}),
awful.key({ modkey, }, "j",
function ()
awful.client.focus.byidx( 1)
end,
{description = "focus next by index", group = "client"}
),
awful.key({ modkey, }, "k",
function ()
awful.client.focus.byidx(-1)
end,
{description = "focus previous by index", group = "client"}
),
awful.key({ modkey, }, "w", function () mymainmenu:show() end,
{description = "show main menu", group = "awesome"}),
-- Layout manipulation
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end,
{description = "swap with next client by index", group = "client"}),
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end,
{description = "swap with previous client by index", group = "client"}),
awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end,
{description = "focus the next screen", group = "screen"}),
awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end,
{description = "focus the previous screen", group = "screen"}),
awful.key({ modkey, }, "u", awful.client.urgent.jumpto,
{description = "jump to urgent client", group = "client"}),
awful.key({ modkey, }, "Tab",
function ()
awful.client.focus.history.previous()
if client.focus then
client.focus:raise()
end
end,
{description = "go back", group = "client"}),
-- Standard program
awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end,
{description = "open a terminal", group = "launcher"}),
awful.key({ modkey, "Control" }, "r", awesome.restart,
{description = "reload awesome", group = "awesome"}),
awful.key({ modkey, "Shift" }, "q", awesome.quit,
{description = "quit awesome", group = "awesome"}),
awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end,
{description = "increase master width factor", group = "layout"}),
awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end,
{description = "decrease master width factor", group = "layout"}),
awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end,
{description = "increase the number of master clients", group = "layout"}),
awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end,
{description = "decrease the number of master clients", group = "layout"}),
awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end,
{description = "increase the number of columns", group = "layout"}),
awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end,
{description = "decrease the number of columns", group = "layout"}),
awful.key({ modkey, }, "space", function () awful.layout.inc( 1) end,
{description = "select next", group = "layout"}),
awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end,
{description = "select previous", group = "layout"}),
awful.key({ modkey, "Control" }, "n",
function ()
local c = awful.client.restore()
-- Focus restored client
if c then
c:emit_signal(
"request::activate", "key.unminimize", {raise = true}
)
end
end,
{description = "restore minimized", group = "client"}),
-- Prompt
awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end,
{description = "run prompt", group = "launcher"}),
awful.key({ modkey }, "x",
function ()
awful.prompt.run {
prompt = "Run Lua code: ",
textbox = awful.screen.focused().mypromptbox.widget,
exe_callback = awful.util.eval,
history_path = awful.util.get_cache_dir() .. "/history_eval"
}
end,
{description = "lua execute prompt", group = "awesome"}),
-- Menubar
awful.key({ modkey }, "p", function() menubar.show() end,
{description = "show the menubar", group = "launcher"})
)
clientkeys = gears.table.join(
awful.key({ modkey, }, "f",
function (c)
c.fullscreen = not c.fullscreen
c:raise()
end,
{description = "toggle fullscreen", group = "client"}),
awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end,
{description = "close", group = "client"}),
awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ,
{description = "toggle floating", group = "client"}),
awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end,
{description = "move to master", group = "client"}),
awful.key({ modkey, }, "o", function (c) c:move_to_screen() end,
{description = "move to screen", group = "client"}),
awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end,
{description = "toggle keep on top", group = "client"}),
awful.key({ modkey, }, "n",
function (c)
-- The client currently has the input focus, so it cannot be
-- minimized, since minimized clients can't have the focus.
c.minimized = true
end ,
{description = "minimize", group = "client"}),
awful.key({ modkey, }, "m",
function (c)
c.maximized = not c.maximized
c:raise()
end ,
{description = "(un)maximize", group = "client"}),
awful.key({ modkey, "Control" }, "m",
function (c)
c.maximized_vertical = not c.maximized_vertical
c:raise()
end ,
{description = "(un)maximize vertically", group = "client"}),
awful.key({ modkey, "Shift" }, "m",
function (c)
c.maximized_horizontal = not c.maximized_horizontal
c:raise()
end ,
{description = "(un)maximize horizontally", group = "client"})
)
-- Bind all key numbers to tags.
-- Be careful: we use keycodes to make it work on any keyboard layout.
-- This should map on the top row of your keyboard, usually 1 to 9.
for i = 1, 9 do
globalkeys = gears.table.join(globalkeys,
-- View tag only.
awful.key({ modkey }, "#" .. i + 9,
function ()
local screen = awful.screen.focused()
local tag = screen.tags[i]
if tag then
tag:view_only()
end
end,
{description = "view tag #"..i, group = "tag"}),
-- Toggle tag display.
awful.key({ modkey, "Control" }, "#" .. i + 9,
function ()
local screen = awful.screen.focused()
local tag = screen.tags[i]
if tag then
awful.tag.viewtoggle(tag)
end
end,
{description = "toggle tag #" .. i, group = "tag"}),
-- Move client to tag.
awful.key({ modkey, "Shift" }, "#" .. i + 9,
function ()
if client.focus then
local tag = client.focus.screen.tags[i]
if tag then
client.focus:move_to_tag(tag)
end
end
end,
{description = "move focused client to tag #"..i, group = "tag"}),
-- Toggle tag on focused client.
awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
function ()
if client.focus then
local tag = client.focus.screen.tags[i]
if tag then
client.focus:toggle_tag(tag)
end
end
end,
{description = "toggle focused client on tag #" .. i, group = "tag"})
)
end
clientbuttons = gears.table.join(
awful.button({ }, 1, function (c)
c:emit_signal("request::activate", "mouse_click", {raise = true})
end),
awful.button({ modkey }, 1, function (c)
c:emit_signal("request::activate", "mouse_click", {raise = true})
awful.mouse.client.move(c)
end),
awful.button({ modkey }, 3, function (c)
c:emit_signal("request::activate", "mouse_click", {raise = true})
awful.mouse.client.resize(c)
end)
)
-- Set keys
root.keys(globalkeys)
-- }}}
-- {{{ Rules
-- Rules to apply to new clients (through the "manage" signal).
awful.rules.rules = {
-- All clients will match this rule.
{ rule = { },
properties = { border_width = beautiful.border_width,
border_color = beautiful.border_normal,
focus = awful.client.focus.filter,
raise = true,
keys = clientkeys,
buttons = clientbuttons,
screen = awful.screen.preferred,
placement = awful.placement.no_overlap+awful.placement.no_offscreen
}
},
-- Floating clients.
{ rule_any = {
instance = {
"DTA", -- Firefox addon DownThemAll.
"copyq", -- Includes session name in class.
"pinentry",
},
class = {
"Arandr",
"Blueman-manager",
"Gpick",
"Kruler",
"MessageWin", -- kalarm.
"Sxiv",
"Tor Browser", -- Needs a fixed window size to avoid fingerprinting by screen size.
"Wpa_gui",
"veromix",
"xtightvncviewer"},
-- Note that the name property shown in xprop might be set slightly after creation of the client
-- and the name shown there might not match defined rules here.
name = {
"Event Tester", -- xev.
},
role = {
"AlarmWindow", -- Thunderbird's calendar.
"ConfigManager", -- Thunderbird's about:config.
"pop-up", -- e.g. Google Chrome's (detached) Developer Tools.
}
}, properties = { floating = true }},
-- Add titlebars to normal clients and dialogs
{ rule_any = {type = { "normal", "dialog" }
}, properties = { titlebars_enabled = true }
},
-- Set Firefox to always map on the tag named "2" on screen 1.
-- { rule = { class = "Firefox" },
-- properties = { screen = 1, tag = "2" } },
}
-- }}}
-- {{{ Signals
-- Signal function to execute when a new client appears.
client.connect_signal("manage", function (c)
-- Set the windows at the slave,
-- i.e. put it at the end of others instead of setting it master.
-- if not awesome.startup then awful.client.setslave(c) end
if awesome.startup
and not c.size_hints.user_position
and not c.size_hints.program_position then
-- Prevent clients from being unreachable after screen count changes.
awful.placement.no_offscreen(c)
end
end)
-- Add a titlebar if titlebars_enabled is set to true in the rules.
client.connect_signal("request::titlebars", function(c)
-- buttons for the titlebar
local buttons = gears.table.join(
awful.button({ }, 1, function()
c:emit_signal("request::activate", "titlebar", {raise = true})
awful.mouse.client.move(c)
end),
awful.button({ }, 3, function()
c:emit_signal("request::activate", "titlebar", {raise = true})
awful.mouse.client.resize(c)
end)
)
awful.titlebar(c) : setup {
{ -- Left
awful.titlebar.widget.iconwidget(c),
buttons = buttons,
layout = wibox.layout.fixed.horizontal
},
{ -- Middle
{ -- Title
align = "center",
widget = awful.titlebar.widget.titlewidget(c)
},
buttons = buttons,
layout = wibox.layout.flex.horizontal
},
{ -- Right
awful.titlebar.widget.floatingbutton (c),
awful.titlebar.widget.maximizedbutton(c),
awful.titlebar.widget.stickybutton (c),
awful.titlebar.widget.ontopbutton (c),
awful.titlebar.widget.closebutton (c),
layout = wibox.layout.fixed.horizontal()
},
layout = wibox.layout.align.horizontal
}
end)
-- Enable sloppy focus, so that focus follows mouse.
client.connect_signal("mouse::enter", function(c)
c:emit_signal("request::activate", "mouse_enter", {raise = false})
end)
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
-- }}}
--
-- Simple Awesome - By ashpie & Arkhist
-- To configure Simple Awesome without losing your changes when updating, see the `config.lua` file.
--
require("simple")

29
simple/core/hotkey.lua Normal file
View File

@ -0,0 +1,29 @@
local awful = require("awful")
local gears = require("gears")
local global_keys = {}
function make(hotkey, action, identity)
if hotkey == nil then
return nil
end
local modifiers = hotkey[1]
local key = hotkey[2]
return awful.key(modifiers, key, action, identity)
end
function registerKeys(...)
global_keys = gears.table.join(global_keys, ...)
end
function getKeys()
return global_keys
end
return {
make = make,
registerKeys = registerKeys,
getKeys = getKeys,
}

756
simple/init.lua Normal file
View File

@ -0,0 +1,756 @@
--
-- DEBUG
--
local inspect = require("simple/debug/inspect")
--
-- Simple Awesome configuration
--
local config = require("config")
--
-- Hotkeys
--
local hotkey = require("simple/core/hotkey")
--
-- Misc components
--
local titlebar = require("simple/titlebar")
--
-- Awesome WM
--
local awful = require("awful")
local beautiful = require("beautiful")
local gears = require("gears")
local naughty = require("naughty")
local wibox = require("wibox")
-- Widgets and layout components
local hotkeys_popup = require("awful.hotkeys_popup")
-- Window autofocus
if config.awesome.autofocus then
require("awful.autofocus")
end
-- Hotkeys popup
if hotkeys_popup then
require("awful.hotkeys_popup.keys")
end
-- Application launcher
local menubar = require("menubar")
menubar.utils.terminal = config.awesome.terminal
function showAppLauncher(commandOnly)
if os.execute(config.awesome.application_launcher_check) then
if commandOnly then
awful.spawn(config.awesome.application_launcher_cmd)
else
awful.spawn(config.awesome.application_launcher)
end
else
menubar.show()
end
end
hotkey.registerKeys(hotkey.make(config.keys.global_keys.launcher, function() showAppLauncher(false) end,
{ description = "show the application launcher", group = "launcher" }))
hotkey.registerKeys(hotkey.make(config.keys.global_keys.launcher_cmd, function() showAppLauncher(true) end,
{ description = "show the application launcher (command line)", group = "launcher" }))
--
-- Error handling
--
-- Startup errors
if awesome.startup_errors then
naughty.notify({
preset = naughty.config.presets.critical,
title = "Something went wrong while booting Awesome",
text = awesome.startup_errors
})
end
-- Runtime errors handling routine
do
local in_error = false
awesome.connect_signal("debug::error", function(err)
-- Make sure we don't go into an endless error loop
if in_error then return end
in_error = true
naughty.notify({
preset = naughty.config.presets.critical,
title = "An error happened during Awesome runtime",
text = tostring(err)
})
in_error = false
end)
end
--
-- Theme
--
beautiful.init(config.theme)
--
-- Window tiling
--
local tiling = require("simple/tiling")
-- Tiling layouts
awful.layout.layouts = config.awesome.tiling.layouts
--
-- Media control keys and widget
--
local media_control = require("simple/media_control")
hotkey.registerKeys(media_control.getKeys(config.keys.global_keys.media_control))
--
-- Widgets
--
-- System resources
local system_resources_widget = require("simple/widgets/system_resources")
-- Keyboard map indicator and switcher
local keyboard_layout = require("simple/widgets/keyboard_layout")
local keyboard_layout_widget
if config.widgets.keyboard_layout.enabled then
keyboard_layout_widget = keyboard_layout.widget
end
hotkey.registerKeys(keyboard_layout.getKeys(config.keys.global_keys.keyboard_layout))
--
-- Auto start
--
for _, app in ipairs(config.autostart) do
local type = type(app)
if type == "table" then -- Has a verification command that checks if it exists on the system
if os.execute(app[1]) == true then
awful.spawn(app[2])
end
elseif type == "string" then -- Simple command
awful.spawn(app)
end
end
--
-- Screen locker
--
function lockScreen()
awful.spawn(config.awesome.lock_command)
end
hotkey.registerKeys(hotkey.make(config.keys.global_keys.lock_screen, lockScreen,
{ description = "lock your screen", group = "awesome" }))
--
-- Launcher (start menu)
--
local launcher = awful.widget.button({
image = beautiful.start_menu_icon,
})
launcher:buttons(gears.table.join(launcher:buttons(),
awful.button({}, 1, nil, function() showAppLauncher(false) end)))
lock_icon = gears.color.recolor_image(awful.util.getdir("config") .. "/assets/icons/lock.svg", beautiful.power_menu_icon_color)
logout_icon = gears.color.recolor_image(awful.util.getdir("config") .. "/assets/icons/log-out.svg", beautiful.power_menu_icon_color)
sleep_icon = gears.color.recolor_image(awful.util.getdir("config") .. "/assets/icons/sleep.svg", beautiful.power_menu_icon_color)
hibernate_icon = gears.color.recolor_image(awful.util.getdir("config") .. "/assets/icons/hibernate.svg", beautiful.power_menu_icon_color)
restart_icon = gears.color.recolor_image(awful.util.getdir("config") .. "/assets/icons/refresh-cw.svg", beautiful.power_menu_icon_color)
shutdown_icon = gears.color.recolor_image(awful.util.getdir("config") .. "/assets/icons/power.svg", beautiful.power_menu_icon_color)
os_menu = awful.widget.launcher({
image = beautiful.awesome_icon,
menu = awful.menu({
items = {
{ "Hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end },
{ "Manual", config.awesome.terminal .. " -e man awesome" },
{ "Edit config", config.awesome.editor_cmd .. " " .. awesome.conffile },
{ "Open terminal", config.awesome.terminal },
{ "Lock", lockScreen, lock_icon },
{ "Logout", function() awesome.quit() end, logout_icon },
{ "Sleep", function() os.execute('systemctl suspend') end, sleep_icon},
{ "Hybrid sleep", function() os.execute('systemctl hybrid-sleep') end, hibernate_icon },
{ "Hibernate", function() os.execute('systemctl hibernate') end, hibernate_icon },
{ "Restart", function() os.execute('shutdown -r now') end, restart_icon },
{ "Shutdown", function() os.execute('shutdown now') end, shutdown_icon },
}
})
})
-- {{{ Wibar
-- Create a textclock widget
mytextclock = wibox.widget.textclock()
-- Create a wibox for each screen and add it
local taglist_buttons = gears.table.join(awful.button({}, 1, function(t) t:view_only() end),
awful.button({ config.keys.modkey }, 1, function(t)
if client.focus then
client.focus:move_to_tag(t)
end
end),
awful.button({}, 3, awful.tag.viewtoggle),
awful.button({ config.keys.modkey }, 3, function(t)
if client.focus then
client.focus:toggle_tag(t)
end
end),
awful.button({}, 4, function(t) awful.tag.viewnext(t.screen) end),
awful.button({}, 5, function(t) awful.tag.viewprev(t.screen) end))
local tasklist_buttons = gears.table.join(awful.button({}, 1, function(c)
if c == client.focus then
c.minimized = true
else
c:emit_signal("request::activate",
"tasklist",
{ raise = true })
end
end),
awful.button({}, 3, function()
awful.menu.client_list({ theme = { width = 250 } })
end),
awful.button({}, 4, function()
awful.client.focus.byidx(1)
end),
awful.button({}, 5, function()
awful.client.focus.byidx(-1)
end))
local function set_wallpaper(s)
-- Wallpaper
if beautiful.wallpaper then
local wallpaper = beautiful.wallpaper
-- If wallpaper is a function, call it with the screen
if type(wallpaper) == "function" then
wallpaper = wallpaper(s)
end
gears.wallpaper.maximized(wallpaper, s)
end
end
-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
screen.connect_signal("property::geometry", set_wallpaper)
awful.screen.connect_for_each_screen(function(s)
-- Wallpaper
set_wallpaper(s)
-- Each screen has its own tag table.
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1])
-- Create a promptbox for each screen
s.mypromptbox = awful.widget.prompt()
-- Create an imagebox widget which will contain an icon indicating which layout we're using.
-- We need one layoutbox per screen.
s.mylayoutbox = awful.widget.layoutbox(s)
s.mylayoutbox:buttons(gears.table.join(awful.button({}, 1, function() awful.layout.inc(1) end),
awful.button({}, 3, function() awful.layout.inc(-1) end),
awful.button({}, 4, function() awful.layout.inc(1) end),
awful.button({}, 5, function() awful.layout.inc(-1) end)))
-- Create a taglist widget
s.mytaglist = awful.widget.taglist {
screen = s,
filter = awful.widget.taglist.filter.all,
buttons = taglist_buttons
}
-- Create a tasklist widget
s.mytasklist = awful.widget.tasklist {
screen = s,
filter = awful.widget.tasklist.filter.currenttags,
buttons = tasklist_buttons,
widget_template = {
{
{
{
{
id = 'icon_role',
widget = wibox.widget.imagebox,
},
margins = 8,
widget = wibox.container.margin,
},
{
id = 'text_role',
widget = wibox.widget.textbox,
},
layout = wibox.layout.fixed.horizontal,
},
left = 0,
right = 8,
widget = wibox.container.margin
},
id = 'background_role',
widget = wibox.container.background,
},
layout = {
max_widget_size = 256,
layout = wibox.layout.flex.horizontal
}
}
-- Create the wibox
s.mywibox = awful.wibar({
position = "top",
screen = s,
height = 32
})
function matchesScreen(screens)
for _, allowedScreen in ipairs(screens) do
if allowedScreen == s.index then
return true
end
end
return false
end
-- Add widgets to the wibox
s.mywibox:setup {
layout = wibox.layout.align.horizontal,
{
-- Left widgets
layout = wibox.layout.fixed.horizontal,
launcher,
s.mytaglist,
s.mypromptbox,
},
s.mytasklist, -- Middle widget
{
-- Right widgets
layout = wibox.layout.fixed.horizontal,
matchesScreen(config.widgets.system_resources.bars.screens) and system_resources_widget.bars or nil,
matchesScreen(config.widgets.system_resources.battery.screens) and system_resources_widget.battery or nil,
keyboard_layout_widget,
wibox.widget.systray(),
mytextclock,
s.mylayoutbox,
os_menu,
},
}
end)
-- }}}
-- {{{ Mouse bindings
root.buttons(gears.table.join(awful.button({}, 3, function() mymainmenu:toggle() end),
awful.button({}, 4, awful.tag.viewnext),
awful.button({}, 5, awful.tag.viewprev)))
-- }}}
-- {{{ Key bindings
hotkey.registerKeys(
awful.key({ config.keys.modkey }, "p",
function()
local screen = awful.screen.focused()
screen.mywibox.visible = not screen.mywibox.visible
end,
{ description = "hide status bar", group = "screen" }))
hotkey.registerKeys(
awful.key({ config.keys.modkey, }, "s", hotkeys_popup.show_help,
{ description = "show help", group = "awesome" }),
awful.key({ config.keys.modkey, }, "Escape", awful.tag.history.restore,
{ description = "go back", group = "tag" }),
awful.key({ config.keys.modkey, }, "j",
function()
awful.client.focus.byidx(1)
end,
{ description = "focus next by index", group = "client" }),
awful.key({ config.keys.modkey, }, "k",
function()
awful.client.focus.byidx(-1)
end,
{ description = "focus previous by index", group = "client" }),
awful.key({ config.keys.modkey, }, "w", function() mymainmenu:show() end,
{ description = "show main menu", group = "awesome" }),
-- Layout manipulation
awful.key({ config.keys.modkey, "Shift" }, "j", function() awful.client.swap.byidx(1) end,
{ description = "swap with next client by index", group = "client" }),
awful.key({ config.keys.modkey, "Shift" }, "k", function() awful.client.swap.byidx(-1) end,
{ description = "swap with previous client by index", group = "client" }),
awful.key({ config.keys.modkey, "Control" }, "j", function() awful.screen.focus_relative(1) end,
{ description = "focus the next screen", group = "screen" }),
awful.key({ config.keys.modkey, "Control" }, "k", function() awful.screen.focus_relative(-1) end,
{ description = "focus the previous screen", group = "screen" }),
awful.key({ config.keys.modkey, }, "u", awful.client.urgent.jumpto,
{ description = "jump to urgent client", group = "client" }),
awful.key({ config.keys.modkey, }, "Tab",
function()
if config.windowSwitcher == "" then
awful.client.focus.history.previous()
if client.focus then
client.focus:raise()
end
else
os.execute(config.windowSwitcher)
end
end,
{ description = "switch window", group = "client" }),
-- Standard program
awful.key({ config.keys.modkey, }, "Return", function() awful.spawn(config.awesome.terminal) end,
{ description = "open a terminal", group = "launcher" }),
awful.key({ config.keys.modkey, "Control" }, "r", awesome.restart,
{ description = "reload awesome", group = "awesome" }),
awful.key({ config.keys.modkey, "Shift" }, "q", awesome.quit,
{ description = "quit awesome", group = "awesome" }),
-- awful.key({ config.keys.modkey, }, "l", function() awful.tag.incmwfact(0.05) end,
-- { description = "increase master width factor", group = "layout" }),
-- awful.key({ config.keys.modkey, }, "h", function() awful.tag.incmwfact(-0.05) end,
-- { description = "decrease master width factor", group = "layout" }),
awful.key({ config.keys.modkey, "Shift" }, "h", function() awful.tag.incnmaster(1, nil, true) end,
{ description = "increase the number of master clients", group = "layout" }),
awful.key({ config.keys.modkey, "Shift" }, "l", function() awful.tag.incnmaster(-1, nil, true) end,
{ description = "decrease the number of master clients", group = "layout" }),
awful.key({ config.keys.modkey, "Control" }, "h", function() awful.tag.incncol(1, nil, true) end,
{ description = "increase the number of columns", group = "layout" }),
awful.key({ config.keys.modkey, "Control" }, "l", function() awful.tag.incncol(-1, nil, true) end,
{ description = "decrease the number of columns", group = "layout" }),
awful.key({ config.keys.modkey, }, "v", function() awful.layout.inc(1) end,
{ description = "select next", group = "layout" }),
awful.key({ config.keys.modkey }, "c", function() awful.layout.inc(-1) end,
{ description = "select previous", group = "layout" }),
awful.key({ config.keys.modkey, "Control" }, "n",
function()
local c = awful.client.restore()
-- Focus restored client
if c then
c:emit_signal("request::activate", "key.unminimize", { raise = true })
end
end,
{ description = "restore minimized", group = "client" }),
-- Prompt
awful.key({ config.keys.modkey }, "r", function() os.execute(config.runMenu) end,
{ description = "show the run menu", group = "launcher" }),
awful.key({ config.keys.modkey }, "x",
function()
awful.prompt.run {
prompt = "Run Lua code: ",
textbox = awful.screen.focused().mypromptbox.widget,
exe_callback = awful.util.eval,
history_path = awful.util.get_cache_dir() .. "/history_eval"
}
end,
{ description = "lua execute prompt", group = "awesome" }),
-- Menubar
awful.key({ config.keys.modkey }, "space", function() os.execute(config.runMenu) end,
{ description = "show the run menu", group = "launcher" }),
-- Flameshot
awful.key({}, "Print", function() os.execute(config.screenshot_utility_command) end,
{ description = "Take a screenshot using the screenshot utility", group = "utilities" })
)
for key in gears.table.iterate(config.keys.custom_keys, function() return true end) do
hotkey.registerKeys(
hotkey.make(key.hotkey, key.action, key.identity)
)
end
clientkeys = gears.table.join(-- tiling
awful.key({ config.keys.modkey, }, "Right",
tiling.key.tileRight,
{ description = "Tile right", group = "tiling" }),
awful.key({ config.keys.modkey, }, "Left",
tiling.key.tileLeft,
{ description = "Tile left", group = "tiling" }),
awful.key({ config.keys.modkey, "Control" }, "Right",
tiling.key.screenRight,
{ description = "Screen right", group = "tiling" }),
awful.key({ config.keys.modkey, "Control" }, "Left",
tiling.key.screenLeft,
{ description = "Screen left", group = "tiling" }),
awful.key({ config.keys.modkey, }, "Up",
tiling.key.toggleMaximized,
{ description = "Toggle maximized", group = "tiling" }),
awful.key({ config.keys.modkey, }, "Down",
tiling.key.minimize,
{ description = "Lower", group = "tiling" }),
awful.key({ config.keys.modkey, }, "f",
function(c)
c.fullscreen = not c.fullscreen
c:raise()
end,
{ description = "toggle fullscreen", group = "client" }),
awful.key({ config.keys.modkey, "Shift" }, "c", function(c) c:kill() end,
{ description = "close", group = "client" }),
awful.key({ config.keys.modkey, "Shift" }, "space", awful.client.floating.toggle,
{ description = "toggle floating", group = "client" }),
awful.key({ config.keys.modkey, "Control" }, "Return", function(c) c:swap(awful.client.getmaster()) end,
{ description = "move to master", group = "client" }),
awful.key({ config.keys.modkey, }, "o", function(c) c:move_to_screen() end,
{ description = "move to screen", group = "client" }),
awful.key({ config.keys.modkey, }, "t", function(c) c.ontop = not c.ontop end,
{ description = "toggle keep on top", group = "client" }),
awful.key({ config.keys.modkey, }, "n",
function(c)
-- The client currently has the input focus, so it cannot be
-- minimized, since minimized clients can't have the focus.
c.minimized = true
end,
{ description = "minimize", group = "client" }),
awful.key({ config.keys.modkey, }, "m",
function(c)
c.maximized = not c.maximized
c:raise()
end,
{ description = "(un)maximize", group = "client" }),
awful.key({ config.keys.modkey, "Control" }, "m",
function(c)
c.maximized_vertical = not c.maximized_vertical
c:raise()
end,
{ description = "(un)maximize vertically", group = "client" }),
awful.key({ config.keys.modkey, "Shift" }, "m",
function(c)
c.maximized_horizontal = not c.maximized_horizontal
c:raise()
end,
{ description = "(un)maximize horizontally", group = "client" }),
awful.key({ config.keys.modkey, "Shift"}, "p",
function(c)
awful.titlebar.toggle(c)
if c.maximized then
c.maximized = false
c.maximized = true
end
end,
{ description = "toggle titlebar", group = "client"}))
-- Bind all key numbers to tags.
-- Be careful: we use keycodes to make it work on any keyboard layout.
-- This should map on the top row of your keyboard, usually 1 to 9.
for i = 1, 9 do
hotkey.registerKeys(-- View tag only.
awful.key({ config.keys.modkey }, "#" .. i + 9,
function()
local screen = awful.screen.focused()
local tag = screen.tags[i]
if tag then
tag:view_only()
end
end,
{ description = "view tag #" .. i, group = "tag" }),
-- Toggle tag display.
awful.key({ config.keys.modkey, "Control" }, "#" .. i + 9,
function()
local screen = awful.screen.focused()
local tag = screen.tags[i]
if tag then
awful.tag.viewtoggle(tag)
end
end,
{ description = "toggle tag #" .. i, group = "tag" }),
-- Move client to tag.
awful.key({ config.keys.modkey, "Shift" }, "#" .. i + 9,
function()
if client.focus then
local tag = client.focus.screen.tags[i]
if tag then
client.focus:move_to_tag(tag)
end
end
end,
{ description = "move focused client to tag #" .. i, group = "tag" }),
-- Toggle tag on focused client.
awful.key({ config.keys.modkey, "Control", "Shift" }, "#" .. i + 9,
function()
if client.focus then
local tag = client.focus.screen.tags[i]
if tag then
client.focus:toggle_tag(tag)
end
end
end,
{ description = "toggle focused client on tag #" .. i, group = "tag" }))
end
clientbuttons = gears.table.join(awful.button({}, 1, function(c)
c:emit_signal("request::activate", "mouse_click", { raise = true })
end),
awful.button({ config.keys.modkey }, 1, function(c)
c:emit_signal("request::activate", "mouse_click", { raise = true })
awful.mouse.client.move(c)
end),
awful.button({ config.keys.modkey }, 3, function(c)
c:emit_signal("request::activate", "mouse_click", { raise = true })
awful.mouse.client.resize(c)
end))
-- Set keys
root.keys(hotkey.getKeys())
-- }}}
-- {{{ Rules
-- Rules to apply to new clients (through the "manage" signal).
awful.rules.rules = {
-- All clients will match this rule.
{
rule = {},
properties = {
border_width = beautiful.border_width,
border_color = beautiful.border_normal,
focus = awful.client.focus.filter,
raise = true,
keys = clientkeys,
buttons = clientbuttons,
screen = awful.screen.preferred,
placement = awful.placement.no_overlap + awful.placement.no_offscreen
}
},
-- Floating clients.
{
rule_any = {
instance = {
"DTA", -- Firefox addon DownThemAll.
"copyq", -- Includes session name in class.
"pinentry",
},
class = {
"Arandr",
"Blueman-manager",
"Gpick",
"Kruler",
"MessageWin", -- kalarm.
"Sxiv",
"Tor Browser", -- Needs a fixed window size to avoid fingerprinting by screen size.
"Wpa_gui",
"veromix",
"xtightvncviewer"
},
-- Note that the name property shown in xprop might be set slightly after creation of the client
-- and the name shown there might not match defined rules here.
name = {
"Event Tester", -- xev.
},
role = {
"AlarmWindow", -- Thunderbird's calendar.
"ConfigManager", -- Thunderbird's about:config.
"pop-up",
},
type = {
"dialog",
"floating",
}
},
properties = { floating = true }
},
-- Add titlebars to normal clients and dialogs
{
rule_any = {
type = { "normal", "dialog" }
},
properties = { titlebars_enabled = true }
},
-- Set Firefox to always map on the tag named "2" on screen 1.
-- { rule = { class = "Firefox" },
-- properties = { screen = 1, tag = "2" } },
}
-- }}}
-- Add a titlebar if titlebars_enabled is set to true in the rules.
client.connect_signal("request::titlebars", function(c)
-- buttons for the titlebar
local buttons = gears.table.join(awful.button({}, 1, function()
c:emit_signal("request::activate", "titlebar", { raise = true })
awful.mouse.client.move(c)
end),
awful.button({}, 3, function()
c:emit_signal("request::activate", "titlebar", { raise = true })
awful.mouse.client.resize(c)
end))
awful.titlebar(c):setup {
{
{
awful.titlebar.widget.iconwidget(c),
buttons = buttons,
layout = wibox.layout.fixed.horizontal
},
margins = 2,
widget = wibox.container.margin,
},
{
{
{
-- Title
align = "left",
widget = awful.titlebar.widget.titlewidget(c)
},
buttons = buttons,
layout = wibox.layout.flex.horizontal
},
left = 8,
right = 8,
widget = wibox.container.margin,
},
{
titlebar.widget.floatingbutton(c),
titlebar.widget.ontopbutton(c),
titlebar.widget.minimizebutton(c),
titlebar.widget.maximizedbutton(c),
titlebar.widget.closebutton(c),
layout = wibox.layout.fixed.horizontal()
},
layout = wibox.layout.align.horizontal
}
if c.requests_no_titlebar then
awful.titlebar.hide(c)
end
end)
-- Enable sloppy focus, so that focus follows mouse.
if config.awesome.autofocus then
client.connect_signal("mouse::enter", function(c)
c:emit_signal("request::activate", "mouse_enter", { raise = false })
end)
end
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
-- }}}
-- Make sure clients requesting fullscreen get a correct fullscreen geometry
-- See https://github.com/awesomeWM/awesome/issues/3156
-- OP: https://github.com/awesomeWM/awesome/issues/1607#issuecomment-298194491
client.connect_signal("property::fullscreen", function(c)
if c.fullscreen then
gears.timer.delayed_call(function()
if c.valid then
c:geometry(c.screen.geometry)
end
end)
end
end)

268
simple/media_control.lua Normal file
View File

@ -0,0 +1,268 @@
--
-- Control playing music/media and sound volume
-- Currently supports :
-- - playerctl
-- - Spotify
--
--
-- DEBUG
--
local inspect = require("simple/debug/inspect")
local awful = require("awful")
local beautiful = require("beautiful")
local gears = require("gears")
local naughty = require("naughty")
local wibox = require("wibox")
local hotkey = require("simple/core/hotkey")
local config = require("config")
local hasPlayerctl = os.execute("playerctl -v") == true
-- playerctl
function sendToPlayerctl(command, callback)
callback = callback or function()
end
awful.spawn.easy_async("playerctl " .. command, callback)
end
-- Spotify
function sendToSpotify(command, callback)
callback = callback or function()
end
awful.spawn.easy_async_with_shell("dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player." .. command, callback)
end
-- Brightness control
function getBrightness(callback)
callback = callback or function()
end
awful.spawn.easy_async("xbacklight -get", function(stdout, stderr, reason, exit_code)
callback(stdout)
end)
end
function increaseBrightness(callback)
callback = callback or function()
end
awful.spawn.easy_async("xbacklight -inc 2", callback)
end
function decreaseBrightness(callback)
callback = callback or function()
end
awful.spawn.easy_async("xbacklight -dec 2", callback)
end
-- Volume control
function isMuted(callback)
awful.spawn.easy_async_with_shell("amixer " .. config.audio.card .. " sget '" .. config.audio.device .. "' | egrep 'Playback.*?\\[o' | egrep -o '\\[o.+\\]'", function(stdout, stderr, reason, exit_code)
callback(string.match(string.gsub(stdout, "[\n]+", ""), "off"))
end)
end
function getVolume(callback)
awful.spawn.easy_async_with_shell("amixer " .. config.audio.card .. " sget '" .. config.audio.device .. "' -M | awk -F\"[][]\" '/%/ { print $2 }' | head -n 1", function(stdout, stderr, reason, exit_code)
callback(string.gsub(stdout, "[\n%%]+", "") / 100)
end)
end
function getVolumeImage(volume)
local path = beautiful.volume_osd_icon_3
if volume < 0.667 then
path = beautiful.volume_osd_icon_2
end
if volume < 0.334 then
path = beautiful.volume_osd_icon_1
end
if volume <= 0 then
path = beautiful.volume_osd_icon_0
end
return gears.color.recolor_image(path, beautiful.volume_osd_image_color)
end
local volumeWibox = wibox({
ontop = true,
bg = beautiful.volume_osd_bg,
border_width = beautiful.volume_osd_border_width,
border_color = beautiful.volume_osd_border_color,
shape = beautiful.volume_osd_shape,
width = beautiful.volume_osd_width,
height = beautiful.volume_osd_bar_height + beautiful.volume_osd_padding * 3,
widget = wibox.widget {
{
{
image = getVolumeImage(1),
widget = wibox.widget.imagebox
},
left = beautiful.volume_osd_padding,
right = beautiful.volume_osd_padding,
top = beautiful.volume_osd_padding,
bottom = 0,
widget = wibox.container.margin,
},
{
{
{
max_value = 1,
value = 0.33,
shape = gears.shape.rounded_bar,
bar_shape = gears.shape.rounded_bar,
margins = beautiful.volume_osd_padding + 4,
color = beautiful.volume_osd_progress_color,
background_color = beautiful.volume_osd_progress_bg,
border_color = beautiful.volume_osd_progress_border_color,
border_width = beautiful.volume_osd_progress_border_width,
widget = wibox.widget.progressbar
},
forced_width = 80,
forced_height = 80,
direction = "east",
layout = wibox.container.rotate,
},
left = beautiful.volume_osd_padding,
right = beautiful.volume_osd_padding,
top = 0,
bottom = beautiful.volume_osd_padding,
widget = wibox.container.margin,
},
layout = wibox.layout.align.vertical
},
})
local imagebox = volumeWibox.widget:get_children()[1]:get_children()[1]
local progressbar = volumeWibox.widget:get_children()[2]:get_children()[1]:get_children()[1]
local timer = nil
-- {{{ Control
local playPause = function()
if hasPlayerctl then
sendToPlayerctl("play-pause")
else
sendToSpotify("PlayPause")
end
end
local nextTrack = function()
if hasPlayerctl then
sendToPlayerctl("next")
else
sendToSpotify("Next")
end
end
local previousTrack = function()
if hasPlayerctl then
sendToPlayerctl("previous")
else
sendToSpotify("Previous")
end
end
local displayVolume = function()
isMuted(function(muted)
getVolume(function(volume)
-- Update values
imagebox.image = getVolumeImage(muted and 0 or volume)
progressbar.value = volume
progressbar.color = muted and beautiful.volume_osd_progress_color_muted or beautiful.volume_osd_progress_color
if timer ~= nil and timer.started then
timer:again()
return
end
-- Update screen
local screen = awful.screen:focused()
volumeWibox.screen = screen
-- Position
local position = beautiful.volume_osd_position(screen.geometry.width, screen.geometry.height, beautiful.volume_osd_width, beautiful.volume_osd_height)
volumeWibox:geometry({
x = (screen.geometry.x + position[1]),
y = (screen.geometry.y + position[2])
})
-- Show
volumeWibox.visible = true
-- Schedule hide
if timer ~= nil then
timer:stop()
end
timer = gears.timer {
timeout = config.volume_osd_timeout,
callback = function()
volumeWibox.visible = false
timer:stop()
timer = nil
end
}
timer:start()
end)
end)
end
local raiseVolume = function()
awful.spawn.easy_async("amixer " .. config.audio.card .. " set '" .. config.audio.device .. "' 5%+ -M", function(stdout, stderr, reason, exit_code)
displayVolume()
end)
end
local lowerVolume = function()
awful.spawn.easy_async("amixer " .. config.audio.card .. " set '" .. config.audio.device .. "' 5%- -M", function(stdout, stderr, reason, exit_code)
displayVolume()
end)
end
local toggleMute = function()
isMuted(function(muted)
awful.spawn.easy_async("amixer " .. config.audio.card .. " set '" .. config.audio.device .. "' " .. (muted and 'on' or 'off'), function(stdout, stderr, reason, exit_code)
displayVolume()
end)
end)
end
-- }}}
function getKeys(keys)
if config.audio.card == 'disabled' then
return
-- Media control
hotkey.make(keys.playPause, playPause,
{ description = "Toggle Play / Pause", group = "media control" }),
hotkey.make(keys.nextTrack, nextTrack,
{ description = "Next track", group = "media control" }),
hotkey.make(keys.previousTrack, previousTrack,
{ description = "Previous track", group = "media control" })
end
return
-- Volume control
hotkey.make(keys.raiseVolume, raiseVolume,
{ description = "Raise volume", group = "media control" }),
hotkey.make(keys.lowerVolume, lowerVolume,
{ description = "Lower volume", group = "media control" }),
hotkey.make(keys.toggleMute, toggleMute,
{ description = "Toggle mute audio", group = "media control" }),
-- Media control
hotkey.make(keys.playPause, playPause,
{ description = "Toggle Play / Pause", group = "media control" }),
hotkey.make(keys.nextTrack, nextTrack,
{ description = "Next track", group = "media control" }),
hotkey.make(keys.previousTrack, previousTrack,
{ description = "Previous track", group = "media control" }),
-- Backlight control
hotkey.make(keys.brightnessUp, increaseBrightness,
{ description = "Increase screen backlight brightness", group = "media control" }),
hotkey.make(keys.brightnessDown, decreaseBrightness,
{ description = "Decrease screen backlight brightness", group = "media control" })
end
return {
getKeys = getKeys,
}

133
simple/tiling.lua Normal file
View File

@ -0,0 +1,133 @@
-- Offers window tiling functionnality
local awful = require("awful")
local grect = require("gears.geometry").rectangle
-- Placements
local leftTileGeometry = awful.placement.scale
+ awful.placement.left
+ awful.placement['maximize_vertically']
local rightTileGeometry = awful.placement.scale
+ awful.placement.right
+ awful.placement['maximize_vertically']
local maximizedTileGeometry = awful.placement.scale
+ awful.placement['maximize']
-- Check if geometries are the same
local geometryEquals = function(geo1, geo2)
return geo1.width == geo2.width and geo1.height == geo2.height and
geo1.x == geo2.x and geo1.y == geo2.y
end
-- Try to apply a tile placement to a client
-- return false if it changed nothing
local applyTile = function(c, geometry)
local initialGeometry = {
x = c.x,
y = c.y,
width = c.width,
height = c.height
}
local newGeometry = geometry(c, {honor_workarea=true, to_percent = 0.5})
return not geometryEquals(initialGeometry, newGeometry)
end
local screenLeft = function(geo)
return function (c)
local newScreen = c.screen.get_next_in_direction(c.screen, "left")
if newScreen ~= nil then
c.screen = newScreen
applyTile(c, geo)
end
end
end
local screenRight = function(geo)
return function (c)
local newScreen = c.screen.get_next_in_direction(c.screen, "right")
if newScreen ~= nil then
c.screen = newScreen
applyTile(c, geo)
end
end
end
local swapClient = function(c, dir)
local sel = c or capi.client.focus
if sel then
local cltbl = sel.screen.tiled_clients
local geomtbl = {}
for i,cl in ipairs(cltbl) do
if not cl.maximized then
geomtbl[i] = cl:geometry()
end
end
local target = grect.get_in_direction(dir, geomtbl, sel:geometry())
-- If we found a client to swap with, then go for it
if target then
cltbl[target]:swap(sel)
return true
end
end
return false
end
client.connect_signal("manage", function (c)
if awesome.startup
and not c.size_hints.user_position
and not c.size_hints.program_position then
-- Prevent clients from being unreachable after screen count changes.
awful.placement.no_offscreen(c)
end
if c.maximized then
applyTile(c, maximizedTileGeometry)
end
end)
return {
key = {
tileRight = function (c)
if c.maximized then
c:raise()
if not applyTile(c, rightTileGeometry) then
screenRight(leftTileGeometry)(c)
end
else
swapClient(c, 'right')
end
end,
tileLeft = function (c)
if c.maximized then
c:raise()
if not applyTile(c, leftTileGeometry) then
screenLeft(rightTileGeometry)(c)
end
else
swapClient(c, 'left')
end
end,
screenLeft = screenLeft(maximizedTileGeometry),
screenRight = screenRight(maximizedTileGeometry),
toggleMaximized = function (c)
if not c.maximized then
if not swapClient(c, 'up') then
c.maximized = true
c:raise()
end
else
if not applyTile(c, maximizedTileGeometry) then
c.maximized = false
end
end
end,
minimize = function(c)
if c.maximized or not swapClient(c, 'down') then
c.minimized = true
end
end
}
}

47
simple/titlebar.lua Normal file
View File

@ -0,0 +1,47 @@
local awful = require('awful')
local beautiful = require('beautiful')
local wibox = require('wibox')
function button(c, image, hover_bg_color)
local background = wibox.container.background(image)
background:connect_signal('mouse::enter', function()
background.bg = hover_bg_color
end)
background:connect_signal('mouse::leave', function()
background.bg = nil
end)
return background
end
function closebutton(c)
return button(c, awful.titlebar.widget.closebutton(c), beautiful.titlebar_close_button_hover_bg_color)
end
function maximizedbutton(c)
return button(c, awful.titlebar.widget.maximizedbutton(c), beautiful.titlebar_maximized_button_hover_bg_color)
end
function minimizebutton(c)
return button(c, awful.titlebar.widget.minimizebutton(c), beautiful.titlebar_minimize_button_hover_bg_color)
end
function ontopbutton(c)
return button(c, awful.titlebar.widget.ontopbutton(c), beautiful.titlebar_ontop_button_hover_bg_color)
end
function floatingbutton(c)
return button(c, awful.titlebar.widget.floatingbutton(c), beautiful.titlebar_floating_button_hover_bg_color)
end
return {
widget = {
closebutton = closebutton,
maximizedbutton = maximizedbutton,
minimizebutton = minimizebutton,
ontopbutton = ontopbutton,
floatingbutton = floatingbutton,
}
}

View File

@ -0,0 +1,26 @@
local awful = require("awful")
local hotkey = require("simple/core/hotkey")
local config = require("config")
local widget = awful.widget.keyboardlayout()
local layouts = config.widgets.keyboard_layout.layouts
local current_layout_index = 1
function switchLayout()
current_layout_index = (current_layout_index % #(layouts)) + 1
os.execute(config.widgets.keyboard_layout.layout_switch_command .. " \"" .. layouts[current_layout_index] .. "\"")
end
return {
widget = widget,
switch = switchLayout,
getKeys = function(config)
return hotkey.make(config.switch, switchLayout,
{ description = "switch keyboard layout" }),
hotkey.make(config.switch_alt, switchLayout,
{ description = "switch keyboard layout (alternative)" })
end
}

View File

@ -0,0 +1,244 @@
local awful = require("awful")
local beautiful = require("beautiful")
local gears = require("gears")
local naughty = require("naughty")
local wibox = require("wibox")
local config = require("config").widgets.system_resources
local inspect = require("simple/debug/inspect")
local bar = {
{
{
max_value = 1,
value = 0,
widget = wibox.widget.progressbar,
color = beautiful.system_resources_widget_bar_color,
background_color = beautiful.system_resources_widget_bar_bg,
shape = beautiful.system_resources_widget_bar_shape,
border_color = beautiful.system_resources_widget_border_color,
border_width = beautiful.system_resources_widget_border_width,
},
forced_width = beautiful.system_resources_widget_bar_width,
direction = "east",
layout = wibox.container.rotate,
},
margins = beautiful.system_resources_widget_bar_margin,
widget = wibox.container.margin,
}
local bars = wibox.widget {
bar,
bar,
bar,
layout = wibox.layout.flex.horizontal
}
function fileExists(name)
local f = io.open(name, "r")
if f ~= nil then
io.close(f)
return true
end
return false
end
function readCommand(command)
local handle = io.popen(command, "r")
local r = handle:read("*a")
handle:close()
return r
end
function readFile(file)
local handle = io.open(file, "r")
local r = handle:read("*a")
handle:close()
return r
end
local cpuBar = bars:get_children()[1]:get_children()[1]:get_children()[1]
function getCpuData()
local raw = readCommand("cat /proc/stat | head -n 1")
local data = {raw:match((raw:gsub("[^ ]* ", "([^ ]*) ")))}
return {
user = data[3],
nice = data[4],
system = data[5],
idle = data[6],
iowait = data[7],
irq = data[8],
softirq = data[9],
steal = data[10],
}
end
local lastCpuTime = -1
local lastCpuIdle = -1
gears.timer {
timeout = config.bars.refresh_interval,
call_now = true,
autostart = true,
callback = function()
local data = getCpuData()
local currentCpuTime = data.user + data.nice + data.system + data.idle + data.iowait + data.irq + data.softirq + data.steal
local currentCpuIdle = data.idle + data.iowait
if(lastCpuTime >= 0) then
cpuBar.value = 1 - (currentCpuIdle - lastCpuIdle) / (currentCpuTime - lastCpuTime)
end
lastCpuTime = currentCpuTime
lastCpuIdle = currentCpuIdle
end
}
local memoryBar = bars:get_children()[2]:get_children()[1]:get_children()[1]
function getTotalMemory()
return readCommand("cat /proc/meminfo | grep MemTotal | awk '{print $2}'")
end
function getAvailableMemory()
return readCommand("cat /proc/meminfo | grep MemAvailable | awk '{print $2}'")
end
function getFreeMemory()
return readCommand("cat /proc/meminfo | grep MemFree | awk '{print $2}'")
end
gears.timer {
timeout = config.bars.refresh_interval,
call_now = true,
autostart = true,
callback = function()
memoryBar.value = 1 - getAvailableMemory() / getTotalMemory()
end
}
local swapBar = bars:get_children()[3]:get_children()[1]:get_children()[1]
function getTotalSwap()
return readCommand("cat /proc/meminfo | grep SwapTotal | awk '{print $2}'")
end
function getFreeSwap()
return readCommand("cat /proc/meminfo | grep SwapFree | awk '{print $2}'")
end
gears.timer {
timeout = config.bars.refresh_interval,
call_now = true,
autostart = true,
callback = function()
swapBar.value = 1 - getFreeSwap() / getTotalSwap()
end
}
---
--- Batteries
---
rawBatteries = {}
function refreshRawBatteries()
rawBatteries = readCommand("ls -A1 /sys/class/power_supply")
end
function getBatteryLevel(battery)
local charge = 0
local capacity = 0
if fileExists(battery .. "/energy_now") then
charge = charge + readFile(battery .. "/energy_now")
capacity = capacity + readFile(battery .. "/energy_full")
elseif fileExists(battery .. "/charge_now") then
charge = charge + readFile(battery .. "/charge_now")
capacity = capacity + readFile(battery .. "/charge_full")
elseif fileExists(battery .. "/capacity_level") then
return readFile(battery .. "/capacity_level")
else
return "Unsupported"
end
return string.format("%." .. config.battery.precision .. "f", (charge / capacity) * 100) .. "%"
end
function isCharging(battery)
return readFile(battery .. "/status") == "Charging\n"
end
local batteryContainer = wibox.widget {
layout = wibox.layout.fixed.horizontal
}
local timers = {}
function refreshBatteries()
-- refresh raw batteries and check for change
local oldBatteries = rawBatteries
refreshRawBatteries()
if rawBatteries == oldBatteries then
return
end
-- clear timers
for i,v in ipairs(timers) do
v:stop()
end
timers = {};
-- clear layout
batteryContainer:set_children({})
for battery in rawBatteries:gmatch("([^\n]+)") do
local path = "/sys/class/power_supply/" .. battery
if readFile(path .. "/type"):match("Battery") then
-- widget
local widget = wibox.widget {
{
markup = "-- %",
align = "center",
valign = "center",
widget = wibox.widget.textbox,
},
margins = beautiful.system_resources_widget_battery_margin,
widget = wibox.container.margin,
}
-- tooltip
local name = readFile(path .. "/model_name")
local tooltip = awful.tooltip {
text = name
}
tooltip:add_to_object(widget)
-- update battery level
local batteryText = widget:get_children()[1]
local timer = gears.timer {
timeout = config.battery.refresh_interval,
call_now = true,
autostart = true,
callback = function()
batteryText.markup = (isCharging(path) and "+" or "") .. getBatteryLevel(path)
end
}
table.insert(timers, timer)
batteryContainer:add(widget)
end
end
end
gears.timer {
timeout = config.battery.list_refresh_interval,
call_now = true,
autostart = true,
callback = function()
refreshBatteries()
end
}
return {
bars = bars,
battery = batteryContainer,
}

144
theme.lua
View File

@ -1,145 +1,3 @@
---------------------------
-- Default awesome theme --
---------------------------
local naughty = require("naughty")
local gears = require("gears")
local theme_assets = require("beautiful.theme_assets")
local xresources = require("beautiful.xresources")
local dpi = xresources.apply_dpi
local gfs = require("gears.filesystem")
local themes_path = gfs.get_themes_dir()
local theme = {}
theme.font = "sans 12"
theme.bg_normal = "#2c2e35"
theme.bg_focus = "#34373f"
theme.bg_urgent = "#bf221c"
theme.bg_minimize = "#5f4b66"
theme.bg_systray = theme.bg_normal
theme.fg_normal = "#aaaaaa"
theme.fg_focus = "#ffffff"
theme.fg_urgent = "#ffffff"
theme.fg_minimize = "#ffffff"
theme.useless_gap = dpi(0)
theme.border_width = dpi(1)
theme.border_normal = "#222222"
theme.border_focus = "#535d6c"
theme.border_marked = "#91231c"
naughty.config.defaults.position = "top_middle"
naughty.config.presets.critical.bg = "#e82922"
theme.notification_shape = function(cr, width, height)
return gears.shape.rounded_rect(cr, width, height, 3)
end
theme.notification_margin = dpi(8)
theme.notification_width = dpi(512)
theme.notification_border_color = theme.border_focus
theme.notification_bg = theme.bg_focus
theme.notification_fg = theme.fg_focus
-- There are other variable sets
-- overriding the default one when
-- defined, the sets are:
-- taglist_[bg|fg]_[focus|urgent|occupied|empty|volatile]
-- tasklist_[bg|fg]_[focus|urgent]
-- titlebar_[bg|fg]_[normal|focus]
-- tooltip_[font|opacity|fg_color|bg_color|border_width|border_color]
-- mouse_finder_[color|timeout|animate_timeout|radius|factor]
-- prompt_[fg|bg|fg_cursor|bg_cursor|font]
-- hotkeys_[bg|fg|border_width|border_color|shape|opacity|modifiers_fg|label_bg|label_fg|group_margin|font|description_font]
-- Example:
--theme.taglist_bg_focus = "#ff0000"
-- Generate taglist squares:
local taglist_square_size = dpi(8)
theme.taglist_squares_sel = theme_assets.taglist_squares_sel(
taglist_square_size, theme.fg_normal
)
theme.taglist_squares_unsel = theme_assets.taglist_squares_unsel(
taglist_square_size, theme.fg_normal
)
-- Variables set for theming notifications:
-- notification_font
-- notification_[bg|fg]
-- notification_[width|height|margin]
-- notification_[border_color|border_width|shape|opacity]
-- Variables set for theming the menu:
-- menu_[bg|fg]_[normal|focus]
-- menu_[border_color|border_width]
theme.menu_submenu_icon = themes_path.."default/submenu.png"
theme.menu_height = dpi(32)
theme.menu_width = dpi(256)
-- You can add as many variables as
-- you wish and access them by using
-- beautiful.variable in your rc.lua
--theme.bg_widget = "#cc0000"
-- Define the image to load
theme.titlebar_close_button_normal = themes_path.."default/titlebar/close_normal.png"
theme.titlebar_close_button_focus = themes_path.."default/titlebar/close_focus.png"
theme.titlebar_minimize_button_normal = themes_path.."default/titlebar/minimize_normal.png"
theme.titlebar_minimize_button_focus = themes_path.."default/titlebar/minimize_focus.png"
theme.titlebar_ontop_button_normal_inactive = themes_path.."default/titlebar/ontop_normal_inactive.png"
theme.titlebar_ontop_button_focus_inactive = themes_path.."default/titlebar/ontop_focus_inactive.png"
theme.titlebar_ontop_button_normal_active = themes_path.."default/titlebar/ontop_normal_active.png"
theme.titlebar_ontop_button_focus_active = themes_path.."default/titlebar/ontop_focus_active.png"
theme.titlebar_sticky_button_normal_inactive = themes_path.."default/titlebar/sticky_normal_inactive.png"
theme.titlebar_sticky_button_focus_inactive = themes_path.."default/titlebar/sticky_focus_inactive.png"
theme.titlebar_sticky_button_normal_active = themes_path.."default/titlebar/sticky_normal_active.png"
theme.titlebar_sticky_button_focus_active = themes_path.."default/titlebar/sticky_focus_active.png"
theme.titlebar_floating_button_normal_inactive = themes_path.."default/titlebar/floating_normal_inactive.png"
theme.titlebar_floating_button_focus_inactive = themes_path.."default/titlebar/floating_focus_inactive.png"
theme.titlebar_floating_button_normal_active = themes_path.."default/titlebar/floating_normal_active.png"
theme.titlebar_floating_button_focus_active = themes_path.."default/titlebar/floating_focus_active.png"
theme.titlebar_maximized_button_normal_inactive = themes_path.."default/titlebar/maximized_normal_inactive.png"
theme.titlebar_maximized_button_focus_inactive = themes_path.."default/titlebar/maximized_focus_inactive.png"
theme.titlebar_maximized_button_normal_active = themes_path.."default/titlebar/maximized_normal_active.png"
theme.titlebar_maximized_button_focus_active = themes_path.."default/titlebar/maximized_focus_active.png"
theme.wallpaper = themes_path.."default/background.png"
-- You can use your own layout icons like this:
theme.layout_fairh = themes_path.."default/layouts/fairhw.png"
theme.layout_fairv = themes_path.."default/layouts/fairvw.png"
theme.layout_floating = themes_path.."default/layouts/floatingw.png"
theme.layout_magnifier = themes_path.."default/layouts/magnifierw.png"
theme.layout_max = themes_path.."default/layouts/maxw.png"
theme.layout_fullscreen = themes_path.."default/layouts/fullscreenw.png"
theme.layout_tilebottom = themes_path.."default/layouts/tilebottomw.png"
theme.layout_tileleft = themes_path.."default/layouts/tileleftw.png"
theme.layout_tile = themes_path.."default/layouts/tilew.png"
theme.layout_tiletop = themes_path.."default/layouts/tiletopw.png"
theme.layout_spiral = themes_path.."default/layouts/spiralw.png"
theme.layout_dwindle = themes_path.."default/layouts/dwindlew.png"
theme.layout_cornernw = themes_path.."default/layouts/cornernww.png"
theme.layout_cornerne = themes_path.."default/layouts/cornernew.png"
theme.layout_cornersw = themes_path.."default/layouts/cornersww.png"
theme.layout_cornerse = themes_path.."default/layouts/cornersew.png"
-- Generate Awesome icon:
theme.awesome_icon = theme_assets.awesome_icon(
theme.menu_height, theme.bg_focus, theme.fg_focus
)
-- Define the icon theme for application icons. If not set then the icons
-- from /usr/share/icons and /usr/share/icons/hicolor will be used.
theme.icon_theme = nil
local theme = require("default_theme")
return theme
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80