@mixin desktop_icons() {
  .caja-desktop, .nemo-desktop.nemo-canvas-item, .nautilus-desktop.nautilus-canvas-item {
    color: $desktop_item_fg;
    text-shadow: 1px 1px $desktop_item_text_shadow;

    &:active { color: $desktop_item_fg; }

    &:selected {
      color: $desktop_item_selected_fg;
      text-shadow: none;
    }
  }
  
  XfdesktopIconView {
    .view {
      border-radius: $view_radius;
      color: $desktop_item_fg;
      background-color: transparent;
      text-shadow: 1px 1px $desktop_item_text_shadow;
     
      &:active { color: $desktop_item_selected_fg; }
    }
    
    &:active {
      color: $desktop_item_selected_fg;
      background-color: $selected_bg_color;
    }
  }
}

@mixin tasklist_button() {
  color: $taskbar_fg_color;
  text-shadow: 1px 1px $dark_shadow;
  border-radius: 2px;
  border: 1px solid gtkalpha($light_shadow, 0.3);
  padding-bottom: 0;
  padding-top: 0;
  background: -gtk-gradient(radial, left top, 0.55, right bottom, 0.6, from(gtkalpha($light_shadow, 0.8)), to(transparent));

  &:hover {
    border: 1px solid gtkalpha($light_shadow, 0.4);
    background: -gtk-gradient(radial, left top, 0.55, right bottom, 0.6, from(gtkalpha($light_shadow, 0.9)), to(transparent));
  }

  &:checked, &:active {
    border: 1px solid gtkalpha($light_shadow, 0.45);
    background: -gtk-gradient(radial, left top, 0.55, right bottom, 0.6, from(gtkalpha($light_shadow, 0.9)), to(transparent)), -gtk-gradient(radial, center bottom, 0.25, center bottom, 0.85, from(gtkalpha($light_shadow, 0.35)), to(transparent));
    
    &:hover {
      border: 1px solid gtkalpha($light_shadow, 0.55);
      background: -gtk-gradient(radial, left top, 0.55, right bottom, 0.6, from(gtkalpha($light_shadow, 0.99)), to(transparent)), -gtk-gradient(radial, center bottom, 0.25, center bottom, 0.85, from(gtkalpha($light_shadow, 0.5)), to(transparent));
    }
  }
}

@mixin panel_button() {
  color: $taskbar_fg_color;
  text-shadow: 1px 1px $dark_shadow;
  background-image: url('../cinnamon/panel.png');
  background-size: 100% 100%;
  background-color: transparent;
  border-radius: 0;
  border: none;
  box-shadow: none;

  &:hover {
    border: none;
    background-color: gtkmix($taskbar_bg_color, $light_shadow, 0.2);
  }

  &:active, &:checked {
    color: $taskbar_fg_color;
    border: none;
    background-color: gtkmix($taskbar_bg_color, $dark_shadow, 0.5);
  }
}

@mixin gnome_flashback() {
  panel-toplevel.background {
    &, menubar {
      background-color: $taskbar_bg_color;
      color: $taskbar_fg_color;
    }

    menubar, #PanelApplet label, #PanelApplet image { color: $taskbar_fg_color; }

    menubar > menuitem, menubar > menuitem label:backdrop { color: $taskbar_fg_color; }

    menubar > menuitem:hover, menubar > menuitem:hover label:backdrop { color: $selected_fg_color; }

    button { @include panel_button(); }
  }

  #tasklist-button {
    @include tasklist_button();
    
    label {
      color: $taskbar_fg_color;
      text-shadow: 1px 1px $dark_shadow;

      &:hover { color: $taskbar_fg_color; }
      &:checked { color: $taskbar_fg_color; }
    }
  }

  panel-toplevel.background na-tray-applet {
    -NaTrayApplet-icon-padding: 0;
    -NaTrayApplet-icon-size: 16px;
  }
}

@mixin xfce() {
  .xfce4-panel.panel, .xfce4-panel.background {
    background-color: transparent;
    background-image: url('../cinnamon/panel.png');
    background-size: 1px 100%;
    background-repeat: repeat;

    button.flat, button.sidebar-button { @include panel_button(); }
    
    // launcher buttons are drawn on the panel and don't need a color override
    button#launcher-arrow { background-image: none; }
    
    menu { text-shadow: none; }
    
    .tasklist button { @include tasklist_button(); }
    
    #clock-button {
      background-image: none;
      
      &:hover { background-color: gtkalpha(gtkmix($taskbar_bg_color, $light_shadow, 0.2), 0.5); }
      &:checked { background-color: gtkalpha(gtkmix($taskbar_bg_color, $dark_shadow, 0.35), 0.5); }
    }
  }
  
  #XfceNotifyWindow {
    &.osd {
      background-color: $bg_color;
      color: $fg_color;
      border-radius: $roundness;
      border: none;

      label #summary { font-weight: bold; }
      
      button { @include normal_buttons($bg_color, $fg_color, $borders); }
    }
  }
  
  // workspace switcher
  wnck-pager {
    background-color: $taskbar_bg_color;
    
    &:hover { background-color: $selected_bg_color; }
    &:selected { background-color: gtkshade($selected_bg_color, 0.88); }
  }
}

