Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Fantastic Sliders and Where to Find Them (Audio, Backlight and Abstract Sliders) #2575

Merged
merged 8 commits into from
Oct 16, 2023

Conversation

Syndelis
Copy link
Contributor

About this PR

This PR:

  1. Slightly refactors the pulseaudio module, moving all logic specific to dealing with pulseaudio into its own class, PulseaudioBackend;
  2. Slightly refactors the backlight module, moving all logic specific to controlling brightness into its own class, BacklightBackend;
  3. Introduces the Abstract Slider class ASlider;
  4. Implements PulseaudioSlider, based on ASlider and PulseaudioBackend;
  5. Implements BacklightSlider, based on ASlider and BacklightBackend;

Demo Video

waybar_slider.mp4

Configuration used in the video

Audio Config
"group/group-audio": {
    "orientation": "inherit",
    "drawer": {
        "transition-duration": 500,
        "children-class": "",
        "transition-left-to-right": false,
    },
    "modules": [
        "pulseaudio",
        "pulseaudio/slider",
    ]
},
"pulseaudio": {
    "scroll-step": 2,
    "format": "{icon}",
    "format-muted": "󰝟",
    "format-source": "",
    "format-source-muted": "",
    "format-icons": {
        "speaker": "󰕾",
        "hdmi": "󰓃",
        "headphone": "󰋋",
        "hands-free": "?",
        "headset": "󰋎",
        "phone": "",
        "portable": "",
        "car": "",
        "default": "󰕾"
    },
    "on-click-right": "pavucontrol",
    "on-click": "swayosd-client --output-volume=mute-toggle",
    "on-scroll-up": "swayosd-client --output-volume=raise",
    "on-scroll-down": "swayosd-client --output-volume=lower"
},
"pulseaudio/slider": {
    "orientation": "vertical"
}
Backlight Config
"group/group-backlight": {
    "orientation": "inherit",
    "drawer": {
        "transition-duration": 500,
        "children-class": "",
        "transition-left-to-right": false,
    },
    "modules": [
        "backlight",
        "backlight/slider",
    ]
},
"backlight": {
    "tooltip": false,
    "format": "{icon}",
    "format-icons": [
        "󰃞", "󰃟", "󰃠"
    ],
},
"backlight/slider": {
    "orientation": "vertical"
}
Style
#pulseaudio-slider, #pulseaudio-slider *, #group-audio,
#backlight-slider, #backlight-slider *, #group-backlight {
    margin: 0;
    padding: 0;
}

slider {
    min-height: 0px;
    min-width: 0px;
    opacity: 0;
    background-image: none;
    border: none;
    box-shadow: none;
}

trough {
    min-height: 80px;
    min-width: 10px;
    border-radius: 5px;
    background-color: @mantle;
}

highlight {
    min-width: 10px;
    border-radius: 5px;
}

#pulseaudio-slider highlight {
    background-color: @macchiato-teal;
}

#backlight-slider highlight {
    background-color: @macchiato-red;
}

Future Work

A custom slider module, with overrideable behavior would be cool. Didn't get to work it still because I was pretty excited with the current results, and couldn't think of many more use cases for sliders at the moment.

@khaneliman
Copy link
Contributor

You're a machine, this look awesome, too!

@Alexays
Copy link
Owner

Alexays commented Oct 16, 2023

LGTM, look awesome.
If you have time to also add this to the example config, these new features need to be visible to everyone.

And I had forgotten, but the drawer documentation should be added to the GitHub wiki.

Thanks again! 😍

@Alexays Alexays merged commit 42741c9 into Alexays:master Oct 16, 2023
8 checks passed
@Syndelis Syndelis deleted the feat/slider branch October 16, 2023 13:27
@Syndelis
Copy link
Contributor Author

LGTM, look awesome. If you have time to also add this to the example config, these new features need to be visible to everyone.

And I had forgotten, but the drawer documentation should be added to the GitHub wiki.

Thanks again! 😍

Both PRs are now properly documented in the Wiki! I appreciate both of your approvals, and thank you again for the fast merge!

StayPirate added a commit to StayPirate/dotfiles that referenced this pull request Nov 3, 2023
This reverts commit de84626.

With the new features [0][1] in waybar I feel I no longer need menubar,
volume slider and audio buttons in swaync. KISS

[0] Alexays/Waybar#2574
[1] Alexays/Waybar#2575
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants