Browse Source

clipboard features

master
Markus K Brechtel 2 years ago
parent
commit
f19b92e2cf
10 changed files with 119 additions and 65 deletions
  1. +2
    -0
      defaults/main.yaml
  2. +13
    -0
      files/bin/clipboard-edit
  3. +6
    -0
      files/bin/clipboard-from-file
  4. +13
    -0
      files/bin/clipboard-pwgen
  5. +6
    -0
      files/bin/clipboard-to-file
  6. +6
    -0
      tasks/clipboard.yaml
  7. +3
    -0
      tasks/main.yaml
  8. +1
    -0
      tasks/structure.yaml
  9. +15
    -11
      templates/i3/i3.config.j2
  10. +54
    -54
      vars/main.yaml

+ 2
- 0
defaults/main.yaml View File

@@ -87,3 +87,5 @@ pulseaudio_jack_source_channels: 2
pulseaudio_jack_source_client_name: PulseAudio pulseaudio_jack_source_client_name: PulseAudio


todo_file: ~/todo.txt todo_file: ~/todo.txt

clipboard_directory: ~/.clipboard

+ 13
- 0
files/bin/clipboard-edit View File

@@ -0,0 +1,13 @@
#!/usr/bin/elvish

var tmpfile = (mktemp)

var selection = clipboard
if (<= 1 (count $args) ) {
set selection = $args[0]
}

xclip -o -selection $selection > $tmpfile
mousepad $tmpfile
xclip -i -selection $selection < $tmpfile
rm $tmpfile

+ 6
- 0
files/bin/clipboard-from-file View File

@@ -0,0 +1,6 @@
#!/usr/bin/elvish

var selection = $args[0]
var file = $args[1]

xclip -i -selection $selection < $file

+ 13
- 0
files/bin/clipboard-pwgen View File

@@ -0,0 +1,13 @@
#!/usr/bin/elvish

var selection = clipboard
if (<= 1 (count $args) ) {
set selection = $args[0]
}

var length = 32
if (<= 2 (count $args) ) {
set length = $args[1]
}

pwgen $length 1 | xclip -i -selection $selection

+ 6
- 0
files/bin/clipboard-to-file View File

@@ -0,0 +1,6 @@
#!/usr/bin/elvish

var selection = $args[0]
var file = $args[1]

xclip -o -selection $selection > $file

+ 6
- 0
tasks/clipboard.yaml View File

@@ -0,0 +1,6 @@
---

- name: clipboard directory
file:
path: "{{clipboard_directory}}"
state: directory

+ 3
- 0
tasks/main.yaml View File

@@ -14,6 +14,9 @@
- import_tasks: todo.yaml - import_tasks: todo.yaml
tags: tags:
- todo - todo
- import_tasks: clipboard.yaml
tags:
- clipboard


- block: - block:
- import_tasks: i3.yaml - import_tasks: i3.yaml


+ 1
- 0
tasks/structure.yaml View File

@@ -20,6 +20,7 @@
src: bin/ src: bin/
dest: ~/.local/bin/ dest: ~/.local/bin/
mode: 0755 mode: 0755
tags: bin


- name: systemd user config directory - name: systemd user config directory
file: file:


+ 15
- 11
templates/i3/i3.config.j2 View File

@@ -49,8 +49,8 @@ bindsym $mod+space exec {{i3_exec_command_prefix}} "on-space-shortcut"


## Workspaces ## Workspaces
bindsym $mod+w {{workspace_switcher}} bindsym $mod+w {{workspace_switcher}}
{% for ws in i3_number_workspace_keymaps %}
bindsym $mod+{{ws.keysym}} workspace "{{ws.workspace}}"
{% for ws in i3_number_keymaps %}
bindsym $mod+{{ws.keysym}} workspace "{{ws.id}}"
{% endfor %} {% endfor %}
# focus workspace # focus workspace
bindsym $mod+Prior workspace next bindsym $mod+Prior workspace next
@@ -81,8 +81,8 @@ bindsym $mod+Control+Down move down
bindsym $mod+Control+Up move up bindsym $mod+Control+Up move up
bindsym $mod+Control+Right move right bindsym $mod+Control+Right move right
bindsym $mod+Control+Tab floating toggle bindsym $mod+Control+Tab floating toggle
{% for ws in i3_number_workspace_keymaps %}
bindsym $mod+Control+{{ws.keysym}} move container to workspace "{{ws.workspace}}"; mode "default"
{% for ws in i3_number_keymaps %}
bindsym $mod+Control+{{ws.keysym}} move container to workspace "{{ws.id}}"; mode "default"
{% endfor %} {% endfor %}
# move workspace # move workspace
bindsym $mod+Shift+Left move workspace to output left bindsym $mod+Shift+Left move workspace to output left
@@ -134,11 +134,11 @@ bindsym $mod+r mode resize
bindsym $plexmod+BackSpace kill bindsym $plexmod+BackSpace kill
bindsym $plexmod+Tab {{workspace_switcher}} bindsym $plexmod+Tab {{workspace_switcher}}


