Browse Source

vnc

pull/1/head
parent
commit
2dccd6776f
22 changed files with 166 additions and 28 deletions
  1. +20
    -1
      defaults/main.yaml
  2. BIN
      files/background/eso0932a.jpg
  3. +16
    -0
      files/bin/pipe-watcher
  4. +5
    -11
      files/bin/timer
  5. +7
    -0
      handlers/main.yaml
  6. +3
    -0
      tasks/git.yaml
  7. +3
    -0
      tasks/i3.yaml
  8. +11
    -0
      tasks/pulseaudio.yaml
  9. +5
    -0
      tasks/timer.yaml
  10. +12
    -0
      tasks/vnc.yaml
  11. +1
    -1
      tasks/workspaces.yaml
  12. +10
    -0
      templates/git/gitconfig.j2
  13. +17
    -3
      templates/i3/i3.config.j2
  14. +5
    -8
      templates/i3/i3blocks.config.j2
  15. +25
    -0
      templates/pulseaudio/default.pa.j2
  16. +1
    -0
      templates/vnc/config.j2
  17. +1
    -1
      templates/vnc/vnc.conf.j2
  18. +3
    -0
      templates/vnc/vncserver.env.j2
  19. +2
    -1
      templates/vnc/vncserver.service.j2
  20. +9
    -0
      templates/workspaces/workspace.focus.fish.j2
  21. +5
    -2
      templates/x11/xsession.reload.fish.j2
  22. +5
    -0
      vars/main.yaml

+ 20
- 1
defaults/main.yaml View File

@@ -16,6 +16,10 @@ home_vncserver_started_and_enabled: "{{ home_profile == 'vdesk' }}"
home_vncserver_display_number: 47
home_xsession_vncviewer: "{{ home_profile == 'vdesk' }}"

home_vncserver_allow_resize: true

home_vncserver_geometry: '1920x1200'

home_profile: desktop

default_terminal: urxvt
@@ -49,8 +53,8 @@ file_browser_command: thunar
calculator_command: "{{default_browser}} --new-window https://www.geogebra.org/calculator"
mail_command: thunderbird

background_image: false
home_copy_all_background_images: false
background_image: background/eso0932a.jpg

home_autostart_terminal: true
home_autostart_nm_applet: "{{ home_profile != 'vdesk' }}"
@@ -59,3 +63,18 @@ home_autostart_pasystray: "{{ home_profile != 'vdesk' }}"
home_autostart_unclutter: "{{ home_profile == 'presentation' }}"

default_activities: []

workspaces: {}

i3_hide_bar: false
i3_hide_border_one_window: false

home_xhosts_allow: []

pulseaudio_load_system_config: true
pulseaudio_jack_sink_enabled: false
pulseaudio_jack_sink_channels: 2
pulseaudio_jack_sink_client_name: PulseAudio
pulseaudio_jack_source_enabled: false
pulseaudio_jack_source_channels: 2
pulseaudio_jack_source_client_name: PulseAudio

BIN
files/background/eso0932a.jpg View File

Before After
Width: 6000  |  Height: 3000  |  Size: 7.8MB

+ 16
- 0
files/bin/pipe-watcher View File

@@ -0,0 +1,16 @@
#!/usr/bin/fish

set pipe $argv[1]

if test (count $argv) -ge 2
echo $argv[2]
end

if [ ! -p $pipe ]
echo named pipe $pipe not found
exit 1
end

while [ -p $pipe ]
cat $pipe
end

+ 5
- 11
files/bin/timer View File

@@ -3,17 +3,11 @@
set timer_folder ~/.timer
set activity_lists_folder $timer_folder/activity.lists
set activity_timeclock_file $timer_folder/activity.timeclock
set activity_i3blocks $timer_folder/activity.i3blocks
set activity_i3blocks_linefile $timer_folder/activity.i3blocks
set activity_current_file $timer_folder/activity.current
set activity_timeclock_append_log_folder $timer_folder/activity.timeclock.d
set activity_timeclock_append_log_filename $activity_timeclock_append_log_folder/(date +%Y-%m-%d)-(hostname)


function set_i3blocks_activity_display
echo $argv[1] > $activity_i3blocks
pkill -RTMIN+1 i3blocks
end

function parse_activity_timeclock
sort -k2 | uniq \
|begin
@@ -42,10 +36,10 @@ function parse_activity_timeclock
end
if [ $state = 'i' ]
echo $activity > $activity_current_file
set_i3blocks_activity_display "<span foreground=\"#00FF00\">★ $activity</span>"
echo "<span foreground=\"#00FF00\">★ $activity</span>" > $activity_i3blocks_linefile
else
rm $activity_current_file
set_i3blocks_activity_display "<span foreground=\"#0000FF\">☆</span>"
echo "<span foreground=\"#0000FF\">☆</span>" > $activity_i3blocks_linefile
end
end

@@ -69,10 +63,12 @@ end

