diff options
Diffstat (limited to 'home-config')
| -rw-r--r-- | home-config/home-configuration.scm | 4 | ||||
| -rw-r--r-- | home-config/sway/config | 325 | ||||
| -rw-r--r-- | home-config/waybar/config | 116 | ||||
| -rwxr-xr-x | home-config/waybar/modules/spotify.sh | 19 | ||||
| -rwxr-xr-x | home-config/waybar/modules/storage.sh | 25 | ||||
| -rwxr-xr-x | home-config/waybar/modules/weather.sh | 77 | ||||
| -rw-r--r-- | home-config/waybar/style.css | 77 |
7 files changed, 642 insertions, 1 deletions
diff --git a/home-config/home-configuration.scm b/home-config/home-configuration.scm index 9a5953d..51fdcd6 100644 --- a/home-config/home-configuration.scm +++ b/home-config/home-configuration.scm | |||
| @@ -90,6 +90,8 @@ | |||
| 90 | "bash_profile"))))) | 90 | "bash_profile"))))) |
| 91 | (service home-xdg-configuration-files-service-type | 91 | (service home-xdg-configuration-files-service-type |
| 92 | `(("nvim/init.vim" ,(local-file "nvim/config/init.vim")) | 92 | `(("nvim/init.vim" ,(local-file "nvim/config/init.vim")) |
| 93 | ("nvim/after/ftplugin/markdown/custom.vim" ,(local-file "nvim/config/after/ftplugin/markdown/custom.vim")) )) | 93 | ("nvim/after/ftplugin/markdown/custom.vim" ,(local-file "nvim/config/after/ftplugin/markdown/custom.vim")) |
| 94 | ("sway" ,(local-file "sway" #:recursive? #t)) | ||
| 95 | ("waybar" ,(local-file "waybar" #:recursive? #t)) )) | ||
| 94 | (service home-files-service-type | 96 | (service home-files-service-type |
| 95 | `((".local/share/nvim/site/autoload/plug.vim" ,(local-file "nvim/plugin-manager/plug.vim")) ))))) | 97 | `((".local/share/nvim/site/autoload/plug.vim" ,(local-file "nvim/plugin-manager/plug.vim")) ))))) |
diff --git a/home-config/sway/config b/home-config/sway/config new file mode 100644 index 0000000..28953b8 --- /dev/null +++ b/home-config/sway/config | |||
| @@ -0,0 +1,325 @@ | |||
| 1 | # Ryan's config for sway | ||
| 2 | # | ||
| 3 | # Dependencies: | ||
| 4 | # waybar | ||
| 5 | # fuzzel | ||
| 6 | # light (with proper udev setting for backlight control) | ||
| 7 | # alacritty | ||
| 8 | # swaylock-effects | ||
| 9 | # swayidle | ||
| 10 | # dejavu-fonts-ttf | ||
| 11 | # nerd-fonts-otf | ||
| 12 | # noto-fonts-cjk | ||
| 13 | # mako / libnotify | ||
| 14 | # grim / slurp / wl-clipboard | ||
| 15 | # swaybg | ||
| 16 | # pipewire / pipewire-pulse / pipewire-jack / wireplumber | ||
| 17 | # blueman | ||
| 18 | # spotifyd | ||
| 19 | # syslog-ng | ||
| 20 | # OPTIONAL: wdisplays (monitor layout) | ||
| 21 | # ... | ||
| 22 | |||
| 23 | ### Variables | ||
| 24 | exec sh ~/.profile | ||
| 25 | |||
| 26 | # Load up the user session dbus | ||
| 27 | exec dbus-daemon --session --address=unix:path=$XDG_RUNTIME_DIR/bus | ||
| 28 | |||
| 29 | # | ||
| 30 | # Logo key. Use Mod1 for Alt. | ||
| 31 | set $mod Mod4 | ||
| 32 | # Home row direction keys, like vim | ||
| 33 | set $left h | ||
| 34 | set $down j | ||
| 35 | set $up k | ||
| 36 | set $right l | ||
| 37 | # Your preferred terminal emulator | ||
| 38 | set $term alacritty | ||
| 39 | # Your preferred application launcher | ||
| 40 | # Note: pass the final command to swaymsg so that the resulting window can be opened | ||
| 41 | # on the original workspace that the command was run on. | ||
| 42 | #set $menu bemenu-run --no-exec | xargs swaymsg exec -- | ||
| 43 | set $menu fuzzel --width=35 --font='Hack:weight=bold:size=12' --background-color='282a36fa' --selection-color='3d4460fa' --line-height=20 --border-radius=20 | ||
| 44 | |||
| 45 | # Set lock screen settings | ||
| 46 | set $lock 'swaylock --screenshots --clock --indicator --grace 3 --fade-in 1 --effect-blur 7x5 --effect-greyscale' | ||
| 47 | # Same as above but no grace period | ||
| 48 | set $lock_now 'swaylock --screenshots --clock --indicator --fade-in 1 --effect-blur 7x5 --effect-greyscale' | ||
| 49 | ### Output configuration | ||
| 50 | # | ||
| 51 | # Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/) | ||
| 52 | output * bg ~/Pictures/Wallpapers/mountains.jpg fill | ||
| 53 | # | ||
| 54 | # Example configuration: | ||
| 55 | # | ||
| 56 | # output HDMI-A-1 resolution 1920x1080 position 1920,0 | ||
| 57 | # | ||
| 58 | # You can get the names of your outputs by running: swaymsg -t get_outputs (moved to ~/.config/sway/monitors) | ||
| 59 | |||
| 60 | include ~/.config/sway/monitors | ||
| 61 | |||
| 62 | #output eDP-1 mode 1920x1080@60.008Hz pos 1920 590 | ||
| 63 | #output HDMI-A-1 mode 1920x1080@74.972Hz pos 0 0 | ||
| 64 | |||
| 65 | ### Idle configuration | ||
| 66 | # | ||
| 67 | # Example configuration: | ||
| 68 | # | ||
| 69 | exec swayidle -w \ | ||
| 70 | timeout 300 $lock \ | ||
| 71 | timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \ | ||
| 72 | before-sleep 'swaylock -f -c 000000' | ||
| 73 | |||
| 74 | # Winkey+L lock key combo | ||
| 75 | bindsym $mod+l exec $lock_now | ||
| 76 | # | ||
| 77 | #Winkey+Shift+L to lock then go to sleep. zzz must run with no passwd | ||
| 78 | bindsym $mod+Shift+l exec 'swaylock --screenshots --clock --indicator --effect-blur 7x5 --effect-greyscale & sleep 0.5; doas zzz' | ||
| 79 | |||
| 80 | # This will lock your screen after 300 seconds of inactivity, then turn off | ||
| 81 | # your displays after another 300 seconds, and turn your screens back on when | ||
| 82 | # resumed. It will also lock your screen before your computer goes to sleep. | ||
| 83 | |||
| 84 | ### Input configuration | ||
| 85 | # | ||
| 86 | # Example configuration: | ||
| 87 | # | ||
| 88 | # input "2:14:SynPS/2_Synaptics_TouchPad" { | ||
| 89 | # dwt enabled | ||
| 90 | # tap enabled | ||
| 91 | # natural_scroll enabled | ||
| 92 | # middle_emulation enabled | ||
| 93 | # } | ||
| 94 | # | ||
| 95 | # You can get the names of your inputs by running: swaymsg -t get_inputs | ||
| 96 | # Read `man 5 sway-input` for more information about this section. | ||
| 97 | |||
| 98 | gaps inner 10 | ||
| 99 | |||
| 100 | ### Key bindings | ||
| 101 | # | ||
| 102 | # Basics: | ||
| 103 | # | ||
| 104 | # Start a terminal | ||
| 105 | bindsym $mod+Return exec $term | ||
| 106 | |||
| 107 | # Kill focused window | ||
| 108 | bindsym $mod+Shift+q kill | ||
| 109 | |||
| 110 | # Start your launcher | ||
| 111 | bindsym $mod+d exec $menu | ||
| 112 | |||
| 113 | # Drag floating windows by holding down $mod and left mouse button. | ||
| 114 | # Resize them with right mouse button + $mod. | ||
| 115 | # Despite the name, also works for non-floating windows. | ||
| 116 | # Change normal to inverse to use left mouse button for resizing and right | ||
| 117 | # mouse button for dragging. | ||
| 118 | floating_modifier $mod normal | ||
| 119 | |||
| 120 | # Reload the configuration file | ||
| 121 | bindsym $mod+Shift+c reload | ||
| 122 | #Restart your session | ||
| 123 | bindsym $mod+Shift+r restart | ||
| 124 | |||
| 125 | # Exit sway (logs you out of your Wayland session) | ||
| 126 | 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' | ||
| 127 | # | ||
| 128 | # Moving around: | ||
| 129 | # | ||
| 130 | # Move your focus around | ||
| 131 | bindsym $mod+$left focus left | ||
| 132 | bindsym $mod+$down focus down | ||
| 133 | bindsym $mod+$up focus up | ||
| 134 | #bindsym $mod+$right focus right | ||
| 135 | # Or use $mod+[up|down|left|right] | ||
| 136 | bindsym $mod+Left focus left | ||
| 137 | bindsym $mod+Down focus down | ||
| 138 | bindsym $mod+Up focus up | ||
| 139 | bindsym $mod+Right focus right | ||
| 140 | |||
| 141 | # Move the focused window with the same, but add Shift | ||
| 142 | bindsym $mod+Shift+$left move left | ||
| 143 | bindsym $mod+Shift+$down move down | ||
| 144 | bindsym $mod+Shift+$up move up | ||
| 145 | #bindsym $mod+Shift+$right move right | ||
| 146 | # Ditto, with arrow keys | ||
| 147 | bindsym $mod+Shift+Left move left | ||
| 148 | bindsym $mod+Shift+Down move down | ||
| 149 | bindsym $mod+Shift+Up move up | ||
| 150 | bindsym $mod+Shift+Right move right | ||
| 151 | |||
| 152 | # Since I run more than one monitor most of the time, these let me move | ||
| 153 | # workspaces between physical screens | ||
| 154 | bindsym $mod+Control+Shift+Right move workspace to output right | ||
| 155 | bindsym $mod+Control+Shift+Left move workspace to output left | ||
| 156 | # Now I could do the same with up and down but I don't have any of those | ||
| 157 | # | ||
| 158 | # Workspaces: | ||
| 159 | # | ||
| 160 | # Switch to workspace | ||
| 161 | bindsym $mod+1 workspace number 1 | ||
| 162 | bindsym $mod+2 workspace number 2 | ||
| 163 | bindsym $mod+3 workspace number 3 | ||
| 164 | bindsym $mod+4 workspace number 4 | ||
| 165 | bindsym $mod+5 workspace number 5 | ||
| 166 | bindsym $mod+6 workspace number 6 | ||
| 167 | bindsym $mod+7 workspace number 7 | ||
| 168 | bindsym $mod+8 workspace number 8 | ||
| 169 | bindsym $mod+9 workspace number 9 | ||
| 170 | bindsym $mod+0 workspace number 10 | ||
| 171 | # Move focused container to workspace | ||
| 172 | bindsym $mod+Shift+1 move container to workspace number 1 | ||
| 173 | bindsym $mod+Shift+2 move container to workspace number 2 | ||
| 174 | bindsym $mod+Shift+3 move container to workspace number 3 | ||
| 175 | bindsym $mod+Shift+4 move container to workspace number 4 | ||
| 176 | bindsym $mod+Shift+5 move container to workspace number 5 | ||
| 177 | bindsym $mod+Shift+6 move container to workspace number 6 | ||
| 178 | bindsym $mod+Shift+7 move container to workspace number 7 | ||
| 179 | bindsym $mod+Shift+8 move container to workspace number 8 | ||
| 180 | bindsym $mod+Shift+9 move container to workspace number 9 | ||
| 181 | bindsym $mod+Shift+0 move container to workspace number 10 | ||
| 182 | # Note: workspaces can have any name you want, not just numbers. | ||
| 183 | # We just use 1-10 as the default. | ||
| 184 | # | ||
| 185 | # Layout stuff: | ||
| 186 | # | ||
| 187 | # You can "split" the current object of your focus with | ||
| 188 | # $mod+b or $mod+v, for horizontal and vertical splits | ||
| 189 | # respectively. | ||
| 190 | bindsym $mod+b splith | ||
| 191 | bindsym $mod+v splitv | ||
| 192 | |||
| 193 | # Switch the current container between different layout styles | ||
| 194 | bindsym $mod+s layout stacking | ||
| 195 | bindsym $mod+w layout tabbed | ||
| 196 | bindsym $mod+e layout toggle split | ||
| 197 | |||
| 198 | # Make the current focus fullscreen | ||
| 199 | bindsym $mod+f fullscreen | ||
| 200 | |||
| 201 | # Toggle the current focus between tiling and floating mode | ||
| 202 | bindsym $mod+Shift+space floating toggle | ||
| 203 | |||
| 204 | # Swap focus between the tiling area and the floating area | ||
| 205 | bindsym $mod+space focus mode_toggle | ||
| 206 | |||
| 207 | # Move focus to the parent container | ||
| 208 | bindsym $mod+a focus parent | ||
| 209 | |||
| 210 | bindsym $mod+Ctrl+Right focus sibling next | ||
| 211 | |||
| 212 | # | ||
| 213 | # Misc. button bindings | ||
| 214 | # | ||
| 215 | # Some custom keybinds for various keys on my laptop | ||
| 216 | bindsym XF86MonBrightnessUp exec light -A 10 | ||
| 217 | bindsym XF86MonBrightnessDown exec light -U 10 | ||
| 218 | |||
| 219 | # | ||
| 220 | # Scratchpad: | ||
| 221 | # | ||
| 222 | # Sway has a "scratchpad", which is a bag of holding for windows. | ||
| 223 | # You can send windows there and get them back later. | ||
| 224 | |||
| 225 | # Move the currently focused window to the scratchpad | ||
| 226 | bindsym $mod+Shift+minus move scratchpad | ||
| 227 | |||
| 228 | # Show the next scratchpad window or hide the focused scratchpad window. | ||
| 229 | # If there are multiple scratchpad windows, this command cycles through them. | ||
| 230 | bindsym $mod+minus scratchpad show | ||
| 231 | # | ||
| 232 | # Resizing containers: | ||
| 233 | # | ||
| 234 | mode "resize" { | ||
| 235 | # left will shrink the containers width | ||
| 236 | # right will grow the containers width | ||
| 237 | # up will shrink the containers height | ||
| 238 | # down will grow the containers height | ||
| 239 | bindsym $left resize shrink width 10px | ||
| 240 | bindsym $down resize grow height 10px | ||
| 241 | bindsym $up resize shrink height 10px | ||
| 242 | bindsym $right resize grow width 10px | ||
| 243 | |||
| 244 | # Ditto, with arrow keys | ||
| 245 | bindsym Left resize shrink width 10px | ||
| 246 | bindsym Down resize grow height 10px | ||
| 247 | bindsym Up resize shrink height 10px | ||
| 248 | bindsym Right resize grow width 10px | ||
| 249 | |||
| 250 | # Return to default mode | ||
| 251 | bindsym Return mode "default" | ||
| 252 | bindsym Escape mode "default" | ||
| 253 | } | ||
| 254 | bindsym $mod+r mode "resize" | ||
| 255 | |||
| 256 | # | ||
| 257 | # Status Bar: | ||
| 258 | # | ||
| 259 | # Read `man 5 sway-bar` for more information about this section. | ||
| 260 | #bar { | ||
| 261 | # position top | ||
| 262 | # | ||
| 263 | # # When the status_command prints a new line to stdout, swaybar updates. | ||
| 264 | # # The default just shows the current date and time. | ||
| 265 | # status_command while date +'%Y-%m-%d %I:%M:%S %p'; do sleep 1; done | ||
| 266 | # | ||
| 267 | # colors { | ||
| 268 | # statusline #ffffff | ||
| 269 | # background #323232 | ||
| 270 | # inactive_workspace #32323200 #32323200 #5c5c5c | ||
| 271 | # } | ||
| 272 | #} | ||
| 273 | |||
| 274 | bar { | ||
| 275 | swaybar_command waybar | ||
| 276 | } | ||
| 277 | |||
| 278 | exec hash dbus-update-activation-environment 2>/dev/null && dbus-update-activation-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK | ||
| 279 | |||
| 280 | # Numlock on startup | ||
| 281 | input * xkb_numlock enabled | ||
| 282 | |||
| 283 | # Audio Server | ||
| 284 | #exec pipewire | ||
| 285 | #exec wireplumber | ||
| 286 | #exec pipewire-pulse | ||
| 287 | |||
| 288 | # Bluetooth | ||
| 289 | exec blueman-applet | ||
| 290 | |||
| 291 | # Spotifyd | ||
| 292 | #exec spotifyd | ||
| 293 | |||
| 294 | # Notification controls | ||
| 295 | exec mako | ||
| 296 | bindsym $mod+n exec makoctl dismiss | ||
| 297 | bindsym $mod+Shift+n exec makoctl dismiss -a | ||
| 298 | |||
| 299 | # Flameshot position fix and autostart | ||
| 300 | #exec QT_QPA_PLATFORM=wayland flameshot | ||
| 301 | #for_window [app_id="flameshot"] border pixel 0, floating enable, fullscreen disable, move absolute position 0 0 | ||
| 302 | |||
| 303 | # Screenshots to clipboard | ||
| 304 | bindsym $mod+Shift+S exec grim -g "$(slurp)" - | wl-copy -t image/png | ||
| 305 | bindsym $mod+Print exec grim - | wl-copy -t image/png | ||
| 306 | #bindsym $mod+Ctrl+Shift+S exec grim -g "$(slurp)" $(echo "$HOME/Pictures/Screenshot_$(date +'%Y%m%d')_$(date +'%H%M%S').png") | ||
| 307 | bindsym $mod+Ctrl+Print exec grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') - | wl-copy -t image/png | ||
| 308 | |||
| 309 | # Zathura notes window resize | ||
| 310 | for_window [app_id="org.pwmt.zathura" title="^.*notes.pdf$"] resize set width 775 | ||
| 311 | |||
| 312 | # Syncthing start | ||
| 313 | exec syncthing serve --no-browser | ||
| 314 | |||
| 315 | # Force various windows to be floating | ||
| 316 | # Firefox PIP YT Player | ||
| 317 | for_window [app_id="firefox-default" title="^Picture-in-Picture$"] floating enable, resize set 578 326, border none, sticky enable | ||
| 318 | # Duo 2FA | ||
| 319 | for_window [app_id="firefox-default" title="^Activate Security Key — Mozilla Firefox$"] floating enable | ||
| 320 | for_window [app_id="firefox-default" title="^Nightly — Sharing Indicator$"] floating enable, resize set 18 52, border none, move position center, move y 0px | ||
| 321 | # Qjackctl | ||
| 322 | for_window [app_id="qjackctl"] floating enable | ||
| 323 | # Weather Window | ||
| 324 | for_window [app_id="ala-wttr"] border none, floating enable, resize set 740 712 | ||
| 325 | include /etc/sway/config.d/* | ||
diff --git a/home-config/waybar/config b/home-config/waybar/config new file mode 100644 index 0000000..10e27c7 --- /dev/null +++ b/home-config/waybar/config | |||
| @@ -0,0 +1,116 @@ | |||
| 1 | { | ||
| 2 | "layer": "bottom", | ||
| 3 | "position": "top", | ||
| 4 | "height": 30, | ||
| 5 | |||
| 6 | "modules-left": ["sway/workspaces", "sway/mode"], | ||
| 7 | "modules-center": ["sway/window"], | ||
| 8 | "modules-right": ["tray", "custom/spotify", "custom/weather", "custom/mail", "custom/storage", "backlight", "pulseaudio", "network", "idle_inhibitor", "battery", "clock"], | ||
| 9 | "sway/mode": { | ||
| 10 | "format": " {}" | ||
| 11 | }, | ||
| 12 | "sway/workspaces": { | ||
| 13 | "format": "{name}", | ||
| 14 | "disable-scroll": true | ||
| 15 | }, | ||
| 16 | "sway/window": { | ||
| 17 | "max-length": 80, | ||
| 18 | "tooltip": false | ||
| 19 | }, | ||
| 20 | "clock": { | ||
| 21 | "format": "{:%a %d %b %H:%M}", | ||
| 22 | "tooltip": false | ||
| 23 | }, | ||
| 24 | "battery": { | ||
| 25 | "format": "{capacity}% {icon}", | ||
| 26 | "format-alt": "{time} {icon}", | ||
| 27 | "format-icons": ["", "", "", "", ""], | ||
| 28 | "format-charging": "{capacity}% ", | ||
| 29 | "interval": 30, | ||
| 30 | "states": { | ||
| 31 | "warning": 25, | ||
| 32 | "critical": 10 | ||
| 33 | }, | ||
| 34 | "tooltip": false, | ||
| 35 | "bat":"BAT1" | ||
| 36 | }, | ||
| 37 | "network": { | ||
| 38 | "format-alt": "{icon}", | ||
| 39 | "format": "{ipaddr}/{cidr} {icon}", | ||
| 40 | "format-alt-click": "click-right", | ||
| 41 | "format-icons": { | ||
| 42 | "wifi": ["", "" ,""], | ||
| 43 | "ethernet": [""], | ||
| 44 | "disconnected": ["睊"] | ||
| 45 | }, | ||
| 46 | "on-click": "alacritty -e iwctl", | ||
| 47 | "tooltip": false | ||
| 48 | }, | ||
| 49 | "pulseaudio": { | ||
| 50 | "format-alt": "{icon}", | ||
| 51 | "format": "{volume} {icon}", | ||
| 52 | "format-alt-click": "click-right", | ||
| 53 | "format-muted": "", | ||
| 54 | "format-icons": { | ||
| 55 | "phone": [" ", " ", " ", " "], | ||
| 56 | "default": ["", "", "", ""] | ||
| 57 | }, | ||
| 58 | "scroll-step": 1, | ||
| 59 | "on-click": "pavucontrol", | ||
| 60 | "tooltip": false | ||
| 61 | }, | ||
| 62 | "custom/spotify": { | ||
| 63 | "interval": 2, | ||
| 64 | "return-type": "json", | ||
| 65 | "exec": "~/.config/waybar/modules/spotify.sh", | ||
| 66 | "exec-if": "pgrep spotifyd", | ||
| 67 | "escape": true, | ||
| 68 | "on-click": "~/.config/waybar/modules/spotify-play-pause.sh play-pause" | ||
| 69 | }, | ||
| 70 | "custom/storage": { | ||
| 71 | "format-alt": "{} ", | ||
| 72 | "format": "{percentage}% ", | ||
| 73 | "format-alt-click": "click-right", | ||
| 74 | "return-type": "json", | ||
| 75 | "interval": 60, | ||
| 76 | "exec": "~/.config/waybar/modules/storage.sh" | ||
| 77 | }, | ||
| 78 | "backlight": { | ||
| 79 | "format-alt": "{icon}", | ||
| 80 | "format": "{percent}% {icon}", | ||
| 81 | "format-alt-click": "click-right", | ||
| 82 | "format-icons": ["", ""], | ||
| 83 | "on-scroll-down": "light -A 1", | ||
| 84 | "on-scroll-up": "light -U 1" | ||
| 85 | }, | ||
| 86 | "custom/weather": { | ||
| 87 | "format-alt": "{}", | ||
| 88 | "format": "{alt}: {}", | ||
| 89 | "format-alt-click": "click-right", | ||
| 90 | "interval": 1800, | ||
| 91 | "return-type": "json", | ||
| 92 | "on-click": "alacritty --class ala-wttr --hold -e curl https://v2.wttr.in", | ||
| 93 | "exec": "~/.config/waybar/modules/weather.sh", | ||
| 94 | "exec-if": "ping wttr.in -c1" | ||
| 95 | }, | ||
| 96 | "idle_inhibitor": { | ||
| 97 | "format": "{icon}", | ||
| 98 | "format-icons": { | ||
| 99 | "activated": "", | ||
| 100 | "deactivated": "" | ||
| 101 | }, | ||
| 102 | "tooltip": false | ||
| 103 | }, | ||
| 104 | "custom/mail": { | ||
| 105 | "format": "", | ||
| 106 | "format-alt": "{alt} ", | ||
| 107 | "format-alt-click": "click-right", | ||
| 108 | "interval": 60, | ||
| 109 | "return-type": "json", | ||
| 110 | "exec": "~/.config/waybar/modules/mail.py", | ||
| 111 | "tooltip": false | ||
| 112 | }, | ||
| 113 | "tray": { | ||
| 114 | "icon-size": 18 | ||
| 115 | } | ||
| 116 | } | ||
diff --git a/home-config/waybar/modules/spotify.sh b/home-config/waybar/modules/spotify.sh new file mode 100755 index 0000000..a75136c --- /dev/null +++ b/home-config/waybar/modules/spotify.sh | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | class=$(playerctl metadata --player=spotifyd --format '{{lc(status)}}') | ||
| 4 | icon="" | ||
| 5 | |||
| 6 | if [[ $class == "playing" ]]; then | ||
| 7 | info=$(playerctl metadata --player=spotifyd --format '{{artist}} - {{title}}') | ||
| 8 | if [[ ${#info} > 40 ]]; then | ||
| 9 | info=$(echo $info | cut -c1-40)"..." | ||
| 10 | fi | ||
| 11 | text=$info" "$icon | ||
| 12 | elif [[ $class == "paused" ]]; then | ||
| 13 | text=$icon | ||
| 14 | elif [[ $class == "stopped" ]]; then | ||
| 15 | text="" | ||
| 16 | fi | ||
| 17 | |||
| 18 | echo -e "{\"text\":\""$text"\", \"class\":\""$class"\"}" | ||
| 19 | |||
diff --git a/home-config/waybar/modules/storage.sh b/home-config/waybar/modules/storage.sh new file mode 100755 index 0000000..90cc3dc --- /dev/null +++ b/home-config/waybar/modules/storage.sh | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | mount="/" | ||
| 4 | warning=20 | ||
| 5 | critical=10 | ||
| 6 | |||
| 7 | df -h -P -l "$mount" | awk -v warning=$warning -v critical=$critical ' | ||
| 8 | /\/.*/ { | ||
| 9 | text=$4 | ||
| 10 | tooltip="Filesystem: "$1"\rSize: "$2"\rUsed: "$3"\rAvail: "$4"\rUse%: "$5"\rMounted on: "$6 | ||
| 11 | use=$5 | ||
| 12 | exit 0 | ||
| 13 | } | ||
| 14 | END { | ||
| 15 | class="" | ||
| 16 | gsub(/%$/,"",use) | ||
| 17 | if ((100 - use) < critical) { | ||
| 18 | class="critical" | ||
| 19 | } else if ((100 - use) < warning) { | ||
| 20 | class="warning" | ||
| 21 | } | ||
| 22 | print "{\"text\":\""text"\", \"percentage\":"use",\"tooltip\":\""tooltip"\", \"class\":\""class"\"}" | ||
| 23 | } | ||
| 24 | ' | ||
| 25 | |||
diff --git a/home-config/waybar/modules/weather.sh b/home-config/waybar/modules/weather.sh new file mode 100755 index 0000000..01faffc --- /dev/null +++ b/home-config/waybar/modules/weather.sh | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | cachedir=~/.cache/rbn | ||
| 2 | cachefile=${0##*/}-$1 | ||
| 3 | |||
| 4 | if [ ! -d $cachedir ]; then | ||
| 5 | mkdir -p $cachedir | ||
| 6 | fi | ||
| 7 | |||
| 8 | if [ ! -f $cachedir/$cachefile ]; then | ||
| 9 | touch $cachedir/$cachefile | ||
| 10 | fi | ||
| 11 | |||
| 12 | # Save current IFS | ||
| 13 | SAVEIFS=$IFS | ||
| 14 | # Change IFS to new line. | ||
| 15 | IFS=$'\n' | ||
| 16 | |||
| 17 | cacheage=$(($(date +%s) - $(stat -c '%Y' "$cachedir/$cachefile"))) | ||
| 18 | if [ $cacheage -gt 1740 ] || [ ! -s $cachedir/$cachefile ]; then | ||
| 19 | data=($(curl -s https://en.wttr.in/$1\?0qnT 2>&1)) | ||
| 20 | echo ${data[0]} | cut -f1 -d, > $cachedir/$cachefile | ||
| 21 | echo ${data[1]} | sed -E 's/^.{15}//' >> $cachedir/$cachefile | ||
| 22 | echo ${data[2]} | sed -E 's/^.{15}//' >> $cachedir/$cachefile | ||
| 23 | fi | ||
| 24 | |||
| 25 | weather=($(cat $cachedir/$cachefile)) | ||
| 26 | |||
| 27 | # Restore IFSClear | ||
| 28 | IFS=$SAVEIFS | ||
| 29 | |||
| 30 | temperature=$(echo ${weather[2]} | sed -E 's/([[:digit:]]+)\.\./\1 to /g') | ||
| 31 | |||
| 32 | #echo ${weather[1]##*,} | ||
| 33 | |||
| 34 | # https://fontawesome.com/icons?s=solid&c=weather | ||
| 35 | case $(echo ${weather[1]##*,} | tr '[:upper:]' '[:lower:]') in | ||
| 36 | "clear" | "sunny") | ||
| 37 | condition="" | ||
| 38 | ;; | ||
| 39 | "partly cloudy") | ||
| 40 | condition="" | ||
| 41 | ;; | ||
| 42 | "cloudy") | ||
| 43 | condition="" | ||
| 44 | ;; | ||
| 45 | "overcast") | ||
| 46 | condition="" | ||
| 47 | ;; | ||
| 48 | "mist" | "fog" | "freezing fog") | ||
| 49 | condition="敖" | ||
| 50 | ;; | ||
| 51 | "patchy rain possible" | "patchy light drizzle" | "light drizzle" | "patchy light rain" | "light rain" | "light rain shower" | "rain") | ||
| 52 | condition="殺" | ||
| 53 | ;; | ||
| 54 | "moderate rain at times" | "moderate rain" | "heavy rain at times" | "heavy rain" | "moderate or heavy rain shower" | "torrential rain shower" | "rain shower") | ||
| 55 | condition="" | ||
| 56 | ;; | ||
| 57 | "patchy snow possible" | "patchy sleet possible" | "patchy freezing drizzle possible" | "freezing drizzle" | "heavy freezing drizzle" | "light freezing rain" | "moderate or heavy freezing rain" | "light sleet" | "ice pellets" | "light sleet showers" | "moderate or heavy sleet showers") | ||
| 58 | condition="流" | ||
| 59 | ;; | ||
| 60 | "blowing snow" | "moderate or heavy sleet" | "patchy light snow" | "light snow" | "light snow showers") | ||
| 61 | condition="ﰕ" | ||
| 62 | ;; | ||
| 63 | "blizzard" | "patchy moderate snow" | "moderate snow" | "patchy heavy snow" | "heavy snow" | "moderate or heavy snow with thunder" | "moderate or heavy snow showers") | ||
| 64 | condition="" | ||
| 65 | ;; | ||
| 66 | "thundery outbreaks possible" | "patchy light rain with thunder" | "moderate or heavy rain with thunder" | "patchy light snow with thunder") | ||
| 67 | condition="" | ||
| 68 | ;; | ||
| 69 | *) | ||
| 70 | condition="" | ||
| 71 | echo -e "{\"text\":\""$condition"\", \"alt\":\""${weather[0]}"\", \"tooltip\":\""${weather[0]}: $temperature ${weather[1]}"\"}" | ||
| 72 | ;; | ||
| 73 | esac | ||
| 74 | |||
| 75 | #echo $temp $condition | ||
| 76 | |||
| 77 | echo -e "{\"text\":\""$temperature $condition"\", \"alt\":\""${weather[0]}"\", \"tooltip\":\""${weather[0]}: $temperature ${weather[1]}"\"}" | ||
diff --git a/home-config/waybar/style.css b/home-config/waybar/style.css new file mode 100644 index 0000000..f785881 --- /dev/null +++ b/home-config/waybar/style.css | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | * { | ||
| 2 | border: none; | ||
| 3 | border-radius: 0; | ||
| 4 | font-family: Sans; | ||
| 5 | font-size: 15px; | ||
| 6 | box-shadow: none; | ||
| 7 | text-shadow: none; | ||
| 8 | transition-duration: 0s; | ||
| 9 | color: white; | ||
| 10 | } | ||
| 11 | |||
| 12 | #waybar { | ||
| 13 | background-color:rgba(0,0,0,0.25); | ||
| 14 | color: white; | ||
| 15 | } | ||
| 16 | |||
| 17 | window { | ||
| 18 | color: rgba(217, 216, 216, 1); | ||
| 19 | background: rgba(35, 31, 32, 0.00); | ||
| 20 | } | ||
| 21 | |||
| 22 | window#waybar.solo { | ||
| 23 | color: rgba(217, 216, 216, 1); | ||
| 24 | background: rgba(35, 31, 32, 0.85); | ||
| 25 | } | ||
| 26 | |||
| 27 | #workspaces { | ||
| 28 | margin: 0 5px; | ||
| 29 | } | ||
| 30 | |||
| 31 | #workspaces button { | ||
| 32 | padding: 0 5px; | ||
| 33 | color: rgba(217, 216, 216, 0.4); | ||
| 34 | } | ||
| 35 | |||
| 36 | #workspaces button.visible { | ||
| 37 | color: rgba(217, 216, 216, 1); | ||
| 38 | } | ||
| 39 | |||
| 40 | #workspaces button.focused { | ||
| 41 | border-top: 3px solid rgba(217, 216, 216, 1); | ||
| 42 | border-bottom: 3px solid rgba(217, 216, 216, 0); | ||
| 43 | } | ||
| 44 | |||
| 45 | #workspaces button.urgent { | ||
| 46 | color: rgba(238, 46, 36, 1); | ||
| 47 | } | ||
| 48 | |||
| 49 | #mode, #battery, #cpu, #memory, #network, #pulseaudio, #idle_inhibitor, #backlight, #custom-storage, #custom-spotify, #custom-weather, #custom-mail { | ||
| 50 | margin: 0px 6px 0px 10px; | ||
| 51 | min-width: 25px; | ||
| 52 | } | ||
| 53 | |||
| 54 | #clock { | ||
| 55 | margin: 0px 16px 0px 10px; | ||
| 56 | min-width: 140px; | ||
| 57 | } | ||
| 58 | |||
| 59 | #battery.warning { | ||
| 60 | color: rgba(255, 210, 4, 1); | ||
| 61 | } | ||
| 62 | |||
| 63 | #battery.critical { | ||
| 64 | color: rgba(238, 46, 36, 1); | ||
| 65 | } | ||
| 66 | |||
| 67 | #battery.charging { | ||
| 68 | color: rgba(217, 216, 216, 1); | ||
| 69 | } | ||
| 70 | |||
| 71 | #custom-storage.warning { | ||
| 72 | color: rgba(255, 210, 4, 1); | ||
| 73 | } | ||
| 74 | |||
| 75 | #custom-storage.critical { | ||
| 76 | color: rgba(238, 46, 36, 1); | ||
| 77 | } | ||