{% for ws in i3_number_workspace_keymaps %}
bindsym $plexmod+{{ws.keysym}} workspace "{{ws.workspace}}"
{% for ws in i3_number_keymaps %}
bindsym $plexmod+{{ws.keysym}} workspace "{{ws.id}}"
{% endfor %} {% endfor %}
{% for ws in i3_letter_workspace_keymaps %}
bindsym $plexmod+{{ws.keysym}} workspace "{{ws.workspace}}"
{% for ws in i3_letter_keymaps %}
bindsym $plexmod+{{ws.keysym}} workspace "{{ws.id}}"
{% endfor %} {% endfor %}
# focus workspace # focus workspace
bindsym $plexmod+Prior workspace next bindsym $plexmod+Prior workspace next
@@ -215,11 +215,16 @@ mode "todo" {


### Clipboard ### Clipboard
mode "clipboard" { mode "clipboard" {
bindsym p exec "clipboard-pwgen clipboard"; mode "default"
bindsym e exec "clipboard-edit clipboard"; mode "default"
{% for clipboard in i3_number_keymaps %}
bindsym {{clipboard.keysym}} exec "clipboard-from-file clipboard {{clipboard_directory}}/{{clipboard.id}}"; mode "default"
bindsym Control+{{clipboard.keysym}} exec "clipboard-to-file clipboard {{clipboard_directory}}/{{clipboard.id}}"; mode "default"
{% endfor %}
# back to normal: Escape # back to normal: Escape
bindsym Escape mode "default" bindsym Escape mode "default"
} }



### Layout ### Layout
# set default layout to tabbed # set default layout to tabbed
workspace_layout tabbed workspace_layout tabbed
@@ -239,8 +244,7 @@ mode "layout" {
bindsym Escape mode "default" bindsym Escape mode "default"
} }


mode "bar" {
bindsym h bar mode hide; mode "default"
mode "bar" { bindsym h bar mode hide; mode "default"
bindsym d bar mode dock; mode "default" bindsym d bar mode dock; mode "default"


# back to normal: Escape # back to normal: Escape


+ 54
- 54
vars/main.yaml View File

@@ -17,114 +17,114 @@ home_autostart_desktop_apps:
command: unclutter command: unclutter
enabled: "{{ home_autostart_unclutter }}" enabled: "{{ home_autostart_unclutter }}"


i3_number_workspace_keymaps:
i3_number_keymaps:
- keysym: 1 - keysym: 1
workspace: 1
id: 1
- keysym: 2 - keysym: 2
workspace: 2
id: 2
- keysym: 3 - keysym: 3
workspace: 3
id: 3
- keysym: 4 - keysym: 4
workspace: 4
id: 4
- keysym: 5 - keysym: 5
workspace: 5
id: 5
- keysym: 6 - keysym: 6
workspace: 6
id: 6
- keysym: 7 - keysym: 7
workspace: 7
id: 7
- keysym: 8 - keysym: 8
workspace: 8
id: 8
- keysym: 9 - keysym: 9
workspace: 9
id: 9
- keysym: 0 - keysym: 0
workspace: 10
id: 10
- keysym: F1 - keysym: F1
workspace: 11
id: 11
- keysym: F2 - keysym: F2
workspace: 12
id: 12
- keysym: F3 - keysym: F3
workspace: 13
id: 13
- keysym: F4 - keysym: F4
workspace: 14
id: 14
- keysym: F5 - keysym: F5
workspace: 15
id: 15
- keysym: F6 - keysym: F6
workspace: 16
id: 16
- keysym: F7 - keysym: F7
workspace: 17
id: 17
- keysym: F8 - keysym: F8
workspace: 18
id: 18
- keysym: F9 - keysym: F9
workspace: 19
id: 19
- keysym: F10 - keysym: F10
workspace: 20
id: 20
- keysym: F11 - keysym: F11
workspace: 21
id: 21
- keysym: F12 - keysym: F12
workspace: 22
id: 22




i3_letter_workspace_keymaps:
i3_letter_keymaps:
- keysym: a - keysym: a
workspace: a
id: a
- keysym: b - keysym: b
workspace: b
id: b
- keysym: c - keysym: c
workspace: c
id: c
- keysym: d - keysym: d
workspace: d
id: d
- keysym: e - keysym: e
workspace: e
id: e
- keysym: f - keysym: f
workspace: f
id: f
- keysym: g - keysym: g
workspace: g
id: g
- keysym: h - keysym: h
workspace: h
id: h
- keysym: i - keysym: i
workspace: i
id: i
- keysym: j - keysym: j
workspace: j
id: j
- keysym: k - keysym: k
workspace: k
id: k
- keysym: l - keysym: l
workspace: l
id: l
- keysym: m - keysym: m
workspace: m
id: m
- keysym: n - keysym: n
workspace: n
id: n
- keysym: o - keysym: o
workspace: o
id: o
- keysym: p - keysym: p
workspace: p
id: p
- keysym: q - keysym: q
workspace: q
id: q
- keysym: r - keysym: r
workspace: r
id: r
- keysym: s - keysym: s
workspace: s
id: s
- keysym: t - keysym: t
workspace: t
id: t
- keysym: u - keysym: u
workspace: u
id: u
- keysym: v - keysym: v
workspace: v
id: v
- keysym: w - keysym: w
workspace: w
id: w
- keysym: x - keysym: x
workspace: x
id: x
- keysym: y - keysym: y
workspace: y
id: y
- keysym: z - keysym: z
workspace: z
id: z
- keysym: adiaeresis - keysym: adiaeresis
workspace: ä
id: ä
- keysym: odiaeresis - keysym: odiaeresis
workspace: ö
id: ö
- keysym: udiaeresis - keysym: udiaeresis
workspace: ü
id: ü
- keysym: ssharp - keysym: ssharp
workspace: ß
id: ß


background_image_path: ~/.backgrounds/{{background_image|basename}} background_image_path: ~/.backgrounds/{{background_image|basename}}
background_command: feh --no-fehbg --bg-fill {{background_image_path}} background_command: feh --no-fehbg --bg-fill {{background_image_path}}