From 42f2f27183a7cb340f90f2f5b89ae48c3fb1f824 Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Mon, 16 Dec 2019 00:54:46 -0700 Subject: [PATCH] develop#graphical: init --- configurations/hp500281.nix | 1 + profiles/graphical/default.nix | 93 ++++++++ profiles/graphical/qutebrowser/config.py | 281 +++++++++++++++++++++++ profiles/graphical/sway/config | 238 +++++++++++++++++++ profiles/graphical/sway/default.nix | 113 +++++++++ profiles/graphical/sway/volnoti.nix | 19 ++ profiles/graphical/sway/waybar/config | 77 +++++++ profiles/graphical/sway/waybar/style.css | 122 ++++++++++ users/nrd.nix | 7 + 9 files changed, 951 insertions(+) create mode 100644 profiles/graphical/default.nix create mode 100644 profiles/graphical/qutebrowser/config.py create mode 100644 profiles/graphical/sway/config create mode 100644 profiles/graphical/sway/default.nix create mode 100644 profiles/graphical/sway/volnoti.nix create mode 100644 profiles/graphical/sway/waybar/config create mode 100644 profiles/graphical/sway/waybar/style.css diff --git a/configurations/hp500281.nix b/configurations/hp500281.nix index a58a9be0..84db97f0 100644 --- a/configurations/hp500281.nix +++ b/configurations/hp500281.nix @@ -5,6 +5,7 @@ in { imports = [ ../users/nrd.nix + ../profiles/graphical ]; diff --git a/profiles/graphical/default.nix b/profiles/graphical/default.nix new file mode 100644 index 00000000..54c77361 --- /dev/null +++ b/profiles/graphical/default.nix @@ -0,0 +1,93 @@ +{ config, pkgs, ... }: +let + inherit (builtins) + readFile + ; +in +{ + imports = [ + ./sway + ]; + + sound.enable = true; + + environment = { + etc = { + "xdg/gtk-3.0/settings.ini" = { + text = '' + [ Settings ] + gtk-icon-theme-name=Papirus-Adapta + gtk-theme-name=Adapta + gtk-cursor-theme-name=Adwaita + ''; + mode = "444"; + }; + + "xdg/qutebrowser/config.py".text = let + mpv = "${pkgs.mpv}/bin/mpv"; + in + '' + ${readFile ./qutebrowser/config.py} + + config.bind(',m', 'hint links spawn -d ${mpv} {hint-url}') + config.bind(',v', 'spawn -d ${mpv} {url}') + ''; + }; + + sessionVariables = { + # default browser + BROWSER = "qute"; + + # Theme settings + QT_QPA_PLATFORMTHEME = "gtk2"; + GDK_PIXBUF_MODULE_FILE = + "$(echo ${pkgs.librsvg.out}/lib/gdk-pixbuf-2.0/*/loaders.cache)"; + GTK2_RC_FILES = let + gtk = '' + gtk-icon-theme-name="Papirus-Adapta" + gtk-cursor-theme-name="Adwaita" + ''; + in + [ + (''${ pkgs.writeText "iconrc" "${gtk}" }'') + "${pkgs.adapta-gtk-theme}/share/themes/Adapta/gtk-2.0/gtkrc" + "${pkgs.gnome3.gnome-themes-extra}/share/themes/Adwaita/gtk-2.0/gtkrc" + ]; + }; + + systemPackages = with pkgs; [ + adapta-gtk-theme + cursor + dzen2 + feh + ffmpeg_4 + gnome3.adwaita-icon-theme + gnome-themes-extra + imagemagick + imlib2 + librsvg + libsForQt5.qtstyleplugins + mpv + networkmanager_dmenu + papirus-icon-theme + qute + qutebrowser + youtubeDL + zathura + ]; + }; + + nixpkgs.overlays = let + qutebrowser = self: super: { + qute = super.writeShellScriptBin "qute" '' + ${super.qutebrowser}/bin/qutebrowser -C /etc/xdg/qutebrowser/config.py "$@" + ''; + + cursor = super.writeTextDir "share/icons/default/index.theme" '' + [icon theme] + Inherits=Adwaita + ''; + }; + in + [ qutebrowser ]; +} diff --git a/profiles/graphical/qutebrowser/config.py b/profiles/graphical/qutebrowser/config.py new file mode 100644 index 00000000..ead3c2cb --- /dev/null +++ b/profiles/graphical/qutebrowser/config.py @@ -0,0 +1,281 @@ +# Documentation: +# qute://help/configuring.html +# qute://help/settings.html + +# Uncomment this to still load settings configured via autoconfig.yml +# config.load_autoconfig() + +# Require a confirmation before quitting the application. +# Type: ConfirmQuit +# Valid values: +# - always: Always show a confirmation. +# - multiple-tabs: Show a confirmation if multiple tabs are opened. +# - downloads: Show a confirmation if downloads are running +# - never: Never show a confirmation. +c.confirm_quit = ['downloads'] + +# Additional arguments to pass to Qt, without leading `--`. With +# QtWebEngine, some Chromium arguments (see +# https://peter.sh/experiments/chromium-command-line-switches/ for a +# list) will work. +# Type: List of String +c.qt.args = [ + 'disable-reading-from-canvas', 'enable-native-gpu-memory-buffers', + 'force-webrtc-ip-handling-policy=default_public_interface_only', + 'no-sandbox' +] + +# Allow websites to request geolocations. +# Type: BoolAsk +# Valid values: +# - true +# - false +# - ask +c.content.geolocation = False + +# Value to send in the `DNT` header. When this is set to true, +# qutebrowser asks websites to not track your identity. If set to null, +# the DNT header is not sent at all. +# Type: Bool +c.content.headers.do_not_track = True + +# Enable host blocking. +# Type: Bool +c.content.host_blocking.enabled = False + +# Allow JavaScript to read from or write to the clipboard. With +# QtWebEngine, writing the clipboard as response to a user interaction +# is always allowed. +# Type: Bool +c.content.javascript.can_access_clipboard = False + +# Allow JavaScript to open new tabs without user interaction. +# Type: Bool +c.content.javascript.can_open_tabs_automatically = False + +# Enable JavaScript. +# Type: Bool +c.content.javascript.enabled = True + +# Enable JavaScript. +# Type: Bool +config.set('content.javascript.enabled', True, 'file://*') + +# Enable JavaScript. +# Type: Bool +config.set('content.javascript.enabled', True, 'chrome://*/*') + +# Enable JavaScript. +# Type: Bool +config.set('content.javascript.enabled', True, 'qute://*/*') + +# Allow locally loaded documents to access remote URLs. +# Type: Bool +c.content.local_content_can_access_remote_urls = False + +# Allow locally loaded documents to access other local URLs. +# Type: Bool +c.content.local_content_can_access_file_urls = True + +# Enable support for HTML 5 local storage and Web SQL. +# Type: Bool +c.content.local_storage = True + +# Allow websites to record audio/video. +# Type: BoolAsk +# Valid values: +# - true +# - false +# - ask +c.content.media_capture = 'ask' + +# Enable plugins in Web pages. +# Type: Bool +c.content.plugins = False + +# Draw the background color and images also when the page is printed. +# Type: Bool +c.content.print_element_backgrounds = True + +# Open new windows in private browsing mode which does not record +# visited pages. +# Type: Bool +c.content.private_browsing = False + +# Enable WebGL. +# Type: Bool +c.content.webgl = True + +# Monitor load requests for cross-site scripting attempts. Suspicious +# scripts will be blocked and reported in the inspector's JavaScript +# console. Enabling this feature might have an impact on performance. +# Type: Bool +c.content.xss_auditing = True + +# What to display in the download filename input. +# Type: String +# Valid values: +# - path: Show only the download path. +# - filename: Show only download filename. +# - both: Show download path and filename. +c.downloads.location.suggestion = 'filename' + +# Where to show the downloaded files. +# Type: VerticalPosition +# Valid values: +# - top +# - bottom +c.downloads.position = 'top' + +# Duration (in milliseconds) to wait before removing finished downloads. +# If set to -1, downloads are never removed. +# Type: Int +c.downloads.remove_finished = 8000 + +# Automatically enter insert mode if an editable element is focused +# after loading the page. +# Type: Bool +c.input.insert_mode.auto_load = True + +# Leave insert mode if a non-editable element is clicked. +# Type: Bool +c.input.insert_mode.auto_leave = True + +# Duration (in milliseconds) to show messages in the statusbar for. Set +# to 0 to never clear messages. +# Type: Int +c.messages.timeout = 8000 + +# Enable smooth scrolling for web pages. Note smooth scrolling does not +# work with the `:scroll-px` command. +# Type: Bool +c.scrolling.smooth = True + +# Languages to use for spell checking. You can check for available +# languages and install dictionaries using scripts/dictcli.py. Run the +# script with -h/--help for instructions. +# Type: List of String +# Valid values: +# - af-ZA: Afrikaans (South Africa) +# - bg-BG: Bulgarian (Bulgaria) +# - ca-ES: Catalan (Spain) +# - cs-CZ: Czech (Czech Republic) +# - da-DK: Danish (Denmark) +# - de-DE: German (Germany) +# - el-GR: Greek (Greece) +# - en-AU: English (Australia) +# - en-CA: English (Canada) +# - en-GB: English (United Kingdom) +# - en-US: English (United States) +# - es-ES: Spanish (Spain) +# - et-EE: Estonian (Estonia) +# - fa-IR: Farsi (Iran) +# - fo-FO: Faroese (Faroe Islands) +# - fr-FR: French (France) +# - he-IL: Hebrew (Israel) +# - hi-IN: Hindi (India) +# - hr-HR: Croatian (Croatia) +# - hu-HU: Hungarian (Hungary) +# - id-ID: Indonesian (Indonesia) +# - it-IT: Italian (Italy) +# - ko: Korean +# - lt-LT: Lithuanian (Lithuania) +# - lv-LV: Latvian (Latvia) +# - nb-NO: Norwegian (Norway) +# - nl-NL: Dutch (Netherlands) +# - pl-PL: Polish (Poland) +# - pt-BR: Portuguese (Brazil) +# - pt-PT: Portuguese (Portugal) +# - ro-RO: Romanian (Romania) +# - ru-RU: Russian (Russia) +# - sh: Serbo-Croatian +# - sk-SK: Slovak (Slovakia) +# - sl-SI: Slovenian (Slovenia) +# - sq: Albanian +# - sr: Serbian +# - sv-SE: Swedish (Sweden) +# - ta-IN: Tamil (India) +# - tg-TG: Tajik (Tajikistan) +# - tr-TR: Turkish (Turkey) +# - uk-UA: Ukrainian (Ukraine) +# - vi-VN: Vietnamese (Viet Nam) +c.spellcheck.languages = ['en-US'] + +# Position of the tab bar. +# Type: Position +# Valid values: +# - top +# - bottom +# - left +# - right +c.tabs.position = 'top' + +# When to show the tab bar. +# Type: String +# Valid values: +# - always: Always show the tab bar. +# - never: Always hide the tab bar. +# - multiple: Hide the tab bar if only one tab is open. +# - switching: Show the tab bar when switching tabs. +c.tabs.show = 'switching' + +# Search engines which can be used via the address bar. Maps a search +# engine name (such as `DEFAULT`, or `ddg`) to a URL with a `{}` +# placeholder. The placeholder will be replaced by the search term, use +# `{{` and `}}` for literal `{`/`}` signs. The search engine named +# `DEFAULT` is used when `url.auto_search` is turned on and something +# else than a URL was entered to be opened. Other search engines can be +# used by prepending the search engine name to the search term, e.g. +# `:open google qutebrowser`. +# Type: Dict +c.url.searchengines = { + 'DEFAULT': 'https://duckduckgo.com/?q={}', + 'y': 'https://youtube.com/results?search_query={}', + 'w': 'https://en.wikipedia.org/w/index.php?search={}', + 'aw': 'https://wiki.archlinux.org/index.php?search={}', + 'g': 'https://www.google.com/search?source=&q={}', + 'gi': 'https://www.google.com/search?tbm=isch&q={}', + 'aur': 'https://aur.archlinux.org/packages/?O=0&K={}', + 'c': 'https://en.cppreference.com/w/cpp/keyword/{}', + 'r': 'https://doc.rust-lang.org/stable/std/?search={}' +} + +c.url.start_pages = ['https://nixos.org/nixos/manual/options.html'] + +c.hints.chars = "asdfghjklvbcntyruewom" + +# Font color for hints. +# Type: QssColor +c.colors.hints.fg = '#EFF0EB' + +# Background color for hints. Note that you can use a `rgba(...)` value +# for transparency. +# Type: QssColor +c.colors.hints.bg = '#1E1F29' + +# Font color for the matched part of hints. +# Type: QssColor +c.colors.hints.match.fg = '#5AF78E' + +# Default monospace fonts. Whenever "monospace" is used in a font +# setting, it's replaced with the fonts listed here. +# Type: Font +c.fonts.monospace = 'monospace' + +# leave listed modes easily with +for mode in\ + ['caret', 'command', 'hint', + 'insert', 'passthrough', 'prompt', + 'yesno']: + config.bind('', 'leave-mode', mode=mode) + +# Bindings for normal mode +config.bind(',p', 'spawn --userscript qute-pass') +config.bind(',P', 'set-cmd-text -s :open -p') +config.bind(',r', 'restart') +config.bind(',c', 'config-source') +config.bind(';I', 'hint images download') +config.bind('X', 'undo') +config.bind('d', 'scroll-page 0 0.5') +config.bind('u', 'scroll-page 0 -0.5') +config.bind('x', 'tab-close') diff --git a/profiles/graphical/sway/config b/profiles/graphical/sway/config new file mode 100644 index 00000000..5d3b2b61 --- /dev/null +++ b/profiles/graphical/sway/config @@ -0,0 +1,238 @@ +### 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 +# preferred terminal emulator +set $term alacritty -e tmux new-session -A -snrd + +# preferred browser +set $browser qute + +# Your preferred application launcher +# Note: it's recommended that you pass the final command to sway +set $menu dmenu_path | dmenu -b | xargs swaymsg exec -- + +# network manager +set $net_menu networkmanager_dmenu -b + +# don't show window titles only show single pixel as border +default_border pixel + +set $φ 38 ppt +set $Φ 62 ppt + +# reusable regexes +set $media "mpv|retroarch" + +### Autostart configuration +# launch browser and tmux session in $terminal on launch + +for_window [app_id="Alacritty"] resize set width $φ +exec $browser +exec $term + +### idle configuration + +exec swayidle -w \ + timeout 300 'loginctl lock-session' \ + timeout 300 'swaymsg "output * dpms off"' \ + resume 'swaymsg "output * dpms on"' \ + lock 'swaylock -e -f -c 000000' \ + before-sleep 'loginctl lock-session' + +for_window [class=".*"] inhibit_idle fullscreen +for_window [app_id=".*"] inhibit_idle fullscreen + +### Input configuration +# +# Example configuration: +# + input "2:7:SynPS/2_Synaptics_TouchPad" { + dwt disable + tap enabled + natural_scroll enabled + middle_emulation enabled + pointer_accel 1 + } + +# hide mouse cursor after one second + seat seat0 { + hide_cursor 1000 + } +# +# 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. + +### Key bindings +# +# Basics: +# + # Start a terminal + bindsym $mod+Return exec $term + + # Start browser + bindsym $mod+Shift+b exec $browser + + # Kill focused window + bindsym $mod+Shift+c kill + + # Start your launcher + bindsym $mod+d exec $menu + + # start network manager + bindsym $mod+n exec $net_menu + + # lock screen + bindsym $mod+Ctrl+l exec loginctl lock-session + + # go fullscreen + bindsym $mod+f fullscreen + + # display volume level when pushed + bindsym XF86AudioRaiseVolume exec $volume + bindsym XF86AudioLowerVolume exec $volume + bindsym XF86AudioMute exec $volume + + # 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+q reload + + # Exit sway (logs you out of your Wayland session) + bindsym $mod+Shift+e exec 'swaymsg exit' +# +# 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 1:main + bindsym $mod+2 workspace 2 + bindsym $mod+3 workspace 3 + bindsym $mod+4 workspace 4 + bindsym $mod+5 workspace 5 + bindsym $mod+6 workspace 6:media + bindsym $mod+7 workspace 7 + bindsym $mod+8 workspace 8 + bindsym $mod+9 workspace 9 + bindsym $mod+0 workspace 10 + # Move focused container to workspace + bindsym $mod+Shift+1 move container to workspace 1:main + bindsym $mod+Shift+2 move container to workspace 2 + bindsym $mod+Shift+3 move container to workspace 3 + bindsym $mod+Shift+4 move container to workspace 4 + bindsym $mod+Shift+5 move container to workspace 5 + bindsym $mod+Shift+6 move container to workspace 6:media + bindsym $mod+Shift+7 move container to workspace 7 + bindsym $mod+Shift+8 move container to workspace 8 + bindsym $mod+Shift+9 move container to workspace 9 + bindsym $mod+Shift+0 move container to workspace 10 + # Note: workspaces can have any name you want, not just numbers. + # We just use 1-10 as the default. + assign [app_id=$media] workspace 6:media + for_window [app_id=$media] fullscreen enable + # [app_id=$media] focus +# +# 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 + + # Toggle the current focus between tiling and floating mode + bindsym $mod+t floating toggle + + # Swap focus between the tiling area and the floating area + bindsym $mod+Shift+t focus mode_toggle + + # resize window to approximately φ ratio of screen + bindsym $mod+Shift+space exec swaymsg resize set width $φ + bindsym $mod+space exec swaymsg resize set width $Φ + + # 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" + +# +# Status Bar: +# +# Read `man 5 sway-bar` for more information about this section. +bar { + swaybar_command waybar +} + +exec "systemctl --user import-environment; systemctl --user start sway-session.target" diff --git a/profiles/graphical/sway/default.nix b/profiles/graphical/sway/default.nix new file mode 100644 index 00000000..f84fccd7 --- /dev/null +++ b/profiles/graphical/sway/default.nix @@ -0,0 +1,113 @@ +{ lib, config, options, pkgs, ... }: +let + inherit (builtins) + readFile + ; + + inherit (config.hardware) + pulseaudio + ; +in +{ + programs.sway = { + enable = true; + + extraSessionCommands = '' + export SDL_VIDEODRIVER=wayland + # needs qt5.qtwayland in systemPackages + export QT_QPA_PLATFORM=wayland + export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" + # Fix for some Java AWT applications (e.g. Android Studio), + # use this if they aren't displayed properly: + export _JAVA_AWT_WM_NONREPARENTING=1 + ''; + + extraPackages = with pkgs; options.programs.sway.extraPackages.default + ++ [ + qt5.qtwayland + alacritty + volnoti + wl-clipboard + (waybar.override { pulseSupport = pulseaudio.enable; }) + ] + ; + }; + + environment.etc = { + "sway/config".text = let + volnoti = pkgs.writeScript "volnoti.sh" (import ./volnoti.nix { inherit pkgs; }); + in + '' + set $volume ${volnoti} + + # set background + output * bg ${pkgs.adapta-backgrounds}/share/backgrounds/adapta/tri-fadeno.jpg fill + + ${readFile ./config} + ''; + + "xdg/waybar".source = ./waybar; + }; + + services.redshift = { + enable = true; + brightness.night = "0.7"; + temperature.night = 3200; + }; + + location = { + latitude = 38.833881; + longitude = -104.821365; + }; + + systemd.user.targets.sway-session = { + enable = true; + description = "sway compositor session"; + documentation = [ "man:systemd.special(7)" ]; + + bindsTo = [ "graphical-session.target" ]; + wants = [ "graphical-session-pre.target" ]; + after = [ "graphical-session-pre.target" ]; + requiredBy = [ "graphical-session.target" "graphical-session-pre.target" ]; + }; + + systemd.user.services.volnoti = { + enable = true; + description = "volnoti volume notification"; + documentation = [ "volnoti --help" ]; + wantedBy = [ "sway-session.target" ]; + + script = ''${pkgs.volnoti}/bin/volnoti -n''; + + serviceConfig = { + Restart = "always"; + RestartSec = 3; + }; + }; + + nixpkgs.overlays = let + overlay = self: super: { + redshift = super.redshift.overrideAttrs ( + o: { + src = super.fetchFromGitHub { + owner = "CameronNemo"; + repo = "redshift"; + rev = "39c162ca487a59857c2eac231318f4b28855798b"; + sha256 = "1in27draskwwi097wiam26bx2szcf58297am3gkyng1ms3rz6i58"; + }; + } + ); + wl-clipboard = super.wl-clipboard.overrideAttrs ( + o: { + src = super.fetchFromGitHub { + owner = "bugaevc"; + repo = "wl-clipboard"; + rev = "c010972e6b0d2eb3002c49a6a1b5620ff5f7c910"; + sha256 = "020l3jy9gsj6gablwdfzp1wfa8yblay3axdjc56i9q8pbhz7g12j"; + }; + } + ); + }; + in + [ overlay ]; +} diff --git a/profiles/graphical/sway/volnoti.nix b/profiles/graphical/sway/volnoti.nix new file mode 100644 index 00000000..e74b52e6 --- /dev/null +++ b/profiles/graphical/sway/volnoti.nix @@ -0,0 +1,19 @@ +{ pkgs, ... }: +let + inherit (pkgs) alsaUtils bash gnugrep volnoti; +in +'' + #!${bash}/bin/bash + + declare -i current=$(${alsaUtils}/bin/amixer get Master | ${gnugrep}/bin/grep -m1 -Po "[0-9]+(?=%)") + if [[ $current -gt 100 ]]; then + current=100 + fi + + + if ${alsaUtils}/bin/amixer get Master | ${gnugrep}/bin/grep -Fq "[off]"; then + ${volnoti}/bin/volnoti-show -m $current + else + ${volnoti}/bin/volnoti-show $current + fi +'' diff --git a/profiles/graphical/sway/waybar/config b/profiles/graphical/sway/waybar/config new file mode 100644 index 00000000..b7d219b4 --- /dev/null +++ b/profiles/graphical/sway/waybar/config @@ -0,0 +1,77 @@ +{ + "layer": "top", // Waybar at top layer + // Choose the order of the modules + "modules-left": ["sway/workspaces", "sway/mode"], + "modules-center": ["sway/window"], + "modules-right": ["cpu", "memory", "temperature", "backlight", "pulseaudio", "network", "battery", "clock", "tray"], + // Modules configuration + "sway/mode": { + "format": "{}" + }, + "clock": { + "format": "{:%l:%M %P}", + "tooltip-format": "{:%Y-%m-%d | %l:%M %P}", + "format-alt": "{:%Y-%m-%d}" + }, + "cpu": { + "format": "{usage}% ", + "tooltip": false + }, + "memory": { + "format": "{}% " + }, + "temperature": { + // "thermal-zone": 2, + // "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input", + "critical-threshold": 80, + // "format-critical": "{temperatureC}°C {icon}", + "format": "{temperatureC}°C {icon}", + "format-icons": ["", "", ""] + }, + "backlight": { + "format": "{percent}% {icon}", + "format-icons": ["", ""] + }, + "battery": { + "states": { + "warning": 30, + "critical": 15 + }, + "format": "{capacity}% {icon}", + "format-charging": "{capacity}% ", + "format-plugged": "{capacity}% ", + "format-alt": "{time} {icon}", + // "format-good": "", // An empty format will hide the module + // "format-full": "", + "format-icons": ["", "", "", "", ""] + }, + "network": { + "format-wifi": "{essid} ({signalStrength}%) ", + "format-ethernet": "{ifname}: {ipaddr}/{cidr} ", + "format-linked": "{ifname} (No IP) ", + "format-disconnected": "Disconnected ⚠", + "format-alt": "{ifname}: {ipaddr}/{cidr}" + }, + "pulseaudio": { + // "scroll-step": 1, // %, can be a float + "format": "{volume}% {icon} {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": { + "headphones": "", + "handsfree": "", + "headset": "", + "phone": "", + "portable": "", + "car": "", + "default": ["", "", ""] + } + }, + "tray": { + "icon-size": 21, + "spacing": 10 + } +} diff --git a/profiles/graphical/sway/waybar/style.css b/profiles/graphical/sway/waybar/style.css new file mode 100644 index 00000000..6819d5bd --- /dev/null +++ b/profiles/graphical/sway/waybar/style.css @@ -0,0 +1,122 @@ +* { + border: none; + border-radius: 0; + font-family: Roboto, Helvetica, Arial, sans-serif; + font-size: 13px; + min-height: 0; +} + +window#waybar { + background-color: rgba(43, 48, 59, 0.5); + border-bottom: 3px solid rgba(100, 114, 125, 0.5); + color: #ffffff; + transition-property: background-color; + transition-duration: .5s; +} + +window#waybar.hidden { + opacity: 0.2; +} + +/* +window#waybar.empty { + background-color: transparent; +} +window#waybar.solo { + background-color: #FFFFFF; +} +*/ + +window#waybar.termite { + background-color: #3F3F3F; +} + +window#waybar.chromium { + background-color: #000000; + border: none; +} + +#workspaces button { + padding: 0 5px; + background-color: transparent; + color: #ffffff; + border-bottom: 3px solid transparent; +} + +/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ +#workspaces button:hover { + background: rgba(0, 0, 0, 0.2); + box-shadow: inherit; + border-bottom: 3px solid #ffffff; +} + +#workspaces button.focused { + background-color: #64727D; + border-bottom: 3px solid #ffffff; +} + +#workspaces button.urgent { + background-color: #eb4d4b; +} + +#mode { + background-color: #64727D; + border-bottom: 3px solid #ffffff; +} + +#clock, +#battery, +#cpu, +#memory, +#temperature, +#backlight, +#network, +#pulseaudio, +#custom-media, +#tray, +#mode, +#idle_inhibitor { + padding: 0 10px; + margin: 0 4px; + color: #ffffff; +} + +#battery.charging { + color: #ffffff; + background-color: #26A65B; +} + +@keyframes blink { + to { + background-color: #ffffff; + color: #000000; + } +} + +#battery.critical:not(.charging) { + background-color: #f53c3c; + color: #ffffff; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +label:focus { + background-color: #000000; +} + +#network.disconnected { + background-color: #f53c3c; +} + +#pulseaudio.muted { + background-color: #90b1b1; + color: #2a5c45; +} + +#temperature.critical { + background-color: #eb4d4b; +} + diff --git a/users/nrd.nix b/users/nrd.nix index 1bb1c3d0..311b92e8 100644 --- a/users/nrd.nix +++ b/users/nrd.nix @@ -41,6 +41,13 @@ in }; }; + programs.mpv = { + enable = true; + config = { + ytdl-format = "bestvideo[height<=?1080]+bestaudio/best"; + }; + }; + programs.git = { enable = true;