mirror of
https://github.com/roles-ansible/ansible_role_i3wm.git
synced 2024-08-16 10:09:53 +02:00
Improve i3wm role wit multiuser support
+ adding rofi themes + customize i3bar + multiuser support + cleanup
This commit is contained in:
parent
e730e862a9
commit
761d8e1268
12 changed files with 553 additions and 86 deletions
28
README.md
28
README.md
|
@ -9,12 +9,9 @@ Install and deploy a basic configuration of [I3 Window Manager](https://i3wm.org
|
||||||
Optionally configure your resolution, which applications will be bound to which screen and what will be included in the autostart.<br/>
|
Optionally configure your resolution, which applications will be bound to which screen and what will be included in the autostart.<br/>
|
||||||
If you want to use wayland instead of xorg, think about using [sway](https://swaywm.org/) as window manager. The corresponding ansible is located on [github.com/roles-ansible/role-sway](https://github.com/roles-ansible/role-sway.git).
|
If you want to use wayland instead of xorg, think about using [sway](https://swaywm.org/) as window manager. The corresponding ansible is located on [github.com/roles-ansible/role-sway](https://github.com/roles-ansible/role-sway.git).
|
||||||
|
|
||||||
[![MIT License](https://raw.githubusercontent.com/chaos-bodensee/role-i3wm/master/.github/license.svg?sanitize=true)](https://github.com/chaos-bodensee/role-i3wm/blob/master/LICENSE)
|
|
||||||
[![MIT License](https://raw.githubusercontent.com/chaos-bodensee/role-i3wm/master/.github/galaxy.svg?sanitize=true)](https://galaxy.ansible.com/do1jlr/i3wm)
|
|
||||||
|
|
||||||
### Get it directly from Ansible Galaxy
|
### Get it directly from Ansible Galaxy
|
||||||
```bash
|
```bash
|
||||||
$ ansible-galaxy install do1jlr.i3wm
|
$ ansible-galaxy install l3d.i3wm
|
||||||
```
|
```
|
||||||
|
|
||||||
Role Variables
|
Role Variables
|
||||||
|
@ -22,22 +19,23 @@ $ ansible-galaxy install do1jlr.i3wm
|
||||||
|
|
||||||
For a good overview about possible variables, please have a look into ``defaults/main.yml``.
|
For a good overview about possible variables, please have a look into ``defaults/main.yml``.
|
||||||
|
|
||||||
Example Playbook
|
## Example Usage
|
||||||
----------------
|
|
||||||
|
|
||||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: install i3wm on localhost
|
- name: install i3wm on localhost
|
||||||
hosts: localhost
|
hosts: localhost
|
||||||
vars_files:
|
vars_files:
|
||||||
- vars/main.yml
|
- vars/main.yml
|
||||||
roles:
|
roles:
|
||||||
- {role: do1jlr.i3wm, tags[i3,i3wm]}
|
- {role: l3d.i3wm, tags[i3, i3wm]}
|
||||||
```
|
```
|
||||||
*`vars/main.yml`*
|
*`vars/main.yml`*
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
# User List for i3wm config
|
||||||
|
i3wm_user_list:
|
||||||
|
- 'alice'
|
||||||
|
- 'bob'
|
||||||
|
|
||||||
# background image
|
# background image
|
||||||
i3_desktop_background: "~/Bilder/wallpaper.jpg"
|
i3_desktop_background: "~/Bilder/wallpaper.jpg"
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,8 @@ i3_keybindings_extra: []
|
||||||
# key: $mod+Shift+F10
|
# key: $mod+Shift+F10
|
||||||
# exec: --no-startup-id touch /tmp/example.txt
|
# exec: --no-startup-id touch /tmp/example.txt
|
||||||
|
|
||||||
i3_monitors: [] # see: xrandr
|
i3_monitors: []
|
||||||
|
# see: xrandr
|
||||||
# - monitor:
|
# - monitor:
|
||||||
# id: 1
|
# id: 1
|
||||||
# output: "VGA-1"
|
# output: "VGA-1"
|
||||||
|
@ -27,18 +28,32 @@ i3_run_on_startup: []
|
||||||
# - foo
|
# - foo
|
||||||
# - bar
|
# - bar
|
||||||
|
|
||||||
# which user are we?
|
# deploy config to these users:
|
||||||
i3wm_user: "{{ ansible_user_id }}"
|
i3wm_user_list:
|
||||||
|
- user: "{{ ansible_user_id }}"
|
||||||
|
home: "{{ ansible_env.HOME | default('/home/{{ ansible_user_id }}') }}"
|
||||||
|
|
||||||
## set default font size
|
## set default font size
|
||||||
i3_font_size: 9
|
i3_font_size: 10
|
||||||
i3_focus_follows_mouse: true
|
i3_focus_follows_mouse: true
|
||||||
|
|
||||||
# set i3lock options
|
# set i3lock options
|
||||||
i3lock_options: "i3lock --image=/home/{{ i3wm_user }}/.config/lockscreen.png --color 000000"
|
i3lock_options: "i3lock --image={{ i3wm_usr.home }}/.config/lockscreen.png --color 000000"
|
||||||
|
|
||||||
# use fancy background
|
# use fancy background
|
||||||
i3_desktop_background: "/home/{{ i3wm_user }}/.config/background.png"
|
i3_desktop_background: "{{ i3wm_usr.home }}/.config/background.png"
|
||||||
|
|
||||||
|
# i3blocks options
|
||||||
|
i3_i3blocks_options:
|
||||||
|
weather: true
|
||||||
|
audio_volume: true
|
||||||
|
wifisignal: true
|
||||||
|
ipaddress: true
|
||||||
|
clock: true
|
||||||
|
battery: true
|
||||||
|
ddate: true
|
||||||
|
|
||||||
|
i3_rofi_config_file: 'files/rofi/dracula_dark.rasi'
|
||||||
|
|
||||||
i3_terminal: "terminator"
|
i3_terminal: "terminator"
|
||||||
|
|
||||||
|
@ -50,7 +65,7 @@ i3wm_copy_wallpapers: true
|
||||||
|
|
||||||
disable_screensaver: true
|
disable_screensaver: true
|
||||||
enable_lock_after_time: false
|
enable_lock_after_time: false
|
||||||
lock_after_time: '200' # minutes to wait until your screen is locked
|
lock_after_time: '90' # minutes to wait until your screen is locked
|
||||||
|
|
||||||
# version check for this role?
|
# version check for this role?
|
||||||
submodules_versioncheck: true
|
submodules_versioncheck: true
|
||||||
|
|
84
files/i3blocks/battery.py
Normal file
84
files/i3blocks/battery.py
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
battery for i3blocks
|
||||||
|
"""
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
def get_battery_info():
|
||||||
|
status = subprocess.check_output(['acpi'], universal_newlines=True)
|
||||||
|
|
||||||
|
if not status:
|
||||||
|
# -> keine Batterie gefunden
|
||||||
|
text_output = "<span color='red'><span font='FontAwesome'>\uf00d \uf240</span></span>"
|
||||||
|
battery_percent = 100
|
||||||
|
else:
|
||||||
|
# -> auswertung der batteriedaten
|
||||||
|
batteries = status.strip().split("\n")
|
||||||
|
state_batteries = []
|
||||||
|
battery_percent_batteries = []
|
||||||
|
|
||||||
|
for battery in batteries:
|
||||||
|
if battery:
|
||||||
|
state_batteries.append(battery.split(": ")[1].split(", ")[0])
|
||||||
|
commasplitstatus = battery.split(", ")
|
||||||
|
battery_percent_batteries.append(int(commasplitstatus[1].rstrip("%\n")))
|
||||||
|
|
||||||
|
state = state_batteries[0]
|
||||||
|
battery_percent = int(sum(battery_percent_batteries) / len(battery_percent_batteries))
|
||||||
|
|
||||||
|
# stands for charging
|
||||||
|
fa_lightning = "<span color='yellow'><span font='FontAwesome'>\uf0e7</span></span>"
|
||||||
|
|
||||||
|
# stands for plugged in
|
||||||
|
fa_plug = "<span font='FontAwesome'>\uf1e6</span>"
|
||||||
|
|
||||||
|
text_output = ""
|
||||||
|
battery_remaining_time = ""
|
||||||
|
|
||||||
|
if state == "Discharging":
|
||||||
|
battery_time = batteries[0].split()[-2]
|
||||||
|
battery_remaining_time = f" ({battery_time})"
|
||||||
|
elif state == "Full":
|
||||||
|
text_output = fa_plug + " "
|
||||||
|
elif state == "Unknown":
|
||||||
|
text_output = "<span font='FontAwesome'>\uf128</span> "
|
||||||
|
else:
|
||||||
|
text_output = fa_lightning + " " + fa_plug + " "
|
||||||
|
|
||||||
|
def get_color(percent):
|
||||||
|
"""
|
||||||
|
-> color based on battery state
|
||||||
|
"""
|
||||||
|
color_mapping = {
|
||||||
|
16: "#FFFFFF",
|
||||||
|
24: "#FF3300",
|
||||||
|
32: "#FF6600",
|
||||||
|
40: "#FF9900",
|
||||||
|
50: "#FFCC00",
|
||||||
|
60: "#FFFF00",
|
||||||
|
70: "#FFFF33",
|
||||||
|
80: "#FFFF66"
|
||||||
|
}
|
||||||
|
|
||||||
|
for threshold, color_code in color_mapping.items():
|
||||||
|
if percent < threshold:
|
||||||
|
return color_code
|
||||||
|
|
||||||
|
return "#FFFFFF"
|
||||||
|
|
||||||
|
battery_form_string = '<span color="{}">{}%</span>'
|
||||||
|
text_output += battery_form_string.format(get_color(battery_percent), battery_percent)
|
||||||
|
text_output += battery_remaining_time
|
||||||
|
|
||||||
|
return text_output
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
text_output = get_battery_info()
|
||||||
|
print(text_output)
|
||||||
|
print(text_output)
|
||||||
|
|
||||||
|
if "battery_percent" in locals() and battery_percent < 16:
|
||||||
|
sys.exit(33)
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
command=~/.config/i3blocks/$BLOCK_NAME
|
|
||||||
separator_block_width=15
|
|
||||||
markup=pango
|
|
||||||
|
|
||||||
[weather]
|
|
||||||
command=curl -Ss 'https://wttr.in?format="%l:+%c%t+%w"' | xargs echo
|
|
||||||
interval=600
|
|
||||||
color=#A4C2F4
|
|
||||||
|
|
||||||
[volume]
|
|
||||||
interval=30
|
|
||||||
signal=10
|
|
||||||
|
|
||||||
[wlan]
|
|
||||||
interval=1
|
|
||||||
signal=10
|
|
||||||
|
|
||||||
[ip]
|
|
||||||
command=hostname -i | awk '{ print " IPv4: " $1 }'
|
|
||||||
interval=120
|
|
||||||
label=🖥️
|
|
||||||
color=#91E78B
|
|
||||||
|
|
||||||
[clock]
|
|
||||||
label=🕒
|
|
||||||
command=date --iso-8601=seconds
|
|
||||||
interval=1
|
|
||||||
|
|
||||||
[ddate]
|
|
||||||
label=🚀
|
|
||||||
command=ddate +'%{%A, %d %B%}, %Y%N, Celebrate %H'
|
|
||||||
interval=120
|
|
133
files/rofi/dracula_dark.rasi
Normal file
133
files/rofi/dracula_dark.rasi
Normal file
|
@ -0,0 +1,133 @@
|
||||||
|
/*Dracula theme based on the Purple official rofi theme*/
|
||||||
|
|
||||||
|
* {
|
||||||
|
font: "Jetbrains Mono 12";
|
||||||
|
foreground: #f8f8f2;
|
||||||
|
background-color: #282a36;
|
||||||
|
active-background: #6272a4;
|
||||||
|
urgent-background: #ff5555;
|
||||||
|
urgent-foreground: #282a36;
|
||||||
|
selected-background: @active-background;
|
||||||
|
selected-urgent-background: @urgent-background;
|
||||||
|
selected-active-background: @active-background;
|
||||||
|
separatorcolor: @active-background;
|
||||||
|
bordercolor: @active-background;
|
||||||
|
}
|
||||||
|
|
||||||
|
configuration {
|
||||||
|
show-icons: true;
|
||||||
|
display-drun: "";
|
||||||
|
disable-history: false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#window {
|
||||||
|
background-color: @background-color;
|
||||||
|
border: 3;
|
||||||
|
border-radius: 6;
|
||||||
|
border-color: @bordercolor;
|
||||||
|
padding: 15;
|
||||||
|
}
|
||||||
|
#mainbox {
|
||||||
|
border: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
#message {
|
||||||
|
border: 0px;
|
||||||
|
border-color: @separatorcolor;
|
||||||
|
padding: 1px;
|
||||||
|
}
|
||||||
|
#textbox {
|
||||||
|
text-color: @foreground;
|
||||||
|
}
|
||||||
|
#listview {
|
||||||
|
fixed-height: 0;
|
||||||
|
border: 0px;
|
||||||
|
border-color: @bordercolor;
|
||||||
|
spacing: 2px ;
|
||||||
|
scrollbar: false;
|
||||||
|
padding: 2px 0px 0px ;
|
||||||
|
}
|
||||||
|
#element {
|
||||||
|
border: 0;
|
||||||
|
padding: 3px ;
|
||||||
|
}
|
||||||
|
#element.normal.normal {
|
||||||
|
background-color: @background-color;
|
||||||
|
text-color: @foreground;
|
||||||
|
}
|
||||||
|
#element.normal.urgent {
|
||||||
|
background-color: @urgent-background;
|
||||||
|
text-color: @urgent-foreground;
|
||||||
|
}
|
||||||
|
#element.normal.active {
|
||||||
|
background-color: @active-background;
|
||||||
|
text-color: @foreground;
|
||||||
|
}
|
||||||
|
#element.selected.normal {
|
||||||
|
background-color: @selected-background;
|
||||||
|
text-color: @foreground;
|
||||||
|
}
|
||||||
|
#element.selected.urgent {
|
||||||
|
background-color: @selected-urgent-background;
|
||||||
|
text-color: @foreground;
|
||||||
|
}
|
||||||
|
#element.selected.active {
|
||||||
|
background-color: @selected-active-background;
|
||||||
|
text-color: @foreground;
|
||||||
|
}
|
||||||
|
#element.alternate.normal {
|
||||||
|
background-color: @background-color;
|
||||||
|
text-color: @foreground;
|
||||||
|
}
|
||||||
|
#element.alternate.urgent {
|
||||||
|
background-color: @urgent-background;
|
||||||
|
text-color: @foreground;
|
||||||
|
}
|
||||||
|
#element.alternate.active {
|
||||||
|
background-color: @active-background;
|
||||||
|
text-color: @foreground;
|
||||||
|
}
|
||||||
|
#scrollbar {
|
||||||
|
width: 2px ;
|
||||||
|
border: 0;
|
||||||
|
handle-width: 8px ;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
#sidebar {
|
||||||
|
border: 2px dash 0px 0px ;
|
||||||
|
border-color: @separatorcolor;
|
||||||
|
}
|
||||||
|
#button.selected {
|
||||||
|
background-color: @selected-background;
|
||||||
|
text-color: @foreground;
|
||||||
|
}
|
||||||
|
#inputbar {
|
||||||
|
spacing: 0;
|
||||||
|
text-color: @foreground;
|
||||||
|
padding: 1px ;
|
||||||
|
}
|
||||||
|
#case-indicator {
|
||||||
|
spacing: 0;
|
||||||
|
text-color: @foreground;
|
||||||
|
}
|
||||||
|
#entry {
|
||||||
|
spacing: 0;
|
||||||
|
text-color: @foreground;
|
||||||
|
}
|
||||||
|
#prompt {
|
||||||
|
spacing: 0;
|
||||||
|
text-color: @foreground;
|
||||||
|
}
|
||||||
|
#inputbar {
|
||||||
|
children: [ prompt,textbox-prompt-colon,entry,case-indicator ];
|
||||||
|
}
|
||||||
|
#textbox-prompt-colon {
|
||||||
|
expand: false;
|
||||||
|
str: ">";
|
||||||
|
margin: 0px 0.3em 0em 0em ;
|
||||||
|
text-color: @foreground;
|
||||||
|
}
|
||||||
|
element-text, element-icon {
|
||||||
|
background-color: inherit;
|
||||||
|
text-color: inherit;
|
||||||
|
}
|
98
files/rofi/spotlight-dark.rasi
Normal file
98
files/rofi/spotlight-dark.rasi
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* MACOS SPOTLIGHT LIKE DARK THEME FOR ROFI
|
||||||
|
* User : LR-Tech
|
||||||
|
* Theme Repo : https://github.com/lr-tech/rofi-themes-collection
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
* {
|
||||||
|
font: "Montserrat 12";
|
||||||
|
|
||||||
|
bg0: #242424E6;
|
||||||
|
bg1: #7E7E7E80;
|
||||||
|
bg2: #0860f2E6;
|
||||||
|
|
||||||
|
fg0: #DEDEDE;
|
||||||
|
fg1: #FFFFFF;
|
||||||
|
fg2: #DEDEDE80;
|
||||||
|
|
||||||
|
background-color: transparent;
|
||||||
|
text-color: @fg0;
|
||||||
|
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
spacing: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
window {
|
||||||
|
background-color: @bg0;
|
||||||
|
|
||||||
|
location: center;
|
||||||
|
width: 640;
|
||||||
|
border-radius: 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
inputbar {
|
||||||
|
font: "Montserrat 20";
|
||||||
|
padding: 12px;
|
||||||
|
spacing: 12px;
|
||||||
|
children: [ icon-search, entry ];
|
||||||
|
}
|
||||||
|
|
||||||
|
icon-search {
|
||||||
|
expand: false;
|
||||||
|
filename: "search";
|
||||||
|
size: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
icon-search, entry, element-icon, element-text {
|
||||||
|
vertical-align: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
entry {
|
||||||
|
font: inherit;
|
||||||
|
|
||||||
|
placeholder : "Search";
|
||||||
|
placeholder-color : @fg2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message {
|
||||||
|
border: 2px 0 0;
|
||||||
|
border-color: @bg1;
|
||||||
|
background-color: @bg1;
|
||||||
|
}
|
||||||
|
|
||||||
|
textbox {
|
||||||
|
padding: 8px 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
listview {
|
||||||
|
lines: 10;
|
||||||
|
columns: 1;
|
||||||
|
|
||||||
|
fixed-height: false;
|
||||||
|
border: 1px 0 0;
|
||||||
|
border-color: @bg1;
|
||||||
|
}
|
||||||
|
|
||||||
|
element {
|
||||||
|
padding: 8px 16px;
|
||||||
|
spacing: 16px;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
element normal active {
|
||||||
|
text-color: @bg2;
|
||||||
|
}
|
||||||
|
|
||||||
|
element selected normal, element selected active {
|
||||||
|
background-color: @bg2;
|
||||||
|
text-color: @fg1;
|
||||||
|
}
|
||||||
|
|
||||||
|
element-icon {
|
||||||
|
size: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
element-text {
|
||||||
|
text-color: inherit;
|
||||||
|
}
|
98
files/rofi/spotlight.rasi
Normal file
98
files/rofi/spotlight.rasi
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* MACOS SPOTLIGHT LIKE THEME FOR ROFI
|
||||||
|
* User : LR-Tech
|
||||||
|
* Theme Repo : https://github.com/lr-tech/rofi-themes-collection
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
* {
|
||||||
|
font: "Montserrat 12";
|
||||||
|
|
||||||
|
bg0: #F5F5F5BF;
|
||||||
|
bg1: #7E7E7E80;
|
||||||
|
bg2: #0860F2E6;
|
||||||
|
|
||||||
|
fg0: #242424;
|
||||||
|
fg1: #FFFFFF;
|
||||||
|
fg2: #24242480;
|
||||||
|
|
||||||
|
background-color: transparent;
|
||||||
|
text-color: @fg0;
|
||||||
|
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
spacing: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
window {
|
||||||
|
background-color: @bg0;
|
||||||
|
|
||||||
|
location: center;
|
||||||
|
width: 640;
|
||||||
|
border-radius: 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
inputbar {
|
||||||
|
font: "Montserrat 20";
|
||||||
|
padding: 12px;
|
||||||
|
spacing: 12px;
|
||||||
|
children: [ icon-search, entry ];
|
||||||
|
}
|
||||||
|
|
||||||
|
icon-search {
|
||||||
|
expand: false;
|
||||||
|
filename: "search";
|
||||||
|
size: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
icon-search, entry, element-icon, element-text {
|
||||||
|
vertical-align: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
entry {
|
||||||
|
font: inherit;
|
||||||
|
|
||||||
|
placeholder : "Search";
|
||||||
|
placeholder-color : @fg2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message {
|
||||||
|
border: 2px 0 0;
|
||||||
|
border-color: @bg1;
|
||||||
|
background-color: @bg1;
|
||||||
|
}
|
||||||
|
|
||||||
|
textbox {
|
||||||
|
padding: 8px 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
listview {
|
||||||
|
lines: 10;
|
||||||
|
columns: 1;
|
||||||
|
|
||||||
|
fixed-height: false;
|
||||||
|
border: 1px 0 0;
|
||||||
|
border-color: @bg1;
|
||||||
|
}
|
||||||
|
|
||||||
|
element {
|
||||||
|
padding: 8px 16px;
|
||||||
|
spacing: 16px;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
element normal active {
|
||||||
|
text-color: @bg2;
|
||||||
|
}
|
||||||
|
|
||||||
|
element selected normal, element selected active {
|
||||||
|
background-color: @bg2;
|
||||||
|
text-color: @fg1;
|
||||||
|
}
|
||||||
|
|
||||||
|
element-icon {
|
||||||
|
size: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
element-text {
|
||||||
|
text-color: inherit;
|
||||||
|
}
|
|
@ -2,71 +2,89 @@
|
||||||
- name: Creates directory
|
- name: Creates directory
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: '/home/{{ i3wm_user }}/.config'
|
path: '{{ i3wm_usr.home }}/.config'
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0750
|
mode: 0750
|
||||||
owner: "{{ i3wm_user }}"
|
owner: "{{ i3wm_usr.user }}"
|
||||||
group: "{{ i3wm_user }}"
|
group: "{{ i3wm_usr.user }}"
|
||||||
|
|
||||||
- name: Create i3 config folder
|
- name: Create i3 config folder
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: '/home/{{ i3wm_user }}/.config/i3/'
|
path: '{{ i3wm_usr.home }}/.config/i3/'
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0755
|
mode: 0750
|
||||||
owner: "{{ i3wm_user }}"
|
owner: "{{ i3wm_usr.user }}"
|
||||||
group: "{{ i3wm_user }}"
|
group: "{{ i3wm_usr.user }}"
|
||||||
|
|
||||||
- name: Copy multiple images
|
- name: Copy multiple images
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: "{{ item.src }}"
|
src: "{{ item.src }}"
|
||||||
dest: "{{ item.dest }}"
|
dest: "{{ item.dest }}"
|
||||||
mode: 0644
|
mode: 0644
|
||||||
owner: "{{ i3wm_user }}"
|
owner: "{{ i3wm_usr.user }}"
|
||||||
group: "{{ i3wm_user }}"
|
group: "{{ i3wm_usr.user }}"
|
||||||
with_items:
|
with_items:
|
||||||
- { src: 'files/background.png', dest: "/home/{{ i3wm_user }}/.config/background.png" }
|
- { src: 'files/background.png', dest: "{{ i3wm_usr.home }}/.config/background.png" }
|
||||||
- { src: 'files/lockscreen.png', dest: '/home/{{ i3wm_user }}/.config/lockscreen.png' }
|
- { src: 'files/lockscreen.png', dest: '{{ i3wm_usr.home }}/.config/lockscreen.png' }
|
||||||
when: i3wm_copy_wallpapers | bool
|
when: i3wm_copy_wallpapers | bool
|
||||||
|
|
||||||
- name: Copy and validate i3wm config file
|
- name: Copy and validate i3wm config file
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: templates/config.j2
|
src: templates/config.j2
|
||||||
dest: "/home/{{ i3wm_user }}/.config/i3/config"
|
dest: "{{ i3wm_usr.home }}/.config/i3/config"
|
||||||
mode: 0600
|
mode: 0600
|
||||||
backup: true
|
backup: true
|
||||||
validate: i3 -C -c %s
|
validate: i3 -C -c %s
|
||||||
owner: "{{ i3wm_user }}"
|
owner: "{{ i3wm_usr.user }}"
|
||||||
group: "{{ i3wm_user }}"
|
group: "{{ i3wm_usr.user }}"
|
||||||
|
|
||||||
# todo: rewrite user stuff and support multiple users
|
- name: Create directory ~/.config/i3blocks/
|
||||||
- name: Mkdir ~/.config/i3blocks/
|
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "/home/{{ i3wm_user }}/.config/i3blocks/"
|
path: "{{ i3wm_usr.home }}/.config/i3blocks/"
|
||||||
state: directory
|
state: directory
|
||||||
mode: '0755'
|
mode: '0750'
|
||||||
owner: "{{ i3wm_user }}"
|
owner: "{{ i3wm_usr.user }}"
|
||||||
group: "{{ i3wm_user }}"
|
group: "{{ i3wm_usr.user }}"
|
||||||
|
|
||||||
- name: Copy i3blocks config
|
- name: Generate i3blocks config
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.copy:
|
ansible.builtin.template:
|
||||||
src: "files/i3blocks/config"
|
src: 'templates/i3blocks_config.j2'
|
||||||
dest: "/home/{{ i3wm_user }}/.config/i3blocks/config"
|
dest: "{{ i3wm_usr.home }}/.config/i3blocks/config"
|
||||||
mode: 0640
|
mode: 0640
|
||||||
owner: "{{ i3wm_user }}"
|
owner: "{{ i3wm_usr.user }}"
|
||||||
group: "{{ i3wm_user }}"
|
group: "{{ i3wm_usr.user }}"
|
||||||
|
|
||||||
- name: Copy i3blocks config
|
- name: Copy i3blocks config
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: "files/i3blocks/{{ item }}"
|
src: "files/i3blocks/{{ item }}"
|
||||||
dest: "/home/{{ i3wm_user }}/.config/i3blocks/{{ item }}"
|
dest: "{{ i3wm_usr.home }}/.config/i3blocks/{{ item }}"
|
||||||
mode: 0750
|
mode: 0750
|
||||||
owner: "{{ i3wm_user }}"
|
owner: "{{ i3wm_usr.user }}"
|
||||||
group: "{{ i3wm_user }}"
|
group: "{{ i3wm_usr.user }}"
|
||||||
with_items:
|
with_items:
|
||||||
- 'volume'
|
- 'volume.sh'
|
||||||
- 'wlan'
|
- 'wlan.sh'
|
||||||
|
- 'battery.py'
|
||||||
|
|
||||||
|
- name: Create rofi config folder
|
||||||
|
become: true
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: '{{ i3wm_usr.home }}/.config/rofi/'
|
||||||
|
state: directory
|
||||||
|
mode: 0750
|
||||||
|
owner: "{{ i3wm_usr.user }}"
|
||||||
|
group: "{{ i3wm_usr.user }}"
|
||||||
|
|
||||||
|
- name: Copy rofi config
|
||||||
|
become: true
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ i3_rofi_config_file }}"
|
||||||
|
dest: "{{ i3wm_usr.home }}/.config/rofi/config.rasi"
|
||||||
|
mode: 0640
|
||||||
|
owner: "{{ i3wm_usr.user }}"
|
||||||
|
group: "{{ i3wm_usr.user }}"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
- name: Run optional versionscheck
|
- name: Run optional versionscheck
|
||||||
ansible.builtin.include_tasks: versioncheck.yml
|
ansible.builtin.include_tasks: versioncheck.yml
|
||||||
when: submodules_versionchecki | bool
|
when: submodules_versioncheck | bool
|
||||||
|
|
||||||
- name: Register variables
|
- name: Register variables
|
||||||
ansible.builtin.import_tasks: variables.yml
|
ansible.builtin.import_tasks: variables.yml
|
||||||
|
@ -20,3 +20,6 @@
|
||||||
|
|
||||||
- name: Create i3 config file
|
- name: Create i3 config file
|
||||||
ansible.builtin.include_tasks: config.yml
|
ansible.builtin.include_tasks: config.yml
|
||||||
|
loop: "{{ i3wm_user_list | flatten(1) }}"
|
||||||
|
loop_control:
|
||||||
|
loop_var: i3wm_usr
|
||||||
|
|
52
templates/i3blocks_config.j2
Normal file
52
templates/i3blocks_config.j2
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
command=~/.config/i3blocks/$BLOCK_NAME
|
||||||
|
separator_block_width=18
|
||||||
|
markup=pango
|
||||||
|
|
||||||
|
{% if i3_i3blocks_options.weather | bool %}
|
||||||
|
[weather]
|
||||||
|
command=curl -Ss 'https://wttr.in?format="%l:+%c%t+%w"' | xargs echo
|
||||||
|
interval=600
|
||||||
|
color=#A4C2F4
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if i3_i3blocks_options.audio_volume | bool %}
|
||||||
|
[volume]
|
||||||
|
command={{ i3wm_usr.home }}/.config/i3blocks/volume.sh
|
||||||
|
interval=30
|
||||||
|
signal=10
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if i3_i3blocks_options.wifisignal | bool %}
|
||||||
|
[wlan]
|
||||||
|
command={{ i3wm_usr.home }}/.config/i3blocks/wlan.sh
|
||||||
|
interval=1
|
||||||
|
signal=10
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if i3_i3blocks_options.ipaddress | bool %}
|
||||||
|
[ip]
|
||||||
|
command=hostname -i | awk '{ print " IPv4: " $1 }'
|
||||||
|
interval=120
|
||||||
|
label=🖥️
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if i3_i3blocks_options.clock | bool %}
|
||||||
|
[clock]
|
||||||
|
command=date --rfc-3339=seconds
|
||||||
|
color=#88ff0a
|
||||||
|
interval=1
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if i3_i3blocks_options.battery | bool %}
|
||||||
|
[battery]
|
||||||
|
command={{ i3wm_usr.home }}/.config/i3blocks/battery.py
|
||||||
|
markup=pango
|
||||||
|
interval=30
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if i3_i3blocks_options.ddate | bool %}
|
||||||
|
[ddate]
|
||||||
|
label=🚀
|
||||||
|
command=ddate +'%A, %d %B, %Y%N, Celebrate %H'
|
||||||
|
interval=120
|
||||||
|
{% endif %}
|
Loading…
Reference in a new issue