diff --git a/Makefile b/Makefile index da29fe4..ecb72d1 100644 --- a/Makefile +++ b/Makefile @@ -5,16 +5,19 @@ SYSCONFDIR ?= /etc BINDIR ?= $(PREFIX)/bin DATADIR ?= $(PREFIX)/share LIBEXECDIR ?= $(PREFIX)/libexec +BACKGROUND ?= $(DATADIR)/backgrounds/default.png .PHONY: build clean install check requires .DEFAULT: build -GENERATED := $(patsubst %.in,%,$(wildcard sway/*.in sway/*/*.in )) -VARIABLES := PREFIX SYSCONFDIR DATADIR LIBEXECDIR +TEMPLATES := sway/*.in sway/*/*.in swaylock/*.in sddm/03-sway-fedora/theme.conf.in +GENERATED := $(patsubst %.in,%,$(wildcard $(TEMPLATES))) +VARIABLES := PREFIX SYSCONFDIR DATADIR LIBEXECDIR BACKGROUND -sway/%: sway/%.in - sed "$(foreach var,$(VARIABLES),s^@$(var)@^$($(var))^i;)" $^ > $@ - sed '$(foreach var,$(VARIABLES),s^$$$(var)\b^$($(var))^i;)' $^ > $@ +%: %.in + sed -e "$(foreach var,$(VARIABLES),s^@$(var)@^$($(var))^i;)" \ + -e '$(foreach var,$(VARIABLES),s^$$$(var)\b^$($(var))^i;)' \ + $^ > $@ build: $(GENERATED) @@ -54,10 +57,6 @@ ifeq ($(WITH_SDDM),yes) install: install-sddm endif -ifeq ($(WITH_WAYBAR),yes) -include waybar/build.mk -endif - install: install-sway install-swaylock check: diff --git a/sddm/03-sway-fedora/Main.qml b/sddm/03-sway-fedora/Main.qml index 06406ca..64e0231 100644 --- a/sddm/03-sway-fedora/Main.qml +++ b/sddm/03-sway-fedora/Main.qml @@ -41,17 +41,16 @@ Rectangle { Connections { target: sddm - onLoginSucceeded: { + function onLoginSucceeded() { errorMessage.color = "steelblue" errorMessage.text = textConstants.loginSucceeded } - - onLoginFailed: { + function onLoginFailed() { password.text = "" errorMessage.color = "red" errorMessage.text = textConstants.loginFailed } - onInformationMessage: { + function onInformationMessage(message) { errorMessage.color = "red" errorMessage.text = message } @@ -127,7 +126,7 @@ Rectangle { KeyNavigation.backtab: rebootButton; KeyNavigation.tab: password - Keys.onPressed: { + Keys.onPressed: function (event) { if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) { sddm.login(name.text, password.text, sessionIndex) event.accepted = true @@ -154,7 +153,7 @@ Rectangle { KeyNavigation.backtab: name; KeyNavigation.tab: session - Keys.onPressed: { + Keys.onPressed: function (event) { if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) { sddm.login(name.text, password.text, sessionIndex) event.accepted = true @@ -165,12 +164,12 @@ Rectangle { Row { spacing: 4 - width: parent.width + width: parent.width / 2 z: 100 Column { z: 100 - width: parent.width + width: parent.width * (layoutBox.visible ? 1.3 : 2) spacing : 4 anchors.bottom: parent.bottom @@ -193,7 +192,35 @@ Rectangle { model: sessionModel index: sessionModel.lastIndex - KeyNavigation.backtab: password; KeyNavigation.tab: loginButton + KeyNavigation.backtab: password; KeyNavigation.tab: layoutBox + } + } + + Column { + z: 101 + width: parent.width * 0.7 + spacing : 4 + anchors.bottom: parent.bottom + + visible: keyboard.enabled && keyboard.layouts.length > 0 + + Text { + id: lblLayout + width: parent.width + text: textConstants.layout + wrapMode: TextEdit.WordWrap + font.bold: true + font.pixelSize: 12 + } + + LayoutBox { + id: layoutBox + width: parent.width; height: 30 + font.pixelSize: 14 + + arrowIcon: Qt.resolvedUrl("angle-down.png") + + KeyNavigation.backtab: session; KeyNavigation.tab: loginButton } } } @@ -221,7 +248,7 @@ Rectangle { onClicked: sddm.login(name.text, password.text, sessionIndex) - KeyNavigation.backtab: session; KeyNavigation.tab: shutdownButton + KeyNavigation.backtab: layoutBox; KeyNavigation.tab: shutdownButton } Button { diff --git a/sddm/03-sway-fedora/metadata.desktop b/sddm/03-sway-fedora/metadata.desktop index aadbafe..c9d5cf6 100644 --- a/sddm/03-sway-fedora/metadata.desktop +++ b/sddm/03-sway-fedora/metadata.desktop @@ -14,3 +14,4 @@ TranslationsDirectory=translations Email=sway@lists.fedoraproject.org Theme-Id=03-sway-fedora Theme-API=2.0 +QtVersion=6 diff --git a/sddm/03-sway-fedora/theme.conf b/sddm/03-sway-fedora/theme.conf deleted file mode 100644 index 80ad085..0000000 --- a/sddm/03-sway-fedora/theme.conf +++ /dev/null @@ -1,2 +0,0 @@ -[General] -background=/usr/share/backgrounds/default.png diff --git a/sddm/03-sway-fedora/theme.conf.in b/sddm/03-sway-fedora/theme.conf.in new file mode 100644 index 0000000..757799e --- /dev/null +++ b/sddm/03-sway-fedora/theme.conf.in @@ -0,0 +1,2 @@ +[General] +background=@BACKGROUND@ diff --git a/sway-config-fedora.spec.rpkg b/sway-config-fedora.spec.rpkg index 8935d7a..35f5ce8 100644 --- a/sway-config-fedora.spec.rpkg +++ b/sway-config-fedora.spec.rpkg @@ -1,9 +1,8 @@ # vim: ft=spec %bcond initialsetup %[0%{?fedora} >= 40 || 0%{?rhel} >= 10] %bcond sddm 1 -%bcond waybar 1 %global sway_ver 1.8 -%global waybar_ver 0.9.24 +%global bg_format %[ 0%{?fedora} >= 42 ? "jxl" : "png" ] Name: {{{ git_name }}} Version: {{{ git_version }}} @@ -46,6 +45,9 @@ Requires: /usr/bin/pkill Requires: brightnessctl >= 0.5.1-11 Requires: desktop-backgrounds-compat Requires: grimshot +%if "%{bg_format}" == "jxl" +Requires: jxl-pixbuf-loader +%endif Requires: lxqt-policykit Requires: playerctl Requires: pulseaudio-utils @@ -82,6 +84,9 @@ Provides: sddm-greeter-displayserver Conflicts: sddm-greeter-displayserver Requires: desktop-backgrounds-compat +%if "%{bg_format}" == "jxl" +Requires: kf6-kimageformats +%endif Requires: sddm >= 0.20.0 Requires: sway >= %{sway_ver} @@ -90,37 +95,22 @@ This package contains configuration and dependencies for SDDM to use Sway for the greeter display server. %endif -%if %{with waybar} -%package -n waybar-config-fedora -Summary: Fedora Sway Spin configuration for Waybar - -Requires: waybar >= %{waybar_ver} -Provides: waybar-config = %{waybar_ver}+%{version}-%{release} -Conflicts: waybar-config - -%description -n waybar-config-fedora -%{summary}. - -%files -n waybar-config-fedora -%license LICENSE -%config(noreplace) %{_sysconfdir}/xdg/waybar/config -%config(noreplace) %{_sysconfdir}/xdg/waybar/style.css -%endif - %prep {{{ git_setup_macro path=$(git rev-parse --show-toplevel) }}} %build -%make_build +%make_build \ + PREFIX='%{_prefix}' \ + BACKGROUND='%{_datadir}/backgrounds/default.%{bg_format}' %install -%make_install PREFIX='%{_prefix}' \ +%make_install \ + PREFIX='%{_prefix}' \ WITH_INITIALSETUP='%[%{with initialsetup}?"yes":"no"]' \ - WITH_SDDM='%[%{with sddm}?"yes":"no"]' \ - WITH_WAYBAR='%[%{with waybar}?"yes":"no"]' + WITH_SDDM='%[%{with sddm}?"yes":"no"]' %files diff --git a/sway/config.in b/sway/config.in index 6e57ce5..53b8844 100644 --- a/sway/config.in +++ b/sway/config.in @@ -30,8 +30,8 @@ set $menu $rofi_cmd -show combi -combi-modes drun#run -modes combi ### Output configuration # # Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/) -# Requires: desktop-backgrounds-compat, swaybg -output * bg /usr/share/backgrounds/default.png fill +# Requires: desktop-backgrounds-compat, swaybg, jxl-pixbuf-loader +output * bg @BACKGROUND@ fill # # Example configuration: # diff --git a/sway/config.live.d/99-system-keyboard-config.conf b/sway/config.live.d/99-system-keyboard-config.conf new file mode 100644 index 0000000..c2c65eb --- /dev/null +++ b/sway/config.live.d/99-system-keyboard-config.conf @@ -0,0 +1,9 @@ +# Apply system-wide XKB configuration stored in systemd-localed. +# +# The configuration can be viewed with `localectl` and modified +# with `localectl set-x11-keymap`. +# +# In the live installer environment, Anaconda relies on the localed +# D-Bus API to update the keyboard configuration. + +exec /usr/libexec/sway-systemd/locale1-xkb-config diff --git a/swaylock/config b/swaylock/config.in similarity index 84% rename from swaylock/config rename to swaylock/config.in index ec2afc7..607bcf2 100644 --- a/swaylock/config +++ b/swaylock/config.in @@ -3,5 +3,5 @@ # # Image path supports environment variables and shell expansions, # e.g. image=$HOME/Pictures/default.png -image=/usr/share/backgrounds/default.png +image=@BACKGROUND@ scaling=fill diff --git a/waybar/build.mk b/waybar/build.mk deleted file mode 100644 index 6d60675..0000000 --- a/waybar/build.mk +++ /dev/null @@ -1,7 +0,0 @@ -.PHONY: install-waybar - -install-waybar: - install -D -m 0644 -pv -t $(DESTDIR)$(SYSCONFDIR)/xdg/waybar \ - waybar/config waybar/style.css - -install: install-waybar diff --git a/waybar/config b/waybar/config index 1938433..daad8ab 100644 --- a/waybar/config +++ b/waybar/config @@ -5,27 +5,9 @@ // "width": 1280, // Waybar width "spacing": 4, // Gaps between modules (4px) // Choose the order of the modules - "modules-left": [ - "sway/workspaces", - "sway/mode", - "sway/scratchpad" - ], - "modules-center": [ - "sway/window" - ], - "modules-right": [ - "idle_inhibitor", - "pulseaudio", - "network", - // "cpu", - // "memory", - // "temperature", - // "backlight", - "sway/language", - "battery", - "clock", - "tray" - ], + "modules-left": ["sway/workspaces", "sway/mode", "sway/scratchpad", "custom/media"], + "modules-center": ["sway/window"], + "modules-right": ["mpd", "idle_inhibitor", "pulseaudio", "network", "cpu", "memory", "temperature", "backlight", "keyboard-state", "sway/language", "battery", "battery#bat2", "clock", "tray"], // Modules configuration // "sway/workspaces": { // "disable-scroll": true, @@ -97,7 +79,7 @@ }, "tray": { // "icon-size": 21, - "spacing": 5 + "spacing": 10 }, "clock": { // "timezone": "America/New_York", @@ -122,7 +104,7 @@ "backlight": { // "device": "acpi_video1", "format": "{percent}% {icon}", - "format-icons": ["🌑", "🌘", "🌗", "🌖", "🌕"] + "format-icons": ["", "", "", "", "", "", "", "", ""] }, "battery": { "states": { diff --git a/waybar/style.css b/waybar/style.css index 19acc08..cf5c5fb 100644 --- a/waybar/style.css +++ b/waybar/style.css @@ -1,111 +1,21 @@ * { - font-family: 'Noto Sans Mono', 'Font Awesome 6 Free', 'Font Awesome 6 Brands', monospace; + /* `otf-font-awesome` is required to be installed for icons */ + font-family: FontAwesome, Roboto, Helvetica, Arial, sans-serif; font-size: 13px; } -@define-color inactive_module_color #a9a9a9; - window#waybar { - background-color: rgba(43, 48, 59, 0.8); - border-color: rgba(100, 114, 125, 0.5); - border-style: solid; + 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:not(.bottom):not(.left):not(.right) { - border-bottom-width: 2px; -} - -window#waybar.bottom { - border-top-width: 2px; -} - window#waybar.hidden { opacity: 0.2; } -button { - /* reset all builtin/theme styles */ - all: unset; - /* Restore some properties */ - min-height: 24px; - min-width: 16px; - padding: 0 10px; - transition: all 200ms ease-out; -} - -/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ -button:hover { - background: inherit; -} - -window#waybar:not(.bottom):not(.left):not(.right) button:hover{ - box-shadow: inset 0 -2px; -} - -window#waybar.bottom button:hover { - box-shadow: inset 0 2px; -} - -/* - * Common module rules - */ - -.modules-left > widget > label, -.modules-center > widget > label, -.modules-right > widget > label { - color: inherit; - margin: 0; - padding: 0 10px; -} - -.modules-left > widget > box, -.modules-center > widget > box, -.modules-right > widget > box { - color: inherit; - margin: 0; - padding: 0; -} - -/* If the leftmost module is a box, omit left margin and padding */ -.modules-left > widget:first-child > box { - margin-left: 0; - padding-left: 0; -} - -/* If the rightmost module is a box, omit right margin and padding */ -.modules-right > widget:last-child > box { - margin-right: 0; - padding-right: 0; -} - -/* - * Uncomment to draw module underlines - */ -/* -window#waybar:not(.bottom):not(.left):not(.right) .modules-left > widget > label, -window#waybar:not(.bottom):not(.left):not(.right) .modules-center > widget > label, -window#waybar:not(.bottom):not(.left):not(.right) .modules-right > widget > label { - box-shadow: inset 0 -2px; -} - -window#waybar.bottom .modules-left > widget > label, -window#waybar.bottom .modules-center > widget > label, -window#waybar.bottom .modules-right > widget > label { - box-shadow: inset 0 2px; -} - -window#waybar #window { - box-shadow: none; -} -*/ - -/* - * Workspace state and focused window rules - */ - /* window#waybar.empty { background-color: transparent; @@ -113,6 +23,7 @@ window#waybar.empty { window#waybar.solo { background-color: #FFFFFF; } +*/ window#waybar.termite { background-color: #3F3F3F; @@ -122,13 +33,23 @@ window#waybar.chromium { background-color: #000000; border: none; } -*/ -/* - * Styles and colors for important states - */ +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 */ +button:hover { + background: inherit; + box-shadow: inset 0 -3px #ffffff; +} #workspaces button { + padding: 0 5px; background-color: transparent; color: #ffffff; } @@ -139,14 +60,7 @@ window#waybar.chromium { #workspaces button.focused { background-color: #64727D; -} - -window#waybar:not(.bottom):not(.left):not(.right) #workspaces button.focused { - box-shadow: inset 0 -2px; -} - -window#waybar.bottom #workspaces button.focused { - box-shadow: inset 0 2px; + box-shadow: inset 0 -3px #ffffff; } #workspaces button.urgent { @@ -155,23 +69,56 @@ window#waybar.bottom #workspaces button.focused { #mode { background-color: #64727D; + border-bottom: 3px solid #ffffff; } -window#waybar:not(.bottom):not(.left):not(.right) #mode { - box-shadow: inset 0 -2px; -} - -window#waybar.bottom #mode { - box-shadow: inset 0 2px; -} - -#image { - margin: 0; +#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; +} + +#clock { + background-color: #64727D; +} + +#battery { + background-color: #ffffff; + color: #000000; } #battery.charging, #battery.plugged { - color: #32cd32; + color: #ffffff; + background-color: #26A65B; } @keyframes blink { @@ -182,7 +129,8 @@ window#waybar.bottom #mode { } #battery.critical:not(.charging) { - color: #f53c3c; + background-color: #f53c3c; + color: #ffffff; animation-name: blink; animation-duration: 0.5s; animation-timing-function: linear; @@ -190,60 +138,128 @@ window#waybar.bottom #mode { animation-direction: alternate; } -#network.disconnected, -#pulseaudio.muted, +label:focus { + background-color: #000000; +} + +#cpu { + background-color: #2ecc71; + color: #000000; +} + +#memory { + background-color: #9b59b6; +} + +#disk { + background-color: #964B00; +} + +#backlight { + background-color: #90b1b1; +} + +#network { + background-color: #2980b9; +} + +#network.disconnected { + background-color: #f53c3c; +} + +#pulseaudio { + background-color: #f1c40f; + color: #000000; +} + +#pulseaudio.muted { + background-color: #90b1b1; + color: #2a5c45; +} + +#wireplumber { + background-color: #fff0f5; + color: #000000; +} + #wireplumber.muted { - color: @inactive_module_color; + background-color: #f53c3c; +} + +#custom-media { + background-color: #66cc99; + color: #2a5c45; + min-width: 100px; +} + +#custom-media.custom-spotify { + background-color: #66cc99; +} + +#custom-media.custom-vlc { + background-color: #ffa000; +} + +#temperature { + background-color: #f0932b; +} + +#temperature.critical { + background-color: #eb4d4b; } #tray { - padding: 0 5px; + background-color: #2980b9; } #tray > .passive { -gtk-icon-effect: dim; } -@keyframes needs-attention { - to { - background-color: rgba(235, 77, 75, 0.5); - } -} - #tray > .needs-attention { -gtk-icon-effect: highlight; - animation-name: needs-attention; - animation-duration: 1s; - animation-timing-function: linear; - animation-iteration-count: infinite; - animation-direction: alternate; - background-color: transparent; + background-color: #eb4d4b; } #idle_inhibitor { - color: @inactive_module_color; + background-color: #2d3436; } #idle_inhibitor.activated { - color: inherit; + background-color: #ecf0f1; + color: #2d3436; +} + +#mpd { + background-color: #66cc99; + color: #2a5c45; +} + +#mpd.disconnected { + background-color: #f53c3c; } -#mpd.disconnected, -#mpd.paused, #mpd.stopped { - color: @inactive_module_color; + background-color: #90b1b1; } -#cpu.high, -#temperature.critical { - color: #eb4d4b; +#mpd.paused { + background-color: #51a37a; } #language { + background: #00b093; + color: #740864; + padding: 0 5px; + margin: 0 5px; min-width: 16px; } #keyboard-state { + background: #97e1ad; + color: #000000; + padding: 0 0px; + margin: 0 5px; min-width: 16px; } @@ -262,54 +278,3 @@ window#waybar.bottom #mode { #scratchpad.empty { background-color: transparent; } - -/* - * Less important colors. - * Uncomment this if you want more colorful bar - */ -/* -#cpu { - color: #2ecc71; -} - -#memory { - color: #ba55d3; -} - -#disk { - color: #964B00; -} - -#backlight { - color: #90b1b1; -} - -#network { - color: #00bfff; -} - -#pulseaudio, -#wireplumber { - color: #f1c40f; -} - -#temperature { - color: #f0932b; -} - -#mpd { - color: #66cc99; -} - -#mpd.paused { - color: #51a37a; -} - -#language { - color: #00b093; -} - -#keyboard-state { - color: #97e1ad; -} -*/