function begin_activity
echo i (date '+%Y-%m-%d %H:%M:%S') $argv >> $activity_timeclock_append_log_filename
echo "<span foreground=\"#00FF00\">★ $argv</span>" > $activity_i3blocks_linefile
end

function end_activity
echo o (date '+%Y-%m-%d %H:%M:%S') >> $activity_timeclock_append_log_filename
echo "<span foreground=\"#0000FF\">☆</span>" > $activity_i3blocks_linefile
end


@@ -95,5 +91,3 @@ switch $command
begin_activity 'Arbeit:Uniklinik Köln'

end

merge_timeclock_append_log

+ 7
- 0
handlers/main.yaml View File

@@ -12,6 +12,13 @@
scope: user
failed_when: false

- name: restart pulseaudio
systemd:
name: pulseaudio.service
state: restarted
scope: user
failed_when: false

- name: i3 reload
systemd:
name: i3wm.service


+ 3
- 0
tasks/git.yaml View File

@@ -4,3 +4,6 @@
template:
src: git/gitconfig.j2
dest: ~/.gitconfig
when:
- git_user_email is defined
- git_user_name is defined

+ 3
- 0
tasks/i3.yaml View File

@@ -38,6 +38,9 @@
dest: ~/.config/systemd/user/i3wm.service
notify: systemd daemon-reload

- name: flush handlers
meta: flush_handlers

- name: i3wm graphical-session service enabled
systemd:
name: i3wm.service


+ 11
- 0
tasks/pulseaudio.yaml View File

@@ -6,3 +6,14 @@
dest: ~/.pulse-cookie
mode: 0600
when: home_copy_pulseaudio_cookie

- name: pulse directory
file:
path: ~/.pulse
state: directory

- name: pulse default config
template:
src: pulseaudio/default.pa.j2
dest: ~/.pulse/default.pa
notify: restart pulseaudio

+ 5
- 0
tasks/timer.yaml View File

@@ -24,3 +24,8 @@
copy:
content: "{{ default_activities | join('\n') }}"
dest: "{{timer_folder}}/activity.lists/10-default"

- name: timer activity i3blocks linefile
shell: echo ☆ > {{timer_folder}}/activity.i3blocks
args:
creates: "{{timer_folder}}/activity.i3blocks"

+ 12
- 0
tasks/vnc.yaml View File

@@ -6,6 +6,18 @@
state: directory
mode: 0700

- name: vnc config
template:
src: vnc/config.j2
dest: ~/.vnc/config
mode: 0644

- name: vnc env
template:
src: vnc/vncserver.env.j2
dest: ~/.vnc/vncserver.env
mode: 0644

- name: vnc server config
template:
src: vnc/vnc.conf.j2


+ 1
- 1
tasks/workspaces.yaml View File

@@ -17,7 +17,7 @@
src: workspaces/workspace.focus.fish.j2
dest: ~/.workspaces/{{workspace}}.focus
mode: 0755
with_items: "{{workspaces|dict2items|json_query(\"[?value.type=='vncviewer'].key\") }}"
with_items: "{{ workspaces }}"
loop_control:
loop_var: workspace



+ 10
- 0
templates/git/gitconfig.j2 View File

@@ -1,3 +1,13 @@
[user]
{% if git_user_email is defined %}
email = {{git_user_email}}
{% endif %}
{% if git_user_name is defined %}
name = {{git_user_name}}
{% endif %}
[init]
defaultBranch = main
{% if github_username is defined %}
[github]
user = {{github_username}}
{% endif %}

+ 17
- 3
templates/i3/i3.config.j2 View File

@@ -47,11 +47,13 @@ bindsym XF86HomePage exec {{default_browser}}
bindsym XF86Calculator exec {{calculator_command}}

## Special modes
bindsym $mod+less mode timer
bindsym $mod+t mode timer
bindsym $mod+s mode session
bindsym $mod+c mode clipboard
bindcode $mod+49 mode "remote"

## Activity
bindsym $mod+less exec "~/bin/timer select_activity"

## Applications
bindsym $mod+Return exec "{{default_terminal}}"
@@ -118,7 +120,6 @@ bindsym $mod+KP_Add exec {{points_up_command}}
# $mod+l
# $mod+n
# $mod+o
# $mod+t
# $mod+u
# $mod+adiaeresis
# $mod+odiaeresis
@@ -167,7 +168,10 @@ bindsym $mod+KP_Add exec {{points_up_command}}

# Special modes
bindcode $plexmod+49 mode "session"
bindsym $plexmod+less mode timer

# activity
bindsym $plexmod+less exec "~/bin/timer select_activity"

{% endmacro %}
{{ overall() }}

@@ -336,6 +340,11 @@ mode "resize" {

### Bar
bar {
{% if i3_hide_bar %}
mode invisible
hidden_state hide
{% endif %}

position top

strip_workspace_numbers yes
@@ -371,8 +380,13 @@ client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c

client.background #ffffff

{% if not i3_hide_border_one_window %}
default_border normal
hide_edge_borders both
{% else %}
default_border none
hide_edge_borders smart
{% endif %}

default_floating_border normal



+ 5
- 8
templates/i3/i3blocks.config.j2 View File

@@ -32,10 +32,9 @@ markup=none

# activity
[activity]
command=cat ~/.timer/activity.i3blocks
interval=once
command=tail -f ~/.timer/activity.i3blocks 2> /dev/null
interval=persist
markup=pango
signal=1

# hostinfo
[hostinfo]
@@ -60,7 +59,6 @@ interval=10
# The type defaults to "mem" if the instance is not specified.
[memory]
label=MEM
separator=false
interval=30

[memory]
@@ -73,10 +71,9 @@ interval=30
# The directory defaults to $HOME if the instance is not specified.
# The script may be called with a optional argument to set the alert
# (defaults to 10 for 10%).
#[disk]
#label=HOME
#instance=/mnt/data
#interval=30
[disk]
label=HOME
interval=30

# Battery indicator
#


+ 25
- 0
templates/pulseaudio/default.pa.j2 View File

@@ -0,0 +1,25 @@
{{ansible_managed|comment}}

{% if pulseaudio_load_system_config %}
.include /etc/pulse/default.pa
{% endif %}

.fail

{% if pulseaudio_jack_sink_enabled %}
load-module module-jack-sink channels={{pulseaudio_jack_sink_channels}} client_name="{{pulseaudio_jack_sink_client_name}}" connect=0
{% endif %}
{% if pulseaudio_jack_source_enabled %}
load-module module-jack-source channels={{pulseaudio_jack_source_channels}} client_name="{{pulseaudio_jack_source_client_name}}" connect=0
{% endif %}

{% if pulseaudio_default_sink is defined %}
set-default-sink {{pulseaudio_default_sink}}
{% endif %}
{% if pulseaudio_default_source is defined %}
set-default-source {{pulseaudio_default_source}}
{% endif %}

.ifexists module-x11-publish.so
load-module module-x11-publish
.endif

+ 1
- 0
templates/vnc/config.j2 View File

@@ -0,0 +1 @@
{{ ansible_managed | comment }}

+ 1
- 1
templates/vnc/vnc.conf.j2 View File

@@ -1,4 +1,4 @@
{{ ansible_managed | comment }}

$desktopName = "{{inventory_hostname}}$ENV{DISPLAY}";
$geometry = "1920x1200";
$geometry = "{{home_vncserver_geometry}}";

+ 3
- 0
templates/vnc/vncserver.env.j2 View File

@@ -0,0 +1,3 @@
{{ ansible_managed | comment }}

VNCSERVER_OPTIONS="{{vncserver_options|replace('\n',' ')|trim}}"

+ 2
- 1
templates/vnc/vncserver.service.j2 View File

@@ -19,8 +19,9 @@ Description=vncserver service - display %i
After=syslog.target network.target

[Service]
EnvironmentFile=%h/.vnc/vncserver.env
Type=forking
ExecStart=/usr/bin/vncserver -autokill %i
ExecStart=/usr/bin/vncserver -autokill %i $VNCSERVER_OPTIONS
ExecStop=/usr/bin/vncserver -kill %i

[Install]


+ 9
- 0
templates/workspaces/workspace.focus.fish.j2 View File

@@ -1,7 +1,16 @@
#!/usr/bin/fish
{{ ansible_managed | comment }}

{% if workspaces[workspace].type is defined %}
{% if workspaces[workspace].type == "vncviewer" %}
i3-msg mode remote
{% endif %}
{% endif %}

{% if workspaces[workspace].activity is defined %}
{% if workspaces[workspace].activity %}
~/bin/timer begin_activity "{{workspaces[workspace].activity}}"
{% else %}
~/bin/timer end_activity
{% endif %}
{% endif %}

+ 5
- 2
templates/x11/xsession.reload.fish.j2 View File

@@ -11,9 +11,7 @@ xkbset nullify lock

# background
xsetroot -solid black
{% if background_image is defined %}
{{background_command}}
{% endif %}

# Xresources
xrdb -merge ~/.Xresources
@@ -23,3 +21,8 @@ rofi -theme ~/.config/rofi/theme -dump-xresources > ~/.config/rofi/config

# screensaver settings
/usr/local/bin/screensaver-settings

# allow hosts
{% for xhost in home_xhosts_allow %}
xhost +{{xhost}}
{% endfor %}

+ 5
- 0
vars/main.yaml View File

@@ -133,3 +133,8 @@ background_command: feh --no-fehbg --bg-fill {{background_image_path}}

timer_folder: ~/.timer
timer_config: {}

vncserver_options: |
{% if not home_vncserver_allow_resize %}
-AcceptSetDesktopSize=0
{% endif %}