From 38a4e8e941ee07a15b0aa5d388a69df061585ec9 Mon Sep 17 00:00:00 2001 From: Matt Singleton Date: Tue, 11 Jun 2024 20:51:49 -0500 Subject: separate sway-de folder causes problems with overlapping stow responsibilities --- stow/foot/.config/foot/foot.ini | 162 +++++++++++++ stow/mako/.config/mako/config | 5 + stow/rofi/.config/rofi/config.rasi | 153 ++++++++++++ stow/rofi/.config/rofi/themes/totus.rasi | 174 ++++++++++++++ stow/rofi/.local/bin/dmenu-wl | 8 + stow/sway/.config/sway/config | 261 +++++++++++++++++++++ stow/sway/.local/bin/dnf-needs-restarting | 26 ++ stow/swaylock/.config/swaylock/config | 2 + stow/udiskie/.config/systemd/user/udiskie.service | 15 ++ stow/waybar/.config/waybar/config | 87 +++++++ stow/waybar/.config/waybar/style.css | 102 ++++++++ .../.config/systemd/user/xdg-names.service | 14 ++ stow/xdg-names/.config/xdg-names.ini | 25 ++ stow/xdg-names/.local/bin/xdg-names.py | 160 +++++++++++++ 14 files changed, 1194 insertions(+) create mode 100644 stow/foot/.config/foot/foot.ini create mode 100644 stow/mako/.config/mako/config create mode 100644 stow/rofi/.config/rofi/config.rasi create mode 100644 stow/rofi/.config/rofi/themes/totus.rasi create mode 100755 stow/rofi/.local/bin/dmenu-wl create mode 100644 stow/sway/.config/sway/config create mode 100755 stow/sway/.local/bin/dnf-needs-restarting create mode 100644 stow/swaylock/.config/swaylock/config create mode 100644 stow/udiskie/.config/systemd/user/udiskie.service create mode 100644 stow/waybar/.config/waybar/config create mode 100644 stow/waybar/.config/waybar/style.css create mode 100644 stow/xdg-names/.config/systemd/user/xdg-names.service create mode 100644 stow/xdg-names/.config/xdg-names.ini create mode 100755 stow/xdg-names/.local/bin/xdg-names.py (limited to 'stow') diff --git a/stow/foot/.config/foot/foot.ini b/stow/foot/.config/foot/foot.ini new file mode 100644 index 0000000..98964ba --- /dev/null +++ b/stow/foot/.config/foot/foot.ini @@ -0,0 +1,162 @@ +# -*- conf -*- + +# shell=$SHELL (if set, otherwise user's default shell from /etc/passwd) +# term=foot (or xterm-256color if built with -Dterminfo=disabled) +# login-shell=no + +font=Intel One Mono:size=9 +font-bold=Intel One Mono Medium:size=9 +# font-bold= +# font-italic= +# font-bold-italic= +# line-height= +letter-spacing=-1px +# horizontal-letter-offset=0 +# vertical-letter-offset=0 +# box-drawings-uses-font-glyphs=no +dpi-aware=yes + +# initial-window-size-pixels=700x500 # Or, +# initial-window-size-chars= +# initial-window-mode=windowed +# pad=2x2 # optionally append 'center' +# resize-delay-ms=100 + +# notify=notify-send -a foot -i foot ${title} ${body} +# url-launch=xdg-open ${url} + +# bold-text-in-bright=no +# bell=none +# word-delimiters=,│`|:"'()[]{}<> +# jump-label-letters=sadfjklewcmpgh +# selection-target=primary +# workers= +# osc8-underline=url-mode + +[scrollback] +# lines=1000 +# multiplier=3.0 +# indicator-position=relative +# indicator-format= + +[cursor] +# style=block +# color=111111 dcdccc +# blink=no + +[mouse] +hide-when-typing=yes +# alternate-scroll-mode=yes + +[colors] +# alpha=1.0 +background=eff0f2 +foreground=4a4b4e +regular0=4a4b4e +regular1=a32a3a +regular2=206620 +regular3=745300 +regular4=4b529a +regular5=8d377e +regular6=086784 +regular7=dee2e0 +bright0=676364 +bright1=a64822 +bright2=187408 +bright3=8b590a +bright4=5c59b2 +bright5=8e45a8 +bright6=3f649c +bright7=eff0f2 + +background=ffffff +foreground=4a484d +regular0=4a484d +regular1=a50000 +regular2=005d26 +regular3=714700 +regular4=1d3ccf +regular5=88267a +regular6=185570 +regular7=efefef +bright0=5e4b4f +bright1=992030 +bright2=4a5500 +bright3=8a3600 +bright4=2d45b0 +bright5=700dc9 +bright6=005289 +bright7=ffffff + + +# selection-foreground= +# selection-background= +# jump-labels= +# urls= + +[csd] +# preferred=server +# size=26 +# color= +# button-width=26 +# button-minimize-color= +# button-maximize-color= +# button-close-color= + +[key-bindings] +# scrollback-up-page=Shift+Page_Up +# scrollback-up-half-page=none +# scrollback-up-line=none +# scrollback-down-page=Shift+Page_Down +# scrollback-down-half-page=none +# scrollback-down-line=none +# clipboard-copy=Control+Shift+c +# clipboard-paste=Control+Shift+v +# primary-paste=Shift+Insert +# search-start=Control+Shift+r +# font-increase=Control+plus Control+equal Control+KP_Add +# font-decrease=Control+minus Control+KP_Subtract +# font-reset=Control+0 Control+KP_0 +# spawn-terminal=Control+Shift+n +# minimize=none +# maximize=none +# fullscreen=none +# pipe-visible=[sh -c "xurls | fuzzel | xargs -r firefox"] none +# pipe-scrollback=[sh -c "xurls | fuzzel | xargs -r firefox"] none +# pipe-selected=[xargs -r firefox] none +# show-urls-launch=Control+Shift+u +# show-urls-copy=none + +[search-bindings] +# cancel=Control+g Escape +# commit=Return +# find-prev=Control+r +# find-next=Control+s +# cursor-left=Left Control+b +# cursor-left-word=Control+Left Mod1+b +# cursor-right=Right Control+f +# cursor-right-word=Control+Right Mod1+f +# cursor-home=Home Control+a +# cursor-end=End Control+e +# delete-prev=BackSpace +# delete-prev-word=Mod1+BackSpace Control+BackSpace +# delete-next=Delete +# delete-next-word=Mod1+d Control+Delete +# extend-to-word-boundary=Control+w +# extend-to-next-whitespace=Control+Shift+w +# clipboard-paste=Control+v Control+y +# primary-paste=Shift+Insert + +#[url-bindings] +# cancel=Control+g Control+d Escape +# toggle-url-visible=t + +[mouse-bindings] +# primary-paste=BTN_MIDDLE +# select-begin=BTN_LEFT +# select-begin-block=Control+BTN_LEFT +# select-extend=BTN_RIGHT +# select-extend-character-wise=Control+BTN_RIGHT +# select-word=BTN_LEFT-2 +# select-word-whitespace=Control+BTN_LEFT-2 +# select-row=BTN_LEFT-3 diff --git a/stow/mako/.config/mako/config b/stow/mako/.config/mako/config new file mode 100644 index 0000000..35a08d8 --- /dev/null +++ b/stow/mako/.config/mako/config @@ -0,0 +1,5 @@ +font=Noto Sans 10 +background-color=#efefef +text-color=#4a484d +border-color=#005289 +progress-color=over #dedede diff --git a/stow/rofi/.config/rofi/config.rasi b/stow/rofi/.config/rofi/config.rasi new file mode 100644 index 0000000..2a37aca --- /dev/null +++ b/stow/rofi/.config/rofi/config.rasi @@ -0,0 +1,153 @@ +configuration { +/* modes: "window,drun,run,ssh";*/ +/* font: "mono 12";*/ +/* location: 0;*/ +/* yoffset: 0;*/ +/* xoffset: 0;*/ +/* fixed-num-lines: true;*/ +/* show-icons: false;*/ +/* terminal: "rofi-sensible-terminal";*/ +/* ssh-client: "ssh";*/ +/* ssh-command: "{terminal} -e {ssh-client} {host} [-p {port}]";*/ +/* run-command: "{cmd}";*/ +/* run-list-command: "";*/ +/* run-shell-command: "{terminal} -e {cmd}";*/ +/* window-command: "wmctrl -i -R {window}";*/ +/* window-match-fields: "all";*/ +/* icon-theme: ;*/ +/* drun-match-fields: "name,generic,exec,categories,keywords";*/ +/* drun-categories: ;*/ +/* drun-show-actions: false;*/ +/* drun-display-format: "{name} [({generic})]";*/ +/* drun-url-launcher: "xdg-open";*/ +/* disable-history: false;*/ +/* ignored-prefixes: "";*/ +/* sort: false;*/ +/* sorting-method: "normal";*/ +/* case-sensitive: false;*/ +/* cycle: true;*/ +/* sidebar-mode: false;*/ +/* hover-select: false;*/ +/* eh: 1;*/ +/* auto-select: false;*/ +/* parse-hosts: false;*/ +/* parse-known-hosts: true;*/ +/* combi-modes: "window,run";*/ +/* matching: "normal";*/ +/* tokenize: true;*/ +/* m: "-5";*/ +/* filter: ;*/ +/* dpi: -1;*/ +/* threads: 0;*/ +/* scroll-method: 0;*/ +/* window-format: "{w} {c} {t}";*/ +/* click-to-exit: true;*/ +/* max-history-size: 25;*/ +/* combi-hide-mode-prefix: false;*/ +/* combi-display-format: "{mode} {text}";*/ +/* matching-negate-char: '-' /* unsupported */;*/ +/* cache-dir: ;*/ +/* window-thumbnail: false;*/ +/* drun-use-desktop-cache: false;*/ +/* drun-reload-desktop-cache: false;*/ +/* normalize-match: false;*/ +/* steal-focus: false;*/ +/* application-fallback-icon: ;*/ +/* refilter-timeout-limit: 300;*/ +/* xserver-i300-workaround: false;*/ +/* pid: "/run/user/1000/rofi.pid";*/ +/* display-window: ;*/ +/* display-run: ;*/ +/* display-ssh: ;*/ +/* display-drun: ;*/ +/* display-combi: ;*/ +/* display-keys: ;*/ +/* display-filebrowser: ;*/ +/* kb-primary-paste: "Control+V,Shift+Insert";*/ +/* kb-secondary-paste: "Control+v,Insert";*/ +/* kb-secondary-copy: "Control+c";*/ +/* kb-clear-line: "Control+w";*/ +/* kb-move-front: "Control+a";*/ +/* kb-move-end: "Control+e";*/ +/* kb-move-word-back: "Alt+b,Control+Left";*/ +/* kb-move-word-forward: "Alt+f,Control+Right";*/ +/* kb-move-char-back: "Left,Control+b";*/ +/* kb-move-char-forward: "Right,Control+f";*/ +/* kb-remove-word-back: "Control+Alt+h,Control+BackSpace";*/ +/* kb-remove-word-forward: "Control+Alt+d";*/ +/* kb-remove-char-forward: "Delete,Control+d";*/ +/* kb-remove-char-back: "BackSpace,Shift+BackSpace,Control+h";*/ +/* kb-remove-to-eol: "Control+k";*/ +/* kb-remove-to-sol: "Control+u";*/ +/* kb-accept-entry: "Control+j,Control+m,Return,KP_Enter";*/ +/* kb-accept-custom: "Control+Return";*/ +/* kb-accept-custom-alt: "Control+Shift+Return";*/ +/* kb-accept-alt: "Shift+Return";*/ +/* kb-delete-entry: "Shift+Delete";*/ +/* kb-mode-next: "Shift+Right,Control+Tab";*/ +/* kb-mode-previous: "Shift+Left,Control+ISO_Left_Tab";*/ +/* kb-mode-complete: "Control+l";*/ +/* kb-row-left: "Control+Page_Up";*/ +/* kb-row-right: "Control+Page_Down";*/ +/* kb-row-up: "Up,Control+p";*/ +/* kb-row-down: "Down,Control+n";*/ +/* kb-row-tab: "";*/ +/* kb-element-next: "Tab";*/ +/* kb-element-prev: "ISO_Left_Tab";*/ +/* kb-page-prev: "Page_Up";*/ +/* kb-page-next: "Page_Down";*/ +/* kb-row-first: "Home,KP_Home";*/ +/* kb-row-last: "End,KP_End";*/ +/* kb-row-select: "Control+space";*/ +/* kb-screenshot: "Alt+S";*/ +/* kb-ellipsize: "Alt+period";*/ +/* kb-toggle-case-sensitivity: "grave,dead_grave";*/ +/* kb-toggle-sort: "Alt+grave";*/ +/* kb-cancel: "Escape,Control+g,Control+bracketleft";*/ +/* kb-custom-1: "Alt+1";*/ +/* kb-custom-2: "Alt+2";*/ +/* kb-custom-3: "Alt+3";*/ +/* kb-custom-4: "Alt+4";*/ +/* kb-custom-5: "Alt+5";*/ +/* kb-custom-6: "Alt+6";*/ +/* kb-custom-7: "Alt+7";*/ +/* kb-custom-8: "Alt+8";*/ +/* kb-custom-9: "Alt+9";*/ +/* kb-custom-10: "Alt+0";*/ +/* kb-custom-11: "Alt+exclam";*/ +/* kb-custom-12: "Alt+at";*/ +/* kb-custom-13: "Alt+numbersign";*/ +/* kb-custom-14: "Alt+dollar";*/ +/* kb-custom-15: "Alt+percent";*/ +/* kb-custom-16: "Alt+dead_circumflex";*/ +/* kb-custom-17: "Alt+ampersand";*/ +/* kb-custom-18: "Alt+asterisk";*/ +/* kb-custom-19: "Alt+parenleft";*/ +/* kb-select-1: "Super+1";*/ +/* kb-select-2: "Super+2";*/ +/* kb-select-3: "Super+3";*/ +/* kb-select-4: "Super+4";*/ +/* kb-select-5: "Super+5";*/ +/* kb-select-6: "Super+6";*/ +/* kb-select-7: "Super+7";*/ +/* kb-select-8: "Super+8";*/ +/* kb-select-9: "Super+9";*/ +/* kb-select-10: "Super+0";*/ +/* ml-row-left: "ScrollLeft";*/ +/* ml-row-right: "ScrollRight";*/ +/* ml-row-up: "ScrollUp";*/ +/* ml-row-down: "ScrollDown";*/ +/* me-select-entry: "MousePrimary";*/ +/* me-accept-entry: "MouseDPrimary";*/ +/* me-accept-custom: "Control+MouseDPrimary";*/ + timeout { + action: "kb-cancel"; + delay: 0; + } + filebrowser { + directories-first: true; + sorting-method: "name"; + } +} + +@theme "totus" diff --git a/stow/rofi/.config/rofi/themes/totus.rasi b/stow/rofi/.config/rofi/themes/totus.rasi new file mode 100644 index 0000000..227f5f8 --- /dev/null +++ b/stow/rofi/.config/rofi/themes/totus.rasi @@ -0,0 +1,174 @@ +/** + * rofi -dump-theme output. + * Rofi version: 1.7.5+wayland2 + **/ +* { + background: rgba ( 240, 240, 240, 100 % ); + foreground: rgba ( 74, 72, 76, 100 % ); + lightfg: rgba ( 93, 75, 79, 100 % ); + lightbg: rgba ( 222, 222, 222, 100 % ); + red: rgba ( 151, 32, 48, 100 % ); + blue: rgba ( 45, 69, 174, 100 % ); + cyan: rgba ( 0, 83, 138, 100% ); + selected-active-foreground: var(background); + separatorcolor: var(foreground); + urgent-foreground: var(red); + alternate-urgent-background: var(lightbg); + background-color: transparent; + border-color: var(foreground); + normal-background: var(background); + selected-urgent-background: var(red); + alternate-active-background: var(lightbg); + spacing: 2; + alternate-normal-foreground: var(foreground); + urgent-background: var(background); + selected-normal-foreground: var(background); + active-foreground: var(blue); + selected-active-background: var(blue); + active-background: var(background); + selected-normal-background: var(cyan); + alternate-normal-background: var(lightbg); + selected-urgent-foreground: var(background); + normal-foreground: var(foreground); + alternate-urgent-foreground: var(red); + alternate-active-foreground: var(blue); +} +element { + padding: 1px ; + cursor: pointer; + spacing: 5px ; + border: 0; +} +element normal.normal { + background-color: var(normal-background); + text-color: var(normal-foreground); +} +element normal.urgent { + background-color: var(urgent-background); + text-color: var(urgent-foreground); +} +element normal.active { + background-color: var(active-background); + text-color: var(active-foreground); +} +element selected.normal { + background-color: var(selected-normal-background); + text-color: var(selected-normal-foreground); +} +element selected.urgent { + background-color: var(selected-urgent-background); + text-color: var(selected-urgent-foreground); +} +element selected.active { + background-color: var(selected-active-background); + text-color: var(selected-active-foreground); +} +element alternate.normal { + background-color: var(alternate-normal-background); + text-color: var(alternate-normal-foreground); +} +element alternate.urgent { + background-color: var(alternate-urgent-background); + text-color: var(alternate-urgent-foreground); +} +element alternate.active { + background-color: var(alternate-active-background); + text-color: var(alternate-active-foreground); +} +element-text { + background-color: transparent; + cursor: inherit; + highlight: inherit; + text-color: inherit; +} +element-icon { + background-color: transparent; + size: 1.0000em ; + cursor: inherit; + text-color: inherit; +} +window { + padding: 5; + background-color: var(background); + border: 1; +} +mainbox { + padding: 0; + border: 0; +} +message { + padding: 1px ; + border-color: var(separatorcolor); + border: 2px dash 0px 0px ; +} +textbox { + text-color: var(foreground); +} +listview { + padding: 2px 0px 0px ; + scrollbar: true; + border-color: var(separatorcolor); + spacing: 2px ; + fixed-height: 0; + border: 2px dash 0px 0px ; +} +scrollbar { + width: 4px ; + padding: 0; + handle-width: 8px ; + border: 0; + handle-color: var(normal-foreground); +} +sidebar { + border-color: var(separatorcolor); + border: 2px dash 0px 0px ; +} +button { + cursor: pointer; + spacing: 0; + text-color: var(normal-foreground); +} +button selected { + background-color: var(selected-normal-background); + text-color: var(selected-normal-foreground); +} +num-filtered-rows { + expand: false; + text-color: Gray; +} +num-rows { + expand: false; + text-color: Gray; +} +textbox-num-sep { + expand: false; + str: "/"; + text-color: Gray; +} +inputbar { + padding: 1px ; + spacing: 0px ; + text-color: var(normal-foreground); + children: [ "prompt","textbox-prompt-colon","entry","num-filtered-rows","textbox-num-sep","num-rows","case-indicator" ]; +} +case-indicator { + spacing: 0; + text-color: var(normal-foreground); +} +entry { + text-color: var(normal-foreground); + cursor: text; + spacing: 0; + placeholder-color: Gray; + placeholder: "Type to filter"; +} +prompt { + spacing: 0; + text-color: var(normal-foreground); +} +textbox-prompt-colon { + margin: 0px 0.3000em 0.0000em 0.0000em ; + expand: false; + str: ":"; + text-color: inherit; +} diff --git a/stow/rofi/.local/bin/dmenu-wl b/stow/rofi/.local/bin/dmenu-wl new file mode 100755 index 0000000..fdc4fa5 --- /dev/null +++ b/stow/rofi/.local/bin/dmenu-wl @@ -0,0 +1,8 @@ +#!/bin/bash +# +# shim to allow wofi to pretend to be dmenu, +# to allow pass to use it + +set -euo pipefail + +rofi -dmenu "$@" diff --git a/stow/sway/.config/sway/config b/stow/sway/.config/sway/config new file mode 100644 index 0000000..32442ad --- /dev/null +++ b/stow/sway/.config/sway/config @@ -0,0 +1,261 @@ +# Default config for sway +# +# Copy this to ~/.config/sway/config and edit it to your liking. +# +# Read `man 5 sway` for a complete reference. + +### Variables +# +# Logo key. Use Mod1 for Alt. +set $mod Mod4 +# Home row direction keys, like vim +set $left h +set $down j +set $up k +set $right l +# Your preferred terminal emulator +# Recommends: foot +set $term foot +# Your preferred application launcher +# Note: pass the final command to swaymsg so that the resulting window can be opened +# on the original workspace that the command was run on. +# Recommends: rofi-wayland +set $rofi_cmd rofi \ + -terminal '$term' +# Shows a combined list of the applications with desktop files and +# executables from PATH. +# TODO: add window with the next release of rofi-wayland +set $menu $rofi_cmd -show combi -combi-modes drun#run -modes combi + +font Noto Sans 9 +default_border pixel 1 +smart_borders on + +### Output configuration +# +# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/) +# Requires: desktop-backgrounds-compat, swaybg +output * bg ~/.local/share/backgrounds/default fill +# +# Example configuration: +# +# output HDMI-A-1 resolution 1920x1080 position 1920,0 +# +# You can get the names of your outputs by running: swaymsg -t get_outputs + +### Idle configuration +# +# Example configuration: +# +# exec swayidle -w \ +# timeout 300 'swaylock -f -c 000000' \ +# timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \ +# before-sleep 'swaylock -f -c 000000' +# +# This will lock your screen after 300 seconds of inactivity, then turn off +# your displays after another 300 seconds, and turn your screens back on when +# resumed. It will also lock your screen before your computer goes to sleep. + +### Input configuration +# +# Example configuration: +# +# input "2:14:SynPS/2_Synaptics_TouchPad" { +# dwt enabled +# tap enabled +# natural_scroll enabled +# middle_emulation enabled +# } +# +# You can get the names of your inputs by running: swaymsg -t get_inputs +# Read `man 5 sway-input` for more information about this section. + + input "type:keyboard" { + xkb_options ctrl:nocaps + } + +### Key bindings +# +# Basics: +# + # Start a terminal + bindsym $mod+Return exec $term + + # Kill focused window + bindsym $mod+Shift+q kill + + # Start your launcher + bindsym $mod+d exec $menu + + # Drag floating windows by holding down $mod and left mouse button. + # Resize them with right mouse button + $mod. + # Despite the name, also works for non-floating windows. + # Change normal to inverse to use left mouse button for resizing and right + # mouse button for dragging. + floating_modifier $mod normal + + # Reload the configuration file + bindsym $mod+Shift+c reload + + # Exit sway (logs you out of your Wayland session) + bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit' + bindsym $mod+Shift+i exec loginctl lock-session +# +# Moving around: +# + # Move your focus around + bindsym $mod+$left focus left + bindsym $mod+$down focus down + bindsym $mod+$up focus up + bindsym $mod+$right focus right + # Or use $mod+[up|down|left|right] + bindsym $mod+Left focus left + bindsym $mod+Down focus down + bindsym $mod+Up focus up + bindsym $mod+Right focus right + + # Move the focused window with the same, but add Shift + bindsym $mod+Shift+$left move left + bindsym $mod+Shift+$down move down + bindsym $mod+Shift+$up move up + bindsym $mod+Shift+$right move right + # Ditto, with arrow keys + bindsym $mod+Shift+Left move left + bindsym $mod+Shift+Down move down + bindsym $mod+Shift+Up move up + bindsym $mod+Shift+Right move right +# +# Workspaces: +# + # Switch to workspace + bindsym $mod+1 workspace number 1 + bindsym $mod+2 workspace number 2 + bindsym $mod+3 workspace number 3 + bindsym $mod+4 workspace number 4 + bindsym $mod+5 workspace number 5 + bindsym $mod+6 workspace number 6 + bindsym $mod+7 workspace number 7 + bindsym $mod+8 workspace number 8 + bindsym $mod+9 workspace number 9 + bindsym $mod+0 workspace number 10 + # Move focused container to workspace + bindsym $mod+Shift+1 move container to workspace number 1 + bindsym $mod+Shift+2 move container to workspace number 2 + bindsym $mod+Shift+3 move container to workspace number 3 + bindsym $mod+Shift+4 move container to workspace number 4 + bindsym $mod+Shift+5 move container to workspace number 5 + bindsym $mod+Shift+6 move container to workspace number 6 + bindsym $mod+Shift+7 move container to workspace number 7 + bindsym $mod+Shift+8 move container to workspace number 8 + bindsym $mod+Shift+9 move container to workspace number 9 + bindsym $mod+Shift+0 move container to workspace number 10 + # Note: workspaces can have any name you want, not just numbers. + # We just use 1-10 as the default. +# +# Layout stuff: +# + # You can "split" the current object of your focus with + # $mod+b or $mod+v, for horizontal and vertical splits + # respectively. + bindsym $mod+b splith + bindsym $mod+v splitv + + # Switch the current container between different layout styles + bindsym $mod+s layout stacking + bindsym $mod+w layout tabbed + bindsym $mod+e layout toggle split + + # Make the current focus fullscreen + bindsym $mod+f fullscreen + + # Toggle the current focus between tiling and floating mode + bindsym $mod+Shift+space floating toggle + + # Swap focus between the tiling area and the floating area + bindsym $mod+space focus mode_toggle + + # Move focus to the parent container + bindsym $mod+a focus parent +# +# Scratchpad: +# + # Sway has a "scratchpad", which is a bag of holding for windows. + # You can send windows there and get them back later. + + # Move the currently focused window to the scratchpad + bindsym $mod+Shift+minus move scratchpad + + # Show the next scratchpad window or hide the focused scratchpad window. + # If there are multiple scratchpad windows, this command cycles through them. + bindsym $mod+minus scratchpad show +# +# Resizing containers: +# +mode "resize" { + # left will shrink the containers width + # right will grow the containers width + # up will shrink the containers height + # down will grow the containers height + bindsym $left resize shrink width 10px + bindsym $down resize grow height 10px + bindsym $up resize shrink height 10px + bindsym $right resize grow width 10px + + # Ditto, with arrow keys + bindsym Left resize shrink width 10px + bindsym Down resize grow height 10px + bindsym Up resize shrink height 10px + bindsym Right resize grow width 10px + + # Return to default mode + bindsym Return mode "default" + bindsym Escape mode "default" +} +bindsym $mod+r mode "resize" + +# +# Theme Colors +# +# derived from tempus totus +# https://gitlab.com/protesilaos/tempus-themes +# +# efefef : white +# 4a484d : black +# 005289 : bright cyan +# 992030 : bright red + +# border bg text ind c_border +client.focused #005289 #efefef #4a484d #992030 #005289 +client.focused_inactive #efefef #efefef #4a484d #992030 #efefef +client.unfocused #efefef #efefef #4a484d #992030 #efefef + +# +# Apps +# + +bindsym $mod+comma exec PATH=~/.local/bin:$PATH /usr/bin/passmenu + +assign [app_id="firefox"] workspace number 1 + +# Include configs from 3 locations: +# - /usr/share/sway/config.d +# - /etc/sway/config.d +# - $XDG_CONFIG_HOME/sway/config.d ($HOME/.config/sway/config.d) +# +# If multiple directories contain the files with the same name, the later +# directory takes precedence; `$XDG_CONFIG_HOME/sway/config.d/20-swayidle.conf` +# will always be loaded instead of `/usr/share/sway/config.d/20-swayidle.conf` +# or `/etc/sway/config.d/20-swayidle.conf` +# +# This mechanism permits overriding our default configuration per-system +# (/etc) or per-user ($XDG_CONFIG_HOME) basis. Just create the file you +# want to modify/override in the higher-level directory. +# +# For example, to disable the default bar from Fedora configs, you'll need to +# $ echo -n > "$HOME/.config/sway/config.d/90-bar.conf" +# +# Note the quoting, the $() and the arguments quoting. All the parts are equally +# important to make the magic work. And if you want to learn the secret behind +# the trick, it's all in the `wordexp(3)`. +# +include '$(/usr/libexec/sway/layered-include "/usr/share/sway/config.d/*.conf" "/etc/sway/config.d/*.conf" "${XDG_CONFIG_HOME:-$HOME/.config}/sway/config.d/*.conf")' diff --git a/stow/sway/.local/bin/dnf-needs-restarting b/stow/sway/.local/bin/dnf-needs-restarting new file mode 100755 index 0000000..7fc6542 --- /dev/null +++ b/stow/sway/.local/bin/dnf-needs-restarting @@ -0,0 +1,26 @@ +#!/bin/bash + +set -euo pipefail + +if command -v dnf > /dev/null; then + DNFCMD="dnf" +fi +if command -v jq > /dev/null; then + JQCMD="jq" +fi +if [ -z "${DNFCMD+x}" ] || [ -z "${JQCMD+x}" ]; then + echo "{\"tooltip\": \"requires 'jq' and 'dnf'\", \"text\": \"\"}" + exit 1 +fi + +set -u + +if ! output="$($DNFCMD needs-restarting -r)"; then + icon="" +else + icon="" +fi + +# this is a literal expression for `jq` +# shellcheck disable=SC2016 +$JQCMD --unbuffered -n -c '{tooltip: $ARGS.positional[0], text: $ARGS.positional[1]}' --args "$output" "$icon" diff --git a/stow/swaylock/.config/swaylock/config b/stow/swaylock/.config/swaylock/config new file mode 100644 index 0000000..f4ee89e --- /dev/null +++ b/stow/swaylock/.config/swaylock/config @@ -0,0 +1,2 @@ +image=~/.local/share/backgrounds/locked +ignore-empty-password diff --git a/stow/udiskie/.config/systemd/user/udiskie.service b/stow/udiskie/.config/systemd/user/udiskie.service new file mode 100644 index 0000000..ba7e7f0 --- /dev/null +++ b/stow/udiskie/.config/systemd/user/udiskie.service @@ -0,0 +1,15 @@ +[Unit] +Description=Handle automounting of usb devices +Documentation=man:udiskie(1) +PartOf=sway-session.target + +[Service] +Type=simple +ExecStart=/usr/bin/udiskie -s +ExecStop=/bin/kill -2 $MAINPID +Restart=on-failure +RestartSec=1 +TimeoutStopSec=10 + +[Install] +WantedBy=sway-session.target diff --git a/stow/waybar/.config/waybar/config b/stow/waybar/.config/waybar/config new file mode 100644 index 0000000..f3dd9b1 --- /dev/null +++ b/stow/waybar/.config/waybar/config @@ -0,0 +1,87 @@ +[ + { + "name": "topbar", + "layer": "bottom", + "position": "top", + "height": 0, + "modules-left": ["sway/workspaces", "sway/mode"], + "modules-center": ["sway/window"], + "modules-right": ["tray", "custom/reboot", "custom/backup", "pulseaudio", "battery", "temperature", "idle_inhibitor", "clock"], + "sway/workspaces": { + "format": "{name} {index}", + "format-icons": { + "1": "", + "2": "", + "3": "" + } + }, + "sway/window": { + "max-length": 100, + "rewrite": { + "(.*) — Mozilla Firefox": "$1" + }, + "icon": true, + "icon-size": 20 + }, + "tray": { + "spacing": 20 + }, + "clock": { + "interval": 1, + "format": "{:%a %d %b %I:%M %p}", + "format-alt": "{:%Y-%m-%d %H:%M:%S}", + "tooltip-format": "{:%Y %B}\n{calendar}", + "today-format": "{}" + }, + "temperature": { + "critical-threshold": 80, + "format": "{icon}", + "format-alt": "{temperatureC}°C {icon}", + "format-icons": ["", "", ""], + "tooltip-format": "Temperature: {temperatureC}°C" + }, + "battery": { + "interval": 60, + "states": { + "warning": 30, + "critical": 15 + }, + "format": "{icon}", + "format-alt": "{capacity}% {icon}", + "format-charging": "\uf0e7", + "format-icons": ["", "", "", "", ""], + "tooltip-format": "Battery: {capacity}%\n{timeTo}" + }, + "pulseaudio": { + "scroll-step": 5, + "format": "{icon}", + "format-muted": "", + "format-icons": { + "headphone": "", + "default": ["", ""] + }, + "tooltip-format": "Volume: {volume}%\n{desc}", + "on-click": "pavucontrol-qt" + }, + "idle_inhibitor": { + "format": "{icon}", + "format-icons": { + "activated": "", + "deactivated": "" + }, + "tooltip": false + }, + "custom/reboot": { + "format": "{}", + "exec": "~/.local/bin/dnf-needs-restarting", + "return-type": "json", + "interval": 60 + }, + "custom/backup": { + "format": "{}", + "exec": "~/.local/bin/checkbackup", + "return-type": "json", + "interval": 60 + } + } +] diff --git a/stow/waybar/.config/waybar/style.css b/stow/waybar/.config/waybar/style.css new file mode 100644 index 0000000..de3eb19 --- /dev/null +++ b/stow/waybar/.config/waybar/style.css @@ -0,0 +1,102 @@ +* { + border-radius: 0; + border: 0; + font-family: "Noto Sans", "Font Awesome 6 Free Solid"; + font-size: 11pt; + text-shadow: none; +} + +window#waybar { + background: #ffffff; + color: #4a484d; + border-bottom: 1px solid #efefef; + border-left: 5px solid black; + border-right: 5px solid black; +} + +.modules-left, .modules-center, .modules-right { + background: #ffffff; + border-bottom: 1px solid #efefef; +} + +.modules-left { + border-radius: 5px 0 0 0; + padding-left: 5px; +} + +.modules-right { + border-radius: 0 5px 0 0; +} + +tooltip { + background: alpha(#fafafa, 0.95); + border: 1px solid #ddd; +} + +tooltip label { + color: #4a484d; +} + +label, #tray { + padding: 2px 10px; + margin: 0; +} + +#workspaces label { + padding: 0; + font-weight: bold; + font-family: "Noto Sans", "Font Awesome 6 Free Regular"; +} + +#workspaces button { + padding: 0 6px; + min-width: 30px; +} + +#workspaces button:hover { + box-shadow: inherit; + text-shadow: inherit; + background: #ffffff; +} + +#workspaces button.focused { + background: #efefef; +} + +#custom-reboot, #custom-backup, #idle_inhibitor { + min-width: 18px; +} + +#network, #pulseaudio, #battery, #temperature { + font-weight: 500; +} + +#battery.warning:not(.charging) { + color: #714700; +} + +#battery.critical:not(.charging) { + color: #a50000; +} + +#temperature.critical { + color: #a50000; +} + +#clock { + font-weight: 500; +} + +#idle_inhibitor { + margin: 0; +} + +#idle_inhibitor.activated { + color: #ffffff; + background: #a50000; + text-shadow: 1px 1px 0 #992030; +} + +#custom-reboot, #custom-backup.script-error { + color: #a50000; +} diff --git a/stow/xdg-names/.config/systemd/user/xdg-names.service b/stow/xdg-names/.config/systemd/user/xdg-names.service new file mode 100644 index 0000000..799431b --- /dev/null +++ b/stow/xdg-names/.config/systemd/user/xdg-names.service @@ -0,0 +1,14 @@ +[Unit] +Description=Rename Sway workspaces based on XDG metadata +PartOf=sway-session.target + +[Service] +Type=simple +ExecStart=%h/.local/bin/xdg-names.py --debug +ExecStop=/bin/kill -2 $MAINPID +Restart=on-failure +RestartSec=1 +TimeoutStopSec=10 + +[Install] +WantedBy=sway-session.target diff --git a/stow/xdg-names/.config/xdg-names.ini b/stow/xdg-names/.config/xdg-names.ini new file mode 100644 index 0000000..3a08dd8 --- /dev/null +++ b/stow/xdg-names/.config/xdg-names.ini @@ -0,0 +1,25 @@ +[fallback] +icon=_ +[desktop] +1= +2= +[app] +xwayland=X +foot= +shotwell= +Signal= +[xdg_main] +Audio= +Video= +Development= +Education= +Game= +Graphics= +Network= +Office= +Science= +Settings= +System= +Utility= +[xdg_additional] +WebBrowser= diff --git a/stow/xdg-names/.local/bin/xdg-names.py b/stow/xdg-names/.local/bin/xdg-names.py new file mode 100755 index 0000000..b5c3e42 --- /dev/null +++ b/stow/xdg-names/.local/bin/xdg-names.py @@ -0,0 +1,160 @@ +#!/usr/bin/env python3 + +""" +Rename i3 and Sway workspaces based on the focused app's XDG categories. + + Copyright (C) 2024 Matt Singleton + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Adapted from this script: + https://github.com/nwg-piotr/swayinfo/blob/master/wsdnames.py + +Which was in turn based on this example: + https://github.com/altdesktop/i3ipc-python/blob/master/README.rst + +Dependencies: python-i3ipc>=2.0.1 (i3ipc-python), python-xlib + +Pay attention to the fact that your workspaces need to be numbered, not named, +for the script to work. + +Use: + bindsym $mod+1 workspace number 1 + +instead of: + bindsym $mod+1 workspace 1 + +in your ~/.config/sway/config or ~/.config/i3/config file. +""" + +import argparse +import configparser +import logging +import os +import os.path +import traceback + +from i3ipc import Connection, Event + + +def get_xdg_categories(app_id): + path = os.path.join("/usr/share/applications", f"{app_id}.desktop") + try: + config = configparser.ConfigParser() + config.read(path) + return config["Desktop Entry"]["Categories"].split(";") + except Exception: + return [] + + +def glyph(ws_num, app_id=None): + """ + Return a single glyph based on the app_id, if given, + then a default based on the workspace number, + and finally an empty glyph. + """ + global CONFIG_MTIME + latest_mtime = os.stat(CONFIG_PATH).st_mtime + if CONFIG_MTIME < latest_mtime: + CONFIG_MTIME = latest_mtime + CONFIG.read(CONFIG_PATH) + if app_id is not None: + if app_id in CONFIG["app"]: + return CONFIG["app"][app_id] + categories = get_xdg_categories(app_id) + for c in categories: + if c in CONFIG["xdg_additional"]: + return CONFIG["xdg_additional"][c] + for c in categories: + if c in CONFIG["xdg_main"]: + return CONFIG["xdg_main"][c] + logger.debug(f"no xdg icon found for: {app_id}") + ws_num = str(ws_num) + if ws_num in CONFIG["desktop"]: + return CONFIG["desktop"][ws_num] + return CONFIG["fallback"]["icon"] + + +def get_ws_name(ws_num, app_id=None): + ws_glyph = glyph(ws_num, app_id) + return f"{ws_num}:{ws_glyph}" + + +def assign_generic_name(i3, e): + """ + Name the workspace after the focused window name + """ + try: + if e.change == 'rename': + return + if e.change in ['new', 'move']: + # if a change results in a window spawning in an unfocused + # state (i.e. on another workspace), we need to look + # it up by id + con = i3.get_tree().find_by_id(e.container.id) + else: + con = i3.get_tree().find_focused() + if con.type == 'workspace': + # empty workspace + ws_num = con.workspace().num + name = get_ws_name(ws_num) + i3.command(f'rename workspace to "{name}"') + else: + old_name = con.workspace().name + # assume windows without an app_id are xwayland + if con.app_id is None: + app_id = con.window_class or "xwayland" + else: + app_id = con.app_id + name = get_ws_name(con.workspace().num, app_id) + i3.command(f'rename workspace "{old_name}" to "{name}"') + except Exception as e: + logger.debug("".join(traceback.format_exception(e))) + + +parser = argparse.ArgumentParser() +parser.add_argument("--debug", action="store_true") +args = parser.parse_args() + +log_format = "%(levelname)s %(name)s: %(message)s" +if args.debug is True: + logging.basicConfig(level=logging.DEBUG, format=log_format) +else: + logging.basicConfig(level=logging.INFO, format=log_format) +logger = logging.getLogger(__name__) + +CONFIG_MTIME = 0 +CONFIG_PATH = os.path.join( + os.environ.get( + "XDG_CONFIG_HOME", + os.path.join(os.environ["HOME"], ".config"), + ), + "xdg-names.ini", +) +CONFIG = configparser.ConfigParser() + +# Create the Connection object that can be used to send commands and +# subscribe to events. +i3 = Connection() + +# Subscribe to events +i3.on(Event.WORKSPACE_FOCUS, assign_generic_name) +i3.on(Event.WINDOW_FOCUS, assign_generic_name) +i3.on(Event.WINDOW_TITLE, assign_generic_name) +i3.on(Event.WINDOW_CLOSE, assign_generic_name) +i3.on(Event.WINDOW_NEW, assign_generic_name) +i3.on(Event.WINDOW_MOVE, assign_generic_name) +i3.on(Event.BINDING, assign_generic_name) + +i3.main() -- cgit v1.2.3