-
Notifications
You must be signed in to change notification settings - Fork 78
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
Add plasma-panel-spacer-extended widget-specific options #290
Open
HeitorAugustoLN
wants to merge
10
commits into
nix-community:trunk
Choose a base branch
from
HeitorAugustoLN:plasma-panel-spacer-extended-options
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0e6d565
Add plasma-panel-spacer-extended widget-specific options
HeitorAugustoLN e08c143
Add screenWidth option and filter null attribute values in actions
HeitorAugustoLN 22a4f46
Remove command in examples
HeitorAugustoLN 53df739
Add panel-spacer-extended example in home.nix
HeitorAugustoLN 0ee6c6f
Make command and appUrl optional
HeitorAugustoLN b0fde11
Remove lib.filterAttrs from actions
HeitorAugustoLN 7aaf1b8
Remove parenthesis
HeitorAugustoLN 317eda4
Merge branch 'trunk' into plasma-panel-spacer-extended-options
HeitorAugustoLN fe0873b
Merge branch 'trunk' into plasma-panel-spacer-extended-options
HeitorAugustoLN 0ad84cc
Merge branch 'trunk' into plasma-panel-spacer-extended-options
HeitorAugustoLN File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,325 @@ | ||
{ lib, ... }: | ||
let | ||
inherit (lib) mkOption types; | ||
|
||
actionType = types.submodule { | ||
options = { | ||
action = mkOption { | ||
type = types.str; | ||
example = "pausemedia"; | ||
description = "The action to perform."; | ||
}; | ||
component = mkOption { | ||
type = types.str; | ||
example = "mediacontrol"; | ||
description = "The component to perform the action on."; | ||
}; | ||
command = mkOption { | ||
type = types.nullOr types.str; | ||
example = ''date="$(date -u)"; notify-send "Single Click" "$date"''; | ||
description = "The command to log."; | ||
}; | ||
appUrl = mkOption { | ||
type = types.nullOr types.str; | ||
description = "The application URL"; | ||
}; | ||
}; | ||
}; | ||
in { | ||
panelSpacerExtended = { | ||
description = "Spacer with Mouse gestures for the KDE Plasma Panel featuring Latte Dock/Gnome/Unity drag window gesture."; | ||
|
||
opts = { | ||
expanding = mkOption { | ||
type = types.nullOr types.bool; | ||
default = null; | ||
example = true; | ||
description = "Whether the spacer should expand to fill the available space."; | ||
}; | ||
length = mkOption { | ||
type = types.nullOr types.ints.unsigned; | ||
default = null; | ||
example = 32; | ||
description = '' | ||
The length in pixels of the spacer. | ||
Configuration effective only if expanding is set to false. | ||
''; | ||
}; | ||
highlight = { | ||
enable = mkOption { | ||
type = types.nullOr types.bool; | ||
default = null; | ||
example = true; | ||
description = "Whether the spacer should highlight when hovered."; | ||
}; | ||
radius = mkOption { | ||
type = types.nullOr types.ints.unsigned; | ||
default = null; | ||
example = 4; | ||
description = '' | ||
The radius in pixels of the highlight. | ||
Configuration effective only if enable is set to true. | ||
''; | ||
}; | ||
fillPanel = mkOption { | ||
type = types.nullOr types.bool; | ||
default = null; | ||
example = true; | ||
description = '' | ||
Whether the highlight should fill the entire panel. | ||
Configuration effective only if enable is set to true. | ||
''; | ||
}; | ||
}; | ||
showTooltip = mkOption { | ||
type = types.nullOr types.bool; | ||
default = null; | ||
example = true; | ||
description = "Whether to show list of actions when hovering the spacer."; | ||
}; | ||
scrollThreshold = mkOption { | ||
type = types.nullOr types.ints.unsigned; | ||
default = null; | ||
example = 10; | ||
description = '' | ||
The scroll sensitivity | ||
|
||
Higher values may help reducing repeated scrolling events on some devices. | ||
''; | ||
}; | ||
actions = { | ||
singleClick = mkOption { | ||
type = types.nullOr actionType; | ||
default = null; | ||
example = { | ||
action = "pausemedia"; | ||
component = "mediacontrol"; | ||
command = ''date="$(date -u)"; notify-send "Single Click" "$date"''; | ||
}; | ||
description = "The action to perform on single click."; | ||
apply = singleClick: let | ||
convertAction = action: component: "${component},${action}"; | ||
in lib.optionalAttrs (singleClick != null) { | ||
singleClickAction = convertAction singleClick.action singleClick.component; | ||
singleClickCommand = singleClick.command; | ||
singleClickAppUrl = singleClick.appUrl; | ||
}; | ||
}; | ||
doubleClick = mkOption { | ||
type = types.nullOr actionType; | ||
default = null; | ||
example = { | ||
action = "pausemedia"; | ||
component = "mediacontrol"; | ||
command = ''date="$(date -u)"; notify-send "Double Click" "$date"''; | ||
}; | ||
description = "The action to perform on double click."; | ||
apply = doubleClick: let | ||
convertAction = action: component: "${component},${action}"; | ||
in lib.optionalAttrs (doubleClick != null) { | ||
doubleClickAction = convertAction doubleClick.action doubleClick.component; | ||
doubleClickCommand = doubleClick.command; | ||
doubleClickAppUrl = doubleClick.appUrl; | ||
}; | ||
}; | ||
middleClick = mkOption { | ||
type = types.nullOr actionType; | ||
default = null; | ||
example = { | ||
action = "pausemedia"; | ||
component = "mediacontrol"; | ||
command = ''date="$(date -u)"; notify-send "Middle Click" "$date"''; | ||
}; | ||
description = "The action to perform on middle click."; | ||
apply = middleClick: let | ||
convertAction = action: component: "${component},${action}"; | ||
in lib.optionalAttrs (middleClick != null) { | ||
middleClickAction = convertAction middleClick.action middleClick.component; | ||
middleClickCommand = middleClick.command; | ||
middleClickAppUrl = middleClick.appUrl; | ||
}; | ||
}; | ||
mouseWheelUp = mkOption { | ||
type = types.nullOr actionType; | ||
default = null; | ||
example = { | ||
action = "pausemedia"; | ||
component = "mediacontrol"; | ||
command = ''date="$(date -u)"; notify-send "Wheel Up" "$date"''; | ||
}; | ||
description = "The action to perform on mouse wheel up."; | ||
apply = mouseWheelUp: let | ||
convertAction = action: component: "${component},${action}"; | ||
in lib.optionalAttrs (mouseWheelUp != null) { | ||
mouseWheelUpAction = convertAction mouseWheelUp.action mouseWheelUp.component; | ||
mouseWheelUpCommand = mouseWheelUp.command; | ||
mouseWheelUpAppUrl = mouseWheelUp.appUrl; | ||
}; | ||
}; | ||
mouseWheelDown = mkOption { | ||
type = types.nullOr actionType; | ||
default = null; | ||
example = { | ||
action = "pausemedia"; | ||
component = "mediacontrol"; | ||
command = ''date="$(date -u)"; notify-send "Wheel Down" "$date"''; | ||
}; | ||
description = "The action to perform on mouse wheel down."; | ||
apply = mouseWheelDown: let | ||
convertAction = action: component: "${component},${action}"; | ||
in lib.optionalAttrs (mouseWheelDown != null) { | ||
mouseWheelDownAction = convertAction mouseWheelDown.action mouseWheelDown.component; | ||
mouseWheelDownCommand = mouseWheelDown.command; | ||
mouseWheelDownAppUrl = mouseWheelDown.appUrl; | ||
}; | ||
}; | ||
mouseDragUp = mkOption { | ||
type = types.nullOr actionType; | ||
default = null; | ||
example = { | ||
action = "pausemedia"; | ||
component = "mediacontrol"; | ||
command = ''date="$(date -u)"; notify-send "Drag Up" "$date"''; | ||
}; | ||
description = "The action to perform on mouse drag up."; | ||
apply = mouseDragUp: let | ||
convertAction = action: component: "${component},${action}"; | ||
in lib.optionalAttrs (mouseDragUp != null) { | ||
mouseDragUpAction = convertAction mouseDragUp.action mouseDragUp.component; | ||
mouseDragUpCommand = mouseDragUp.command; | ||
mouseDragUpAppUrl = mouseDragUp.appUrl; | ||
}; | ||
}; | ||
mouseDragDown = mkOption { | ||
type = types.nullOr actionType; | ||
default = null; | ||
example = { | ||
action = "pausemedia"; | ||
component = "mediacontrol"; | ||
command = ''date="$(date -u)"; notify-send "Drag Down" "$date"''; | ||
}; | ||
description = "The action to perform on mouse drag down."; | ||
apply = mouseDragDown: let | ||
convertAction = action: component: "${component},${action}"; | ||
in lib.optionalAttrs (mouseDragDown != null) { | ||
mouseDragDownAction = convertAction mouseDragDown.action mouseDragDown.component; | ||
mouseDragDownCommand = mouseDragDown.command; | ||
mouseDragDownAppUrl = mouseDragDown.appUrl; | ||
}; | ||
}; | ||
mouseDragLeft = mkOption { | ||
type = types.nullOr actionType; | ||
default = null; | ||
example = { | ||
action = "pausemedia"; | ||
component = "mediacontrol"; | ||
command = ''date="$(date -u)"; notify-send "Drag Left" "$date"''; | ||
}; | ||
description = "The action to perform on mouse drag left."; | ||
apply = mouseDragLeft: let | ||
convertAction = action: component: "${component},${action}"; | ||
in lib.optionalAttrs (mouseDragLeft != null) { | ||
mouseDragLeftAction = convertAction mouseDragLeft.action mouseDragLeft.component; | ||
mouseDragLeftCommand = mouseDragLeft.command; | ||
mouseDragLeftAppUrl = mouseDragLeft.appUrl; | ||
}; | ||
}; | ||
mouseDragRight = mkOption { | ||
type = types.nullOr actionType; | ||
default = null; | ||
example = { | ||
action = "pausemedia"; | ||
component = "mediacontrol"; | ||
command = ''date="$(date -u)"; notify-send "Drag Right" "$date"''; | ||
}; | ||
description = "The action to perform on mouse drag right."; | ||
apply = mouseDragRight: let | ||
convertAction = action: component: "${component},${action}"; | ||
in lib.optionalAttrs (mouseDragRight != null) { | ||
mouseDragRightAction = convertAction mouseDragRight.action mouseDragRight.component; | ||
mouseDragRightCommand = mouseDragRight.command; | ||
mouseDragRightAppUrl = mouseDragRight.appUrl; | ||
}; | ||
}; | ||
longPress = mkOption { | ||
type = types.nullOr actionType; | ||
default = null; | ||
example = { | ||
action = "pausemedia"; | ||
component = "mediacontrol"; | ||
command = ''date="$(date -u)"; notify-send "Long Press" "$date"''; | ||
}; | ||
description = "The action to perform on long press."; | ||
apply = longPress: let | ||
convertAction = action: component: "${component},${action}"; | ||
in lib.optionalAttrs (longPress != null) { | ||
pressHoldAction = convertAction longPress.action longPress.component; | ||
pressHoldCommand = longPress.command; | ||
pressHoldAppUrl = longPress.appUrl; | ||
}; | ||
}; | ||
}; | ||
troubleshooting = { | ||
debugMessages.enable = mkOption { | ||
type = types.nullOr types.bool; | ||
default = null; | ||
example = true; | ||
description = "Whether to enable debug messages."; | ||
}; | ||
}; | ||
settings = mkOption { | ||
type = with types; nullOr (attrsOf (attrsOf (either (oneOf [ bool float int str ]) (listOf (oneOf [ bool float int str ]))))); | ||
default = null; | ||
example = { | ||
General = { | ||
expanding = true; | ||
}; | ||
}; | ||
description = '' | ||
Extra configuration for the widget | ||
|
||
See available options at https://github.com/antroids/application-title-bar/blob/main/package/contents/config/main.xml | ||
''; | ||
apply = settings: if settings == null then {} else settings; | ||
}; | ||
}; | ||
|
||
convert = | ||
{ expanding | ||
, length | ||
, highlight | ||
, showTooltip | ||
, scrollThreshold | ||
, actions | ||
, troubleshooting | ||
, settings | ||
}: { | ||
name = "luisbocanegra.panelspacer.extended"; | ||
config = lib.recursiveUpdate { | ||
General = lib.filterAttrs (_: v: v != null) ( | ||
{ | ||
inherit expanding length showTooltip; | ||
|
||
showHoverBg = highlight.enable; | ||
hoverBgRadius = highlight.radius; | ||
bgFillPanel = highlight.fillPanel; | ||
|
||
scrollSensitivity = scrollThreshold; | ||
|
||
enableDebug = troubleshooting.debugMessages.enable; | ||
} | ||
// actions.singleClick | ||
// actions.doubleClick | ||
// actions.middleClick | ||
// actions.mouseWheelUp | ||
// actions.mouseWheelDown | ||
// actions.mouseDragUp | ||
// actions.mouseDragDown | ||
// actions.mouseDragLeft | ||
// actions.mouseDragRight | ||
// actions.longPress | ||
); | ||
} settings; | ||
}; | ||
}; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if
// actions
would work here.