-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathdesktop-user-config.yml
182 lines (168 loc) · 6.23 KB
/
desktop-user-config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# This role manages configuration that differs across my accounts
# or is otherwise infeasible to track as part of my [dotfiles repository]
# (https://github.com/jan-warchol/dotfiles). For example:
#
# * I need different ssh config for personal and work accounts,
#
# * I may want to ensure that some specific host fingerprints are present
# in my `known_hosts` file, but it would not make sense to track the whole
# file in git, as I don't care much about most of its contents,
#
# * Some desktop environment settings are stored in binary files - it doesn't
# make sense to track these files, but rather track the commands that produce
# the effects I want (e.g. `gsetttings set org.gnome.foo bar`).
#
# * Some settings are too casual to keep them in version control (for example
# file manager bookmarks), but I still don't want to loose them accidentally.
# In such cases I move them to my private data directory so that they are
# backed up (I don't backup my whole HOME dir because there's too much stuff
# there, like git repositories, large binary files etc.) and set up symlinks
# to their original locations.
- name: Configuration related to graphical desktop
hosts: all
vars:
# user directories (relative to $HOME)
xdg_documents_dir: data
xdg_music_dir: multimedia/muzyka
xdg_pictures_dir: multimedia/obrazy
xdg_videos_dir: multimedia/filmy
tasks:
# https://askubuntu.com/questions/1083913/what-does-ctrl-shift-e-do-while-typing-text
- name: disable ubuntu emoji keyboard shortcut
gsetting:
settings:
org.freedesktop.ibus.panel.emoji.hotkey: "['']"
- name: ensure directories exist
file:
path: "{{ ansible_env.HOME }}/.config/systemd/user/"
state: directory
- name: configure redshift service
copy:
content: |
[Unit]
Description=Redshift
[Service]
ExecStart=/usr/bin/redshift -c {{ ansible_env.HOME }}/.config/redshift/redshift.conf
[Install]
WantedBy=default.target
dest: "{{ ansible_env.HOME }}/.config/systemd/user/redshift.service"
- name: manage redshift service
systemd:
daemon_reload: yes
name: redshift
enabled: yes
state: started
scope: user
- name: create XDG and other directories
file:
path: "{{ ansible_env.HOME }}/{{ item }}"
state: directory
with_items:
- "{{ xdg_documents_dir }}"
- "{{ xdg_music_dir }}"
- "{{ xdg_pictures_dir }}"
- "{{ xdg_videos_dir }}"
- zasoby
- bin
- data
- multimedia
- multimedia/obrazy
- multimedia/filmy
- multimedia/muzyka
- multimedia/zdjęcia
- inbox
- src
- tmp
- name: update user-dirs.dirs
copy:
content: |
# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
#
XDG_DESKTOP_DIR="$HOME/"
XDG_DOWNLOAD_DIR="$HOME/inbox"
XDG_TEMPLATES_DIR="$HOME/"
XDG_PUBLICSHARE_DIR="$HOME/"
XDG_DOCUMENTS_DIR="$HOME/{{xdg_documents_dir}}"
XDG_MUSIC_DIR="$HOME/{{xdg_music_dir}}"
XDG_PICTURES_DIR="$HOME/{{xdg_pictures_dir}}"
XDG_VIDEOS_DIR="$HOME/{{xdg_videos_dir}}"
dest: ~/.config/user-dirs.dirs
- name: update file manager bookmarks
copy:
content: |
file://{{ ansible_env.HOME }}/{{ xdg_documents_dir }} Data
file://{{ ansible_env.HOME }}/{{ xdg_music_dir }} Muzyka
file://{{ ansible_env.HOME }}/{{ xdg_pictures_dir }} Obrazy
file://{{ ansible_env.HOME }}/{{ xdg_videos_dir }} Filmy
file://{{ ansible_env.HOME }}/inbox Inbox
file://{{ ansible_env.HOME }}/src/ansible-setup ansible-setup
file://{{ ansible_env.HOME }}/src/code-samples code-samples
file://{{ ansible_env.HOME }}/src/selenized selenized
file://{{ ansible_env.HOME }}/src/limestone-colors limestone
file://{{ ansible_env.HOME }}/src/organizer2 organizer2
file://{{ ansible_env.HOME }}/src/przepisy-programisty przepisy
dest: ~/.config/gtk-3.0/bookmarks
force: no
- name: remove default XDG directories
# cannot use file module because I want to delete only empty directories
shell: >
rmdir {{ item }}
args:
chdir: "{{ ansible_env.HOME }}"
warn: False
register: task_result
changed_when: task_result.stderr == ''
failed_when: '"Directory not empty" in task_result.stderr'
loop:
- Desktop
- Documents
- Downloads
- Music
- Pictures
- Public
- Templates
- Videos
- Pulpit
- Dokumenty
- Pobrane
- Muzyka
- Obrazy
- Publiczne
- Szablony
- Wideo
# I prefer to keep installed fonts in another location
- name: update fonts directory location
shell: >
if [ -d ~/.fonts ]; then
mv -n ~/.fonts ~/zasoby/czcionki
else
mkdir ~/zasoby/czcionki
fi
creates=~/zasoby/czcionki
- name: create link to ~/.fonts
file:
src: ~/zasoby/czcionki
dest: ~/.fonts
state: link
force: no
- name: create desktop entry for GoLand
copy:
content: |
[Desktop Entry]
Version=1.0
Type=Application
Name=GoLand
Icon={{ ansible_env.HOME }}/bin/GoLand-2022.2.2/bin/goland.svg
Exec="{{ ansible_env.HOME }}/bin/GoLand-2022.2.2/bin/goland.sh" %f
Comment=A cross-platform Go IDE with extended support for JavaScript, TypeScript, and databases
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-goland
StartupNotify=true
OnlyShowIn=Old;
dest: "{{ ansible_env.HOME }}/.gnome/apps/jetbrains-goland.desktop"