@mixin mate() {
  .mate-panel-menu-bar menubar > menuitem {
    color: $taskbar_fg_color;
    background-color: transparent;
  }
  
  .mate-panel-menu-bar menubar { background: transparent; }

  .mate-panel-menu-bar {
    color: $taskbar_fg_color;
    background-color: transparent;
    background-image: url('../cinnamon/panel.png');
    background-size: 100% 100%;

    &, .menubar { background-color: transparent; }

    menubar, menubar menuitem, togglebutton {
      border-color: transparent;
      background-color: transparent;
    }

    menubar menuitem {
      &:hover, &:active {
        color: $selected_fg_color;
        background-color: $selected_bg_color;
      }
    }

    .menubar > .menuitem {
      padding-top: 0;
      padding-bottom: 0;
    }

    GtkMenu .label {
      color: $fg_color;
      font-style: normal;

      &:disabled { color: $disabled_fg_color; }
    }

    button, button.flat { @include panel_button(); }

    > .button:not(#tasklist-button) { @include panel_button(); }

    #tasklist-button { @include tasklist_button(); }

    PanelSeparator {
      color: gtkshade($taskbar_bg_color, 0.7);
      padding-top: 4px;
      padding-bottom: 4px;
    }

    NaTrayApplet { -NaTrayApplet-icon-padding: 2; }
    
    #PanelApplet label { color: $taskbar_fg_color; }

    .caja-desktop, .caja-navigation-window .view {
      &.entry {
        background-image: none;
        border-radius: $entry_radius;
        box-shadow: none;
        border-color: gtkshade($selected_bg_color, 0.6);
        background-color: $base_color;
      
        &:selected {
          color: $selected_fg_color;
          background-color: $selected_bg_color;
        }
      }
    }
  }

  .mintmenu:hover { background-color: gtkshade($taskbar_bg_color, 1.1); }
  .mintmenu:selected {
    color: $selected_fg_color;
    background-color: $selected_bg_color;
  }

  .wnck-pager {
    background-color: gtkalpha(black, 0.04);

    &:selected { background-color: gtkalpha($selected_bg_color, 0.3); }
    &:hover { background-color: gtkalpha($selected_bg_color, 0.2); }
  }
}

@mixin nemo() {
  .nemo-window {
    .nemo-window-pane widget.entry {
      border: 1px solid;
      border-radius: 3px;
      border-color: $selected_bg_color;
      color: $fg_color;
      background-color: $base_color;
        
      &:selected, &:selected:focus {
        color: $selected_fg_color;
        background-color: $selected_bg_color;
      }
    }
  }
}

@mixin unity() {
  UnityDecoration {
    -UnityDecoration-extents: 28px 0 0 0;
    -UnityDecoration-input-extents: 10px;

    -UnityDecoration-shadow-offset-x: 1px;
    -UnityDecoration-shadow-offset-y: 1px;
    -UnityDecoration-active-shadow-color: rgba(0,0,0,0.7);
    -UnityDecoration-active-shadow-radius: 8px;
    -UnityDecoration-inactive-shadow-color: rgba(0,0,0,0.5);
    -UnityDecoration-inactive-shadow-radius: 5px;

    -UnityDecoration-glow-size: 10px;
    -UnityDecoration-glow-color: $selected_bg_color;

    -UnityDecoration-title-indent: 10px;
    -UnityDecoration-title-fade: 35px;
    -UnityDecoration-title-alignment: 0.0;

    .top {
      border: none;
      border-radius: $roundness $roundness 0 0;
      padding: 1px 8px 0 8px;
      background-color: $titlebar_bg_color;
      color: gtkmix($titlebar_fg_color, $titlebar_bg_color, 0.1);
      text-shadow: none;

      &:backdrop {
        background-color: $unfocused_bg_color;
        color: gtkmix($titlebar_fg_color, $titlebar_bg_color, 0.4);
      }
    }

    .left, .right, &.bottom {
      background-color: $titlebar_bg_color;

      &:backdrop { background-color: $titlebar_bg_color; }
    }

    // new menubar function in unity 7.5
    &.menuitem, .menuitem {
      border-radius: 0;

      &:hover, *:hover {
        background-color: $selected_bg_color;
        color: $selected_fg_color;
      }
    }
  }

  UnityPanelWidget, .unity-panel {
    border-width: 0 0 1px 0;
    border-style: solid;
    border-color: $taskbar_bg_color;
    background-color: $taskbar_bg_color;
    color: $taskbar_fg_color;

    &.menuitem, .menuitem {
      border-width: 0 1px;
      color: $taskbar_fg_color;
    }
  }

  @keyframes playbackmenuitem_spinner {
    to { -gtk-icon-transform: rotate(1turn); }
  }

  .menu IdoPlaybackMenuItem.menuitem:active {
    -gtk-icon-source: -gtk-icontheme("process-working-symbolic");
    animation: playbackmenuitem_spinner 1s infinite linear;
    color: $selected_bg_color;
  }
}
