diff options
| author | LMBishop <13875753+LMBishop@users.noreply.github.com> | 2023-01-13 13:46:51 +0000 |
|---|---|---|
| committer | LMBishop <13875753+LMBishop@users.noreply.github.com> | 2023-01-13 13:46:51 +0000 |
| commit | 921cc1b7466f504b4521450cf7d2adac4e6c5c93 (patch) | |
| tree | e3ba4a37e145b941ef182a9a92456e3333996954 | |
| parent | 8bf69148fbb8ac98bf21e1bbd87021aa8f5291cc (diff) | |
Add new configs
| -rw-r--r-- | alacritty/alacritty.yml | 49 | ||||
| -rw-r--r-- | info.yml | 75 | ||||
| -rw-r--r-- | mako/config | 13 | ||||
| -rw-r--r-- | rofi/config.rasi | 13 | ||||
| -rw-r--r-- | sway/config | 179 | ||||
| -rw-r--r-- | sway/wallpaper.jpg | bin | 0 -> 448718 bytes | |||
| -rw-r--r-- | waybar/config | 70 | ||||
| -rw-r--r-- | waybar/scripts/mediaplayer.py | 129 | ||||
| -rw-r--r-- | waybar/style.css | 106 |
9 files changed, 634 insertions, 0 deletions
diff --git a/alacritty/alacritty.yml b/alacritty/alacritty.yml new file mode 100644 index 0000000..b33e97f --- /dev/null +++ b/alacritty/alacritty.yml @@ -0,0 +1,49 @@ +font: + normal: + family: Iosevka Term + style: Regular + bold: + family: Iosevka Term + style: Bold + italic: + family: Iosevka Term + style: Italic + bold_italic: + family: Iosevka Term + style: Bold Italic + size: 11 + +shell: + program: /usr/bin/zsh + +colors: + primary: + background: '#2b2b2b' + foreground: '#ffffff' + + bright_background: '#2b2b2b' + bright_foreground: '#ffffff' + + cursor: + text: '#000000' + cursor: '#fefefe' + + normal: + black: '#000000' + red: '#fd6b67' + green: '#097e00' + yellow: '#ccca00' + blue: '#5496ef' + magenta: '#fd75ff' + cyan: '#39cbcc' + white: '#f1f1f1' + + bright: + black: '#676767' + red: '#fd8784' + green: '#73f961' + yellow: '#fefb00' + blue: '#7eaff4' + magenta: '#fd9cff' + cyan: '#6ed9d9' + white: '#ffffff' @@ -102,3 +102,78 @@ sections: from: .tmux.conf to: ~/.tmux.conf + # Copy alacritty configurations + configure-alacritty: + directory: "alacritty" + tags: ["config"] + preconditions: + os: "linux" + steps: + - ==: run + command: "mkdir -p ~/.config/alacritty" + - ==: link + from: alacritty.yml + to: ~/.config/alacritty/alacritty.yml + + # Copy mako configurations + configure-mako: + directory: "mako" + tags: ["config"] + preconditions: + os: "linux" + steps: + - ==: run + command: "mkdir -p ~/.config/mako" + - ==: link + from: config + to: ~/.config/mako/config + + # Copy rofi configurations + configure-rofi: + directory: "rofi" + tags: ["config"] + preconditions: + os: "linux" + steps: + - ==: run + command: "mkdir -p ~/.config/rofi" + - ==: link + from: config.rasi + to: ~/.config/rofi/config.rasi + + # Copy sway configurations + configure-sway: + directory: "sway" + tags: ["config"] + preconditions: + os: "linux" + steps: + - ==: run + command: "mkdir -p ~/.config/sway" + - ==: link + from: config + to: ~/.config/sway/config + - ==: link + from: wallpaper.jpg + to: ~/.config/sway/wallpaper.jpg + + # Copy waybar configurations + configure-waybar: + directory: "waybar" + tags: ["config"] + preconditions: + os: "linux" + steps: + - ==: run + command: "mkdir -p ~/.config/waybar" + - ==: run + command: "mkdir -p ~/.config/waybar/scripts" + - ==: link + from: config + to: ~/.config/waybar/config + - ==: link + from: style.css + to: ~/.config/waybar/style.css + - ==: link + from: scripts/mediaplayer.py + to: ~/.config/waybar/scripts/mediaplayer.py diff --git a/mako/config b/mako/config new file mode 100644 index 0000000..de96178 --- /dev/null +++ b/mako/config @@ -0,0 +1,13 @@ +sort=-time +layer=overlay +background-color=#1c1c1cf0 +width=400 +height=110 +border-size=0 +border-color=#4d4d4d +icons=1 +icon-location=right +max-icon-size=64 +default-timeout=5000 +ignore-timeout=1 +font=Iosevka Term 12 diff --git a/rofi/config.rasi b/rofi/config.rasi new file mode 100644 index 0000000..7d29615 --- /dev/null +++ b/rofi/config.rasi @@ -0,0 +1,13 @@ +configuration { + modes: [ combi ]; + combi-modes: [ drun, run ]; +} + +@theme "sidebar" + +inputbar { + background-color: #2b2b2b; + text-color: #ffffff; + padding: 4px; + border: 0px 0px 2px 0px; +} diff --git a/sway/config b/sway/config new file mode 100644 index 0000000..52926f6 --- /dev/null +++ b/sway/config @@ -0,0 +1,179 @@ +############# +# Varaibles # +############# + +set $mod Mod4 +set $left h +set $down j +set $up k +set $right l +set $term alacritty +set $menu rofi -font "Iosevka Term 12" -show combi | xargs swaymsg exec + +# Colours +set $cl_high #4d4d4d +set $cl_indi #d9d8d8 +set $cl_back #1c1c1c +set $cl_fore #ffffff +set $cl_urge #ee2e24 + +# Output names +set $monitor1 DP-1 +set $monitor2 HDMI-A-1 + +############# +# Display # +############# + +font pango:Iosevka Term 11 + +gaps inner 15 + +client.focused $cl_high $cl_high $cl_fore $cl_indi $cl_high +client.focused_inactive $cl_back $cl_back $cl_fore $cl_back $cl_back +client.unfocused $cl_back $cl_back $cl_fore $cl_back $cl_back +client.urgent $cl_urge $cl_urge $cl_fore $cl_urge $cl_urge + +output * background ~/.config/sway/wallpaper.jpg fill + +############ +# Inputs # +############ + +input type:keyboard { + xkb_layout "gb" + repeat_delay 300 + repeat_rate 30 +} + +input type:pointer { + pointer_accel -0.7 +} + +############## +# Workspaces # +############## + +# Bind to specific outputs +workspace 1 output $monitor1 # terminal +workspace 2 output $monitor1 # firefox +workspace 3 output $monitor2 # discord +workspace 4 output $monitor2 # spotify +workspace 5 output $monitor1 # thunderbird + +############## +# Keybinds # +############## + +bindsym $mod+Return exec $term +bindsym $mod+d exec $menu +bindsym $mod+Shift+q kill +bindsym $mod+Shift+c reload +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' + +floating_modifier $mod normal + +# Move around +bindsym $mod+$left focus left +bindsym $mod+$down focus down +bindsym $mod+$up focus up +bindsym $mod+$right focus 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 +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+Shift+Left move left +bindsym $mod+Shift+Down move down +bindsym $mod+Shift+Up move up +bindsym $mod+Shift+Right move right + +# Move to workspaces +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 + +# Layout +bindsym $mod+b splith +bindsym $mod+v splitv + +# Layout styles +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+e layout toggle split + +# Fullscreen +bindsym $mod+f fullscreen + +# Toggle to floating windows +bindsym $mod+space focus mode_toggle + +# Toggle current window as floating +bindsym $mod+Shift+space floating toggle + +# Move focus to the parent container +bindsym $mod+a focus parent + +# Scratchpad +bindsym $mod+Shift+minus move scratchpad +bindsym $mod+minus scratchpad show + +# Screenshot +bindsym Print exec /usr/share/sway/scripts/grimshot copy area + +mode "resize" { + bindsym $left resize shrink width 10px + bindsym $down resize grow height 10px + bindsym $up resize shrink height 10px + bindsym $right resize grow width 10px + + bindsym Left resize shrink width 10px + bindsym Down resize grow height 10px + bindsym Up resize shrink height 10px + bindsym Right resize grow width 10px + + bindsym Return mode "default" + bindsym Escape mode "default" + bindsym $mod+r mode "default" +} +bindsym $mod+r mode "resize" + +# Start notification daemon +exec mako + +# Make sure env vars are imported into D-Bus +exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway + +############ +# Waybar # +############ + +bar { + swaybar_command waybar +} + +include @sysconfdir@/sway/config.d/* diff --git a/sway/wallpaper.jpg b/sway/wallpaper.jpg Binary files differnew file mode 100644 index 0000000..f9f751e --- /dev/null +++ b/sway/wallpaper.jpg diff --git a/waybar/config b/waybar/config new file mode 100644 index 0000000..a239f8f --- /dev/null +++ b/waybar/config @@ -0,0 +1,70 @@ +{ + "height": 30, + "spacing": 4, + "modules-left": ["sway/workspaces", "sway/mode"], + "modules-right": ["tray", "custom/spotify", "pulseaudio", "network", "cpu", "memory", "temperature", "clock"], + "custom/spotify": { + "exec": "/usr/bin/python3 ~/.config/waybar/scripts/mediaplayer.py --player spotify", + "format": "{}", + "return-type": "json", + "on-click": "playerctl play-pause", + "on-scroll-up": "playerctl next", + "on-scroll-down": "playerctl previous" + }, + "sway/workspaces": { + "disable-scroll": true, + "all-outputs": false, + "format": "{name}{icon}", + "format-icons": { + "1": ": terminal", + "2": ": firefox", + "3": ": discord", + "4": ": spotify", + "5": ": thunderbird", + "default": "" + } + }, + "tray": { + "spacing": 10 + }, + "clock": { + "tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>", + "format": "{:%d/%m/%Y %H:%M:%S}", + "format-alt": "{:%Y-%m-%d}", + "interval": 1 + }, + "cpu": { + "format": " {usage}%", + "tooltip": false + }, + "memory": { + "format": " {used}/{total} GiB" + }, + "network": { + "format-wifi": "{essid} ({signalStrength}%) ", + "format-ethernet": "歷 {ipaddr}", + "tooltip-format": "{ifname} via {gwaddr} ", + "format-linked": "歷 {ifname} (No IP)", + "format-disconnected": "歷 Disconnected", + "format-alt": "{ifname}: {ipaddr}/{cidr}" + }, + "pulseaudio": { + "format": "{icon} {volume}% {format_source}", + "format-bluetooth": "{volume}% {icon} {format_source}", + "format-bluetooth-muted": " {icon} {format_source}", + "format-muted": " {format_source}", + "format-source": " {volume}%", + "format-source-muted": "", + "format-icons": { + "headphone": "", + "hands-free": "", + "headset": "", + "phone": "", + "portable": "", + "car": "", + "default": ["", "", ""] + }, + "on-click": "pavucontrol" + } +} + diff --git a/waybar/scripts/mediaplayer.py b/waybar/scripts/mediaplayer.py new file mode 100644 index 0000000..57b5240 --- /dev/null +++ b/waybar/scripts/mediaplayer.py @@ -0,0 +1,129 @@ +#!/usr/bin/env python3 +import argparse +import logging +import sys +import signal +import gi +import json +gi.require_version('Playerctl', '2.0') +from gi.repository import Playerctl, GLib + +logger = logging.getLogger(__name__) + + +def write_output(text, player): + logger.info('Writing output') + + output = {'text': text, + 'class': 'custom-' + player.props.player_name, + 'alt': player.props.player_name} + + sys.stdout.write(json.dumps(output) + '\n') + sys.stdout.flush() + + +def on_play(player, status, manager): + logger.info('Received new playback status') + on_metadata(player, player.props.metadata, manager) + + +def on_metadata(player, metadata, manager): + logger.info('Received new metadata') + track_info = '' + + if player.props.player_name == 'spotify' and \ + 'mpris:trackid' in metadata.keys() and \ + ':ad:' in player.props.metadata['mpris:trackid']: + track_info = 'AD PLAYING' + elif player.get_artist() != '' and player.get_title() != '': + track_info = '{artist} - {title}'.format(artist=player.get_artist(), + title=player.get_title()) + else: + track_info = player.get_title() + + if player.props.status != 'Playing' and track_info: + track_info = ' ' + track_info + write_output(track_info, player) + + +def on_player_appeared(manager, player, selected_player=None): + if player is not None and (selected_player is None or player.name == selected_player): + init_player(manager, player) + else: + logger.debug("New player appeared, but it's not the selected player, skipping") + + +def on_player_vanished(manager, player): + logger.info('Player has vanished') + sys.stdout.write('\n') + sys.stdout.flush() + + +def init_player(manager, name): + logger.debug('Initialize player: {player}'.format(player=name.name)) + player = Playerctl.Player.new_from_name(name) + player.connect('playback-status', on_play, manager) + player.connect('metadata', on_metadata, manager) + manager.manage_player(player) + on_metadata(player, player.props.metadata, manager) + + +def signal_handler(sig, frame): + logger.debug('Received signal to stop, exiting') + sys.stdout.write('\n') + sys.stdout.flush() + # loop.quit() + sys.exit(0) + + +def parse_arguments(): + parser = argparse.ArgumentParser() + + # Increase verbosity with every occurrence of -v + parser.add_argument('-v', '--verbose', action='count', default=0) + + # Define for which player we're listening + parser.add_argument('--player') + + return parser.parse_args() + + +def main(): + arguments = parse_arguments() + + # Initialize logging + logging.basicConfig(stream=sys.stderr, level=logging.DEBUG, + format='%(name)s %(levelname)s %(message)s') + + # Logging is set by default to WARN and higher. + # With every occurrence of -v it's lowered by one + logger.setLevel(max((3 - arguments.verbose) * 10, 0)) + + # Log the sent command line arguments + logger.debug('Arguments received {}'.format(vars(arguments))) + + manager = Playerctl.PlayerManager() + loop = GLib.MainLoop() + + manager.connect('name-appeared', lambda *args: on_player_appeared(*args, arguments.player)) + manager.connect('player-vanished', on_player_vanished) + + signal.signal(signal.SIGINT, signal_handler) + signal.signal(signal.SIGTERM, signal_handler) + signal.signal(signal.SIGPIPE, signal.SIG_DFL) + + for player in manager.props.player_names: + if arguments.player is not None and arguments.player != player.name: + logger.debug('{player} is not the filtered player, skipping it' + .format(player=player.name) + ) + continue + + init_player(manager, player) + + loop.run() + + +if __name__ == '__main__': + main() + diff --git a/waybar/style.css b/waybar/style.css new file mode 100644 index 0000000..c92fd57 --- /dev/null +++ b/waybar/style.css @@ -0,0 +1,106 @@ +* { + /* `otf-font-awesome` is required to be installed for icons */ + font-family: Iosevka Term; + font-size: 13px; +} + +window#waybar { + background-color: #1c1c1c; + color: #ffffff; + border-bottom: 3px solid #4d4d4d; + transition-property: background-color; + transition-duration: .5s; +} + +window#waybar.hidden { + opacity: 0.2; +} + + +button { + /* Use box-shadow instead of border so the text isn't offset */ + box-shadow: inset 0 -3px transparent; + /* Avoid rounded borders under each button name */ + border: none; + border-radius: 0; +} + +/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ + +#workspaces button { + padding: 0 5px; + background-color: transparent; + color: #ffffff; +} + +#workspaces button:hover { + background: rgba(0, 0, 0, 0.2); +} + +#workspaces button.focused { + background-color: #4d4d4d; +} + +#workspaces button.urgent { + background-color: #eb4d4b; +} + +#mode { + font-style: italic; + background-color: #4d4d4d; +} + +#clock, +#battery, +#cpu, +#memory, +#disk, +#temperature, +#backlight, +#network, +#pulseaudio, +#wireplumber, +#custom-media, +#tray, +#mode, +#idle_inhibitor, +#scratchpad, +#mpd { + padding: 0 10px; + color: #ffffff; +} + +#window, +#workspaces { + margin: 0 4px; +} + +/* If workspaces is the leftmost module, omit left margin */ +.modules-left > widget:first-child > #workspaces { + margin-left: 0; +} + +/* If workspaces is the rightmost module, omit right margin */ +.modules-right > widget:last-child > #workspaces { + margin-right: 0; +} + +@keyframes blink { + to { + background-color: #ffffff; + color: #000000; + } +} + +label:focus { + background-color: #000000; +} + +#custom-media { + min-width: 100px; +} + +#tray > .passive { + -gtk-icon-effect: dim; +} + |
