From 0dd88a896dd0af0ab1904be4ecee011fd638b833 Mon Sep 17 00:00:00 2001 From: Maximilian Friedersdorff Date: Tue, 4 Jun 2019 10:33:18 +0100 Subject: [PATCH] Sway configuration for magnesium --- states/conky/init.sls | 0 states/dotfiles.sls | 1 + states/font/pango-liberation-mono.sls | 0 states/sway/files/config.jinja | 247 ++++++++++++++++++++++++++ states/sway/gentoo.sls | 19 ++ states/sway/init.sls | 21 +++ 6 files changed, 288 insertions(+) create mode 100644 states/conky/init.sls create mode 100644 states/font/pango-liberation-mono.sls create mode 100644 states/sway/files/config.jinja create mode 100644 states/sway/gentoo.sls create mode 100644 states/sway/init.sls diff --git a/states/conky/init.sls b/states/conky/init.sls new file mode 100644 index 0000000..e69de29 diff --git a/states/dotfiles.sls b/states/dotfiles.sls index cf4225a..8fdb4cc 100644 --- a/states/dotfiles.sls +++ b/states/dotfiles.sls @@ -1,3 +1,4 @@ include: - bash - git + - sway diff --git a/states/font/pango-liberation-mono.sls b/states/font/pango-liberation-mono.sls new file mode 100644 index 0000000..e69de29 diff --git a/states/sway/files/config.jinja b/states/sway/files/config.jinja new file mode 100644 index 0000000..786fb69 --- /dev/null +++ b/states/sway/files/config.jinja @@ -0,0 +1,247 @@ +{% set host = grains['host'] %} +# Colors +set $black #000000 +set $black_super #555555 + +set $red #f92672 +set $red_super #dd4278 + +set $green #74e22e +set $green_super #9dc54b + +set $yellow #e6db74 +set $yellow_super #d1ca89 + +set $blue #66d9ef +set $blue_super #7accda + +set $magenta #ae81ff +set $magenta_super #b392ef + +set $cyan #00d9d9 +set $cyan_super #c8f0f0 + +set $white #f5deb3 +set $white_super #ffffff + +client.focused $black $yellow_super $black $black $black +client.focused_inactive $black $black_super $white $black $black + + +set $mod Mod4 + +# Slight gaps between windows +gaps inner 5 +gaps outer 5 + +# Use Mouse+$mod to drag floating windows to their wanted position +floating_modifier $mod + +bindsym Control+t mode "$ratpoison" + +set $ws1 "1" +set $ws2 "2" +set $ws3 "3" +set $ws4 "4" +set $ws5 "5" +set $ws6 "6" +set $ws7 "7" +set $ws8 "8" +set $ws9 "9" +set $ws10 "10" + +mode "$ratpoison" { +# All/most commands in this mode should revert to the default mode on comleption. +# We are emulating ratpoison (kinda) here + +# Moving to workspaces +# bindsym n workspace next mode "default" +# bindsym Shift+n workspace prev mode "default" + + bindsym 1 exec 'swaymsg mode "default"; swaymsg workspace $ws1' + bindsym 2 exec 'swaymsg mode "default"; swaymsg workspace $ws2' + bindsym 3 exec 'swaymsg mode "default"; swaymsg workspace $ws3' + bindsym 4 exec 'swaymsg mode "default"; swaymsg workspace $ws4' + bindsym 5 exec 'swaymsg mode "default"; swaymsg workspace $ws5' + bindsym 6 exec 'swaymsg mode "default"; swaymsg workspace $ws6' + bindsym 7 exec 'swaymsg mode "default"; swaymsg workspace $ws7' + bindsym 8 exec 'swaymsg mode "default"; swaymsg workspace $ws8' + bindsym 9 exec 'swaymsg mode "default"; swaymsg workspace $ws9' + bindsym 0 exec 'swaymsg mode "default"; swaymsg workspace $ws10' + + bindsym Shift+1 exec 'swaymsg mode "default"; swaymsg move container to workspace $ws1' + bindsym Shift+2 exec 'swaymsg mode "default"; swaymsg move container to workspace $ws2' + bindsym Shift+3 exec 'swaymsg mode "default"; swaymsg move container to workspace $ws3' + bindsym Shift+4 exec 'swaymsg mode "default"; swaymsg move container to workspace $ws4' + bindsym Shift+5 exec 'swaymsg mode "default"; swaymsg move container to workspace $ws5' + bindsym Shift+6 exec 'swaymsg mode "default"; swaymsg move container to workspace $ws6' + bindsym Shift+7 exec 'swaymsg mode "default"; swaymsg move container to workspace $ws7' + bindsym Shift+8 exec 'swaymsg mode "default"; swaymsg move container to workspace $ws8' + bindsym Shift+9 exec 'swaymsg mode "default"; swaymsg move container to workspace $ws9' + bindsym Shift+0 exec 'swaymsg mode "default"; swaymsg move container to workspace $ws10' + +# Moving focus +# bindsym Tab focus right mode "default" +# bindsym Shift+Tab focus left mode "default" + + bindsym h exec 'swaymsg mode "default"; swaymsg focus left' + bindsym j exec 'swaymsg mode "default"; swaymsg focus down' + bindsym k exec 'swaymsg mode "default"; swaymsg focus up' + bindsym l exec 'swaymsg mode "default"; swaymsg focus right' + + +# Moving windows + bindsym Shift+h exec 'swaymsg mode "default"; swaymsg move left' + bindsym Shift+j exec 'swaymsg mode "default"; swaymsg move down' + bindsym Shift+k exec 'swaymsg mode "default"; swaymsg move up' + bindsym Shift+l exec 'swaymsg mode "default"; swaymsg move right' + +# Changing split modes + bindsym v exec 'swaymsg mode "default"; swaymsg split v' + bindsym o exec 'swaymsg mode "default"; swaymsg split h' + + + bindsym c exec 'swaymsg mode "default"; swaymsg exec termite' + bindsym q exec 'swaymsg mode "default"; swaymsg kill' + + bindsym Shift+e exec 'swaymsg mode "default"; swaymsg exec dmenu_run' + + bindsym $mod+l exec 'swaymsg mode "default"; "lock.{{ host }}"' + bindsym Escape mode "default" +} + + + +# There also is the (new) i3-dmenu-desktop which only displays applications +# shipping a .desktop file. It is a wrapper around dmenu, so you need that +# installed. +# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop + +# enter fullscreen mode for the focused container +bindsym $mod+t fullscreen toggle + +# change container layout (stacked, tabbed, toggle split) +bindsym $mod+r layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+f layout toggle split + +# toggle tiling / floating +bindsym $mod+Shift+space floating toggle + +# change focus between tiling / floating windows +bindsym $mod+space focus mode_toggle + +# focus the parent container +bindsym $mod+a focus parent + +# focus the child container +#bindsym $mod+d focus child + +#reload the configuration file +bindsym $mod+Shift+c reload +# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) +bindsym $mod+Shift+r restart +# exit i3 (logs you out of your X session) +bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'" + +# resize window (you can also use the mouse for that) +mode "resize" { +# These bindings trigger as soon as you enter the resize mode + +# Pressing left will shrink the window’s width. +# Pressing right will grow the window’s width. +# Pressing up will shrink the window’s height. +# Pressing down will grow the window’s height. + bindsym h resize shrink width 10 px or 10 ppt + bindsym j resize grow height 10 px or 10 ppt + bindsym k resize shrink height 10 px or 10 ppt + bindsym l resize grow width 10 px or 10 ppt + +# same bindings, but for the arrow keys + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt + bindsym Right resize grow width 10 px or 10 ppt + +# back to normal: Enter or Escape or $mod+r + bindsym Return mode "default" + bindsym Escape mode "default" + bindsym $mod+p mode "default" +} + +bindsym $mod+p mode "resize" + + + +hide_edge_borders both + +focus_follows_mouse no + +focus_on_window_activation urgent + +for_window [class="^rdesktop"] move workspace number 9; floating disable +for_window [class="Pinentry"] floating enable + +exec swayidle \ + timeout 300 "lock.{{ host }}" \ + timeout 600 'swaymsg "output * dpms off"' \ + resume 'swaymsg "output * dpms on" \ + before-sleep "lock.{{ host }}" + +# Magnesium specific section +{% if host == 'magnesium' %} +bar { + id bar_left + status_command conky-i3bar + position top + output "HDMI-A-3" + font pango:Liberation Mono 10 + colors { + background $black_super + focused_background $black + focused_workspace $black_super $yellow_super $black + active_workspace $black_super $blue_super $black + inactive_workspace $black_super $black_super $white_super + urgent_workspace $black $red_super $white + } +} + +bar { + id bar_right + position top + output "HDMI-A-2" + font pango:Liberation Mono 10 + colors { + background $black_super + focused_background $black + focused_workspace $black_super $yellow_super $black + active_workspace $black_super $blue_super $black + inactive_workspace $black_super $black_super $white_super + urgent_workspace $black $red_super $white + } +} + + +workspace 1 output HDMI-A-3 +workspace 2 output HDMI-A-2 + +output HDMI-A-2 { + position 0 1080 + background ~/Pictures/background_1080_1.png fit +} + +output HDMI-A-3 { + position 0 0 + background ~/Pictures/background_1080_2.png fit +} + + + +font pango:Liberation Mono 8 + +input 1241:36:HOLDCHIP_USB_Keyboard { + xkb_layout us + xkb_variant colemak + xkb_options ctrl:nocaps +} +{% endif %} diff --git a/states/sway/gentoo.sls b/states/sway/gentoo.sls new file mode 100644 index 0000000..a1861af --- /dev/null +++ b/states/sway/gentoo.sls @@ -0,0 +1,19 @@ +{% set swaypkgs = [ + 'gui-wm/sway' +] +%} + +install sway: + pkg.installed: + - name: gui-wm/sway + - require: + - file: sway useflags + +sway useflags: + file.managed: + - name: /etc/portage/package.use/sway-salt + - contents: + - gui-wm/sway swaybar swaybg swayidle swaylock swaymsg swaynag + - user: root + - group: root + - mode: 644 diff --git a/states/sway/init.sls b/states/sway/init.sls new file mode 100644 index 0000000..f19533d --- /dev/null +++ b/states/sway/init.sls @@ -0,0 +1,21 @@ +include: + - sway.{{ grains['os']| lower }} + - conky + - font.pango-liberation-mono + +config dir: + file.directory: + - name: {{ grains['homedir'] }}/.config/sway + - user: {{ grains['user'] }} + - group: {{ grains['user'] }} + - dir_mode: 750 + - makedirs: True + +sway config: + file.managed: + - name: {{ grains['homedir'] }}/.config/sway/config + - source: {{ grains['stateroot'] }}/sway/files/config.jinja + - template: jinja + - user: {{ grains['user']}} + - group: {{ grains['user']}} + - mode: 640 -- 2.46.2