@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_fg; }
    }
    
    &:active {
      color: $desktop_item_selected_fg;
      text-shadow: none;
      background-color: $selected_bg_color;
    }
  }
}

@mixin tasklist_button() {
  @include normal_buttons($taskbar_bg_color, $taskbar_fg_color, $borders);
}

@mixin panel_button() { @include flat_buttons($taskbar_bg_color, $taskbar_fg_color, $borders); }

@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: gtkalpha($taskbar_fg_color, 0.7);

      &:hover { color: gtkalpha($taskbar_fg_color, 0.7); }
      &:checked { color: $taskbar_fg_color; }
    }
  }

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

@mixin xfce() {
  .xfce4-panel.panel {
    background-color: $taskbar_bg_color;
    
    // TODO: implement when we can apply images to panel wrappers too
    //background-image: linear-gradient(to bottom, $taskbar_bg_color, gtkalpha($taskbar_bg_color, 0.35));

    button.flat, button.sidebar-button { @include panel_button(); }
    
    .tasklist button { @include tasklist_button(); }
  }
  
  #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: $taskbar_bg_color;
  }
  
  .mate-panel-menu-bar menubar { background: transparent; box-shadow: none; }

  .mate-panel-menu-bar {
    color: $taskbar_fg_color;
    background-color: $taskbar_bg_color;
    background-image: linear-gradient(to bottom, $taskbar_bg_color, gtkalpha($taskbar_bg_color, 0.35));

    &, .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 { background-color: transparent; }

    > .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;
  }
}
