commit 05316253fae50568434cbf156db563b5401cf3e0 Author: Karl Goecking Date: Sat Feb 14 21:23:19 2026 +0100 initial commit diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..07db9a1 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,44 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Project Overview + +Ansible playbook project that automates the installation and configuration of a personalized i3 window manager desktop environment across multiple Linux distributions (Arch/Manjaro, Fedora, Ubuntu/Debian). + +## Running the Playbook + +```bash +ansible-playbook -i inventory setup.yaml +``` + +**Important:** The username in `setup.yaml` (variable `myuser`) must be changed from the default `venkatn` to the actual user before running. + +**Prerequisites by distribution:** +- Arch/Manjaro: `sudo pacman -S ansible i3` +- Fedora: `sudo dnf install ansible` +- Ubuntu: `sudo apt install git ansible python curl i3` + +## Architecture + +**`setup.yaml`** is the main entry point. It runs against localhost with sudo and conditionally loads tasks based on the detected OS family (`ansible_os_family`). + +### Task Flow + +1. **Distribution-specific package installation** — one task file per distro family: + - `tasks/configure-software-manjaro.yaml` (Arch Linux) + - `tasks/configure-software-ubuntu.yaml` (Debian) + - `tasks/configure-software-fedora.yaml` (RedHat) +2. **`tasks/configure-user.yaml`** — sudoers config, tmux config, wallpaper, `~/opt/scripts` directory +3. **`tasks/configure-i3.yaml`** — deploys all i3 configs, status bar scripts, and system-wide scripts (i3exit, blurlock) + +### Configuration Files (`files/configs/`) + +- `i3/i3/config` — main i3 window manager configuration +- `i3/config/picom.conf` — compositor settings +- `i3/config/dunst/dunstrc` — notification daemon +- `i3/config/rofi/config.rasi` — application launcher +- `i3/config/i3blocks/config` — status bar configuration +- `i3/myi3blocks/` — custom bash scripts for i3blocks status bar segments (memory, load, weather, date, battery, temp) +- `misc-scripts/i3exit` — system exit actions (lock, logout, suspend, hibernate, reboot, shutdown) using systemctl +- `misc-scripts/blurlock` — blurred lock screen script using i3lock diff --git a/README.md b/README.md new file mode 100644 index 0000000..c7f3358 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# myi3-setup +Configure my Laptop + +## How to run it +#### Install Pre-reqs +``` +$ sudo pacman -S ansible i3 (for Arch Linux) +$ sudo dnf install ansible (for Fedora, i3 will be installed during ansible run) +``` +(for Ubuntu refer docs/ubuntu-specific.md) + +#### Clone my repo and run ansible +``` +$ git clone https://github.com/justmeandopensource/myi3 +$ cd myi3 +$ ansible-playbook -i inventory setup.yaml (edit the username in setup.yaml before running) +``` diff --git a/docs/applications.md b/docs/applications.md new file mode 100644 index 0000000..ef23f5e --- /dev/null +++ b/docs/applications.md @@ -0,0 +1,13 @@ +## My applications + +|Application|Description| +|---|---| +|rofi|Application launcher and window switcher| +|i3blocks|i3 status bar| +|dunst|Notification for i3| +|picom|Compositor (transparency, shadows)| +|gnome-terminal|Terminal| +|ranger|command line file manager| +|mousepad|Editor| +|flameshot|Screenshot utility| +|scrot|Screenshot for lock screen| diff --git a/docs/i3-shortcuts.md b/docs/i3-shortcuts.md new file mode 100644 index 0000000..9dce137 --- /dev/null +++ b/docs/i3-shortcuts.md @@ -0,0 +1,37 @@ +## My Custom i3 shortcuts + +|Shortcut|Description| +|---|---| +|mod+q|Close/Kill window| +|mod+space|Open Rofi application launcher| +|mod+f|Fullscreen a window/container| +|mod+s|Change layout to stack mode| +|mod+d|Change layout to split mode| +|mod+PrintScr|Open Flameshot screenshot application| +|mod+shift+enter|Open Terminal| +|mod+shift+f|Open Ranger command line file manager| +|mod+shift+e|Open Mousepad editor| +|mod+left|Switch focus to container on the left| +|mod+righ|Switch focus to container on the right| +|mod+up|Switch focus to container at the top| +|mod+down|Switch focus to container at the bottom| +|mod+shift+left|Move current container to left| +|mod+shift+right|Move current container to right| +|mod+shift+up|Move current container to top| +|mod+shift+down|Move current container to bottom| +|mod+shift+space|Toggle floating mode of container/window| +|mod+shift+minus|Move current window to scratchpad| +|mod+minus|Bring windows from scratchpad| +|mod+ctl+left|Move to worksapce left| +|mod+ctl+right|Move to worksapce right| +|mod+1|Move to workspace 1| +|mod+2|Move to workspace 2| +|mod+3|Move to workspace 3| +|mod+4|Move to workspace 4| +|mod+shift+1|Move the current window to workspace 1| +|mod+shift+2|Move the current window to workspace 2| +|mod+shift+3|Move the current window to workspace 3| +|mod+shift+4|Move the current window to workspace 4| +|mod+r|(up,down,left,right) Resize current window| +|mod+ctl+r|Restart i3| +|mod+ctl+del|Show (e)xit, (h)ibernate, (r)eboot, (s)hutdown (o)ption| diff --git a/docs/ubuntu-specific.md b/docs/ubuntu-specific.md new file mode 100644 index 0000000..31fb04c --- /dev/null +++ b/docs/ubuntu-specific.md @@ -0,0 +1,7 @@ +## Ubuntu specific tweaks +#### Install pre-requisites +``` +sudo apt install -y git ansible python3 curl i3 +``` + +Note: Since i3 version 4.22, gaps support is included in the standard i3 package. A separate i3-gaps installation is no longer needed. diff --git a/docs/zsh.md b/docs/zsh.md new file mode 100644 index 0000000..5d703c7 --- /dev/null +++ b/docs/zsh.md @@ -0,0 +1,11 @@ +## oh-my-zsh with zsh-autosuggestions + +``` +sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" +cp $HOME/myi3/files/configs/robbyrussell.zsh-theme $HOME/.oh-my-zsh/themes/robbyrussell.zsh-theme +git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions +``` +Update $HOME/.zshrc +``` +plugins=(zsh-autosuggestions) +``` diff --git a/files/configs/i3/config/dunst/dunstrc b/files/configs/i3/config/dunst/dunstrc new file mode 100644 index 0000000..2d221e4 --- /dev/null +++ b/files/configs/i3/config/dunst/dunstrc @@ -0,0 +1,165 @@ +[global] + frame_width = 1 + frame_color = "#788388" + + font = Noto Sans 10 + + # Allow a small subset of html markup: + # bold + # italic + # strikethrough + # underline + # + # For a complete reference see + # . + # If markup is not allowed, those tags will be stripped out of the + # message. + markup = yes + + # The format of the message. Possible variables are: + # %a appname + # %s summary + # %b body + # %i iconname (including its path) + # %I iconname (without its path) + # %p progress value if set ([ 0%] to [100%]) or nothing + # Markup is allowed + format = "%s %p\n%b" + + # Sort messages by urgency. + sort = yes + + # Show how many messages are currently hidden (because of geometry). + indicate_hidden = yes + + # Alignment of message text. + # Possible values are "left", "center" and "right". + alignment = left + + # Show age of message if message is older than show_age_threshold + # seconds. + # Set to -1 to disable. + show_age_threshold = 60 + + # Split notifications into multiple lines if they don't fit into + # geometry. + word_wrap = yes + + # Ignore newlines '\n' in notifications. + ignore_newline = no + + # Notification window size and position (replaces deprecated geometry) + width = 800 + height = 100 + origin = top-right + offset = 25x25 + + # Shrink window if it's smaller than the width. + shrink = yes + + # The transparency of the window. Range: [0; 100]. + # This option will only work if a compositing windowmanager is + # present (e.g. picom, compiz, etc.). + transparency = 0 + + # Don't remove messages, if the user is idle (no mouse or keyboard input) + # for longer than idle_threshold seconds. + # Set to 0 to disable. + idle_threshold = 0 + + # Which monitor should the notifications be displayed on. + monitor = 0 + + # Display notification on focused monitor. Possible modes are: + # mouse: follow mouse pointer + # keyboard: follow window with keyboard focus + # none: don't follow anything + follow = mouse + + # Should a notification popped up from history be sticky or timeout + # as if it would normally do. + sticky_history = yes + + # Maximum amount of notifications kept in history + history_length = 20 + + # Display indicators for URLs (U) and actions (A). + show_indicators = yes + + # The height of a single line. If the height is smaller than the + # font height, it will get raised to the font height. + line_height = 0 + + # Draw a line of "separator_height" pixel height between two + # notifications. + # Set to 0 to disable. + separator_height = 1 + + # Padding between text and separator. + padding = 8 + + # Horizontal padding. + horizontal_padding = 10 + + # Define a color for the separator. + separator_color = "#263238" + + # Print a notification on startup. + startup_notification = false + + # dmenu path. + dmenu = /usr/bin/dmenu -p dunst: + + # Browser for opening urls in context menu. + browser = xdg-open + + # Align icons left/right/off + icon_position = left + + # Paths to default icons. + icon_path = /usr/share/icons/Adwaita/16x16/status/:/usr/share/icons/Adwaita/16x16/devices/ + + # Limit icons size. + max_icon_size = 64 + +# Note: [shortcuts] section was removed in dunst 1.7+ +# Use dunstctl for keyboard control instead: +# dunstctl close +# dunstctl close-all +# dunstctl history-pop +# dunstctl context + +[urgency_low] + background = "#263238" + foreground = "#556064" + timeout = 8 + +[urgency_normal] + background = "#263238" + foreground = "#F9FAF9" + timeout = 8 + +[urgency_critical] + background = "#D62929" + foreground = "#F9FAF9" + timeout = 8 + +[irc] + appname = weechat + timeout = 0 + background = "#0033bb" + foreground = "#dddddd" + +[weechat hl] + appname = weechat + category = weechat.HL + background = "#FF5C47" + foreground = "#FFFFFF" + +[weechat pn] + appname = weechat + category = weechat.PM + background = "#D53B84" + foreground = "#FFFFFF" + +# vim: ft=cfg diff --git a/files/configs/i3/config/i3blocks/config b/files/configs/i3/config/i3blocks/config new file mode 100644 index 0000000..41948f0 --- /dev/null +++ b/files/configs/i3/config/i3blocks/config @@ -0,0 +1,40 @@ +# i3blocks config file +command=/usr/lib/i3blocks/$BLOCK_NAME +separator_block_width=15 +markup=none + +[myi3temp] +command=$HOME/opt/scripts/myi3blocks/myi3temp +label= +interval=5 + +[myi3memory] +command=$HOME/opt/scripts/myi3blocks/myi3memory +label= +interval=5 + +[myi3load] +command=$HOME/opt/scripts/myi3blocks/myi3load +label= +interval=5 + +[myi3battery] +command=$HOME/opt/scripts/myi3blocks/myi3battery +label= +instance=0 +interval=10 + +[iface] +label= +color=#33CCFF +interval=30 + +[myi3weather-cam] +command=$HOME/opt/scripts/myi3blocks/myi3weather +label=ℂ +instance=2653941 +interval=600 + +[time] +command=$HOME/opt/scripts/myi3blocks/myi3date +interval=5 diff --git a/files/configs/i3/config/picom.conf b/files/configs/i3/config/picom.conf new file mode 100644 index 0000000..fc996ac --- /dev/null +++ b/files/configs/i3/config/picom.conf @@ -0,0 +1,65 @@ +# Shadow +shadow = true; +detect-rounded-corners = true; +shadow-radius = 5; +shadow-offset-x = 1; +shadow-offset-y = 1; +shadow-opacity = .3; +shadow-exclude = [ + "name = 'Notification'", +# workaround for conky until it provides window properties: + "override_redirect = 1 && !WM_CLASS@:s", + "class_g ?= 'Dmenu'", +# "class_g ?= 'Dunst'", +# disable shadows for hidden windows: + "_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'", + "_GTK_FRAME_EXTENTS@:c", +# disables shadows on i3 frames + "class_g ?= 'i3-frame'" +]; + +fading = true; +fade-delta = 4; +fade-in-step = 0.03; +fade-out-step = 0.03; +fade-exclude = [ ]; + +backend = "glx"; +mark-wmwin-focused = true; +mark-ovredir-focused = true; +detect-client-opacity = true; +unredir-if-possible = true; +vsync = true; +focus-exclude = [ "class_g = 'Cairo-clock'" ]; +detect-transient = true; +detect-client-leader = true; +invert-color-include = [ ]; +glx-copy-from-front = false; + +opacity-rule = [ +"80:class_g = 'Gnome-terminal'", +"80:class_g = 'Rofi'", +"80:class_g = 'Mousepad'", +"80:class_g = 'Evolution'", +"80:class_g = 'Pcmanfm'", +"80:class_g = 'Virt-manager'", +"80:class_g = 'i3bar'" +]; + +wintypes : +{ + tooltip : + { + fade = true; + shadow = false; + opacity = 0.85; + focus = true; + }; + fullscreen : + { + fade = true; + shadow = false; + opacity = 1; + focus = true; + }; +}; diff --git a/files/configs/i3/config/rofi/config.rasi b/files/configs/i3/config/rofi/config.rasi new file mode 100644 index 0000000..a1a723e --- /dev/null +++ b/files/configs/i3/config/rofi/config.rasi @@ -0,0 +1,6 @@ +configuration { + theme: "android_notification"; + terminal: "gnome-terminal"; + ssh-client: "ssh"; + ssh-command: "{terminal} -- {ssh-client} {host}"; +} diff --git a/files/configs/i3/i3/config b/files/configs/i3/i3/config new file mode 100644 index 0000000..08244f7 --- /dev/null +++ b/files/configs/i3/i3/config @@ -0,0 +1,293 @@ +# Please see http://i3wm.org/docs/userguide.html for a complete reference! + +set $mod Mod4 + +# Configure border style +default_border pixel 1 +default_floating_border normal + +# Hide borders +hide_edge_borders none + +# Window title font +font xft:URWGothic-Book 11 + +# Use Mouse+$mod to drag floating windows +floating_modifier $mod + +# Focus follows mouse +focus_follows_mouse no + +# change container layout (stacked, tabbed, toggle split) +bindsym $mod+s layout stacking +bindsym $mod+d layout toggle split + +# Set screen resolution to 1920x1080 +#exec --no-startup-id xrandr --output eDP-1 --mode 1920x1080 + +# Enable touchpad natural scrolling +exec_always --no-startup-id xinput set-prop "bcm5974" "libinput Natural Scrolling Enabled" 1 + +bindsym $mod+Shift+Return exec gnome-terminal +bindsym $mod+Shift+w exec vivaldi-stable +bindsym $mod+Shift+f exec gnome-terminal -- ranger +bindsym $mod+Shift+e exec mousepad +bindsym $mod+Shift+p exec keepassxc + +bindsym $mod+space --release exec "rofi -combi-modi drun,window,ssh -show combi -modi combi" +bindsym $mod+q kill + +bindsym $mod+Ctrl+p exec pavucontrol +bindsym $mod+Ctrl+b exec gnome-terminal -- bmenu +bindsym $mod+Print --release exec --no-startup-id flameshot gui + +# Autostart applications +exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 +exec --no-startup-id nitrogen --restore; sleep 1; picom -b +exec --no-startup-id nm-applet +exec --no-startup-id blueman-applet +exec --no-startup-id xautolock -time 10 -locker blurlock +exec --no-startup-id keepassxc --keyfile /home/kalle/kgokeyfile /home/kalle/Passwords.kdbx + +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right + +bindsym $mod+Shift+Left move left +bindsym $mod+Shift+Down move down +bindsym $mod+Shift+Up move up +bindsym $mod+Shift+Right move right + +bindsym $mod+z split toggle +bindsym $mod+f fullscreen toggle +bindsym $mod+Shift+space floating toggle + +bindsym $mod+Shift+minus move scratchpad +bindsym $mod+minus scratchpad show + +bindsym $mod+Ctrl+Right workspace next +bindsym $mod+Ctrl+Left workspace prev + +# Workspace names +# Eg: set $ws1 1:mail +# set $ws2 2: +set $ws1 1 +set $ws2 2 +set $ws3 3 +set $ws4 4 +set $ws5 5 +set $ws6 6 +set $ws7 7 +set $ws8 8 + +# Switch to workspace +bindsym $mod+1 workspace number $ws1 +bindsym $mod+2 workspace number $ws2 +bindsym $mod+3 workspace number $ws3 +bindsym $mod+4 workspace number $ws4 +bindsym $mod+5 workspace number $ws5 +bindsym $mod+6 workspace number $ws6 +bindsym $mod+7 workspace number $ws7 +bindsym $mod+8 workspace number $ws8 + +# Move to workspace with focused container +bindsym $mod+Shift+1 move container to workspace $ws1; workspace $ws1 +bindsym $mod+Shift+2 move container to workspace $ws2; workspace $ws2 +bindsym $mod+Shift+3 move container to workspace $ws3; workspace $ws3 +bindsym $mod+Shift+4 move container to workspace $ws4; workspace $ws4 +bindsym $mod+Shift+5 move container to workspace $ws5; workspace $ws5 +bindsym $mod+Shift+6 move container to workspace $ws6; workspace $ws6 +bindsym $mod+Shift+7 move container to workspace $ws7; workspace $ws7 +bindsym $mod+Shift+8 move container to workspace $ws8; workspace $ws8 + +# Open applications on specific workspaces +# assign [class="Thunderbird"] $ws1 +# assign [class="Pcmanfm"] $ws3 +# assign [class="Skype"] $ws5 + +# Open specific applications in floating mode +for_window [title="alsamixer"] floating enable border pixel 1 +for_window [class="calamares"] floating enable border normal +for_window [title="File Transfer*"] floating enable +for_window [class="Galculator"] floating enable border pixel 1 +for_window [class="GParted"] floating enable border normal +for_window [class="Lightdm-settings"] floating enable +for_window [class="Lxappearance"] floating enable sticky enable border normal +for_window [class="Nitrogen"] floating enable sticky enable border normal +for_window [class="Pavucontrol"] floating enable +for_window [class="Simple-scan"] floating enable border normal +for_window [class="(?i)System-config-printer.py"] floating enable border normal +for_window [class="Skype"] floating enable border normal +for_window [class="Timeset-gui"] floating enable border normal +for_window [class="SimpleScreenRecorder"] floating enable border normal +for_window [class="MPlayer"] floating enable +for_window [class="Spotify"] floating enable + +# switch to workspace with urgent window automatically +for_window [urgent=latest] focus + +# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) +bindsym $mod+Ctrl+r restart + +# Set shut down, restart and locking features +bindsym $mod+Ctrl+Delete mode "$mode_system" +set $mode_system (e)xit, switch_(u)ser, (h)ibernate, (r)eboot, (s)hutdown +mode "$mode_system" { + bindsym u exec --no-startup-id i3exit switch_user, mode "default" + bindsym e exec --no-startup-id i3exit logout, mode "default" + bindsym h exec --no-startup-id i3exit hibernate, mode "default" + bindsym r exec --no-startup-id i3exit reboot, mode "default" + bindsym s exec --no-startup-id i3exit shutdown, mode "default" + + # exit system mode: "Enter" or "Escape" + bindsym Return mode "default" + bindsym Escape mode "default" +} + +# Resize window (you can also use the mouse for that) +bindsym $mod+r mode "resize" +mode "resize" { + # 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 + + # exit resize mode: Enter or Escape + bindsym Return mode "default" + bindsym Escape mode "default" +} + +# Lock screen +bindsym $mod+l exec --no-startup-id blurlock + + +# Color palette used for the terminal ( ~/.Xresources file ) +# Colors are gathered based on the documentation: +# https://i3wm.org/docs/userguide.html#xresources +# Change the variable name at the place you want to match the color +# of your terminal like this: +# [example] +# If you want your bar to have the same background color as your +# terminal background change the line 362 from: +# background #14191D +# to: +# background $term_background +# Same logic applied to everything else. +set_from_resource $term_background background +set_from_resource $term_foreground foreground +set_from_resource $term_color0 color0 +set_from_resource $term_color1 color1 +set_from_resource $term_color2 color2 +set_from_resource $term_color3 color3 +set_from_resource $term_color4 color4 +set_from_resource $term_color5 color5 +set_from_resource $term_color6 color6 +set_from_resource $term_color7 color7 +set_from_resource $term_color8 color8 +set_from_resource $term_color9 color9 +set_from_resource $term_color10 color10 +set_from_resource $term_color11 color11 +set_from_resource $term_color12 color12 +set_from_resource $term_color13 color13 +set_from_resource $term_color14 color14 +set_from_resource $term_color15 color15 + +# Start i3bar +bar { + i3bar_command i3bar + status_command i3blocks + position bottom + + # please set your primary output first. Example: 'xrandr --output eDP1 --primary' + # tray_output primary + # tray_output eDP1 + + bindsym button4 nop + bindsym button5 nop + strip_workspace_numbers yes + + colors { + background #222D31 + statusline #F9FAF9 + separator #454947 + + # border backgr text + focused_workspace #F9FAF9 #16a085 #292F34 + active_workspace #595B5B #353836 #FDF6E3 + inactive_workspace #595B5B #222D31 #EEE8D5 + binding_mode #16a085 #2C2C2C #F9FAF9 + urgent_workspace #16a085 #FDF6E3 #E5201D + } +} + +# hide/unhide i3bar +bindsym $mod+m bar mode toggle + +# Theme colors +# class border backgr. text indic. child_border + client.focused #556064 #556064 #80FFF9 #FDF6E3 + client.focused_inactive #2F3D44 #2F3D44 #1ABC9C #454948 + client.unfocused #2F3D44 #2F3D44 #1ABC9C #454948 + client.urgent #CB4B16 #FDF6E3 #1ABC9C #268BD2 + client.placeholder #000000 #0c0c0c #ffffff #000000 + + client.background #2B2C2B + +############################# +### settings for i3-gaps: ### +############################# + +# Set inner/outer gaps +gaps inner 5 +gaps outer 0 + +# Additionally, you can issue commands with the following syntax. This is useful to bind keys to changing the gap size. +# gaps inner|outer current|all set|plus|minus +# gaps inner all set 10 +# gaps outer all plus 5 + +# Smart gaps (gaps used if only more than one container on the workspace) +smart_gaps on + +# Smart borders (draw borders around container only if it is not the only container on this workspace) +# on|no_gaps (on=always activate and no_gaps=only activate if the gap size to the edge of the screen is 0) +smart_borders on + +# Press $mod+Shift+g to enter the gap mode. Choose o or i for modifying outer/inner gaps. Press one of + / - (in-/decrement for current workspace) or 0 (remove gaps for current workspace). If you also press Shift with these keys, the change will be global for all workspaces. +set $mode_gaps Gaps: (o) outer, (i) inner +set $mode_gaps_outer Outer Gaps: +|-|0 (local), Shift + +|-|0 (global) +set $mode_gaps_inner Inner Gaps: +|-|0 (local), Shift + +|-|0 (global) +bindsym $mod+Shift+g mode "$mode_gaps" + +mode "$mode_gaps" { + bindsym o mode "$mode_gaps_outer" + bindsym i mode "$mode_gaps_inner" + bindsym Return mode "default" + bindsym Escape mode "default" +} +mode "$mode_gaps_inner" { + bindsym plus gaps inner current plus 5 + bindsym minus gaps inner current minus 5 + bindsym 0 gaps inner current set 0 + + bindsym Shift+plus gaps inner all plus 5 + bindsym Shift+minus gaps inner all minus 5 + bindsym Shift+0 gaps inner all set 0 + + bindsym Return mode "default" + bindsym Escape mode "default" +} +mode "$mode_gaps_outer" { + bindsym plus gaps outer current plus 5 + bindsym minus gaps outer current minus 5 + bindsym 0 gaps outer current set 0 + + bindsym Shift+plus gaps outer all plus 5 + bindsym Shift+minus gaps outer all minus 5 + bindsym Shift+0 gaps outer all set 0 + + bindsym Return mode "default" + bindsym Escape mode "default" +} diff --git a/files/configs/i3/myi3blocks/myi3battery b/files/configs/i3/myi3blocks/myi3battery new file mode 100755 index 0000000..ccc0f65 --- /dev/null +++ b/files/configs/i3/myi3blocks/myi3battery @@ -0,0 +1,64 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use utf8; + +my $acpi; +my $status; +my $percent; +my $full_text; +my $short_text; +my $bat_number = $ENV{BLOCK_INSTANCE} || 0; + +# read the first line of the "acpi" command output +open (ACPI, "acpi -b | grep 'Battery $bat_number' |") or die; +$acpi = ; +close(ACPI); + +# fail on unexpected output +if ($acpi !~ /: (\w+), (\d+)%/) { + die "$acpi\n"; +} + +$status = $1; +$percent = $2; +$full_text = "$percent%"; + +if ($status eq 'Discharging') { + $full_text = ' ' . $full_text; +} elsif ($status eq 'Charging') { + $full_text = '⚡ ' . $full_text; +} else { + $full_text = '☻ ' . $full_text; +} + +$short_text = $full_text; + +if ($acpi =~ /(\d\d:\d\d):/) { + $full_text .= " ($1)"; +} + +# print text +print "$full_text\n"; +print "$short_text\n"; + +# consider color and urgent flag only on discharge +if ($status eq 'Discharging') { + + if ($percent < 20) { + print "#FF0000\n"; + } elsif ($percent < 40) { + print "#FFAE00\n"; + } elsif ($percent < 60) { + print "#FFF600\n"; + } elsif ($percent < 85) { + print "#A8FF00\n"; + } + + if ($percent < 5) { + exit(33); + } +} + +exit(0); diff --git a/files/configs/i3/myi3blocks/myi3date b/files/configs/i3/myi3blocks/myi3date new file mode 100755 index 0000000..11dfe97 --- /dev/null +++ b/files/configs/i3/myi3blocks/myi3date @@ -0,0 +1,8 @@ +#!/bin/bash + +echo $(date '+%a, %b %d %I:%M %p') + +case $BLOCK_BUTTON in + 1) gsimplecal ;; + *) ;; +esac diff --git a/files/configs/i3/myi3blocks/myi3load b/files/configs/i3/myi3blocks/myi3load new file mode 100755 index 0000000..355aead --- /dev/null +++ b/files/configs/i3/myi3blocks/myi3load @@ -0,0 +1,22 @@ +#!/bin/bash + +readonly LOAD_AVG=$(cat /proc/loadavg | awk '{print $1,$2,$3}') +LOAD_AVG_1m=$(echo ${LOAD_AVG} | awk '{print $1}') + +echo "${LOAD_AVG}" +echo "${LOAD_AVG}" + +if (( $(echo "$LOAD_AVG_1m > 5.0" | bc -l) )) +then + echo "#FF6666" +elif (( $(echo "$LOAD_AVG_1m > 2.5" | bc -l) )) +then + echo "#FFBF00" +else + echo "#33CC33" +fi + +case $BLOCK_BUTTON in + 1) gnome-terminal -- htop ;; + *) ;; +esac diff --git a/files/configs/i3/myi3blocks/myi3memory b/files/configs/i3/myi3blocks/myi3memory new file mode 100755 index 0000000..ecc4668 --- /dev/null +++ b/files/configs/i3/myi3blocks/myi3memory @@ -0,0 +1,6 @@ +#!/bin/bash + +MEM_STAT=$(free -m | grep Mem | awk '{print $2,$3}') +MEM_USED_MB=${MEM_STAT##* } +MEM_USED_GB=$(echo "scale=2;$MEM_USED_MB/1024" | bc -l) +echo "$MEM_USED_GB GB" diff --git a/files/configs/i3/myi3blocks/myi3temp b/files/configs/i3/myi3blocks/myi3temp new file mode 100755 index 0000000..ce5d75c --- /dev/null +++ b/files/configs/i3/myi3blocks/myi3temp @@ -0,0 +1,18 @@ +#!/bin/bash + +readonly TEMP_RAW=$(sensors | grep Package | sed -n "s/.*+\(.*C\) .*/\1/p") + +echo "${TEMP_RAW}" +echo "${TEMP_RAW}" + +TEMP_ROUND=${TEMP_RAW%.*} + +if (( $(echo "$TEMP_ROUND > 80" | bc -l) )) +then + echo "#FF6666" +elif (( $(echo "$TEMP_ROUND > 60" | bc -l) )) +then + echo "#FFBF00" +else + echo "#33CC33" +fi diff --git a/files/configs/i3/myi3blocks/myi3weather b/files/configs/i3/myi3blocks/myi3weather new file mode 100755 index 0000000..f66a3cc --- /dev/null +++ b/files/configs/i3/myi3blocks/myi3weather @@ -0,0 +1,59 @@ +#!/bin/bash +# Based on http://openweathermap.org/current + +API_KEY="e0160e7f77434e10242b1d7bab182e19" + +# Check on http://openweathermap.org/find +CITY_ID="${BLOCK_INSTANCE}" + +URGENT_LOWER=0 +URGENT_HIGHER=30 + +ICON_SUNNY="" +ICON_CLOUDY="" +ICON_RAINY="" +ICON_STORM="" +ICON_SNOW="" +ICON_FOG="" + +SYMBOL_CELSIUS="℃" + +WEATHER_URL="http://api.openweathermap.org/data/2.5/weather?id=${CITY_ID}&appid=${API_KEY}&units=metric" + +WEATHER_INFO=$(wget -qO- "${WEATHER_URL}") +WEATHER_MAIN=$(echo "${WEATHER_INFO}" | grep -o -e '\"main\":\"[a-Z]*\"' | awk -F ':' '{print $2}' | tr -d '"') +WEATHER_TEMP=$(echo "${WEATHER_INFO}" | grep -o -e '\"temp\":\-\?[0-9]*' | awk -F ':' '{print $2}' | tr -d '"') + +if [[ "${WEATHER_MAIN}" = *Snow* ]]; then + echo "${ICON_SNOW} ${WEATHER_TEMP}${SYMBOL_CELSIUS}" + echo "${ICON_SNOW} ${WEATHER_TEMP}${SYMBOL_CELSIUS}" + echo "" +elif [[ "${WEATHER_MAIN}" = *Rain* ]] || [[ "${WEATHER_MAIN}" = *Drizzle* ]]; then + echo "${ICON_RAINY} ${WEATHER_TEMP}${SYMBOL_CELSIUS}" + echo "${ICON_RAINY} ${WEATHER_TEMP}${SYMBOL_CELSIUS}" + echo "" +elif [[ "${WEATHER_MAIN}" = *Thunderstorm* ]]; then + echo "${ICON_STORM} ${WEATHER_TEMP}${SYMBOL_CELSIUS}" + echo "${ICON_STORM} ${WEATHER_TEMP}${SYMBOL_CELSIUS}" + echo "" +elif [[ "${WEATHER_MAIN}" = *Cloud* ]]; then + echo "${ICON_CLOUDY} ${WEATHER_TEMP}${SYMBOL_CELSIUS}" + echo "${ICON_CLOUDY} ${WEATHER_TEMP}${SYMBOL_CELSIUS}" + echo "" +elif [[ "${WEATHER_MAIN}" = *Clear* ]]; then + echo "${ICON_SUNNY} ${WEATHER_TEMP}${SYMBOL_CELSIUS}" + echo "${ICON_SUNNY} ${WEATHER_TEMP}${SYMBOL_CELSIUS}" + echo "" +elif [[ "${WEATHER_MAIN}" = *Fog* ]] || [[ "${WEATHER_MAIN}" = *Mist* ]]; then + echo "${ICON_FOG} ${WEATHER_TEMP}${SYMBOL_CELSIUS}" + echo "${ICON_FOG} ${WEATHER_TEMP}${SYMBOL_CELSIUS}" + echo "" +else + echo "${WEATHER_MAIN} ${WEATHER_TEMP}${SYMBOL_CELSIUS}" + echo "${WEATHER_MAIN} ${WEATHER_TEMP}${SYMBOL_CELSIUS}" + echo "" +fi + +if [[ "${WEATHER_TEMP}" -lt "${URGENT_LOWER}" ]] || [[ "${WEATHER_TEMP}" -gt "${URGENT_HIGHER}" ]]; then + exit 33 +fi diff --git a/files/configs/misc-scripts/blurlock b/files/configs/misc-scripts/blurlock new file mode 100755 index 0000000..3677623 --- /dev/null +++ b/files/configs/misc-scripts/blurlock @@ -0,0 +1,19 @@ +#!/bin/bash +# /usr/bin/blurlock + +# take screenshot +scrot /tmp/screenshot.png + +# blur it +convert /tmp/screenshot.png -blur 0x12 /tmp/screenshotblur.png +rm /tmp/screenshot.png + +# lock the screen +i3lock -i /tmp/screenshotblur.png + +# sleep 1 adds a small delay to prevent possible race conditions with suspend +sleep 1 + +xset dpms force off + +exit 0 diff --git a/files/configs/misc-scripts/i3exit b/files/configs/misc-scripts/i3exit new file mode 100755 index 0000000..afc9233 --- /dev/null +++ b/files/configs/misc-scripts/i3exit @@ -0,0 +1,32 @@ +#!/bin/sh +# /usr/bin/i3exit + +case "$1" in + lock) + blurlock + ;; + logout) + i3-msg exit + ;; + switch_user) + dm-tool switch-to-greeter + ;; + suspend) + blurlock && systemctl suspend + ;; + hibernate) + blurlock && systemctl hibernate + ;; + reboot) + systemctl reboot + ;; + shutdown) + systemctl poweroff + ;; + *) + echo "== ! i3exit: missing or invalid argument ! ==" + echo "Try again with: lock | logout | switch_user | suspend | hibernate | reboot | shutdown" + exit 2 +esac + +exit 0 diff --git a/files/configs/robbyrussell.zsh-theme b/files/configs/robbyrussell.zsh-theme new file mode 100644 index 0000000..6a11170 --- /dev/null +++ b/files/configs/robbyrussell.zsh-theme @@ -0,0 +1,7 @@ +local ret_status="%(?:%{$fg_bold[green]%}🞂🞂:%{$fg_bold[red]%}🞂🞂)" +PROMPT='%{$fg_bold[cyan]%}%c%{$reset_color%} $(git_prompt_info) ${ret_status}%{$reset_color%} ' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}🟍" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" diff --git a/files/configs/tmux.conf b/files/configs/tmux.conf new file mode 100644 index 0000000..a7db6b5 --- /dev/null +++ b/files/configs/tmux.conf @@ -0,0 +1,52 @@ +############################## +# _ +# | |_ _ __ ___ _ ___ __ +# | __| '_ ` _ \| | | \ \/ / +# | |_| | | | | | |_| |> < +# \__|_| |_| |_|\__,_/_/\_\ +# +############################# + +# start window indexing at one instead of zero +set -g base-index 1 + +# ============ +# Key Bindings +# ============ +bind R source-file ~/.tmux.conf \; display-message "Config reloaded..." +bind -n F2 new-window +# Window Navigation +bind -n F3 prev +bind -n F4 next +# Split Windows +bind -n F5 split-window -v +bind -n F6 split-window -h +bind -n F7 copy-mode +bind -n F8 command-prompt 'rename-window %%' +bind -n F9 break-pane +bind -n F10 set-window-option synchronize-panes +bind -n F12 kill-pane +# Pane Navigation +bind -n M-Left select-pane -L +bind -n M-Right select-pane -R +bind -n M-Up select-pane -U +bind -n M-Down select-pane -D + +# =============== +# General Options +# =============== +set -g allow-rename off +set -g history-limit 10000 +set -g default-terminal "xterm-256color" +set-option -g default-command zsh +# No delay for escape key press +set -sg escape-time 0 + +# ======================== +# set window notifications +# ======================== +set-option -g visual-activity on +set-option -g visual-bell on +set-window-option -g monitor-activity on +set -g status-interval 2 +source /usr/lib/python3.7/site-packages/powerline/bindings/tmux/powerline.conf diff --git a/files/pictures/monk-wallpaper.jpg b/files/pictures/monk-wallpaper.jpg new file mode 100644 index 0000000..40e8d22 Binary files /dev/null and b/files/pictures/monk-wallpaper.jpg differ diff --git a/inventory b/inventory new file mode 100644 index 0000000..45b5d23 --- /dev/null +++ b/inventory @@ -0,0 +1,2 @@ +[localhost] +127.0.0.1 ansible_connection=local diff --git a/setup.yaml b/setup.yaml new file mode 100644 index 0000000..e69de29 diff --git a/tasks/configure-i3.yaml b/tasks/configure-i3.yaml new file mode 100644 index 0000000..732e9fc --- /dev/null +++ b/tasks/configure-i3.yaml @@ -0,0 +1,72 @@ +- name: i3 Configuration - Create .i3 directory + become_user: "{{ username }}" + file: + path: "{{ userhome }}/.i3" + state: directory + +- name: i3 Configuration - Copy "{{ userhome }}/.i3/config" + become_user: "{{ username }}" + copy: + src: "files/configs/i3/i3/config" + dest: "{{ userhome }}/.i3/config" + +- name: i3 Configuration - Copy "{{ userhome }}/.config/picom.conf" + become_user: "{{ username }}" + copy: + src: "files/configs/i3/config/picom.conf" + dest: "{{ userhome }}/.config/picom.conf" + +- name: i3 Configuration - Create dunst directory + become_user: "{{ username }}" + file: + path: "{{ userhome }}/.config/dunst" + state: directory + +- name: i3 Configuration - Copy "{{ userhome }}/.config/dunst/dunstrc" + become_user: "{{ username }}" + copy: + src: "files/configs/i3/config/dunst/dunstrc" + dest: "{{ userhome }}/.config/dunst/dunstrc" + +- name: i3 Configuration - Create i3blocks directory + become_user: "{{ username }}" + file: + path: "{{ userhome }}/.config/i3blocks" + state: directory + +- name: i3 Configuration - Copy "{{ userhome }}/.config/i3blocks/config" + become_user: "{{ username }}" + copy: + src: "files/configs/i3/config/i3blocks/config" + dest: "{{ userhome }}/.config/i3blocks/config" + +- name: i3 Configuration - Create rofi directory + become_user: "{{ username }}" + file: + path: "{{ userhome }}/.config/rofi" + state: directory + +- name: i3 Configuration - Copy "{{ userhome }}/.config/rofi/config.rasi" + become_user: "{{ username }}" + copy: + src: "files/configs/i3/config/rofi/config.rasi" + dest: "{{ userhome }}/.config/rofi/config.rasi" + +- name: i3 Configuration - Copy "{{ userhome }}/opt/scripts/myi3blocks" scripts + become_user: "{{ username }}" + copy: + src: files/configs/i3/myi3blocks/ + dest: "{{ userhome }}/opt/scripts/myi3blocks/" + mode: "0755" + +- name: i3 Configuration - Copy i3exit script + copy: + src: files/configs/misc-scripts/i3exit + dest: /usr/bin/i3exit + mode: "0755" + +- name: i3 Configuration - Copy blurlock script + copy: + src: files/configs/misc-scripts/blurlock + dest: /usr/bin/blurlock + mode: "0755" diff --git a/tasks/configure-software-fedora.yaml b/tasks/configure-software-fedora.yaml new file mode 100644 index 0000000..7379fe3 --- /dev/null +++ b/tasks/configure-software-fedora.yaml @@ -0,0 +1,24 @@ +- name: Package Installation - Productivity Tools + package: + name: ["gnome-terminal", "ranger", "mousepad"] + state: present + +- name: Package Installation - Development Tools + package: + name: ["binutils"] + state: present + +- name: Package Installation - Media + package: + name: ["flameshot", "ImageMagick", "scrot"] + state: present + +- name: Package Installation - System Desktop + package: + name: ["rofi", "nitrogen", "arandr", "dunst"] + state: present + +- name: Package Installation - I3 Desktop + package: + name: ["i3", "i3lock", "i3blocks"] + state: present diff --git a/tasks/configure-software-manjaro.yaml b/tasks/configure-software-manjaro.yaml new file mode 100644 index 0000000..ab425d7 --- /dev/null +++ b/tasks/configure-software-manjaro.yaml @@ -0,0 +1,24 @@ +- name: Package Installation - Update Pacman package cache + pacman: + update_cache: true + changed_when: false + +- name: Package Installation - Productivity Tools + package: + name: ["gnome-terminal", "ranger", "mousepad"] + state: present + +- name: Package Installation - Development Tools + package: + name: ["binutils"] + state: present + +- name: Package Installation - Media + package: + name: ["flameshot", "imagemagick", "scrot"] + state: present + +- name: Package Installation - System Desktop + package: + name: ["rofi", "nitrogen", "dunst", "i3blocks"] + state: present diff --git a/tasks/configure-software-ubuntu.yaml b/tasks/configure-software-ubuntu.yaml new file mode 100644 index 0000000..7eb1744 --- /dev/null +++ b/tasks/configure-software-ubuntu.yaml @@ -0,0 +1,24 @@ +- name: Package Installation - Update Apt package cache + apt: + update_cache: true + changed_when: false + +- name: Package Installation - Productivity Tools + package: + name: ["gnome-terminal", "ranger", "mousepad"] + state: present + +- name: Package Installation - Development Tools + package: + name: ["binutils"] + state: present + +- name: Package Installation - Media + package: + name: ["flameshot", "imagemagick", "scrot"] + state: present + +- name: Package Installation - System Desktop + package: + name: ["rofi", "nitrogen", "dunst", "i3blocks"] + state: present diff --git a/tasks/configure-user.yaml b/tasks/configure-user.yaml new file mode 100644 index 0000000..9e7c04b --- /dev/null +++ b/tasks/configure-user.yaml @@ -0,0 +1,25 @@ +- name: User Configuration - Add sudoers entry for "{{ username }}" + lineinfile: + path: "/etc/sudoers.d/{{ username }}" + line: "{{ username }} ALL=(ALL) NOPASSWD: ALL" + create: yes + mode: "0640" + +- name: User Configuration - Copy tmux configuration + copy: + src: "files/configs/tmux.conf" + dest: "{{ userhome }}/.tmux.conf" + owner: "{{ username }}" + group: "{{ username }}" + +- name: User Configuration - Copy pictures + become_user: "{{ username }}" + copy: + src: files/pictures/ + dest: "{{ userhome }}/Pictures/" + +- name: User Configuration - Create opt/scripts directory + become_user: "{{ username }}" + file: + path: "{{ userhome }}/opt/scripts" + state: directory